diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-08-20 23:21:06 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-08-20 23:21:06 +0200 |
| commit | 9b7f943969e17273ac9bd78bb238ffbea3865993 (patch) | |
| tree | 32d7d5c5f35414717b8bfa25f786fc4d2ebce029 /libs/samba/build.gradle.kts | |
| parent | 088a7aef623700798647ad5b279388c4f7a59299 (diff) | |
Support building libsamba.so for unittests
Unittests still fail as there is no samba server to talk to (step 2).
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) + } +} |
