Skip to content

Commit 8fdd3cf

Browse files
Add README.md
1 parent 9f2364a commit 8fdd3cf

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Conan Android Gradle Plugin
2+
3+
## Why is this needed?
4+
5+
In order to use Conan dependencies in an Android project, `conan install` needs to be executed before CMake tries to find those libraries. This plugin calls `conan install` for all 4 Android's architectures.
6+
7+
## How it works
8+
9+
Conan Android Gradle Plugin creates 4 Gradle tasks: `conanInstall-armv7`, `conanInstall-armv8`, `conanInstall-x86`, `conanInstall-x86_64` - one for each architecture, for which `conan install` will be launched.
10+
11+
`conanInstall` tasks are added as dependencies to module level `preBuild` task and top level `prepareKotlinBuildScriptModel` task, if it's found.
12+
13+
`preBuild` task is executed before building Android project. `prepareKotlinBuildScriptModel` task is executed when doing Android Studio sync.
14+
15+
16+
## How to use
17+
18+
Conan Android Gradle Plugin is distributed through Gradle Plugin Portal ( `pluginManagement { repositories { gradlePluginPortal() } }` in `settings.gradle`).
19+
20+
To use this plugin, include it in the top level `build.gradle`:
21+
```groovy
22+
plugins {
23+
id 'app.opendocument.conanandroidgradleplugin' version "0.9.0" apply false
24+
}
25+
```
26+
27+
And then apply the plugin in the module's `build.gradle`:
28+
```groovy
29+
plugins {
30+
id 'app.opendocument.conanandroidgradleplugin'
31+
}
32+
```
33+
34+
Once the plugin is applied, it needs to be configured. Configuration currently consists of setting conan profile file for each architecture:
35+
36+
```groovy
37+
["armv7", "armv8", "x86", "x86_64"].each { arch ->
38+
tasks.named("conanInstall-" + arch) {
39+
profile.set("android-21-" + arch)
40+
}
41+
}
42+
```
43+
44+
Conan profile can be either a relative path or an absolute path, it could also be a regular conan profile, installed and managed by conan (eg. `default`).
45+
46+
Plugin applies `arch` setting when calling `conan install`, thus all architectures can share the same profile, if no differentiation is needed - `{ profile.set("android") }`.

0 commit comments

Comments
 (0)