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

Use build pipeline to build android_client apk #445

Merged
merged 20 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
Expand Down
11 changes: 8 additions & 3 deletions android_client/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.microsoft.hydralab.android.client"
minSdkVersion 21
targetSdkVersion 28
versionCode 17
versionName '2.6.0'
versionCode rootProject.ext.clientVersionCode
versionName rootProject.ext.clientVersionNumber
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
Expand All @@ -23,12 +23,17 @@ android {

release {
signingConfig signingConfigs.debug
minifyEnabled true
minifyEnabled false
TedaLIEz marked this conversation as resolved.
Show resolved Hide resolved
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'com.microsoft.hydralab.android.client'

lint {
xmlReport true
abortOnError false
}
}

dependencies {
Expand Down
14 changes: 13 additions & 1 deletion android_client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

ext {
if (project.hasProperty("clientVersionNumber")) {
clientVersionNumber = project.property("clientVersionNumber")
} else {
clientVersionNumber = '2.6.0'
TedaLIEz marked this conversation as resolved.
Show resolved Hide resolved
}
if (project.hasProperty("clientVersionCode")) {
clientVersionCode = Integer.parseInt(project.property("clientVersionCode"))
} else {
clientVersionCode = 17
TedaLIEz marked this conversation as resolved.
Show resolved Hide resolved
}
println "version number: " + clientVersionNumber + ", version code: " + clientVersionCode
}
allprojects {
repositories {
google()
Expand Down
Binary file added android_client/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
51 changes: 48 additions & 3 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ resources:

variables:
# Container registry service connection established during pipeline creation
version: '$(Build.BuildId)'
- name: version
value: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'windows-latest'
fullBuild: $[ne(variables['Build.Reason'], 'PullRequest')]
- name: vmImageName
value: 'windows-latest'
- name: fullBuild
value: $[ne(variables['Build.Reason'], 'PullRequest')]
- name: versionMajor
value: 1
- name: versionMinor
value: $[format('{0:yyMM}', pipeline.startTime)]
- name: hydraVersionCode
value: $(Build.BuildId)
- name: hydraVersion
value: $[counter(format('{0}.{1}.{2}', variables['versionMajor'], variables['versionMinor'], eq(variables['build.reason'], 'PullRequest')), 1)]

stages:
- stage: Build
Expand Down Expand Up @@ -61,6 +72,8 @@ stages:
(Get-Content agent/src/main/resources/version.properties) -Replace '0.0.0', $hydraVersion| Set-Content agent/src/main/resources/version.properties
(Get-Content center/src/main/resources/version.properties) -Replace '0.0.0', $hydraVersion| Set-Content center/src/main/resources/version.properties
}
echo "##vso[task.setvariable variable=hydraVersionCode;]$hydraVersionCode"
echo "##vso[task.setvariable variable=hydraVersion;]$hydraVersion"
workingDirectory: '$(Build.Repository.LocalPath)'
condition: eq(variables.fullBuild, 'true')
- task: Gradle@3
Expand Down Expand Up @@ -92,6 +105,22 @@ stages:
summaryFileLocation: 'build/reports/jacoco/jacocoRootReport/*.xml'
reportDirectory: 'build/reports/jacoco/jacocoRootReport/html'
condition: eq(variables.fullBuild, 'false')
- task: Gradle@2
displayName: Package Android client APK
inputs:
workingDirectory: 'android_client'
gradleWrapperFile: 'android_client/gradlew'
tasks: 'assembleRelease'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
options: '-PclientVersionCode=$(hydraVersionCode) -PclientVersionNumber=$(hydraVersion)'
- task: PowerShell@2
displayName: Copy APK to folder for deployment
inputs:
targetType: 'inline'
script: |
cp android_client/app/build/outputs/apk/release/app-release.apk common/src/main/java/record_release.apk -force
TedaLIEz marked this conversation as resolved.
Show resolved Hide resolved
- task: Gradle@2
displayName: Build center
inputs:
Expand Down Expand Up @@ -155,6 +184,22 @@ stages:
sonarQubeRunAnalysis: false
spotBugsAnalysis: false
condition: eq(variables.fullBuild, 'true')
- task: PowerShell@2
displayName: Copy APK to artifact
inputs:
targetType: 'inline'
script: |
mkdir -p $(Build.ArtifactStagingDirectory)/android_client
cp android_client/app/build/outputs/apk/release/app-release.apk $(Build.ArtifactStagingDirectory)/android_client/app-release-$hydraVersion.apk
condition: eq(variables.fullBuild, 'true')
- task: PowerShell@2
displayName: Copy Mapping file to artifact
inputs:
targetType: 'inline'
script: |
mkdir -p $(Build.ArtifactStagingDirectory)/android_client
cp android_client/app/build/outputs/mapping/release/mapping.txt $(Build.ArtifactStagingDirectory)/android_client/
condition: eq(variables.fullBuild, 'true')
- task: CopyFiles@2
displayName: Copy agent jar
inputs:
Expand Down