diff --git a/source/android/adaptivecards/build.gradle b/source/android/adaptivecards/build.gradle index 45a542692a..9d75d6ab19 100644 --- a/source/android/adaptivecards/build.gradle +++ b/source/android/adaptivecards/build.gradle @@ -42,102 +42,65 @@ task sourceJar(type: Jar) { classifier "sources" } -task createPom { - doLast { - pom { - project { - groupId 'io.adaptivecards' - artifactId 'adaptivecards-android' - version System.getenv('XES_PACKAGEVERSIONNUMBER') ?: '0.0.0' - name 'Android Adaptive Cards Library' - description 'Android Adaptive Cards Lib' - url 'https://github.com/Microsoft/AdaptiveCards' - packaging 'aar' - scm { - url 'https://github.com/Microsoft/AdaptiveCards' - } - - licenses { - license { - name 'MIT' - url 'https://github.com/Microsoft/AdaptiveCards/blob/master/LICENSE' - distribution 'repo' - } - } +def projectInfo = { + name = 'Android Adaptive Cards Library' + description 'Android Adaptive Cards Lib' + url = 'https://github.com/Microsoft/AdaptiveCards' - developers { - developer { - id 'microsoft' - name 'adaptivecards' - } - } - } - }.writeTo("pom.xml") + scm { + url = 'https://github.com/Microsoft/AdaptiveCards' } -} -publishing { - publications { - adaptivecards(MavenPublication) { - groupId 'io.adaptivecards' - version System.getenv('XES_SEMANTICVERSION') + '-20' + System.getenv('TFS_VersionNumber') - artifact(sourceJar) - artifact("$buildDir/outputs/aar/adaptivecards-release.aar") + licenses { + license { + name = 'MIT' + url = 'https://github.com/Microsoft/AdaptiveCards/blob/main/LICENSE' + distribution = 'repo' } } - repositories { - maven { - url 'https://microsoft.pkgs.visualstudio.com/_packaging/AdaptiveCards-Android/maven/v1' - credentials { - username "VSTS" - password System.getenv("VSTS_ENV_ACCESS_TOKEN") ?: System.getenv("AdaptiveCardsAuthoTokens") - } - } + + organization { + name = 'Microsoft' + url = 'https://microsoft.com/' } } -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - pom.artifactId ="adaptivecards-android" +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + from components.release - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") { - authentication(userName: NexusUserName, password: NexusPassword) - } - pom { - setGroupId "io.adaptivecards" - setVersion System.getenv("XES_PACKAGEVERSIONNUMBER") ?:"0.0.0" - } + groupId = 'io.adaptivecards' + artifactId = 'adaptivecards-android' - pom.project { - name 'Android Adaptive Cards Library' - description 'Android Adaptive Cards Lib' - url 'https://github.com/Microsoft/AdaptiveCards' + // Get version from PackageES, or fallback to Azure Pipeline build number + version = System.getenv('XES_PACKAGEVERSIONNUMBER') ?: System.getenv('BUILD_BUILDNUMBER') ?: '0.0.0' - scm { - url 'https://github.com/Microsoft/AdaptiveCards' - } + pom projectInfo + } - licenses { - license { - name 'MIT' - url 'https://github.com/Microsoft/AdaptiveCards/blob/master/LICENSE' - distribution 'repo' - } - } + } - developers { - developer { - id 'microsoft' - name 'adaptivecards' - } - } + repositories { + // Publish to Azure Artifacts feed + maven { + name = 'azuredevops' + url = 'https://microsoft.pkgs.visualstudio.com/_packaging/AdaptiveCards/maven/v1' + credentials { + username "AZURE_ARTIFACTS" + password System.getenv("AZURE_ARTIFACTS_ENV_ACCESS_TOKEN") ?: "${azureArtifactsGradleAccessToken}" } - } + // Save to local directory "artifact" + maven { + name = 'localArtifact' + url = "artifact" + } + // TODO: Add SonaType OSS repository to publish directly } } +} dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') diff --git a/source/android/adaptivecards/gradle.properties b/source/android/adaptivecards/gradle.properties index edc59598f7..220011279b 100644 --- a/source/android/adaptivecards/gradle.properties +++ b/source/android/adaptivecards/gradle.properties @@ -1,2 +1,3 @@ NexusUserName= NexusPassword= +azureArtifactsGradleAccessToken= diff --git a/source/android/build.gradle b/source/android/build.gradle index 56532aa698..4438d8a7c8 100644 --- a/source/android/build.gradle +++ b/source/android/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/source/android/gradle/wrapper/gradle-wrapper.properties b/source/android/gradle/wrapper/gradle-wrapper.properties index 5f3be9f5ea..627fb6d0c2 100644 --- a/source/android/gradle/wrapper/gradle-wrapper.properties +++ b/source/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip