def nativeLibTask = project.hasProperty('usePrebuilt') ? ':core:downloadNativeLib' : ':core:nativeCompile'
task copyNativeLib(type: Copy) {
dependsOn nativeLibTask
from project(':core').layout.buildDirectory.dir('native/nativeCompile')
into layout.buildDirectory.dir('native')
include 'libccl.*'
include '*.h'
}
task test(type: Exec) {
dependsOn copyNativeLib
workingDir projectDir
def nativeDir = layout.buildDirectory.dir('native').get().asFile.absolutePath
environment 'CCL_LIB_PATH', nativeDir
environment 'DYLD_LIBRARY_PATH', nativeDir
environment 'LD_LIBRARY_PATH', nativeDir
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
commandLine 'cargo', 'test', '--features', 'providers', '--', '--test-threads=1'
} else {
commandLine 'bash', '-c', 'cargo test --features providers -- --test-threads=1'
}
}