diff options
-rw-r--r-- | app/build.gradle | 60 | ||||
-rw-r--r-- | build.gradle | 42 | ||||
-rw-r--r-- | common.gradle | 105 | ||||
-rw-r--r-- | core/build.gradle | 78 | ||||
-rw-r--r-- | model/build.gradle | 47 | ||||
-rw-r--r-- | net/ssl/build.gradle | 58 | ||||
-rw-r--r-- | net/sync/gpoddernet/build.gradle | 47 | ||||
-rw-r--r-- | net/sync/model/build.gradle | 47 | ||||
-rw-r--r-- | playFlavor.gradle | 11 | ||||
-rw-r--r-- | ui/app-start-intent/build.gradle | 47 | ||||
-rw-r--r-- | ui/common/build.gradle | 47 | ||||
-rw-r--r-- | ui/png-icons/build.gradle | 42 |
12 files changed, 137 insertions, 494 deletions
diff --git a/app/build.gradle b/app/build.gradle index 2c622cd91..658e52a0e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,34 +3,17 @@ plugins { id('com.getkeepsafe.dexcount') id('com.github.triplet.play') version '2.7.5' apply false } +apply from: "../common.gradle" +apply from: "../playFlavor.gradle" android { - compileSdkVersion rootProject.ext.compileSdkVersion - - viewBinding { - enabled = true - } - - lintOptions { - checkGeneratedSources = true - } - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion // Version code schema: // "1.2.3-beta4" -> 1020304 // "1.2.3" -> 1020395 versionCode 2020003 versionName "2.2.0-beta3" - multiDexEnabled false - vectorDrawables.useSupportLibrary true - vectorDrawables.generatedDensities = [] - - testApplicationId "de.test.antennapod" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - def commit = "" try { def hashStdOut = new ByteArrayOutputStream() @@ -91,13 +74,6 @@ android { applicationIdSuffix ".debug" resValue "string", "provider_authority", "de.danoeh.antennapod.debug.provider" - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - dexcount { if (project.hasProperty("enableDexcountInDebug")) { runOnEachPackage enableDexcountInDebug.toBoolean() @@ -110,52 +86,24 @@ android { resValue "string", "provider_authority", "de.danoeh.antennapod.provider" minifyEnabled true shrinkResources true - proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard.cfg" signingConfig signingConfigs.releaseConfig } } - packagingOptions { - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" - } - lintOptions { disable 'ObsoleteLintCustomCheck', 'CheckResult', 'UnusedAttribute', 'BatteryLife', 'InflateParams', - 'GradleDependency', 'RestrictedApi', 'TrustAllX509TrustManager', 'ExportedReceiver', 'AllowBackup', + 'RestrictedApi', 'TrustAllX509TrustManager', 'ExportedReceiver', 'AllowBackup', 'VectorDrawableCompat', 'StaticFieldLeak', 'UseCompoundDrawables', 'NestedWeights', 'Overdraw', 'UselessParent', 'TextFields', 'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'ContentDescription', 'KeyboardInaccessibleWidget', 'LabelFor', 'SetTextI18n', 'HardcodedText', 'RelativeOverlap', 'RtlCompat', 'RtlHardcoded', 'MissingMediaBrowserServiceIntentFilter', 'VectorPath', - 'InvalidPeriodicWorkRequestInterval', 'VectorDrawableCompat' - checkDependencies true - warningsAsErrors true - abortOnError true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + 'InvalidPeriodicWorkRequestInterval' } aaptOptions { additionalParameters "--no-version-vectors" } - testOptions { - animationsDisabled = true - } - - flavorDimensions "market" - productFlavors { - free { - dimension "market" - } - play { - dimension "market" - } - } - dexOptions { jumboMode true } diff --git a/build.gradle b/build.gradle index ec9148778..72c93f2f8 100644 --- a/build.gradle +++ b/build.gradle @@ -20,44 +20,6 @@ allprojects { maven { url "https://jitpack.io" } jcenter() } - - gradle.projectsEvaluated { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint" - } - } - - apply plugin: 'com.github.spotbugs' - - spotbugs { - effort = 'max' - reportLevel = 'medium' - excludeFilter = rootProject.file('config/spotbugs/exclude.xml') - ignoreFailures = true // Handled by printing task - } - - gradle.taskGraph.beforeTask { task -> - if (task.name.toLowerCase().contains('spotbugs')) { - task.doLast { - def reportFile = task.project.file("build/reports/spotbugs/playDebug.xml") - if (!reportFile.exists()) return - def slurped = new XmlSlurper().parse(reportFile) - - def foundErrors = false - slurped['BugInstance'].each { bug -> - logger.error "[SpotBugs] ${bug['LongMessage']} [${bug.@'type'}]" - bug['SourceLine'].each { line -> - logger.error "[SpotBugs] ${line['Message']}" - foundErrors = true - } - } - if (foundErrors) { - throw new TaskExecutionException(task, - new Exception("SpotBugs violations were found. See output above for details.")) - } - } - } - } } // Disable predex if requested (we can"t predex in Circle CI @@ -76,10 +38,6 @@ subprojects { } project.ext { - compileSdkVersion = 30 - minSdkVersion = 16 - targetSdkVersion = 30 - // AndroidX annotationVersion = "1.1.0" appcompatVersion = "1.2.0" diff --git a/common.gradle b/common.gradle new file mode 100644 index 000000000..4c3ee192d --- /dev/null +++ b/common.gradle @@ -0,0 +1,105 @@ +android { + compileSdkVersion 30 + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 30 + + multiDexEnabled false + vectorDrawables.useSupportLibrary true + vectorDrawables.generatedDensities = [] + + testApplicationId "de.danoeh.antennapod.core.tests" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } + debug { + // debug build has method count over 64k single-dex threshold. + // For building debug build to use on Android < 21 (pre-Android 5) devices, + // you need to manually change class + // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . + // See Issue #2813 + multiDexEnabled true + } + } + + packagingOptions { + exclude "META-INF/LICENSE.txt" + exclude "META-INF/NOTICE.txt" + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + testOptions { + animationsDisabled = true + unitTests { + includeAndroidResources = true + } + } + + lintOptions { + disable "GradleDependency" + checkDependencies true + warningsAsErrors true + abortOnError true + checkGeneratedSources = true + } + + viewBinding { + enabled = true + } +} + +tasks.withType(Test) { + testLogging { + exceptionFormat "full" + events "skipped", "passed", "failed" + showStandardStreams true + displayGranularity 2 + } +} + +gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint" + } +} + +apply plugin: 'com.github.spotbugs' + +spotbugs { + effort = 'max' + reportLevel = 'medium' + excludeFilter = rootProject.file('config/spotbugs/exclude.xml') + ignoreFailures = true // Handled by printing task +} + +gradle.taskGraph.beforeTask { task -> + if (task.name.toLowerCase().contains('spotbugs')) { + task.doLast { + def reportFile = task.project.file("build/reports/spotbugs/playDebug.xml") + if (!reportFile.exists()) return + def slurped = new XmlSlurper().parse(reportFile) + + def foundErrors = false + slurped['BugInstance'].each { bug -> + logger.error "[SpotBugs] ${bug['LongMessage']} [${bug.@'type'}]" + bug['SourceLine'].each { line -> + logger.error "[SpotBugs] ${line['Message']}" + foundErrors = true + } + } + if (foundErrors) { + throw new TaskExecutionException(task, + new Exception("SpotBugs violations were found. See output above for details.")) + } + } + } +} diff --git a/core/build.gradle b/core/build.gradle index f9c09c7bc..e78b70881 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,75 +1,22 @@ apply plugin: "com.android.library" +apply from: "../common.gradle" +apply from: "../playFlavor.gradle" android { - compileSdkVersion rootProject.ext.compileSdkVersion + lintOptions { + disable "InvalidPeriodicWorkRequestInterval", "ObsoleteLintCustomCheck", "DefaultLocale", "UnusedAttribute", + "ParcelClassLoader", "Typos", "ExtraTranslation", "ImpliedQuantity", "CheckResult", + "PluralsCandidate", "UnusedQuantity", "StringFormatCount", "TrustAllX509TrustManager", + "StaticFieldLeak", "TypographyEllipsis", "IconDensities", "IconDuplicates" + } defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - vectorDrawables.useSupportLibrary true - vectorDrawables.generatedDensities = [] - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - javaCompileOptions { annotationProcessorOptions { arguments = [eventBusIndex: 'de.danoeh.antennapod.core.ApCoreEventBusIndex'] } } } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - packagingOptions { - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - flavorDimensions "market" - productFlavors { - free { - dimension "market" - } - play { - dimension "market" - } - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable "InvalidPeriodicWorkRequestInterval", "ObsoleteLintCustomCheck", "DefaultLocale", "UnusedAttribute", - "GradleDependency", "ParcelClassLoader", "Typos", "ExtraTranslation", "ImpliedQuantity", - "PluralsCandidate", "UnusedQuantity", "StringFormatCount", "TrustAllX509TrustManager", - "StaticFieldLeak", "TypographyEllipsis", "IconDensities", "IconDuplicates", "CheckResult" - checkDependencies true - warningsAsErrors true - abortOnError true - } } dependencies { @@ -124,12 +71,3 @@ dependencies { androidTestImplementation "androidx.test:runner:$runnerVersion" androidTestImplementation "androidx.test:rules:$rulesVersion" } - -tasks.withType(Test) { - testLogging { - exceptionFormat "full" - events "skipped", "passed", "failed" - showStandardStreams true - displayGranularity 2 - } -} diff --git a/model/build.gradle b/model/build.gradle index 4d6d5b56d..3abbd8e24 100644 --- a/model/build.gradle +++ b/model/build.gradle @@ -1,50 +1,5 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - vectorDrawables.useSupportLibrary false - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - warningsAsErrors true - abortOnError true - } -} +apply from: "../common.gradle" dependencies { annotationProcessor "androidx.annotation:annotation:$annotationVersion" diff --git a/net/ssl/build.gradle b/net/ssl/build.gradle index 32aa7fee0..2a47968d3 100644 --- a/net/ssl/build.gradle +++ b/net/ssl/build.gradle @@ -1,60 +1,6 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - flavorDimensions "market" - productFlavors { - free { - dimension "market" - } - play { - dimension "market" - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - checkDependencies true - warningsAsErrors true - abortOnError true - } -} +apply from: "../../common.gradle" +apply from: "../../playFlavor.gradle" dependencies { annotationProcessor "androidx.annotation:annotation:$annotationVersion" diff --git a/net/sync/gpoddernet/build.gradle b/net/sync/gpoddernet/build.gradle index cd6d8d04c..eb5af1b60 100644 --- a/net/sync/gpoddernet/build.gradle +++ b/net/sync/gpoddernet/build.gradle @@ -1,50 +1,5 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - checkDependencies true - warningsAsErrors true - abortOnError true - } -} +apply from: "../../../common.gradle" dependencies { implementation project(':net:sync:model') diff --git a/net/sync/model/build.gradle b/net/sync/model/build.gradle index 299359602..e47040892 100644 --- a/net/sync/model/build.gradle +++ b/net/sync/model/build.gradle @@ -1,50 +1,5 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - checkDependencies true - warningsAsErrors true - abortOnError true - } -} +apply from: "../../../common.gradle" dependencies { implementation project(':model') diff --git a/playFlavor.gradle b/playFlavor.gradle new file mode 100644 index 000000000..7289bd4c9 --- /dev/null +++ b/playFlavor.gradle @@ -0,0 +1,11 @@ +android { + flavorDimensions "market" + productFlavors { + free { + dimension "market" + } + play { + dimension "market" + } + } +} diff --git a/ui/app-start-intent/build.gradle b/ui/app-start-intent/build.gradle index b05569b04..5390b85d8 100644 --- a/ui/app-start-intent/build.gradle +++ b/ui/app-start-intent/build.gradle @@ -1,50 +1,5 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - checkDependencies true - warningsAsErrors true - abortOnError true - } -} +apply from: "../../common.gradle" dependencies { annotationProcessor "androidx.annotation:annotation:$annotationVersion" diff --git a/ui/common/build.gradle b/ui/common/build.gradle index b05569b04..5390b85d8 100644 --- a/ui/common/build.gradle +++ b/ui/common/build.gradle @@ -1,50 +1,5 @@ apply plugin: "com.android.library" - -android { - compileSdkVersion rootProject.ext.compileSdkVersion - - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - checkDependencies true - warningsAsErrors true - abortOnError true - } -} +apply from: "../../common.gradle" dependencies { annotationProcessor "androidx.annotation:annotation:$annotationVersion" diff --git a/ui/png-icons/build.gradle b/ui/png-icons/build.gradle index cf13d882d..651d04f2e 100644 --- a/ui/png-icons/build.gradle +++ b/ui/png-icons/build.gradle @@ -1,48 +1,10 @@ apply plugin: "com.android.library" +apply from: "../../common.gradle" android { - compileSdkVersion rootProject.ext.compileSdkVersion - defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - vectorDrawables.useSupportLibrary false - multiDexEnabled false - - testApplicationId "de.danoeh.antennapod.core.tests" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - debug { - // debug build has method count over 64k single-dex threshold. - // For building debug build to use on Android < 21 (pre-Android 5) devices, - // you need to manually change class - // de.danoeh.antennapod.PodcastApp to extend MultiDexApplication . - // See Issue #2813 - multiDexEnabled true - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - lintOptions { - disable 'GradleDependency' - warningsAsErrors true - abortOnError true + vectorDrawables.generatedDensities = null } } |