Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uploadArchives {
- repositories {
- mavenDeployer {
- snapshotRepository(url: "https://artifact.example.net/content/repositories/snapshots") {
- authentication(userName: artifactUsername, password: artifactPassword)
- }
- repository(url: "https://artifact.example.net/content/repositories/snapshots") {
- authentication(userName: artifactUsername, password: artifactPassword)
- }
- addFilter('release') {artifact, file ->
- artifact.name == 'release'
- }
- addFilter('internal') {artifact, file ->
- artifact.name == 'internal'
- }
- addFilter('androidtest') {artifact, file ->
- artifact.name == 'androidtest'
- }
- pom('release').groupId = groupId
- pom('release').artifactId = "${appId}.release-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- pom('release').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- pom('internal').groupId = groupId
- pom('internal').artifactId = "${appId}.internal-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- pom('internal').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- pom('androidtest').groupId = groupId
- pom('androidtest').artifactId = "${appId}.androidtest-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- pom('androidtest').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
- }
- }
- }
- def testApk = file("./build/outputs/apk/com.example.app.androidtest-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
- def releaseApk = file("./build/outputs/apk/com.example.app.release-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
- def internalApk = file("./build/outputs/apk/com.example.app.internal-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
- /*This defines the files we want to upload each as an archive with a different classifier.
- The classifier basically differentiates the two files in the eyes of maven which means we can upload
- both files to one snapshot. Otherwise we were stuck needing one snapshot per apk which was a pain.*/
- artifacts {
- archives file: testApk, name: 'androidtest'
- }
- artifacts {
- archives file: releaseApk, name: 'release'
- }
- artifacts {
- archives file: internalApk, name: 'internal'
- }
- configurations {
- artifactDownload
- }
- dependencies {
- artifactDownload (group: 'com.example.mobile.android', name: appId, version: "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}-SNAPSHOT", classifier: releaseClassifier, ext: 'apk')
- artifactDownload (group: 'com.example.mobile.android', name: appId, version: "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}-SNAPSHOT", classifier: internalClassifier, ext: 'apk')
- artifactDownload (group: 'com.example.mobile.android', name: appId, version: "app-automation-androidTest-unsigned-SNAPSHOT", classifier: testClassifier, ext: 'apk')
- }
- task artifactDownload(type: Copy) {
- from configurations.artifactDownload
- into "/builds/dev/mobile-android-sync/app/build"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement