Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. uploadArchives {
  2. repositories {
  3. mavenDeployer {
  4. snapshotRepository(url: "https://artifact.example.net/content/repositories/snapshots") {
  5. authentication(userName: artifactUsername, password: artifactPassword)
  6. }
  7. repository(url: "https://artifact.example.net/content/repositories/snapshots") {
  8. authentication(userName: artifactUsername, password: artifactPassword)
  9. }
  10. addFilter('release') {artifact, file ->
  11. artifact.name == 'release'
  12. }
  13. addFilter('internal') {artifact, file ->
  14. artifact.name == 'internal'
  15. }
  16. addFilter('androidtest') {artifact, file ->
  17. artifact.name == 'androidtest'
  18. }
  19.  
  20. pom('release').groupId = groupId
  21. pom('release').artifactId = "${appId}.release-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  22. pom('release').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  23.  
  24. pom('internal').groupId = groupId
  25. pom('internal').artifactId = "${appId}.internal-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  26. pom('internal').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  27.  
  28. pom('androidtest').groupId = groupId
  29. pom('androidtest').artifactId = "${appId}.androidtest-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  30. pom('androidtest').version = "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}"
  31.  
  32. }
  33. }
  34. }
  35.  
  36. def testApk = file("./build/outputs/apk/com.example.app.androidtest-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
  37. def releaseApk = file("./build/outputs/apk/com.example.app.release-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
  38. def internalApk = file("./build/outputs/apk/com.example.app.internal-${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}.apk")
  39.  
  40. /*This defines the files we want to upload each as an archive with a different classifier.
  41. The classifier basically differentiates the two files in the eyes of maven which means we can upload
  42. both files to one snapshot. Otherwise we were stuck needing one snapshot per apk which was a pain.*/
  43. artifacts {
  44. archives file: testApk, name: 'androidtest'
  45. }
  46.  
  47. artifacts {
  48. archives file: releaseApk, name: 'release'
  49. }
  50.  
  51. artifacts {
  52. archives file: internalApk, name: 'internal'
  53. }
  54.  
  55. configurations {
  56. artifactDownload
  57. }
  58.  
  59. dependencies {
  60. artifactDownload (group: 'com.example.mobile.android', name: appId, version: "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}-SNAPSHOT", classifier: releaseClassifier, ext: 'apk')
  61. artifactDownload (group: 'com.example.mobile.android', name: appId, version: "${rootProject.ext.appVersionCode}-${rootProject.ext.appVersionName}-SNAPSHOT", classifier: internalClassifier, ext: 'apk')
  62. artifactDownload (group: 'com.example.mobile.android', name: appId, version: "app-automation-androidTest-unsigned-SNAPSHOT", classifier: testClassifier, ext: 'apk')
  63. }
  64.  
  65. task artifactDownload(type: Copy) {
  66. from configurations.artifactDownload
  67. into "/builds/dev/mobile-android-sync/app/build"
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement