build.gradle 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. plugins {
  2. id 'com.android.application'
  3. id 'org.jetbrains.kotlin.android'
  4. }
  5. /**
  6. * Use the number of seconds/10 since Jan 1 2016 as the versionCode.
  7. * This lets us upload a new build at most every 10 seconds for the
  8. * next 680 years.
  9. */
  10. def autoVersion = (int) (((new Date().getTime() / 1000) - 1451606400) / 10)
  11. def buildType
  12. android {
  13. namespace 'org.yuzu.yuzu_emu'
  14. compileSdkVersion 33
  15. ndkVersion "25.2.9519653"
  16. viewBinding.enabled = true
  17. compileOptions {
  18. sourceCompatibility JavaVersion.VERSION_11
  19. targetCompatibility JavaVersion.VERSION_11
  20. }
  21. kotlinOptions {
  22. jvmTarget = '11'
  23. }
  24. lint {
  25. // This is important as it will run lint but not abort on error
  26. // Lint has some overly obnoxious "errors" that should really be warnings
  27. abortOnError false
  28. //Uncomment disable lines for test builds...
  29. //disable 'MissingTranslation'bin
  30. //disable 'ExtraTranslation'
  31. }
  32. defaultConfig {
  33. // TODO If this is ever modified, change application_id in strings.xml
  34. applicationId "org.yuzu.yuzu_emu"
  35. minSdkVersion 28
  36. targetSdkVersion 33
  37. versionCode autoVersion
  38. versionName getVersion()
  39. ndk.abiFilters "arm64-v8a", "x86_64"
  40. }
  41. signingConfigs {
  42. //release {
  43. // storeFile file('')
  44. // storePassword System.getenv('ANDROID_KEYPASS')
  45. // keyAlias = 'key0'
  46. // keyPassword System.getenv('ANDROID_KEYPASS')
  47. //}
  48. }
  49. applicationVariants.all { variant ->
  50. buildType = variant.buildType.name // sets the current build type
  51. }
  52. // Define build types, which are orthogonal to product flavors.
  53. buildTypes {
  54. // Signed by release key, allowing for upload to Play Store.
  55. release {
  56. signingConfig signingConfigs.debug
  57. }
  58. // builds a release build that doesn't need signing
  59. // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
  60. relWithDebInfo {
  61. initWith release
  62. versionNameSuffix '-debug'
  63. signingConfig signingConfigs.debug
  64. minifyEnabled false
  65. testCoverageEnabled false
  66. debuggable true
  67. jniDebuggable true
  68. }
  69. // Signed by debug key disallowing distribution on Play Store.
  70. // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
  71. debug {
  72. // TODO If this is ever modified, change application_id in debug/strings.xml
  73. versionNameSuffix '-debug'
  74. debuggable true
  75. jniDebuggable true
  76. }
  77. }
  78. flavorDimensions "version"
  79. productFlavors {
  80. mainline {
  81. dimension "version"
  82. }
  83. }
  84. externalNativeBuild {
  85. cmake {
  86. version "3.22.1"
  87. path "../../../CMakeLists.txt"
  88. }
  89. }
  90. defaultConfig {
  91. externalNativeBuild {
  92. cmake {
  93. arguments "-DENABLE_QT=0", // Don't use QT
  94. "-DENABLE_SDL2=0", // Don't use SDL
  95. "-DENABLE_WEB_SERVICE=0", // Don't use telemetry
  96. "-DBUNDLE_SPEEX=ON",
  97. "-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
  98. "-DYUZU_USE_BUNDLED_VCPKG=ON",
  99. "-DYUZU_USE_BUNDLED_FFMPEG=ON"
  100. abiFilters "arm64-v8a", "x86_64"
  101. }
  102. }
  103. }
  104. }
  105. dependencies {
  106. implementation 'androidx.core:core-ktx:1.9.0'
  107. implementation 'androidx.appcompat:appcompat:1.6.1'
  108. implementation 'androidx.exifinterface:exifinterface:1.3.6'
  109. implementation 'androidx.cardview:cardview:1.0.0'
  110. implementation 'androidx.recyclerview:recyclerview:1.2.1'
  111. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  112. implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
  113. implementation 'androidx.fragment:fragment:1.5.5'
  114. implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
  115. implementation "androidx.documentfile:documentfile:1.0.1"
  116. implementation 'com.google.android.material:material:1.8.0'
  117. implementation 'androidx.preference:preference:1.2.0'
  118. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
  119. implementation "io.coil-kt:coil:2.2.2"
  120. implementation 'androidx.core:core-splashscreen:1.0.0'
  121. implementation 'androidx.window:window:1.0.0'
  122. // Allows FRP-style asynchronous operations in Android.
  123. implementation 'io.reactivex:rxandroid:1.2.1'
  124. implementation 'com.nononsenseapps:filepicker:4.2.1'
  125. implementation 'org.ini4j:ini4j:0.5.4'
  126. implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  127. implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
  128. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  129. }
  130. def getVersion() {
  131. def versionName = '0.0'
  132. try {
  133. versionName = 'git describe --always --long'.execute([], project.rootDir).text
  134. .trim()
  135. .replaceAll(/(-0)?-[^-]+$/, "")
  136. } catch (Exception) {
  137. logger.error('Cannot find git, defaulting to dummy version number')
  138. }
  139. if (System.getenv("GITHUB_ACTIONS") != null) {
  140. def gitTag = System.getenv("GIT_TAG_NAME")
  141. versionName = gitTag ?: versionName
  142. }
  143. return versionName
  144. }