Skip to content

Commit a30fc9d

Browse files
committed
cleanup stale dylibs before build
1 parent 4af212d commit a30fc9d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

photon-apple/build.gradle

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,26 @@ test {
3737
enabled = project.hasProperty('runAppleTests')
3838
}
3939

40+
// Task to clean cached dylibs before Swift build (critical for preventing stale library issues)
41+
task cleanCachedDylibs(type: Delete) {
42+
def nativeLibsDir = file("${projectDir}/../photon-server/photonvision_config/nativelibs")
43+
if (nativeLibsDir.exists()) {
44+
delete fileTree(dir: nativeLibsDir) {
45+
include '*.dylib'
46+
}
47+
}
48+
doLast {
49+
if (nativeLibsDir.exists()) {
50+
println "Cleaned cached dylibs from photon-server/photonvision_config/nativelibs"
51+
} else {
52+
println "Native libs directory does not exist, skipping dylib cleanup"
53+
}
54+
}
55+
}
56+
4057
// Task to build Swift library and generate Java bindings
4158
task buildSwift(type: Exec) {
59+
dependsOn cleanCachedDylibs
4260
commandLine 'swift', 'build', '-c', 'release'
4361
workingDir projectDir
4462
}

0 commit comments

Comments
 (0)