Skip to content

Commit

Permalink
Update conan install wrapper task
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Jul 15, 2024
1 parent ba7bd9d commit d7abb46
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
android.useAndroidX=true


org.gradle.configuration-cache=true
52 changes: 40 additions & 12 deletions pdf2htmlEX/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,47 @@ plugins {

group = rootProject.group

tasks.register('conanInstall') {
doFirst {
["armv7", "armv8", "x86", "x86_64"].each { String arch ->
exec {
commandLine(
"conan", "install", ".",
"--output-folder=build/conan/" + arch,
"--build=missing",
"--profile:host=android-21-" + arch,
)
}
abstract class ConanInstallTask extends Exec {
@Input
abstract Property<String> getArch()

// Cannot read project.layout.buildDirectory when configuration-cache is enabled
@Input
abstract Property<String> getArchBuildDirPath()

@OutputDirectory
final Provider<Directory> outputDirectory = archBuildDirPath.map { new File(it) }

@Override
protected void exec() {
commandLine(
"conan", "install", ".",
"--output-folder=" + archBuildDirPath.get(),
"--build=missing",
"--profile:host=android-21-" + arch.get(),
)
super.exec()
}
}

["armv8", "armv7", "x86", "x86_64"].each { architecture ->
tasks.register('conanInstall-' + architecture, ConanInstallTask) {
setArch(architecture)
setArchBuildDirPath(new File(project.layout.buildDirectory.get().toString(), 'conan/' + architecture).absolutePath)
// Execute at least one conanInstall before running all three others in parallel.
// Some issue with conan's local cache
// @TODO: isolate and report to conan-client bugtracker
if (architecture != "armv8") {
dependsOn(tasks.named("conanInstall-armv8"))
}
}
}
tasks.register("conanInstall") {
["armv7", "armv8", "x86", "x86_64"].each { arch ->
dependsOn tasks.named('conanInstall-' + arch)
}
}

tasks.named("preBuild").configure { preBuildTask ->
preBuildTask.dependsOn(tasks.named("conanInstall"))
}
Expand Down Expand Up @@ -145,7 +172,8 @@ if (System.getenv('SIGNING_KEY')) {
// Without removing .cxx dir on cleanup, double gradle clean is erroring out.
// Before removing this workaround, check if "./gradlew assembleDebug; ./gradlew clean; ./gradlew clean" works
tasks.named("clean") {
def dotCxxDir = getLayout().getProjectDirectory().dir(".cxx")
doFirst {
delete getLayout().getProjectDirectory().dir(".cxx")
delete dotCxxDir
}
}

0 comments on commit d7abb46

Please sign in to comment.