Skip to content

Commit

Permalink
Address Gradle buildDir deprecation.
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth J. Shackleton <[email protected]>
  • Loading branch information
kennethshackleton committed Sep 9, 2023
1 parent dd76c34 commit e21ad3a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
15 changes: 8 additions & 7 deletions OpenSSL/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ val openSslBaseUrl = "https://www.openssl.org/source"
fun Project.openSslUrl() = "$openSslBaseUrl/openssl-${openSslVersion()}.tar.gz"
fun Project.openSslPgpUrl() = "$openSslBaseUrl/openssl-${openSslVersion()}.tar.gz.asc"

val archive = File("$buildDir/tmp/openssl-${openSslVersion()}.tar.gz")
val archive = File("${layout.buildDirectory.get()}/tmp/openssl-${openSslVersion()}.tar.gz")
val archivePgp = File("${archive.path}.asc")

tasks.register<Download>("downloadOpenSslPgp") {
Expand Down Expand Up @@ -83,14 +83,14 @@ tasks.register<Exec>("verifyOpenSslSignature") {
}

fun openSslWorkingDir(target: String) = archive.run {
File("$buildDir/generated/$target/${name.substringBefore(".tar.gz")}")
File("${layout.buildDirectory.get()}/generated/$target/${name.substringBefore(".tar.gz")}")
}.path

arrayOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64").forEach {
val titleCaseName = it.replaceFirstChar { c -> c.uppercaseChar() }
tasks.register<Copy>("unpackOpenSsl$titleCaseName") {
from(tarTree(archive))
into("$buildDir/generated/$it")
into("${layout.buildDirectory.get()}/generated/$it")
dependsOn("downloadOpenSsl")
}

Expand All @@ -100,12 +100,13 @@ arrayOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64").forEach {
inputs.property("version", openSslVersion())
outputs.files(fileTree("${openSslWorkingDir(it)}/include") { include("**/*.h") })
.withPropertyName("headers")
outputs.dir("$buildDir/libs/$it").withPropertyName("lib")
outputs.dir("${layout.buildDirectory.get()}/libs/$it").withPropertyName("lib")
outputs.cacheIf { true }
workingDir(projectDir)
commandLine("./build_libraries.sh")
args(
archive.run { File("$buildDir/generated/$it/${name.substringBefore(".tar.gz")}") }.path,
archive.run { File("${layout.buildDirectory.get()}/generated" +
"/$it/${name.substringBefore(".tar.gz")}") }.path,
it,
21
)
Expand Down Expand Up @@ -134,7 +135,7 @@ val openSslWorkingDir: String = openSslWorkingDir(targetIdentifier())
// FIXME Some of the host building logic parallels Android's above. Re-purpose?
tasks.register<Copy>("unpackOpenSslHost") {
from(tarTree(archive))
into("$buildDir/generated/${targetIdentifier()}")
into("${layout.buildDirectory.get()}/generated/${targetIdentifier()}")
dependsOn("downloadOpenSsl")
mustRunAfter("clean")
}
Expand Down Expand Up @@ -171,7 +172,7 @@ tasks.register<Copy>("assembleHost") {
dependsOn("makeHost")
inputs.property("target", targetIdentifier())
inputs.property("version", openSslVersion())
val outputDir = "$buildDir/libs/${targetIdentifier()}"
val outputDir = "${layout.buildDirectory.get()}/libs/${targetIdentifier()}"
outputs.dir(outputDir).withPropertyName("libs")
outputs.cacheIf { true }
from(fileTree(openSslWorkingDir) {
Expand Down
2 changes: 1 addition & 1 deletion Selektric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tasks.register<Copy>("copyLibraries") {
from(fileTree(".cxx-host") {
include("**/*.dll", "**/*.dylib", "**/*.so")
})
into("$buildDir/intermediates/libs/${platformIdentifier()}")
into("${layout.buildDirectory.get()}/intermediates/libs/${platformIdentifier()}")
}

tasks.register<Delete>("deleteCxxHost") {
Expand Down
9 changes: 5 additions & 4 deletions selekt-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ repositories {

android {
compileSdk = Versions.ANDROID_SDK.version.toInt()
@Suppress("UnstableApiUsage")
buildToolsVersion = Versions.ANDROID_BUILD_TOOLS.version
namespace = "com.bloomberg.selekt.android"
defaultConfig {
Expand All @@ -51,7 +52,7 @@ android {
arrayOf("debug", "main", "release", "test").forEach {
sourceSets[it].java.srcDir("src/$it/kotlin")
}
sourceSets["test"].resources.srcDir("$buildDir/intermediates/libs")
sourceSets["test"].resources.srcDir("${layout.buildDirectory.get()}/intermediates/libs")
publishing {
singleVariant("release") {
withJavadocJar()
Expand Down Expand Up @@ -91,10 +92,10 @@ koverReport {

tasks.register<Copy>("copyJniLibs") {
from(
fileTree("${project(":selekt-sqlite3").buildDir.absolutePath}/intermediates/libs"),
fileTree("${project(":Selektric").buildDir.absolutePath}/intermediates/libs")
fileTree("${project(":selekt-sqlite3").layout.buildDirectory.get()}/intermediates/libs"),
fileTree("${project(":Selektric").layout.buildDirectory.get()}/intermediates/libs")
)
into("${buildDir.path}/intermediates/libs/jni")
into("${layout.buildDirectory.get()}/intermediates/libs/jni")
}

tasks.register<Task>("buildNativeHost") {
Expand Down
6 changes: 3 additions & 3 deletions selekt-java/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sourceSets {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
resources.srcDir("$buildDir/intermediates/libs")
resources.srcDir("${layout.buildDirectory.get()}/intermediates/libs")
}
}

Expand Down Expand Up @@ -88,8 +88,8 @@ tasks.register<Task>("buildHostSQLite") {
}

tasks.register<Copy>("copyJniLibs") {
from(fileTree("${project(":selekt-sqlite3").buildDir}/intermediates/libs"))
into("${buildDir.path}/intermediates/libs/jni")
from(fileTree("${project(":selekt-sqlite3").layout.buildDirectory.get()}/intermediates/libs"))
into("${layout.buildDirectory.get()}/intermediates/libs/jni")
}

tasks.withType<ProcessResources>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion selekt-sqlite3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fun platformIdentifier() = "${osName()}-${System.getProperty("os.arch")}"
tasks.register<Copy>("buildHost") {
dependsOn("makeSQLite")
from(".cxx-host/sqlite3")
into("$buildDir/intermediates/libs/${platformIdentifier()}")
into("${layout.buildDirectory.get()}/intermediates/libs/${platformIdentifier()}")
include("*.dll", "*.dylib", "*.so")
}

Expand Down

0 comments on commit e21ad3a

Please sign in to comment.