build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. buildscript {
  2. repositories {
  3. maven { url 'https://plugins.gradle.org/m2/'}
  4. }
  5. dependencies {
  6. classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.8'
  7. }
  8. }
  9. plugins {
  10. id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
  11. }
  12. apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
  13. repositories {
  14. maven { url 'https://maven.google.com' }
  15. }
  16. apply plugin: 'com.android.application'
  17. // Only relevant for signing "release" APKs, retrieves signing key/store information from the Mac OS X keychain ;]
  18. // Refer to the README for more info on that shit
  19. def getPassword(String user, String entryName) {
  20. def stdout = new ByteArrayOutputStream()
  21. //def stderr = new ByteArrayOutputStream()
  22. exec {
  23. //commandLine 'security', '-q', 'find-generic-password', '-a', user, '-gl', entryName
  24. commandLine 'security', '-q', 'find-generic-password', '-a', user, '-ws', entryName
  25. standardOutput = stdout
  26. //errorOutput = stderr
  27. ignoreExitValue true
  28. }
  29. //noinspection GroovyAssignabilityCheck
  30. stdout.toString().trim()
  31. //(stderr.toString().trim() =~ /password: ["'](.*)["']/)[0][1]
  32. }
  33. // Get username of person currently running (prolly) Android st00dio
  34. ext.currentUser = System.getenv('USER')
  35. android {
  36. signingConfigs {
  37. muhconfig {
  38. // There are 4 keychain items for the user lol
  39. storeFile file(getPassword(currentUser, 'ANDROID_KEY_STORE'))
  40. storePassword getPassword(currentUser, 'ANDROID_STORE_PASSWORD')
  41. keyAlias getPassword(currentUser, 'ANDROID_KEY_ALIAS')
  42. keyPassword getPassword(currentUser, 'ANDROID_KEY_PASSWORD')
  43. }
  44. }
  45. def versionPropsFile = file('version.properties')
  46. def vcode = 0 // Apparently Gradle builds it twice the initial time, so by setting this to 0 it will become 1 when Gradle's done
  47. Properties versionProps = new Properties()
  48. if(versionPropsFile.canRead()) {
  49. versionProps.load(new FileInputStream(versionPropsFile))
  50. vcode = versionProps['VERSION_CODE'].toInteger() + 1
  51. }
  52. versionProps['VERSION_CODE'] = vcode.toString()
  53. versionProps.store(versionPropsFile.newWriter(), null)
  54. compileSdkVersion 28
  55. defaultConfig {
  56. applicationId 'com.jemoeder.lief.pushem'
  57. minSdkVersion 25
  58. //noinspection ExpiredTargetSdkVersion ZERO FUCKS GIVEN (ain't publishan on Jewgle gay st0re anyways so)
  59. targetSdkVersion 25
  60. testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
  61. signingConfig signingConfigs.muhconfig
  62. versionCode vcode
  63. manifestPlaceholders = [
  64. onesignal_app_id: '', // Is required for proper compilation, but we'll set it to user-specified values laturd ;]
  65. onesignal_google_project_number: 'REMOTE', // Jewgle project number is pulled from el dashboard yo
  66. ]
  67. }
  68. buildTypes {
  69. release {
  70. // Proguard that shit for release APKs
  71. minifyEnabled true
  72. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  73. signingConfig signingConfigs.muhconfig
  74. }
  75. debug {
  76. minifyEnabled false // Explicitly disable lmao
  77. signingConfig signingConfigs.muhconfig
  78. }
  79. // Lazy m00d =]]]]]]]]
  80. applicationVariants.all { variant ->
  81. if(variant.buildType.name == 'release') {
  82. variant.outputs.each { output ->
  83. output.outputFileName = '../../../../../../Pushem.apk'
  84. }
  85. }
  86. }
  87. }
  88. }
  89. dependencies {
  90. implementation fileTree(dir: 'libs', include: ['*.jar'])
  91. implementation 'com.android.support:appcompat-v7:28.0.0'
  92. implementation 'com.android.support:support-v4:28.0.0'
  93. implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  94. implementation 'com.android.support:design:28.0.0'
  95. implementation 'com.onesignal:OneSignal:3.15.1'
  96. testImplementation 'junit:junit:4.12'
  97. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  98. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  99. }