Julien Verfaillie
09/21/2020, 1:27 PMSebastian Sellmair [JB]
09/21/2020, 1:52 PMSebastian Sellmair [JB]
09/21/2020, 1:52 PMJulien Verfaillie
09/21/2020, 1:58 PMimport com.github.spotbugs.SpotBugsTask
project.extensions.extraProperties.set('SpotBugsTask', SpotBugsTask)
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka'
apply from: '../ci/staticAnalysis/spotbugs/XxxxxxSpotBugs.gradle'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
afterEvaluate {
def originalFilePath = "$buildDir/outputs/aar/XxxxxxZzzz-release.aar"
def newFilePath = originalFilePath.replace(".aar", "_v${defaultConfig.versionName}.aar")
def debugFile = file(originalFilePath)
tasks.named("assembleRelease").configure {
doLast {
debugFile.renameTo(newFilePath)
}
}
}
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.9.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
consumerProguardFiles '<http://proguard-rules.pro|proguard-rules.pro>'
dimension "default"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
}
}
flavorDimensions "default"
productFlavors {
def useSecureFlagProd = rootProject.hasProperty("useSecureFlagProd") ? rootProject.useSecureFlagProd : true
def useSecureFlagDev = rootProject.hasProperty("useSecureFlagDev") ? rootProject.useSecureFlagDev : false
prod {
buildConfigField 'boolean', 'USE_SECURE_FLAG', "$useSecureFlagProd"
}
dev {
buildConfigField 'boolean', 'USE_SECURE_FLAG', "$useSecureFlagDev"
}
}
repositories {
flatDir {
dirs 'libs'
}
}
compileOptions {
// Flag to enable support for the new language APIs
// Source <https://developer.android.com/studio/write/java8-support>
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
// Specify Versions here to avoid coupling this module with the app.
def koinVersion = '2.1.6'
api project(path: ':XxxxxxYyyyy')
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Source: <https://developer.android.com/studio/write/java8-support>
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
// Android x
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.core:core:1.3.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
// Google Play services
implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation "com.google.android.gms:play-services-location:17.0.0"
// When you update play-services-fitness to 18.0.0 or higher, observe the breaking changes
// here: <https://developers.google.com/android/guides/releases#august_22_2019>
implementation "com.google.android.gms:play-services-fitness:17.0.0"
implementation "com.google.android.gms:play-services-auth:17.0.0"
// Phone number parser
implementation 'com.googlecode.libphonenumber:libphonenumber:8.11.3'
// Barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// Misc libs
implementation "com.google.code.gson:gson:2.8.6"
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation "com.afollestad.material-dialogs:core:0.9.0.2"
// Material components
api "com.google.android.material:material:1.2.0"
// Make this available to Zzzz and PAT.
// (latest Picasso is 2.5.2, not 2.7xxx, see picasso's website)
api "com.squareup.picasso:picasso:2.5.2"
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
// Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion"
// Koin for Android
implementation "org.koin:koin-android:$koinVersion"
implementation "org.koin:koin-android-scope:$koinVersion"
implementation "org.koin:koin-androidx-viewmodel:$koinVersion"
testImplementation "org.koin:koin-test:$koinVersion"
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:2.3.0"
implementation "androidx.navigation:navigation-ui-ktx:2.3.0"
// Mockito framework
testImplementation "org.mockito:mockito-core:3.4.6"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
// JUnit 4 framework
testImplementation 'junit:junit:4.13'
// OkHttp mock server
testImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
}
buildscript {
ext {
dokkaVersion = "1.4.0"
kotlinVersion = "1.3.72"
kotlinCoroutinesVersion = '1.3.6'
}
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}"
}
}
//publishing pom configurations
def Zzzz_POM_GROUP = "com.Xxxxxx.Zzzz"
def Zzzz_POM_ARTIFACT_ID = "ZzzzSDK"
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.groupId = Zzzz_POM_GROUP
pom.artifactId = Zzzz_POM_ARTIFACT_ID
pom.version = android.defaultConfig.versionName
def deployPath = file('./')
repository(url: "file://${deployPath.absolutePath}/../sdkOutput/")
pom.whenConfigured { pom ->
pom.dependencies.forEach { dep ->
if (dep.getVersion() == "unspecified") {
dep.setVersion(android.defaultConfig.versionName)
}
}
}
}
}
}
}
// publishing task is not modifying the "unspecified" dependencies as uploadArchives does
publishing {
publications {
maven(MavenPublication) {
groupId Zzzz_POM_GROUP
artifactId Zzzz_POM_ARTIFACT_ID
version android.defaultConfig.versionName
artifact "$buildDir/../../sdkOutput/com/Xxxxxx/Zzzz/ZzzzSDK/${version}/ZzzzSDK-${version}.aar"
//generate pom nodes for dependencies
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each { dependency ->
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.name)
dependencyNode.appendNode('version', dependency.version)
}
}
}
}
//publish to filesystem repo
repositories{
maven {
url "$buildDir/repo"
}
}
}
Julien Verfaillie
09/21/2020, 1:58 PMSebastian Sellmair [JB]
09/21/2020, 2:43 PM.gradlew tasks
or ./gradlew :{app}:tasks
Julien Verfaillie
09/21/2020, 2:50 PMJulien Verfaillie
09/21/2020, 2:51 PMThe Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: <https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl>
The Kotlin plugin was loaded in the following projects: ':ZzzzzZzzz', ':ZzzzzYyyyy'
> Task :tasks
------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------
Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.
Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
assembleDebug - Assembles main outputs for all Debug variants.
assembleDev - Assembles main outputs for all Dev variants.
assembleProd - Assembles main outputs for all Prod variants.
assembleRelease - Assembles main outputs for all Release variants.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
cleanBuildCache - Deletes the build cache directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileDevDebugAndroidTestSources
compileDevDebugSources
compileDevDebugUnitTestSources
compileDevReleaseSources
compileDevReleaseUnitTestSources
compileProdDebugAndroidTestSources
compileProdDebugSources
compileProdDebugUnitTestSources
compileProdReleaseSources
compileProdReleaseUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
extractDebugAnnotations - Extracts Android annotations for the debug variant into the archive file
extractDevDebugAnnotations - Extracts Android annotations for the devDebug variant into the archive file
extractDevReleaseAnnotations - Extracts Android annotations for the devRelease variant into the archive file
extractProdDebugAnnotations - Extracts Android annotations for the prodDebug variant into the archive file
extractProdReleaseAnnotations - Extracts Android annotations for the prodRelease variant into the archive file
extractReleaseAnnotations - Extracts Android annotations for the release variant into the archive file
Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Cleanup tasks
-------------
lintFix - Runs lint on all variants and applies any safe suggestions to the source code.
Documentation tasks
-------------------
dokka - Generates dokka documentation for Kotlin
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'ZzzzLib'.
components - Displays the components produced by root project 'ZzzzLib'. [incubating]
dependencies - Displays all dependencies declared in root project 'ZzzzLib'.
dependencyInsight - Displays the insight into a specific dependency in root project 'ZzzzLib'.
dependentComponents - Displays the dependent components of components in root project 'ZzzzLib'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'ZzzzLib'. [incubating]
outgoingVariants - Displays the outgoing variants of root project 'ZzzzLib'.
projects - Displays the sub-projects of root project 'ZzzzLib'.
properties - Displays the properties of root project 'ZzzzLib'.
tasks - Displays the tasks runnable from root project 'ZzzzLib' (some of the displayed tasks may belong to subprojects).
Install tasks
-------------
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
installDevDebugAndroidTest - Installs the android (on device) tests for the DevDebug build.
installProdDebugAndroidTest - Installs the android (on device) tests for the ProdDebug build.
uninstallAll - Uninstall all applications.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallDevDebugAndroidTest - Uninstalls the android (on device) tests for the DevDebug build.
uninstallProdDebugAndroidTest - Uninstalls the android (on device) tests for the ProdDebug build.
Publishing tasks
----------------
generateMetadataFileForMavenPublication - Generates the Gradle metadata file for publication 'maven'.
generatePomFileForMavenPublication - Generates the Maven POM file for publication 'maven'.
publish - Publishes all publications produced by this project.
publishAllPublicationsToMavenRepository - Publishes all Maven publications produced by this project to the maven repository.
publishMavenPublicationToMavenLocal - Publishes Maven publication 'maven' to the local Maven repository.
publishMavenPublicationToMavenRepository - Publishes Maven publication 'maven' to Maven repository 'maven'.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.
Upload tasks
------------
uploadArchives - Uploads all artifacts belonging to configuration ':ZzzzzZzzz:archives'
Verification tasks
------------------
check - Runs all checks.
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
connectedDevDebugAndroidTest - Installs and runs the tests for devDebug on connected devices.
connectedProdDebugAndroidTest - Installs and runs the tests for prodDebug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on all variants.
lintDebug - Runs lint on the Debug build.
lintDevDebug - Runs lint on the DevDebug build.
lintDevRelease - Runs lint on the DevRelease build.
lintProdDebug - Runs lint on the ProdDebug build.
lintProdRelease - Runs lint on the ProdRelease build.
lintRelease - Runs lint on the Release build.
spotbugsMain - Run SpotBugs analysis for main classes
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testDevDebugUnitTest - Run unit tests for the devDebug build.
testDevReleaseUnitTest - Run unit tests for the devRelease build.
testProdDebugUnitTest - Run unit tests for the prodDebug build.
testProdReleaseUnitTest - Run unit tests for the prodRelease build.
testReleaseUnitTest - Run unit tests for the release build.
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings>
BUILD SUCCESSFUL in 690ms
1 actionable task: 1 executed
Sebastian Sellmair [JB]
09/22/2020, 4:28 PMSebastian Sellmair [JB]
09/22/2020, 4:29 PMJulien Verfaillie
09/22/2020, 4:36 PMJulien Verfaillie
09/22/2020, 4:36 PMDocumentation tasks
-------------------
dokkaGfm - Generates documentation in GitHub flavored markdown format
dokkaHtml - Generates documentation in 'html' format
dokkaJavadoc - Generates documentation in 'javadoc' format
dokkaJekyll - Generates documentation in Jekyll flavored markdown format
Julien Verfaillie
09/22/2020, 4:36 PMJulien Verfaillie
09/22/2020, 4:36 PMSebastian Sellmair [JB]
09/22/2020, 4:36 PM