build.gradle 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'maven-publish'
  4. // 声明aar包的版本号
  5. def aarVersion = "0.0.1.101"
  6. android {
  7. compileSdkVersion versions.compileSdk
  8. buildToolsVersion versions.buildTools
  9. defaultConfig {
  10. minSdkVersion versions.minSdk
  11. targetSdkVersion versions.targetSdk
  12. flavorDimensions "versioncode"
  13. buildConfigField("String", "APP_ID", "\"" + apps.applicationId + "\"")
  14. }
  15. buildTypes {
  16. release {
  17. minifyEnabled false
  18. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  19. }
  20. }
  21. productFlavors productF
  22. namespace 'com.xuqm.base'
  23. }
  24. dependencies {
  25. implementation fileTree(dir: 'libs', include: ['*.jar'])
  26. api androidxDependencies
  27. implementation 'androidx.appcompat:appcompat:1.3.0'
  28. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  29. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  30. implementation 'org.jetbrains.anko:anko-commons:0.10.5'
  31. annotationProcessor compilerDependencies
  32. commonDependencies.each { k, v ->
  33. api(v) {
  34. //去除第三方的重复support库
  35. exclude group: 'com.android.support'
  36. }
  37. }
  38. //扫码二维码
  39. api 'com.huawei.hms:scanplus:1.1.1.301'
  40. }
  41. // 这个是把源码打入aar包中的任务
  42. task sourceJar(type: Jar) {
  43. archiveClassifier.set('sources')
  44. from android.sourceSets.main.java.srcDirs
  45. }
  46. afterEvaluate {
  47. publishing {
  48. publications {
  49. // 这里的debug名字是自己起的
  50. release(MavenPublication) {
  51. groupId = 'cn.org.bjca.trust.android'
  52. artifactId = 'base'
  53. version = aarVersion
  54. // 这里除了有debug 还有release
  55. from components.release
  56. // 运行任务,把源码打进去
  57. artifact sourceJar
  58. }
  59. }
  60. // 添加仓库地址
  61. repositories {
  62. // 本地仓库
  63. // mavenLocal()
  64. // 当上传到远端仓库
  65. // maven {
  66. // allowInsecureProtocol true
  67. // url("http://nexus.51trust.net/repository/android-hosted/")
  68. // credentials {
  69. // username = "deployment"
  70. // password = "deployment123"
  71. // }
  72. // }
  73. maven {
  74. allowInsecureProtocol true
  75. url("http://xuqinmin.com.cn:8081/repository/android-releases/")
  76. credentials {
  77. username = "admin"
  78. password = "xuqinmin1022"
  79. }
  80. }
  81. }
  82. }
  83. }