2020-11-28 13:00:11 +03:00
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google ( )
2021-03-16 08:18:09 +03:00
mavenCentral ( )
2020-12-02 08:06:25 +03:00
maven {
url "https://plugins.gradle.org/m2/"
}
2020-11-28 13:00:11 +03:00
}
ext {
2021-10-09 00:46:43 +03:00
// Updating the dependency below throws a 'java.lang.OutOfMemoryError: Metaspace' during build time.
2021-09-07 23:19:06 +03:00
googleGmsServicesPluginVersion = "4.3.8"
2021-02-08 23:19:41 +03:00
gradleAndroidBuildToolsPluginVersion = "30.0.3"
2021-10-09 00:46:43 +03:00
// Need to make many changes before being able to update the gradle plugin version below.
gradleAndroidToolsPluginVersion = "4.0.2"
2020-12-04 01:27:02 +03:00
gradleJunitJacocoPluginVersion = "0.16.0"
2021-09-09 23:59:51 +03:00
gradleDexcountPluginVersion = "3.0.0"
2021-10-09 00:46:43 +03:00
gradleSpotbugsPluginVersion = "4.7.5"
gradleAndroidJunit5PluginVersion = "1.8.0.0"
2021-09-09 23:59:51 +03:00
jacocoVersion = "0.8.7"
2021-10-09 00:46:43 +03:00
// Updating the dependency below causes a ClassDefNotFound exception with the current CheckStyle implementation
// in the /eng/ directory.
qualityReportsPuppycrawlVersion = "8.34"
2021-09-09 23:59:51 +03:00
qualityReportsJunitVersion = "4.13.2"
2020-11-28 13:00:11 +03:00
}
dependencies {
2020-12-04 01:27:02 +03:00
classpath ( "com.android.tools.build:gradle:$gradleAndroidToolsPluginVersion" )
classpath ( "de.mannodermaus.gradle.plugins:android-junit5:$gradleAndroidJunit5PluginVersion" )
classpath ( "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$gradleDexcountPluginVersion" )
classpath ( "com.vanniktech:gradle-android-junit-jacoco-plugin:$gradleJunitJacocoPluginVersion" )
classpath ( "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:$gradleSpotbugsPluginVersion" )
2021-09-07 23:19:06 +03:00
classpath ( "com.google.gms:google-services:$googleGmsServicesPluginVersion" )
2020-11-28 13:00:11 +03:00
}
}
2021-03-03 19:52:31 +03:00
apply plugin: "com.vanniktech.android.junit.jacoco"
2023-10-13 23:33:07 +03:00
// Configure all client library projects with the standard Android build / publish template.
2020-11-28 13:00:11 +03:00
configure ( subprojects . findAll { it . path . startsWith ( ':sdk:' ) & & it . path . count ( ':' ) = = 3 } ) {
apply plugin: "com.android.library"
2021-03-03 19:52:31 +03:00
apply plugin: "de.mannodermaus.android-junit5"
2021-02-22 19:54:59 +03:00
// https://github.com/KeepSafe/dexcount-gradle-plugin/issues/222#issuecomment-604247658
2023-10-13 23:33:07 +03:00
// apply plugin: 'com.getkeepsafe.dexcount'.
2020-11-29 10:52:38 +03:00
apply plugin: 'checkstyle'
2020-12-02 08:06:25 +03:00
apply plugin: 'com.github.spotbugs'
2021-02-22 19:54:59 +03:00
apply plugin: "maven-publish"
2020-11-28 13:00:11 +03:00
group = "com.azure.android"
android {
2024-02-16 01:20:02 +03:00
compileSdkVersion 34
2020-12-04 01:27:02 +03:00
buildToolsVersion ( "$gradleAndroidBuildToolsPluginVersion" )
2020-11-28 13:00:11 +03:00
defaultConfig {
2021-02-23 04:25:28 +03:00
minSdkVersion 15
2024-02-16 01:20:02 +03:00
targetSdkVersion 34
2020-11-28 13:00:11 +03:00
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion . VERSION_1_8
targetCompatibility JavaVersion . VERSION_1_8
}
lintOptions {
lintConfig file ( "$rootDir/eng/lint.xml" )
htmlReport true
textReport true
textOutput 'stdout'
explainIssues false
abortOnError true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/license'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.md'
exclude 'META-INF/notice'
exclude 'META-INF/ASL2.0'
exclude ( "META-INF/*.md" )
exclude ( "META-INF/*.txt" )
exclude ( "META-INF/*.kotlin_module" )
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile ( "proguard-android-optimize.txt" ) , "proguard-rules.pro"
}
debug {
debuggable true
}
}
testOptions {
2024-02-16 01:20:02 +03:00
unitTests . all {
jacoco {
includeNoLocationClasses = true
excludes = [ 'jdk.internal.*' ]
}
2020-11-28 13:00:11 +03:00
}
2024-02-16 01:20:02 +03:00
unitTests . includeAndroidResources = true
unitTests . returnDefaultValues = true
2020-11-28 13:00:11 +03:00
}
}
junitJacoco {
jacocoVersion = "$jacocoVersion"
}
2021-03-03 19:52:31 +03:00
task jacocoTestReport ( type: JacocoReport ) {
group = "Reporting"
2024-02-16 01:20:02 +03:00
description = "Generate Jacoco reports"
2021-03-03 19:52:31 +03:00
reports {
xml . enabled = true
html . enabled = false
csv . enabled = false
}
}
2020-12-02 08:06:25 +03:00
// Add dependency to the module containing azure custom checkstyle.
2020-12-02 04:41:57 +03:00
dependencies {
checkstyle project ( ":eng:code-quality-reports" )
}
2020-11-29 10:52:38 +03:00
task checkstyle ( type: Checkstyle ) {
project . ext . checkstyleVersion = '8.29'
description 'Runs Checkstyle inspection.'
group = 'Code Quality'
configDirectory = file ( "${rootDir}/config/checkstyle" )
2020-12-02 04:41:57 +03:00
configProperties = [ samedir: "${rootDir}/config/checkstyle" ]
2020-11-29 10:52:38 +03:00
ignoreFailures false
showViolations true
maxWarnings = 0
classpath = files ( )
source 'src/main/java'
}
2023-10-13 23:33:07 +03:00
// Check code style after project evaluation.
2020-11-29 10:52:38 +03:00
afterEvaluate {
check . dependsOn ( 'checkstyle' )
}
2020-12-02 08:06:25 +03:00
// Set spotbugs plugin to use SpotBugs.
dependencies {
spotbugs 'com.github.spotbugs:spotbugs:4.0.0'
}
spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = "max"
reportLevel = "Low" // threshold
reportsDir = file ( "$buildDir/spotbugs" )
excludeFilter = file ( "${rootDir}/config/spotbugs/spotbugs-exclude.xml" )
}
2020-11-28 13:00:11 +03:00
task sourcesJar ( type: Jar ) {
from android . sourceSets . main . java . srcDirs
archiveClassifier . set ( "sources" )
}
task javadoc ( type: Javadoc ) {
failOnError false
source = android . sourceSets . main . java . srcDirs
classpath + = project . files ( android . getBootClasspath ( ) . join ( File . pathSeparator ) )
}
task javadocJar ( type: Jar , dependsOn: javadoc ) {
from javadoc . destinationDir
archiveClassifier . set ( "javadoc" )
}
2021-08-26 02:42:05 +03:00
task updatePackageVersion ( type: WriteProperties ) {
if ( project . properties [ "newVersion" ] )
{
outputFile = file ( 'gradle.properties' )
property 'version' , project . getProperty ( "newVersion" )
}
}
2021-09-09 23:59:51 +03:00
2021-09-01 00:40:37 +03:00
task retrieveProjectProperties {
doLast {
println ( project . properties [ 'version' ] + '~' +
project . properties [ 'name' ] + '~' +
project . properties [ 'group' ] + '~' +
project . properties [ 'projectDir' ] )
}
}
2021-08-26 02:42:05 +03:00
2020-11-28 13:00:11 +03:00
project . afterEvaluate {
javadoc . classpath + = files ( android . libraryVariants . collect { variant - >
variant . javaCompileProvider . get ( ) . classpath . files
} )
publishing {
publications {
release ( MavenPublication ) { - > project
from components . release
artifact sourcesJar
artifact javadocJar
pom {
name = project . publishName
description = project . description
url = 'https://github.com/Azure/azure-sdk-for-android'
licenses {
license {
name = 'The MIT License (MIT)'
url = 'http://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'microsoft'
name = 'Microsoft'
}
}
scm {
connection = 'scm:git:https://github.com/Azure/azure-sdk-for-android.git'
developerConnection = 'scm:git:https://github.com/Azure/azure-sdk-for-android.git'
url = 'https://github.com/Azure/azure-sdk-for-android'
}
}
}
}
repositories {
maven {
url = "$buildDir/repo/"
}
}
}
}
2021-11-15 20:33:56 +03:00
// Used by aggregate-report pipeline to generate .lockfiles
dependencyLocking {
lockAllConfigurations ( )
}
2020-11-28 13:00:11 +03:00
}
allprojects {
repositories {
google ( )
2021-03-16 08:18:09 +03:00
mavenCentral ( )
// org.jetbrains.trove4j:trove4j:20160824.
2021-03-27 03:16:10 +03:00
maven {
url 'https://plugins.gradle.org/m2/'
}
2020-11-28 13:00:11 +03:00
}
ext {
2021-09-09 23:59:51 +03:00
androidxTestVersion = "1.4.0"
2020-11-28 13:00:11 +03:00
appCompatVersion = "1.2.0"
2024-02-28 06:55:51 +03:00
azureCommunicationCommonVersion = "1.2.1"
2024-02-23 23:19:42 +03:00
azureCoreVersion = "1.0.0-beta.14"
2023-10-13 23:33:07 +03:00
jacksonVersion = "2.12.7" // Do not upgrade to 2.13.0 and above, as it introduced using an API not available in javax.xml.stream:stax-api:1.0-2. See: https://github.com/Azure/azure-sdk-for-android/issues/1017.
2022-11-09 20:27:53 +03:00
jacksonDatabindVersion = "2.12.7.1" // Need this to be a separate version to include a security fix.
2021-10-09 00:46:43 +03:00
junitJupiterVersion = "5.7.2"
mockitoVersion = "4.0.0"
nimbusJoseJwtTestVersion = "9.15.2"
2023-10-13 23:33:07 +03:00
okHttpVersion = "3.14.9" // Do not upgrade, newer versions require a higher Android minSdkLevel.
okioVersion = "1.17.6" // Directly setting this OkHttp dependency as it has a fix for CVE-2023-3635 and we cannot update to a newer version of OkHttp yet. See: https://github.com/square/okio/issues/1323#issuecomment-1742354403
orgtestngVersion = "7.5.1"
2021-10-09 00:46:43 +03:00
powerMockVersion = "2.0.9"
retroFutureVersion = "1.7.4"
2023-10-13 23:33:07 +03:00
staxApiVersion = "1.0-2" // Need this instead of using the JDK due to: https://stackoverflow.com/a/47371517/1473510.
2021-10-09 00:46:43 +03:00
slf4jApiVersion = "1.7.32"
2021-09-09 23:59:51 +03:00
threeTenAbpVersion = "1.3.1"
threeTenBpVersion = "1.5.1"
2021-09-26 20:02:05 +03:00
trouterVersion = "0.1.1"
2021-10-09 00:46:43 +03:00
wireMockVersion = "2.27.2"
2022-11-09 20:27:53 +03:00
woodstoxVersion = "6.4.0"
2020-11-28 13:00:11 +03:00
}
}
// Synthesize dependencies for service-level projects so that running a task on a service-level project automatically
2023-10-13 23:33:07 +03:00
// runs it on all sub-projects of that project.
2020-11-28 13:00:11 +03:00
configure ( subprojects . findAll { it . path . startsWith ( ':sdk:' ) & & it . path . count ( ':' ) = = 2 } ) {
apply plugin: "org.gradle.help-tasks"
def setupTasks = [ "init" , "wrapper" ]
project . gradle . startParameter . taskNames . each { task - >
task = task . split ( ':' ) . last ( )
if ( ! task . startsWith ( "-" ) & & ! setupTasks . contains ( task ) & & tasks . findByPath ( task ) = = null ) {
tasks . create ( task ) {
subprojects . each { dependsOn ( "$it.name:$task" ) }
}
}
}
}