1/**
2 * Base rules for building setup wizard library. This build file is not used directly but rather
3 * included in scripts like build.gradle or standalone.gradle using 'apply from'.
4 *
5 * This allows the dependencies to be configured so that for builds in the Android tree, the
6 * dependencies like support library is built directly from source, while for standalone builds they
7 * will be fetched from maven central.
8 */
9
10apply plugin: 'com.android.library'
11
12android {
13
14    publishNonDefault true
15
16    sourceSets {
17        main {
18            manifest.srcFile 'main/AndroidManifest.xml'
19            java.srcDirs = ['main/src']
20            resources.srcDirs = ['main/src']
21            res.srcDirs = ['main/res']
22        }
23
24        productFlavors {
25            // Platform version that will not include the compatibility libraries
26            platform {
27                minSdkVersion 21
28            }
29
30            // Compatibility build that provides the L layout for SDK versions ICS+
31            icsCompat {
32                minSdkVersion 14
33                dependencies {
34                    // Read the dependencies from the "deps" map in the extra properties.
35                    //
36                    // For builds in the Android tree we want to build the dependencies from source
37                    // for reproducible builds, for example in build.gradle define something like
38                    // this:
39                    //      ext {
40                    //          deps = ['project-name': project(':project-path')]
41                    //      }
42                    //
43                    // For standalone project clients, since the source may not be available, we
44                    // fetch the dependencies from maven. For example in standalone.gradle define
45                    // something like this:
46                    //      ext {
47                    //          deps = ['project-name': 'com.example.group:project-name:1.0.0']
48                    //      }
49                    //
50                    icsCompatCompile deps['support-appcompat-v7']
51                }
52            }
53
54            // Compatibility build that provides the L layout for SDK versions Eclair MR1+
55            eclairMr1Compat {
56                minSdkVersion 7
57                dependencies {
58                    eclairMr1CompatCompile deps['support-appcompat-v7']
59                }
60            }
61
62            // This build depends on any support library that setup wizard library integrates with,
63            // including RecyclerView, AppCompat, and possibly Design support library in the future.
64            fullSupport {
65                minSdkVersion 7
66                dependencies {
67                    fullSupportCompile deps['support-appcompat-v7']
68                    fullSupportCompile deps['support-recyclerview-v7']
69                }
70            }
71        }
72
73        platform {
74            java.srcDirs = ['platform/src']
75            res.srcDirs = ['platform/res']
76        }
77
78        icsCompat {
79            java.srcDirs = ['eclair-mr1/src']
80            res.srcDirs = ['eclair-mr1/res']
81        }
82
83        eclairMr1Compat {
84            java.srcDirs = ['eclair-mr1/src']
85            res.srcDirs = ['eclair-mr1/res']
86        }
87
88        fullSupport {
89            java.srcDirs = ['eclair-mr1/src', 'full-support/src']
90            res.srcDirs = ['eclair-mr1/res', 'full-support/res']
91        }
92
93        androidTest {
94            manifest.srcFile 'test/AndroidManifest.xml'
95            java.srcDirs = ['test/src']
96            res.srcDirs = ['test/res']
97        }
98
99        androidTestEclairMr1Compat {
100            java.srcDirs = ['eclair-mr1/test/src']
101        }
102
103        androidTestFullSupport {
104            java.srcDirs = ['full-support/test/src', 'eclair-mr1/test/src']
105            res.srcDirs = ['full-support/test/res']
106        }
107    }
108}
109