Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade AGP, Gradle, language dependencies #75

Merged
merged 7 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ ci/
**/.idea/

# Secrets
**/*/values/secrets.xml
**/*/values/secrets.xml

# Local configuration file (sdk path, etc)
local.properties

# Android Studio Navigation editor temp files
.navigation/

# Coverage tools
jacoco.exec

# Application files
*.apk
*.aar
*.aab

# Dex files for ART/Dalvik VM
*.dex
27 changes: 15 additions & 12 deletions code/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "com.diffplug.spotless"
plugins {
id 'com.android.application'
id 'com.diffplug.spotless'
id 'org.jetbrains.kotlin.android'
}

spotless {
kotlin {
Expand All @@ -12,14 +13,16 @@ spotless {
}

android {
compileSdkVersion 31
namespace 'com.adobe.marketing.edge.identity.app'

compileSdk rootProject.ext.compileSdkVersion

defaultConfig {
applicationId "com.adobe.marketing.edge.identity.app"
minSdkVersion 19
targetSdkVersion 31
versionCode 1
versionName "1.0"
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName project.property('moduleVersion') as String ?: "1.0.0 (Default)"
multiDexEnabled = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -35,14 +38,14 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = rootProject.ext.kotlinJvmTarget
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down
3 changes: 1 addition & 2 deletions code/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adobe.marketing.edge.identity.app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down
65 changes: 26 additions & 39 deletions code/build.gradle
Original file line number Diff line number Diff line change
@@ -1,53 +1,40 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = '1.5.0'
}
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.12.5"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

apply plugin: 'maven-publish'
}

task clean(type: Delete) {
delete rootProject.buildDir
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'com.diffplug.gradle.spotless' version '6.11.0' apply false
prudrabhat marked this conversation as resolved.
Show resolved Hide resolved
id 'org.jetbrains.kotlin.android' version "1.6.21" apply false
}

ext {
// android config
minSdkVersion = 19
targetSdkVersion = 29
compileSdkVersion = 29
targetSdkVersion = 33
compileSdkVersion = 33
versionCode = 1

// java config
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

// kotlin config
kotlinVersion = "1.6.21"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this kotlinVersion being used, can you remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is being used in code/app/build.gradle Line#48.

kotlinJvmTarget = "1.8"

// dependencies
junitVersion = "1.1.2"
// test dependencies
junitVersion = "1.1.3"
mockitoCoreVersion = "2.28.2"
buildToolsVersion = "29.0.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
jacocoVersion = "0.8.5"

// spotless
prettierVersion = "2.7.1"
prettierPluginJavaVersion = "1.6.2"
Comment on lines +31 to +32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use these variables in the Spotless configuration in code/edgeidentity/build.gradle line 20?


// jacoco
jacocoVersion = "0.8.8"
}

task clean(type: Delete) {
delete rootProject.buildDir
}
98 changes: 34 additions & 64 deletions code/edgeidentity/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "com.diffplug.spotless"
plugins {
id 'com.android.library'
id 'jacoco'
id 'maven-publish'
id 'signing'
id 'com.diffplug.spotless'
}

jacoco {
toolVersion = rootProject.ext.jacocoVersion
Expand All @@ -15,19 +17,21 @@ spotless {
toggleOffOn("format:off", "format:on")
target "src/*/java/**/*.java"
removeUnusedImports()
prettier(['prettier': '2.3.0', 'prettier-plugin-java': '1.1.0'])
prettier(['prettier': rootProject.ext.prettierVersion, 'prettier-plugin-java': rootProject.ext.prettierPluginJavaVersion])
.config(['parser': 'java', 'tabWidth': 4, 'useTabs': true, 'printWidth': 120])
endWithNewline()
licenseHeaderFile "../../config/formatter/adobe.header.txt"
}
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
namespace 'com.adobe.marketing.mobile.edge.identity'

compileSdk rootProject.ext.compileSdkVersion

defaultConfig {
cacheung marked this conversation as resolved.
Show resolved Hide resolved
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdk rootProject.ext.minSdkVersion
targetSdk rootProject.ext.targetSdkVersion

prudrabhat marked this conversation as resolved.
Show resolved Hide resolved
testInstrumentationRunner rootProject.ext.testInstrumentationRunner
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -43,6 +47,7 @@ android {
buildTypes {
debug {
testCoverageEnabled true
debuggable true
}

release {
Expand Down Expand Up @@ -73,16 +78,16 @@ android {
}
}

prudrabhat marked this conversation as resolved.
Show resolved Hide resolved
android.libraryVariants.all { variant ->
afterEvaluate {
tasks.withType(Javadoc) {
source = [android.sourceSets.main.java.sourceFiles, android.sourceSets.phone.java.sourceFiles]
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})

doFirst{classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)}

exclude "**/BuildConfig.java"
exclude "**/R.java"
options {
source = "8"
links "https://developer.android.com/reference"
}
}
prudrabhat marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -113,39 +118,6 @@ publish.dependsOn('assemblePhone')

publishing {
publications {
aar(MavenPublication) {
groupId = 'com.adobe.marketing.mobile'
artifactId = rootProject.moduleName
version = rootProject.moduleVersion
artifact("$buildDir/outputs/aar/${rootProject.moduleAARName}")
artifact javadocPublish
pom.withXml {
asNode().appendNode('name', mavenRepoName)
asNode().appendNode('description', mavenRepoDescription)
asNode().appendNode('url', 'https://aep-sdks.gitbook.io/docs/')
def scmNode = asNode().appendNode('scm')
scmNode.appendNode('url', 'https://github.com/Adobe-Marketing-Cloud/acp-sdks/')


def developersNode = asNode().appendNode('developers')
def developerNode = developersNode.appendNode('developer')
developerNode.appendNode('id', 'adobe')
developerNode.appendNode('name', 'adobe')

def licensesNode = asNode().appendNode('licenses')
def licenseNode = licensesNode.appendNode('license')
licenseNode.appendNode('name', 'Adobe Proprietary')

def dependenciesNode = asNode().appendNode('dependencies')

//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each

def coreDependencyNode = dependenciesNode.appendNode('dependency')
coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile')
coreDependencyNode.appendNode('artifactId', 'core')
coreDependencyNode.appendNode('version', mavenCoreVersion)
}
}
release(MavenPublication) {
groupId = 'com.adobe.marketing.mobile'
artifactId = rootProject.moduleName
Expand All @@ -156,7 +128,7 @@ publishing {
pom {
name = mavenRepoName
description = mavenRepoDescription
url = 'https://aep-sdks.gitbook.io'
url = 'https://developer.adobe.com/client-sdks'
licenses {
license {
name = 'Adobe Proprietary'
Expand All @@ -170,9 +142,9 @@ publishing {
}
}
scm {
connection = 'scm:git:github.com//Adobe-Marketing-Cloud/acp-sdks.git'
developerConnection = 'scm:git:ssh://github.com//Adobe-Marketing-Cloud/acp-sdks.git'
url = 'https://github.com/Adobe-Marketing-Cloud/acp-sdks'
connection = 'scm:git:github.com//adobe/aepsdk-edgeidentity-android.git'
developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-edgeidentity-android.git'
url = 'https://github.com/adobe/aepsdk-edgeidentity-android'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
Expand Down Expand Up @@ -212,23 +184,23 @@ signing {
}

task platformUnitTestJacocoReport(type: JacocoReport, dependsOn: "testPhoneDebugUnitTest") {
def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class']
def excludeRegex = ['**/BuildConfig.class']
def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes/com/adobe/marketing/mobile", excludes: excludeRegex)

additionalClassDirs.setFrom files([debugTree])
additionalSourceDirs.setFrom files(android.sourceSets.main.java.sourceFiles)
sourceDirectories.setFrom files(android.sourceSets.phone.java.sourceFiles)
executionData "$buildDir/jacoco/testPhoneDebugUnitTest.exec"
executionData "$buildDir/outputs/unit_test_code_coverage/phoneDebugUnitTest/testPhoneDebugUnitTest.exec"

reports {
xml.enabled true
csv.enabled false
html.enabled true
xml.required = true
csv.required = false
html.required = true
}
}

task platformFunctionalTestJacocoReport(type: JacocoReport, dependsOn: "createPhoneDebugCoverageReport") {
def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class']
def excludeRegex = ['**/BuildConfig.class']
def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes/com/adobe/marketing/mobile", excludes: excludeRegex)
cacheung marked this conversation as resolved.
Show resolved Hide resolved

additionalClassDirs.setFrom files([debugTree])
Expand All @@ -239,15 +211,13 @@ task platformFunctionalTestJacocoReport(type: JacocoReport, dependsOn: "createPh
])

reports {
xml.enabled true
csv.enabled false
html.enabled true
xml.required = true
csv.required = false
html.required = true
}
}


dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'

// Adobe Mobile SDK Core
implementation "com.adobe.marketing.mobile:core:${rootProject.mavenCoreVersion}"
Expand Down
4 changes: 1 addition & 3 deletions code/edgeidentity/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.adobe.marketing.mobile.edge.identity">
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/>
1 change: 1 addition & 0 deletions code/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ org.gradle.jvmargs=-Xmx2048m

android.useAndroidX=true
android.enableJetifier=true
android.disableAutomaticComponentCreation=true

moduleProjectName=edgeidentity
moduleName=edgeidentity
Expand Down
4 changes: 2 additions & 2 deletions code/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Mar 18 11:50:52 PDT 2022
#Mon Nov 07 08:48:57 PST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
17 changes: 17 additions & 0 deletions code/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}

include ':app'
include ':edgeidentity'
rootProject.name = "edgeidentity-sdk"