diff options
Diffstat (limited to 'libs/samba/build.gradle.kts')
| -rw-r--r-- | libs/samba/build.gradle.kts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/samba/build.gradle.kts b/libs/samba/build.gradle.kts index 79827ee..2fc5007 100644 --- a/libs/samba/build.gradle.kts +++ b/libs/samba/build.gradle.kts @@ -24,3 +24,42 @@ android { dependencies { implementation(project(":libs:io")) } + +listOf("Debug", "Release").forEach { buildType -> + val buildDir = project.layout.buildDirectory.dir("test/debug/build") + + val configure by tasks.register( + "configureLibsFor${buildType}UnitTest", + Exec::class + ) { + args( + "-S", + project.layout.projectDirectory.dir("."), + "-B", + buildDir.get() + ) + executable = "cmake" + } + + val compile by tasks.register( + "compileLibsFor${buildType}UnitTest", + Exec::class + ) { + dependsOn(configure) + args("--build", buildDir.get()) + executable = "cmake" + } + + val copy by tasks.register( + "copyLibsFor${buildType}UnitTest", + Copy::class + ) { + dependsOn(compile) + from(buildDir.map { it.file("libsamba.so") }) + into(project.layout.projectDirectory.dir("src/test${buildType}/jniLibs")) + } + + tasks.matching { it.name == "test${buildType}UnitTest" }.all { + dependsOn(copy) + } +} |
