summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2015-03-30 16:06:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-30 16:06:16 +0000
commitd2abf66846d1fcea1345f0b7d5383c3366721e8c (patch)
treece1345d984354d8bf3a92295d6c299eda13c9400
parent5e9b02ef72403231363d697dc0f71d398bac350d (diff)
parent6df734500612c91d396ccc61da80cd1cdc96b5b3 (diff)
downloadandroid_frameworks_opt_setupwizard-d2abf66846d1fcea1345f0b7d5383c3366721e8c.tar.gz
android_frameworks_opt_setupwizard-d2abf66846d1fcea1345f0b7d5383c3366721e8c.tar.bz2
android_frameworks_opt_setupwizard-d2abf66846d1fcea1345f0b7d5383c3366721e8c.zip
am 6df73450: [SetupWizardLib] Add standalone build file
* commit '6df734500612c91d396ccc61da80cd1cdc96b5b3': [SetupWizardLib] Add standalone build file
-rw-r--r--library/build.gradle85
-rw-r--r--library/rules.gradle81
-rw-r--r--library/standalone.gradle35
3 files changed, 147 insertions, 54 deletions
diff --git a/library/build.gradle b/library/build.gradle
index ff5daa4..678e886 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,57 +1,34 @@
-apply plugin: 'com.android.library'
-apply plugin: 'dist'
-
-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 {
- icsCompatCompile project(':support-appcompat-v7')
- }
- }
+/**
+ * Build the file with local dependencies. This is typically the build file you want to use when
+ * building from the Android source tree. The difference between this and standalone.gradle is that
+ * this will build the dependencies like support libraries from source, whereas standalone.gradle
+ * will get it from maven central.
+ *
+ * For example, you can include the following in your settings.gradle file:
+ * include ':setup-wizard-lib'
+ * project(':setup-wizard-lib').projectDir = new File(PATH_TO_THIS_DIRECTORY)
+ *
+ * And then you can include the :setup-wizard-lib project as one of your dependencies
+ * dependencies {
+ * compile project(path: ':setup-wizard-lib', configuration: 'icsCompatRelease')
+ * }
+ */
- // Compatibility build that provides the L layout for SDK versions Eclair MR1+
- eclairMr1Compat {
- minSdkVersion 7
- dependencies {
- eclairMr1CompatCompile project(':support-appcompat-v7')
- }
- }
- }
-
- platform {
- res.srcDirs = ['platform/res']
- }
-
- icsCompat {
- res.srcDirs = ['eclair-mr1/res']
- }
-
- eclairMr1Compat {
- res.srcDirs = ['eclair-mr1/res']
- }
+apply plugin: 'dist'
- androidTest {
- manifest.srcFile 'test/AndroidManifest.xml'
- java.srcDirs = ['test/src']
- res.srcDirs = ['test/res']
- }
- }
+ext {
+ // For builds in the Android tree we want to build the dependencies from source for reproducible
+ // builds. To add a dependency, you want to specify something like this:
+ // ext {
+ // deps = ['project-name': project(':project-path')]
+ // }
+ //
+ // And then in rules.gradle you can reference the dependency by
+ // dependencies {
+ // compile deps['project-name']
+ // }
+ //
+ deps = ['support-appcompat-v7': project(':support-appcompat-v7')]
}
+
+apply from: 'rules.gradle'
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']
+ }
+ }
+}
diff --git a/library/standalone.gradle b/library/standalone.gradle
new file mode 100644
index 0000000..3d9e50f
--- /dev/null
+++ b/library/standalone.gradle
@@ -0,0 +1,35 @@
+/**
+ * Include this gradle file if you are building against this as a standalone gradle library project,
+ * as opposed to building it as part of the git-tree. This is typically the file you want to include
+ * if you create a new project in Android Studio.
+ *
+ * For example, you can include the following in your settings.gradle file:
+ * include ':setup-wizard-lib'
+ * project(':setup-wizard-lib').projectDir = new File(PATH_TO_THIS_DIRECTORY)
+ * project(':setup-wizard-lib').buildFileName = 'standalone.gradle'
+ *
+ * And then you can include the :setup-wizard-lib project as one of your dependencies
+ * dependencies {
+ * compile project(path: ':setup-wizard-lib', configuration: 'icsCompatRelease')
+ * }
+ */
+
+ext {
+ // For standalone project clients, since the source may not be available, we fetch the
+ // dependencies from maven. To add a dependency, you want to specify something like this:
+ // ext {
+ // deps = ['project-name': 'com.example.group:project-name:1.0.0']
+ // }
+ //
+ // And then in rules.gradle you can reference the dependency by
+ // dependencies {
+ // compile deps['project-name']
+ // }
+ //
+ deps = ['support-appcompat-v7': 'com.android.support:appcompat-v7:21.0.0']
+}
+
+apply from: 'rules.gradle'
+
+android.compileSdkVersion 21
+android.buildToolsVersion '21.1.0'