Skip to content

Commit

Permalink
1.5.2; android-gradle-build 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pfn committed Oct 5, 2015
1 parent 8bb74f8 commit acc7180
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
17 changes: 17 additions & 0 deletions CHANGES.md
@@ -1,5 +1,22 @@
## New features in 1.5.x ##

* `1.5.2`:
* Add an entirely new, alternative, `flavors` and `buildTypes` system.
* Configure by adding `buildTypes in Android += (("name", List(settings)))`
or the same for `flavors in Android`.
* Load the variant configuration by using the
`variant[/PROJECT] [BUILD_TYPE] [FLAVOR]` command, run `variant[/PROJECT]`
by itself to see current variant status and available flavors and/or
build types.
* Alternatively, load a default variant by adding
`android.Plugin.withVariant("PROJECT-ID", Option("BUILD-TYPE"), Option("FLAVOR"))`
into `build.sbt`
* LIMITATIONS: Any `set` command must occur prior to calling `variant` or
else the `set` command will reset all variant settings
* warn if `exportJars` is set incorrectly on dependency projects
* automatically set project for `pidcat`, `adb-runas`, `adb-kill` when
possible. Also allow appending `/<project>` to any of those commands
* `adb-kill` now uses `am force-stop` when running against a device api 11+
* `1.5.1`:
* add `android:debug` command to wait for debugger to connect on app launch
* properly include assets from transitive aar and apklibs
Expand Down
43 changes: 43 additions & 0 deletions GRADLE.md
@@ -0,0 +1,43 @@
# Android Gradle Auto-Import Plugin for SBT #

Current version is 1.1.0

## Description ##

Automatically import all settings from an Android project's `build.gradle` into
a generated `00-gradle-generated.sbt` file. Dependencies, flavors, build
types and all Android-related configurations are retained. Any changes to
`build.gradle` are automatically reflected in `00-gradle-generated.sbt`
whenever changes occur.

## Usage ##

1. Download & install SBT 0.13.6+ (google it)
2. From your Android project root, wherever the base `build.gradle` is located,
load `android-gradle-build`:
* `mkdir project`
* `echo 'addSbtPlugin("com.hanhuy.sbt" % "android-gradle-build" % "1.1.0")' > project/plugins.sbt`
* `echo "object Build extends android.GradleBuild" > project/build.scala"`
3. Run `sbt`
* The initial load will be slow as gradle will run to extract all
project settings and export them into sbt
* Once fully loaded, the full power of android-sdk-plugin is available
* Typical android projects created by Android Studio have an `app` project,
so in order to run any any build tasks, they must generally be prefixed by
`app/`, e.g. `app/android:package`
* Build types and flavors can be loaded using the `variant` command
(`variant[/PROJECT] [BUILD-TYPE] [FLAVOR]`)
* Build variants can be auto-loaded by adding a line into `build.sbt` such
as `android.Plugin.withVariant("PROJECT-NAME (e.g. app)", Some("BUILD-TYPE"), Some("FLAVOR"))`
replace `Some(...)` with `None` if only a build-type or flavor is desired.
4. Load other SBT plugins such as [protify](https://github.com/pfn/protify) to
further enhance the Android build experience


### Limitations ###

* Custom tasks defined in gradle will not be executed; they will need to be
re-implemented in SBT if required.
* Inline function calls to populate android settings in gradle will be detected
and loaded, but will not be updated in SBT until `build.gradle` itself is
modified
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -4,6 +4,8 @@

Current version is 1.5.1 ([Change log](CHANGES.md))

Auto-import from gradle using [android-gradle-build](GRADLE.md)

## Description ##

This is an easy-to-use plugin for existing and newly created android
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
@@ -1,8 +1,8 @@
import ScriptedPlugin._
import bintray.Keys._

val pluginVersion = "1.5.2-SNAPSHOT"
val gradleBuildVersion = "1.0.6-SNAPSHOT"
val pluginVersion = "1.5.2"
val gradleBuildVersion = "1.1.0"

// gradle-plugin and gradle-model projects
val model = project.in(file("gradle-model")).settings(
Expand Down

0 comments on commit acc7180

Please sign in to comment.