build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import groovy.swing.SwingBuilder
  2. buildscript {
  3. repositories {
  4. mavenCentral()
  5. }
  6. dependencies {
  7. classpath 'com.android.tools.build:gradle:1.2.3'
  8. }
  9. }
  10. repositories {
  11. mavenLocal()
  12. mavenCentral()
  13. jcenter()
  14. }
  15. apply plugin: 'android'
  16. dependencies {
  17. compile 'com.android.support:support-v4:21.0.+'
  18. compile 'com.android.support:appcompat-v7:21.0.+'
  19. compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
  20. compile 'com.intellij:annotations:12.0'
  21. compile 'commons-io:commons-io:2.4'
  22. compile 'com.squareup:otto:1.3.4'
  23. compile 'com.google.zxing:android-integration:2.3.0'
  24. compile 'com.getbase:floatingactionbutton:1.10.0'
  25. compile 'com.nononsenseapps:filepicker:2.2.3'
  26. }
  27. android {
  28. compileSdkVersion 22
  29. buildToolsVersion "22.0.1"
  30. defaultConfig {
  31. minSdkVersion 16
  32. targetSdkVersion 22
  33. versionCode 1440
  34. versionName "1.4.4"
  35. }
  36. productFlavors {
  37. google
  38. }
  39. signingConfigs {
  40. release {
  41. storeFile file("keystore")
  42. keyAlias "zotable"
  43. storePassword ""
  44. keyPassword ""
  45. }
  46. }
  47. buildTypes {
  48. release {
  49. zipAlignEnabled true
  50. signingConfig signingConfigs.release
  51. minifyEnabled false
  52. proguardFile getDefaultProguardFile('proguard-android.txt')
  53. }
  54. }
  55. lintOptions {
  56. abortOnError false
  57. }
  58. packagingOptions {
  59. exclude 'META-INF/LICENSE.txt'
  60. }
  61. }
  62. gradle.taskGraph.whenReady { taskGraph ->
  63. println taskGraph.allTasks
  64. if(taskGraph.hasTask(':zotable:assembleGoogleRelease')) {
  65. def storePass = ''
  66. def keyPass = ''
  67. if(System.console() == null) {
  68. new SwingBuilder().edt {
  69. dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
  70. title: 'Enter password', // Dialog title
  71. alwaysOnTop: true, // pretty much what the name says
  72. resizable: false, // Don't allow the user to resize the dialog
  73. locationRelativeTo: null, // Place dialog in center of the screen
  74. pack: true, // We need to pack the dialog (so it will take the size of it's children)
  75. show: true // Let's show it
  76. ) {
  77. vbox { // Put everything below each other
  78. label(text: "Please enter store passphrase:")
  79. storeInput = passwordField()
  80. label(text: "Please enter key passphrase:")
  81. keyInput = passwordField()
  82. button(defaultButton: true, text: 'OK', actionPerformed: {
  83. storePass = storeInput.password; // Set pass variable to value of input field
  84. keyPass = storeInput.password; // Set pass variable to value of input field
  85. dispose(); // Close dialog
  86. })
  87. } // vbox end
  88. } // dialog end
  89. } // edt end
  90. } else {
  91. storePass = System.console().readPassword("\nPlease enter store passphrase: ")
  92. storePass = new String(storePass)
  93. keyPass = System.console().readPassword("\nPlease enter key passphrase: ")
  94. keyPass = new String(keyPass)
  95. }
  96. if(storePass.size() <= 0) {
  97. throw new InvalidUserDataException("You must enter a store password to proceed.")
  98. }
  99. if(keyPass.size() <= 0) {
  100. throw new InvalidUserDataException("You must enter a key password to proceed.")
  101. }
  102. // -----
  103. // Do what you need to do with pass here!
  104. // -----
  105. android.signingConfigs.release.storePassword = storePass
  106. android.signingConfigs.release.keyPassword = keyPass
  107. } // end if has task
  108. } // end whenRead
  109. task wrapper(type: Wrapper) {
  110. gradleVersion = '1.12'
  111. }