build.gradle 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'com.jfrog.bintray'
  3. apply plugin: 'com.github.dcendents.android-maven'
  4. def siteUrl = 'https://github.com/DmcSDK/MediaPickerPoject' // 项目的主页
  5. def gitUrl = 'https://github.com/DmcSDK/MediaPickerPoject.git' // Git仓库的url
  6. Properties properties = new Properties()
  7. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  8. version = "3.3" //发布版本号
  9. group = "com.dmcBig" //最终引用形式,如compile 'com.**;
  10. android {
  11. compileSdkVersion 25
  12. buildToolsVersion '28.0.2'
  13. defaultConfig {
  14. minSdkVersion 15
  15. targetSdkVersion 25
  16. versionCode 1
  17. versionName "3.3"
  18. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  19. }
  20. buildTypes {
  21. release {
  22. minifyEnabled false
  23. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  24. }
  25. }
  26. }
  27. dependencies {
  28. compile fileTree(include: ['*.jar'], dir: 'libs')
  29. compile 'com.android.support:appcompat-v7:25.3.1'
  30. testCompile 'junit:junit:4.12'
  31. compile 'com.android.support:recyclerview-v7:25.3.1'
  32. compile 'com.android.support:support-v4:25.3.1'
  33. // annotationProcessor 'com.github.bumptech.glide:compiler:5.0.0'
  34. // compile 'com.github.bumptech.glide:glide:4.0.0'
  35. compile 'pub.devrel:easypermissions:1.0.0'
  36. compile 'com.github.chrisbanes.photoview:library:1.2.4'
  37. }
  38. bintray {
  39. user = properties.getProperty("bintray.user")
  40. key = properties.getProperty("bintray.apikey")
  41. pkg {
  42. repo = 'dmcBig'//自己创建的仓库名字
  43. name = 'MediaPicker'//上传到JCenter的名字,最终引用的名字
  44. websiteUrl = siteUrl
  45. vcsUrl = gitUrl
  46. licenses = ['Apache-2.1']//不能随便写,只能是仓库创建时选择的license type
  47. userOrg = 'yuanwu' //自己创建的organization名称
  48. publish = true // 是否是公开项目,公开别人可以引用
  49. version {
  50. name = '3.3'
  51. desc = 'MediaPicker open library.'//描述,自己定义
  52. released = new Date()
  53. vcsTag = 'v1.1'
  54. attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
  55. }
  56. }
  57. configurations = ['archives']
  58. }
  59. install {
  60. repositories.mavenInstaller {
  61. // This generates POM.xml with proper parameters
  62. pom {
  63. project {
  64. packaging 'aar'
  65. // Add your description here
  66. name 'mediaPicker Android'
  67. description 'MediaPicker open library.'
  68. url siteUrl
  69. // Set your license
  70. licenses {
  71. license {
  72. name 'The Apache Software License, Version 2.1'
  73. url 'http://www.apache.org/licenses/LICENSE-2.1.txt'
  74. }
  75. }
  76. developers {
  77. developer {
  78. id 'dmcBig' //填写bintray或者github的用户名
  79. name 'dmcBig' //姓名
  80. email 'yu911512152@gmail.com'//邮箱
  81. }
  82. }
  83. scm {
  84. connection gitUrl
  85. developerConnection gitUrl
  86. url siteUrl
  87. }
  88. }
  89. }
  90. }
  91. }
  92. task sourcesJar(type: Jar) {
  93. from android.sourceSets.main.java.srcDirs
  94. classifier = 'sources'
  95. }
  96. task javadoc(type: Javadoc) {
  97. failOnError false //必须添加以免出错
  98. source = android.sourceSets.main.java.srcDirs
  99. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  100. }
  101. task javadocJar(type: Jar, dependsOn: javadoc) {
  102. classifier = 'javadoc'
  103. from javadoc.destinationDir
  104. }
  105. artifacts {
  106. archives javadocJar
  107. archives sourcesJar
  108. }
  109. javadoc {
  110. options{
  111. //如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
  112. encoding "UTF-8"
  113. charSet 'UTF-8'
  114. author true
  115. version true
  116. links "http://docs.oracle.com/javase/7/docs/api"
  117. }
  118. }