build.gradle 4.2 KB

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