File tree Expand file tree Collapse file tree
sandbox/libs/dataformat-native Expand file tree Collapse file tree Original file line number Diff line number Diff 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
9097assemble. dependsOn buildRustLibrary
9198
9299test {
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}
You can’t perform that action at this time.
0 commit comments