| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 apply plugin: 'com.android.application' | 1 apply plugin: 'com.android.application' |
| 2 apply plugin: 'kotlin-android' | 2 apply plugin: 'kotlin-android' |
| 3 apply plugin: 'kotlin-android-extensions' | 3 apply plugin: 'kotlin-android-extensions' |
| 4 | 4 |
| 5 android { | 5 android { |
| 6 compileSdkVersion rootProject.ext.compileSdkVersion | 6 compileSdkVersion rootProject.ext.compileSdkVersion |
| 7 buildToolsVersion rootProject.ext.buildToolsVersion | 7 buildToolsVersion rootProject.ext.buildToolsVersion |
| 8 | 8 |
| 9 compileOptions { | 9 compileOptions { |
| 10 sourceCompatibility = rootProject.ext.sourceCompatibilityVersion | 10 sourceCompatibility = rootProject.ext.sourceCompatibilityVersion |
| 11 targetCompatibility = rootProject.ext.targetCompatibilityVersion | 11 targetCompatibility = rootProject.ext.targetCompatibilityVersion |
| 12 } | 12 } |
| 13 | 13 |
| 14 defaultConfig { | 14 defaultConfig { |
| 15 applicationId "org.adblockplus.adblockplussbrowser" | 15 applicationId "org.adblockplus.adblockplussbrowser" |
| 16 minSdkVersion rootProject.ext.minSdkVersion | 16 minSdkVersion rootProject.ext.minSdkVersion |
| 17 targetSdkVersion rootProject.ext.targetSdkVersion | 17 targetSdkVersion rootProject.ext.targetSdkVersion |
| 18 versionCode 14 | 18 versionCode 14 |
| 19 versionName '1.1.4' | 19 versionName '1.1.4' |
| 20 buildConfigField "String", "FLAVOR_REGION_WORLD", '"world"' | |
| 21 buildConfigField "String", "FLAVOR_REGION_CHINA", '"china"' | |
|
diegocarloslima
2018/04/20 13:33:01
Since the current flavor is defined at build time,
| |
| 20 } | 22 } |
| 21 | 23 |
| 22 sourceSets { | 24 sourceSets { |
| 23 main { | 25 main { |
| 24 manifest.srcFile 'AndroidManifest.xml' | 26 manifest.srcFile 'AndroidManifest.xml' |
| 25 res.srcDirs = ['res'] | 27 res.srcDirs = ['res'] |
| 26 } | 28 } |
| 27 } | 29 } |
| 28 | 30 |
| 29 buildTypes { | 31 buildTypes { |
| 30 release { | 32 release { |
| 31 minifyEnabled true | 33 minifyEnabled true |
| 32 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'progu ard-rules.pro' | 34 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'progu ard-rules.pro' |
| 33 lintOptions { | 35 lintOptions { |
| 34 disable 'MissingTranslation' | 36 disable 'MissingTranslation' |
| 35 } | 37 } |
| 36 } | 38 } |
| 37 } | 39 } |
| 38 | 40 |
| 39 flavorDimensions "region" | 41 flavorDimensions "region" |
| 40 | 42 |
| 41 productFlavors { | 43 productFlavors { |
| 42 world { | 44 world { |
| 43 dimension "region" | 45 dimension "region" |
| 44 } | 46 } |
| 45 | 47 |
| 46 cn { | 48 china { |
|
diegocarloslima
2018/04/20 13:33:01
Renamed to make the flavor finding through the tas
| |
| 47 dimension "region" | 49 dimension "region" |
| 48 applicationIdSuffix ".cn" | 50 applicationIdSuffix ".cn" |
| 49 } | 51 } |
| 50 } | 52 } |
| 51 | 53 |
| 52 testOptions { | 54 testOptions { |
| 53 unitTests { | 55 unitTests { |
| 54 includeAndroidResources = true | 56 includeAndroidResources = true |
| 55 } | 57 } |
| 56 } | 58 } |
| 57 | 59 |
| 58 afterEvaluate { project -> | 60 afterEvaluate { project -> |
| 59 | 61 |
| 60 project.tasks.all { task -> | 62 project.tasks.all { task -> |
| 61 if (task.name.matches("generate.*Release.*Resources")) { | 63 if (task.name.matches("generate.*Release.*Resources")) { |
| 62 task.doLast { | 64 task.doLast { |
| 63 updateBundledLists() | 65 updateBundledLists(task.name) |
| 64 println('Bundled lists updated at ' + new Date().format('dd MMM yyyy, HH:mm:ss zzz')) | 66 println('Bundled lists updated at ' + new Date().format('dd MMM yyyy, HH:mm:ss zzz')) |
| 65 } | 67 } |
| 66 } | 68 } |
| 67 } | 69 } |
| 68 } | 70 } |
| 69 } | 71 } |
| 70 | 72 |
| 71 def updateBundledLists() { | 73 def updateBundledLists(taskName) { |
| 72 new URL(rootProject.ext.easyListUpdateUrl).withInputStream { | 74 def easylistUrl = taskName.contains("China") ? |
|
diegocarloslima
2018/04/20 13:33:02
I couldn't find any reliable and elegant way of de
| |
| 75 rootProject.ext.easyListChinaUpdateUrl : rootProject.ext.easyListDef aultUpdateUrl | |
| 76 new URL(easylistUrl).withInputStream { | |
| 73 i -> new File(rootProject.ext.easyListFilePath).withOutputStream { it << i } | 77 i -> new File(rootProject.ext.easyListFilePath).withOutputStream { it << i } |
| 74 } | 78 } |
| 75 new URL(rootProject.ext.exceptionRulesUpdateUrl).withInputStream { | 79 new URL(rootProject.ext.exceptionRulesUpdateUrl).withInputStream { |
| 76 i -> new File(rootProject.ext.exceptionRulesFilePath).withOutputStream { it << i } | 80 i -> new File(rootProject.ext.exceptionRulesFilePath).withOutputStream { it << i } |
| 77 } | 81 } |
| 78 } | 82 } |
| 79 | 83 |
| 80 dependencies { | 84 dependencies { |
| 81 testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" | 85 testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" |
| 82 testImplementation 'junit:junit:4.12' | 86 testImplementation 'junit:junit:4.12' |
| 83 testImplementation 'org.mockito:mockito-core:2.16.0' | 87 testImplementation 'org.mockito:mockito-core:2.16.0' |
| 84 testImplementation 'org.robolectric:robolectric:3.8' | 88 testImplementation 'org.robolectric:robolectric:3.8' |
| 85 implementation "com.android.support:support-v4:$rootProject.ext.androidSuppo rtLibraryVersion" | 89 implementation "com.android.support:support-v4:$rootProject.ext.androidSuppo rtLibraryVersion" |
| 86 implementation (group: 'commons-validator', name: 'commons-validator', versi on: '1.6') { | 90 implementation (group: 'commons-validator', name: 'commons-validator', versi on: '1.6') { |
| 87 exclude group: 'commons-logging', module: 'commons-logging' | 91 exclude group: 'commons-logging', module: 'commons-logging' |
| 88 } | 92 } |
| 89 } | 93 } |
| OLD | NEW |