1
0

build.gradle 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. apply plugin: 'com.android.library'
  2. apply from: rootProject.projectDir.absolutePath + "/VideoGradle/video.gradle"
  3. android {
  4. compileSdkVersion project.ext.androidCompileSdkVersion
  5. buildToolsVersion project.ext.androidBuildToolsVersion
  6. defaultConfig {
  7. minSdkVersion project.ext.androidMinSdkVersion
  8. targetSdkVersion project.ext.androidTargetSdkVersion
  9. versionCode 2
  10. versionName "1.0.2"
  11. }
  12. buildTypes {
  13. release {
  14. minifyEnabled false
  15. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  16. }
  17. }
  18. }
  19. dependencies {
  20. implementation fileTree(dir: "libs", include: ["*.jar"])
  21. implementation project.ext.AppDependencies['appcompat']
  22. implementation project.ext.AppDependencies['media']
  23. implementation project(path: ':VideoTool')
  24. }
  25. /** 以下开始是将Android Library上传到jcenter的相关配置**/
  26. apply plugin: 'com.github.dcendents.android-maven'
  27. apply plugin: 'com.jfrog.bintray'
  28. //项目主页
  29. def siteUrl = 'https://github.com/yangchong211/YCVideoPlayer' // project homepage
  30. //项目的版本控制地址
  31. def gitUrl = 'https://github.com/yangchong211/YCVideoPlayer.git' // project git
  32. //发布到组织名称名字,必须填写
  33. group = "cn.yc"
  34. //发布到JCenter上的项目名字,必须填写
  35. def libName = "MusicPlayer"
  36. // 版本号,下次更新是只需要更改版本号即可
  37. version = "1.0.2"
  38. //生成源文件
  39. task sourcesJar(type: Jar) {
  40. from android.sourceSets.main.java.srcDirs
  41. classifier = 'sources'
  42. }
  43. //生成文档
  44. task javadoc(type: Javadoc) {
  45. source = android.sourceSets.main.java.srcDirs
  46. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  47. options.encoding "UTF-8"
  48. options.charSet 'UTF-8'
  49. options.author true
  50. options.version true
  51. options.links "https://github.com/linglongxin24/FastDev/tree/master/mylibrary/docs/javadoc"
  52. failOnError false
  53. }
  54. //文档打包成jar
  55. task javadocJar(type: Jar, dependsOn: javadoc) {
  56. classifier = 'javadoc'
  57. from javadoc.destinationDir
  58. }
  59. //拷贝javadoc文件
  60. task copyDoc(type: Copy) {
  61. from "${buildDir}/docs/"
  62. into "docs"
  63. }
  64. //上传到jcenter所需要的源码文件
  65. artifacts {
  66. archives javadocJar
  67. archives sourcesJar
  68. }
  69. // 配置maven库,生成POM.xml文件
  70. install {
  71. repositories.mavenInstaller {
  72. // This generates POM.xml with proper parameters
  73. pom {
  74. project {
  75. packaging 'aar'
  76. //项目描述,自由填写
  77. name 'This is music player lib'
  78. url siteUrl
  79. licenses {
  80. license {
  81. //开源协议
  82. name 'The Apache Software License, Version 2.0'
  83. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  84. }
  85. }
  86. developers {
  87. developer {
  88. //开发者的个人信息,根据个人信息填写
  89. id 'yangchong'
  90. name 'yc'
  91. email 'yangchong211@163.com'
  92. }
  93. }
  94. scm {
  95. connection gitUrl
  96. developerConnection gitUrl
  97. url siteUrl
  98. }
  99. }
  100. }
  101. }
  102. }
  103. //上传到jcenter
  104. Properties properties = new Properties()
  105. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  106. bintray {
  107. user = properties.getProperty("bintray.user") //读取 local.properties 文件里面的 bintray.user
  108. key = properties.getProperty("bintray.apikey") //读取 local.properties 文件里面的 bintray.apikey
  109. configurations = ['archives']
  110. pkg {
  111. repo = "maven"
  112. name = libName //发布到JCenter上的项目名字,必须填写
  113. desc = 'android music player' //项目描述
  114. websiteUrl = siteUrl
  115. vcsUrl = gitUrl
  116. licenses = ["Apache-2.0"]
  117. publish = true
  118. }
  119. }
  120. javadoc {
  121. options {
  122. //如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
  123. encoding "UTF-8"
  124. charSet 'UTF-8'
  125. author true
  126. version true
  127. links "http://docs.oracle.com/javase/7/docs/api"
  128. }
  129. }