build.gradle 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * ********************************************************************************************************************
  3. *
  4. * iFHS7.
  5. * ;BBMBMBMc rZMBMBR BMB
  6. * MBEr:;PBM, 7MBMMEOBB: BBB RBW
  7. * XK: BO SB. :SZ MBM. c;; ir BBM :FFr :SSF: ;xBMB:r iuGXv. i:. iF2;
  8. * DBBM0r. :D S7 ;XMBMB GMBMu. MBM: BMB MBMBBBMBMS WMBMBMBBK MBMBMBM BMBRBMBW .MBMBMBMBB
  9. * :JMRMMD .. , 1MMRM1; ;MBMBBR: MBM ;MB: BMB: MBM. RMBr sBMH BM0 UMB, BMB. KMBv
  10. * ;. XOW B1; :uM: 1RE, i .2BMBs rMB. MBO MBO JMB; MBB MBM BBS 7MBMBOBM: MBW :BMc
  11. * OBRJ.SEE MRDOWOR, 3DE:7OBM . ;BMB RMR7BM BMB MBB. BMB ,BMR .BBZ MMB rMB, BMM rMB7
  12. * :FBRO0D0 RKXSXPR. JOKOOMPi BMBSSWBMB; BMBB: MBMB0ZMBMS .BMBOXRBMB MBMDE RBM2;SMBM; MBB xBM2
  13. * iZGE O0SHSPO. uGZ7. sBMBMBDL :BMO OZu:BMBK, rRBMB0; ,EBMB xBMBr:ER. RDU :OO;
  14. * ,BZ, 1D0 RPSFHXR. xWZ .SMr . .BBB
  15. * :0BMRDG RESSSKR. 2WOMBW; BMBMR
  16. * i0BM: SWKHKGO MBDv
  17. * .UB OOGDM. MK, Copyright (c) 2015-2019. 斯伯坦机器人
  18. * , XMW ..
  19. * r All rights reserved.
  20. *
  21. * ********************************************************************************************************************
  22. */
  23. group rootProject.group
  24. version rootProject.version
  25. apply plugin: 'com.android.library'
  26. apply plugin: 'kotlin-android'
  27. apply plugin: 'kotlin-android-extensions'
  28. apply plugin: 'org.jetbrains.dokka-android'
  29. apply plugin: 'maven'
  30. sourceCompatibility = JVM_TARGET
  31. //compileKotlin {
  32. // kotlinOptions.jvmTarget = JVM_TARGET
  33. //}
  34. //compileTestKotlin {
  35. // kotlinOptions.jvmTarget = JVM_TARGET
  36. //}
  37. android {
  38. compileSdkVersion ANDROID_SDK_VERSION.toInteger()
  39. buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
  40. defaultConfig {
  41. minSdkVersion ANDROID_MIN_SDK_VERSION.toInteger()
  42. targetSdkVersion ANDROID_SDK_VERSION.toInteger()
  43. versionCode SAGA_CODE.toInteger()
  44. versionName SAGA_ANDROID_VERSION
  45. testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
  46. }
  47. buildTypes {
  48. release {
  49. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  50. }
  51. }
  52. kotlinOptions {
  53. jvmTarget = JVM_TARGET
  54. }
  55. }
  56. dependencies {
  57. implementation fileTree(dir: 'libs', include: ['*.jar'])
  58. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  59. // kotlin 依赖
  60. implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: KOTLIN_VERSION
  61. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  62. // android支持
  63. implementation group: 'com.android.support', name: 'appcompat-v7', version: ANDROID_SUPPORT_VERSION
  64. implementation group: 'com.android.support', name: 'design', version: ANDROID_SUPPORT_VERSION
  65. //implementation group: 'com.android.support', name: 'support-v4', version: ANDROID_SUPPORT_VERSION
  66. implementation group: 'com.android.support.constraint', name: 'constraint-layout', version: CONSTRAINT_VERSION
  67. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  68. // anko依赖
  69. // https://mvnrepository.com/artifact/org.jetbrains.anko/anko-common
  70. implementation group: 'org.jetbrains.anko', name: 'anko-commons', version: ANKO_VERSION
  71. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  72. // 测试依赖
  73. testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: JUNIT_VERSION
  74. androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
  75. exclude group: 'com.android.support', module: 'support-annotations'
  76. })
  77. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  78. // 运行时权限申请
  79. // https://mvnrepository.com/artifact/pub.devrel/easypermissions
  80. implementation group: 'pub.devrel', name: 'easypermissions', version: EASYPERMISSIONS_VERSION
  81. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  82. // http请求
  83. // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
  84. implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: OKHTTP_VERSION
  85. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  86. // JSON解析
  87. // https://mvnrepository.com/artifact/com.alibaba/fastjson
  88. implementation group: 'com.alibaba', name: 'fastjson', version: FASTJSON_VERSION
  89. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  90. // 二维码与条形码
  91. // https://mvnrepository.com/artifact/com.google.zxing/core
  92. implementation group: 'com.google.zxing', name: 'core', version: ZXING_VERSION
  93. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  94. // SAGA依赖
  95. implementation group: 'cn.sagacloud', name: 'saga-kotlin-base', version: SAGA_KOTLIN_VERSION
  96. }
  97. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  98. // 文档生成
  99. // 源码
  100. task sourcesJar(type: Jar) {
  101. group = 'jar'
  102. from "${android.sourceSets.main.java.srcDirs}"
  103. classifier = 'sources'
  104. }
  105. // 文档
  106. task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
  107. jdkVersion = JDK_VERSION.toInteger()
  108. noStdlibLink = true
  109. outputFormat = 'javadoc'
  110. outputDirectory = "$buildDir/javadoc"
  111. // sourceDirs = files('src/main/java')
  112. }
  113. // 上成上传的文档jar包
  114. task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
  115. group = 'jar'
  116. classifier = 'javadoc'
  117. from "${dokka.outputDirectory}"
  118. }
  119. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  120. // maven 仓库管理
  121. // 设置上传的包,默认上传aar与pom
  122. artifacts {
  123. // 上传源码包
  124. // archives sourcesJar
  125. // 上传文档包
  126. // archives javadocJar
  127. }
  128. uploadArchives {
  129. repositories {
  130. mavenDeployer {
  131. pom.groupId = project.group
  132. pom.version = project.version
  133. pom.artifactId = project.name
  134. pom.project {
  135. name project.name
  136. packaging 'jar'
  137. url SAGA_URL
  138. description '斯伯坦机器人世界 android核心支持库。'
  139. licenses {
  140. license {
  141. name 'The Apache Software License, Version 2.0'
  142. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  143. }
  144. }
  145. developers {
  146. developer {
  147. id DEVELOPER_ID
  148. name DEVELOPER_NAME
  149. }
  150. }
  151. }
  152. snapshotRepository(url: MAVEN_REPO_SNAPSHOT_URL) {
  153. authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD)
  154. }
  155. repository(url: MAVEN_REPO_RELEASE_URL) {
  156. authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD)
  157. }
  158. }
  159. }
  160. }