Skip to content

Commit 7f58bdb

Browse files
Merge pull request #365 from opendocument-app/conanplugin
Use ConanAndroidGradlePlugin
2 parents 014b84a + 5a5dc1b commit 7f58bdb

File tree

3 files changed

+6
-54
lines changed

3 files changed

+6
-54
lines changed

app/build.gradle

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id 'com.android.application'
55
id 'com.google.gms.google-services'
66
id 'com.google.firebase.crashlytics'
7+
id 'app.opendocument.conanandroidgradleplugin'
78
}
89

910
android {
@@ -16,56 +17,12 @@ tasks.register('conanProfile', Copy) {
1617
filter(ReplaceTokens, tokens: ["NDK_PATH": android.ndkDirectory.toString()])
1718
}
1819

19-
abstract class ConanInstallTask extends Exec {
20-
@Input
21-
abstract Property<String> getArch()
22-
23-
// Cannot read project.layout.buildDirectory when configuration-cache is enabled
24-
@Input
25-
abstract Property<String> getArchBuildDirPath()
26-
27-
@OutputDirectory
28-
final Provider<Directory> outputDirectory = archBuildDirPath.map { new File(it) }
29-
30-
@Override
31-
protected void exec() {
32-
commandLine(
33-
"conan", "install", ".",
34-
"--output-folder=" + archBuildDirPath.get(),
35-
"--build=missing",
36-
"--profile:host=build/conanprofile.txt",
37-
"-s", "arch=" + arch.get(),
38-
"-s", "build_type=Release",
39-
"-s", "&:build_type=RelWithDebInfo",
40-
"-s", "odrcore/*:build_type=RelWithDebInfo",
41-
)
42-
super.exec()
43-
}
44-
}
45-
4620
["armv8", "armv7", "x86", "x86_64"].each { architecture ->
47-
tasks.register('conanInstall-' + architecture, ConanInstallTask) {
48-
setArch(architecture)
49-
setArchBuildDirPath(new File(project.layout.buildDirectory.get().toString(), 'conan/' + architecture).absolutePath)
50-
dependsOn(tasks.named("conanProfile"))
51-
52-
// Execute at least one conanInstall before running all three others in parallel.
53-
// Some issue with conan's local cache
54-
// @TODO: isolate and report to conan-client bugtracker
55-
if (architecture != "armv8") {
56-
dependsOn(tasks.named("conanInstall-armv8"))
57-
}
21+
tasks.named("conanInstall-" + architecture) {
22+
profile.set('build/conanprofile.txt')
23+
dependsOn(tasks.named('conanProfile'))
5824
}
5925
}
60-
tasks.register("conanInstall") {
61-
["armv7", "armv8", "x86", "x86_64"].each { arch ->
62-
dependsOn tasks.named('conanInstall-' + arch)
63-
}
64-
}
65-
66-
tasks.named("preBuild").configure { preBuildTask ->
67-
preBuildTask.dependsOn(tasks.named("conanInstall"))
68-
}
6926

7027
android {
7128
defaultConfig {

app/conanprofile.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ compiler=clang
77
compiler.version=12
88
compiler.cppstd=17
99
compiler.libcxx=c++_shared
10+
build_type=RelWithDebInfo
1011

1112
[conf]
1213
tools.android:ndk_path=@NDK_PATH@

build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,5 @@ plugins {
22
id 'com.android.application' version '8.4.1' apply false
33
id 'com.google.gms.google-services'version '4.4.1' apply false
44
id 'com.google.firebase.crashlytics' version '3.0.1' apply false
5-
}
6-
7-
// Android Studio's sync task expects CMake to work properly
8-
// Proper CMake, due to our supplied conan_toolchain.cmake, requires conan to be
9-
// done as a dependency of Android Studio sync
10-
tasks.named('prepareKotlinBuildScriptModel').configure { prepareKotlinBuildScriptModelTask ->
11-
prepareKotlinBuildScriptModelTask.dependsOn(project("app").tasks.named("conanInstall"))
5+
id 'app.opendocument.conanandroidgradleplugin' version "0.9.0" apply false
126
}

0 commit comments

Comments
 (0)