From 9b23d6dab76769dc9854d1a76e0ec8b0ff4b6ede Mon Sep 17 00:00:00 2001 From: Risheek Rajolu Date: Wed, 5 Aug 2020 01:43:45 -0400 Subject: [PATCH 1/4] Use gradle for dependencies --- source/android/adaptivecards/build.gradle | 120 ++++++++-------------- source/android/build.gradle | 2 +- 2 files changed, 42 insertions(+), 80 deletions(-) diff --git a/source/android/adaptivecards/build.gradle b/source/android/adaptivecards/build.gradle index 327eb0d536..9d75d6ab19 100644 --- a/source/android/adaptivecards/build.gradle +++ b/source/android/adaptivecards/build.gradle @@ -42,103 +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/main/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('ACSDKVERSION') + '-' + System.getenv('BUILD_BUILDNUMBER') - 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/maven/v1' - credentials { - username "AZURE_ARTIFACTS" - password System.getenv("AZURE_ARTIFACTS_ENV_ACCESS_TOKEN") ?: "${azureArtifactsGradleAccessToken}" - } - } + 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/main/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/build.gradle b/source/android/build.gradle index 4dc1795ee4..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:4.0.0' + 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 From d6724067afedf0d2d61f6c2b24055db4817b5ff5 Mon Sep 17 00:00:00 2001 From: Risheek Rajolu Date: Wed, 5 Aug 2020 12:52:41 -0400 Subject: [PATCH 2/4] Android Daily pipeline --- .pipelines/android-daily.yml | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .pipelines/android-daily.yml diff --git a/.pipelines/android-daily.yml b/.pipelines/android-daily.yml new file mode 100644 index 0000000000..161bc0f5ab --- /dev/null +++ b/.pipelines/android-daily.yml @@ -0,0 +1,53 @@ +name: $(date:yyyy.MM.dd)-$(rev:r) +schedules: +- cron: "0 10 * * Mon-Fri" + displayName: 3:00 AM Pacific (UTC-8) Daily Build (M-F) + branches: + include: + - main + +pool: + name: Hosted Ubuntu 1604 + demands: java + +#Your build pipeline references an undefined variable named ‘gradleprop.secureFilePath’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972 + +steps: +- task: DownloadSecureFile@1 + name: gradleproperties + displayName: 'Download secure file' + inputs: + secureFile: gradle.properties.4 + +- bash: | + # Write your commands here + + # Use the environment variables input below to pass secret variables to this script + cp -f $(gradleproperties.secureFilePath) ./source/android/adaptivecards/gradle.properties + + + displayName: 'Bash Script' + +- bash: | + #!/usr/bin/env bash + + # Starting from AGP 4.1+, the required NDK version will be retrieved automatically, so this script will not be needed. Please remove. + + unset ANDROID_NDK_HOME + sudo ${ANDROID_HOME}/tools/bin/sdkmanager --verbose --install "ndk;21.0.6113669" + displayName: 'Get NDK (won''t be needed w/ Android Gradle Plugin 4.1+)' + +- task: Gradle@2 + displayName: 'gradlew adaptivecards:build' + inputs: + gradleWrapperFile: source/android/gradlew + workingDirectory: source/android + tasks: 'adaptivecards:build' + +- task: Gradle@2 + displayName: 'gradlew publish' + inputs: + gradleWrapperFile: source/android/gradlew + workingDirectory: source/android + tasks: 'adaptivecards:publish' + publishJUnitResults: false From e112ef18fabc4edd9251ccd1be8fcee66be1094c Mon Sep 17 00:00:00 2001 From: Risheek Rajolu Date: Thu, 6 Aug 2020 00:07:03 -0400 Subject: [PATCH 3/4] Remove trailing zeros from version number --- .pipelines/android-daily.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/android-daily.yml b/.pipelines/android-daily.yml index 161bc0f5ab..e9b3d3a2e0 100644 --- a/.pipelines/android-daily.yml +++ b/.pipelines/android-daily.yml @@ -1,4 +1,4 @@ -name: $(date:yyyy.MM.dd)-$(rev:r) +name: $(Year:yyyy).$(Month).$(DayOfMonth)-$(rev:r) schedules: - cron: "0 10 * * Mon-Fri" displayName: 3:00 AM Pacific (UTC-8) Daily Build (M-F) From 203e2e107138889e5a4775601dcd3ca6f9af1b63 Mon Sep 17 00:00:00 2001 From: Risheek Rajolu Date: Thu, 6 Aug 2020 00:41:53 -0400 Subject: [PATCH 4/4] Disable ci/pr triggers --- .pipelines/android-daily.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pipelines/android-daily.yml b/.pipelines/android-daily.yml index e9b3d3a2e0..c86965e994 100644 --- a/.pipelines/android-daily.yml +++ b/.pipelines/android-daily.yml @@ -1,4 +1,8 @@ name: $(Year:yyyy).$(Month).$(DayOfMonth)-$(rev:r) + +pr: none +trigger: none + schedules: - cron: "0 10 * * Mon-Fri" displayName: 3:00 AM Pacific (UTC-8) Daily Build (M-F)