16df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam/** 26df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * Base rules for building setup wizard library. This build file is not used directly but rather 36df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * included in scripts like build.gradle or standalone.gradle using 'apply from'. 46df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * 56df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * This allows the dependencies to be configured so that for builds in the Android tree, the 66df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * dependencies like support library is built directly from source, while for standalone builds they 76df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam * will be fetched from maven central. 86df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam */ 96df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 106df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lamapply plugin: 'com.android.library' 116df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 126df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lamandroid { 136df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 146df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam publishNonDefault true 156df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 166df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam sourceSets { 176df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam main { 186df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam manifest.srcFile 'main/AndroidManifest.xml' 196df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam java.srcDirs = ['main/src'] 206df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam resources.srcDirs = ['main/src'] 216df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam res.srcDirs = ['main/res'] 226df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 236df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 246df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam productFlavors { 256df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // Platform version that will not include the compatibility libraries 266df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam platform { 276df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam minSdkVersion 21 286df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 296df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 306df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // Compatibility build that provides the L layout for SDK versions ICS+ 316df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam icsCompat { 326df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam minSdkVersion 14 336df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam dependencies { 346df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // Read the dependencies from the "deps" map in the extra properties. 356df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // 366df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // For builds in the Android tree we want to build the dependencies from source 376df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // for reproducible builds, for example in build.gradle define something like 386df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // this: 396df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // ext { 406df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // deps = ['project-name': project(':project-path')] 416df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // } 426df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // 436df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // For standalone project clients, since the source may not be available, we 446df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // fetch the dependencies from maven. For example in standalone.gradle define 456df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // something like this: 466df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // ext { 476df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // deps = ['project-name': 'com.example.group:project-name:1.0.0'] 486df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // } 496df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // 506df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam icsCompatCompile deps['support-appcompat-v7'] 516df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 526df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 536df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 546df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam // Compatibility build that provides the L layout for SDK versions Eclair MR1+ 556df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam eclairMr1Compat { 566df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam minSdkVersion 7 576df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam dependencies { 586df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam eclairMr1CompatCompile deps['support-appcompat-v7'] 596df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 606df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 6124f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam 6224f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam // This build depends on any support library that setup wizard library integrates with, 6324f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam // including RecyclerView, AppCompat, and possibly Design support library in the future. 6424f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam fullSupport { 6524f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam minSdkVersion 7 6624f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam dependencies { 6724f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam fullSupportCompile deps['support-appcompat-v7'] 6824f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam fullSupportCompile deps['support-recyclerview-v7'] 6924f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam } 7024f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam } 716df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 726df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 736df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam platform { 7491051468dbc273da8d7e7608640e833a71d011e2Maurice Lam java.srcDirs = ['platform/src'] 756df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam res.srcDirs = ['platform/res'] 766df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 776df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 786df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam icsCompat { 7991051468dbc273da8d7e7608640e833a71d011e2Maurice Lam java.srcDirs = ['eclair-mr1/src'] 806df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam res.srcDirs = ['eclair-mr1/res'] 816df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 826df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 836df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam eclairMr1Compat { 8491051468dbc273da8d7e7608640e833a71d011e2Maurice Lam java.srcDirs = ['eclair-mr1/src'] 856df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam res.srcDirs = ['eclair-mr1/res'] 866df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 876df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam 8824f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam fullSupport { 89a74bc1d5c6d7cb9e0f5add4c56a983cb492cb3c2Maurice Lam java.srcDirs = ['eclair-mr1/src', 'full-support/src'] 9024f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam res.srcDirs = ['eclair-mr1/res', 'full-support/res'] 9124f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam } 9224f1d0b9512dfc20bb1814a4e63f976a59f3ad99Maurice Lam 936df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam androidTest { 946df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam manifest.srcFile 'test/AndroidManifest.xml' 956df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam java.srcDirs = ['test/src'] 966df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam res.srcDirs = ['test/res'] 976df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 98a74bc1d5c6d7cb9e0f5add4c56a983cb492cb3c2Maurice Lam 996e55f30c31f1ac3b35d60f306cf6cef084b1a845Maurice Lam androidTestEclairMr1Compat { 1006e55f30c31f1ac3b35d60f306cf6cef084b1a845Maurice Lam java.srcDirs = ['eclair-mr1/test/src'] 1016e55f30c31f1ac3b35d60f306cf6cef084b1a845Maurice Lam } 1026e55f30c31f1ac3b35d60f306cf6cef084b1a845Maurice Lam 103a74bc1d5c6d7cb9e0f5add4c56a983cb492cb3c2Maurice Lam androidTestFullSupport { 1046e55f30c31f1ac3b35d60f306cf6cef084b1a845Maurice Lam java.srcDirs = ['full-support/test/src', 'eclair-mr1/test/src'] 105b01f3ef075d501d1f61e6f61794a5cadd3ff2026Maurice Lam res.srcDirs = ['full-support/test/res'] 106a74bc1d5c6d7cb9e0f5add4c56a983cb492cb3c2Maurice Lam } 1076df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam } 1086df734500612c91d396ccc61da80cd1cdc96b5b3Maurice Lam} 109