Skip to content

Commit dc70c68

Browse files
authored
Merge branch 'main' into feature/stats-analytics-verify
2 parents 77d2cc1 + a02606f commit dc70c68

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

sandbox/libs/dataformat-native/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,21 @@ task buildRustLibrary(type: Exec) {
8484
outputs.file nativeLibFile
8585
}
8686

87-
// Expose the native lib path so plugins can reference it for tests
88-
ext.nativeLibPath = nativeLibFile
87+
// External override: reuse a prebuilt .dylib from another worktree, a blessed shared copy,
88+
// or a CI-provided binary. Set OPENSEARCH_NATIVE_LIB (env) or -PnativeLibOverride to an
89+
// absolute .dylib/.so/.dll path; buildRustLibrary is skipped and nativeLibPath resolves to
90+
// the override. Consumers across sandbox/plugins read ext.nativeLibPath, so the override
91+
// propagates without per-plugin changes.
92+
def nativeLibOverride = project.findProperty('nativeLibOverride') ?: System.getenv('OPENSEARCH_NATIVE_LIB')
93+
def resolvedNativeLib = nativeLibOverride ? file(nativeLibOverride) : nativeLibFile
94+
ext.nativeLibPath = resolvedNativeLib
95+
buildRustLibrary.onlyIf { nativeLibOverride == null }
8996

9097
assemble.dependsOn buildRustLibrary
9198

9299
test {
93100
systemProperty 'tests.security.manager', 'false'
94-
systemProperty 'native.lib.path', nativeLibFile.absolutePath
101+
systemProperty 'native.lib.path', resolvedNativeLib.absolutePath
95102
jvmArgs += ['--enable-native-access=ALL-UNNAMED']
96103
dependsOn buildRustLibrary
97104
}

0 commit comments

Comments
 (0)