summaryrefslogtreecommitdiff
path: root/library/rules.gradle
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2015-03-19 17:25:53 -0700
committerMaurice Lam <yukl@google.com>2015-03-27 17:07:19 -0700
commit6df734500612c91d396ccc61da80cd1cdc96b5b3 (patch)
tree44f49626b5ebc21c05aaeb5e1b0969ea6ce11f6f /library/rules.gradle
parent9f9367672191190f903955d09a4314d40869acc6 (diff)
downloadsetupwizard-6df734500612c91d396ccc61da80cd1cdc96b5b3.tar.gz
[SetupWizardLib] Add standalone build file
Add a standalone build file to the build for users outside of the Android tree. This is necessary because gradle builds in Android tree have a different configuration than normal projects created in Android Studio, like android.properties file and the dist plugin. Change-Id: I0f1a9728d61fcad391d9d23f75445b5c435da13d
Diffstat (limited to 'library/rules.gradle')
-rw-r--r--library/rules.gradle81
1 files changed, 81 insertions, 0 deletions
diff --git a/library/rules.gradle b/library/rules.gradle
new file mode 100644
index 0000000..4813c27
--- /dev/null
+++ b/library/rules.gradle
@@ -0,0 +1,81 @@
+/**
+ * Base rules for building setup wizard library. This build file is not used directly but rather
+ * included in scripts like build.gradle or standalone.gradle using 'apply from'.
+ *
+ * This allows the dependencies to be configured so that for builds in the Android tree, the
+ * dependencies like support library is built directly from source, while for standalone builds they
+ * will be fetched from maven central.
+ */
+
+apply plugin: 'com.android.library'
+
+android {
+
+ publishNonDefault true
+
+ sourceSets {
+ main {
+ manifest.srcFile 'main/AndroidManifest.xml'
+ java.srcDirs = ['main/src']
+ resources.srcDirs = ['main/src']
+ res.srcDirs = ['main/res']
+ }
+
+ productFlavors {
+ // Platform version that will not include the compatibility libraries
+ platform {
+ minSdkVersion 21
+ }
+
+ // Compatibility build that provides the L layout for SDK versions ICS+
+ icsCompat {
+ minSdkVersion 14
+ dependencies {
+ // Read the dependencies from the "deps" map in the extra properties.
+ //
+ // For builds in the Android tree we want to build the dependencies from source
+ // for reproducible builds, for example in build.gradle define something like
+ // this:
+ // ext {
+ // deps = ['project-name': project(':project-path')]
+ // }
+ //
+ // For standalone project clients, since the source may not be available, we
+ // fetch the dependencies from maven. For example in standalone.gradle define
+ // something like this:
+ // ext {
+ // deps = ['project-name': 'com.example.group:project-name:1.0.0']
+ // }
+ //
+ icsCompatCompile deps['support-appcompat-v7']
+ }
+ }
+
+ // Compatibility build that provides the L layout for SDK versions Eclair MR1+
+ eclairMr1Compat {
+ minSdkVersion 7
+ dependencies {
+ eclairMr1CompatCompile deps['support-appcompat-v7']
+ }
+ }
+ }
+
+ platform {
+ res.srcDirs = ['platform/res']
+ }
+
+ icsCompat {
+ res.srcDirs = ['eclair-mr1/res']
+ }
+
+ eclairMr1Compat {
+ res.srcDirs = ['eclair-mr1/res']
+ }
+
+ androidTest {
+ manifest.srcFile 'test/AndroidManifest.xml'
+ java.srcDirs = ['test/src']
+ res.srcDirs = ['test/res']
+ }
+ }
+}