build.gradle 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'com.github.dcendents.android-maven'
  3. apply plugin: 'com.jfrog.bintray'
  4. android {
  5. compileSdkVersion 27
  6. defaultConfig {
  7. minSdkVersion 16
  8. targetSdkVersion 26
  9. versionCode 1
  10. versionName "1.0"
  11. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  12. }
  13. buildTypes {
  14. release {
  15. minifyEnabled false
  16. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  17. }
  18. }
  19. compileOptions {
  20. sourceCompatibility JavaVersion.VERSION_1_8
  21. targetCompatibility JavaVersion.VERSION_1_8
  22. }
  23. }
  24. dependencies {
  25. implementation fileTree(dir: 'libs', include: ['*.jar'])
  26. testImplementation 'junit:junit:4.12'
  27. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  28. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  29. implementation 'com.android.support:appcompat-v7:27.1.1'
  30. }
  31. version = "2.6.0"
  32. def siteUrl = 'https://github.com/zhpanvip/BannerViewPager' // 项目的主页
  33. def gitUrl = 'https://github.com/zhpanvip/BannerViewPager.git' // Git仓库的url
  34. group = "com.zhpan.library" // Maven Group ID for the artifact,一般填你唯一的包名
  35. install {
  36. repositories.mavenInstaller {
  37. // This generates POM.xml with proper parameters
  38. pom {
  39. project {
  40. packaging 'aar'
  41. // Add your description here
  42. description 'Banner ViewPager for Android'
  43. name 'Banner ViewPager for Android' //项目描述
  44. url siteUrl
  45. // Set your license
  46. licenses {
  47. license {
  48. name 'The Apache Software License, Version 2.0'
  49. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  50. }
  51. }
  52. developers {
  53. developer { // 开发者信息
  54. id 'zhpan'
  55. name 'zhangpan'
  56. email 'zhpanvip@outlook.com'
  57. }
  58. }
  59. scm {
  60. connection gitUrl
  61. developerConnection gitUrl
  62. url siteUrl
  63. }
  64. }
  65. }
  66. }
  67. }
  68. task sourcesJar(type: Jar) {
  69. from android.sourceSets.main.java.srcDirs
  70. classifier = 'sources'
  71. }
  72. task javadoc(type: Javadoc) {
  73. failOnError false
  74. }
  75. task javadocJar(type: Jar, dependsOn: javadoc) {
  76. classifier = 'javadoc'
  77. from javadoc.destinationDir
  78. }
  79. artifacts {
  80. archives javadocJar
  81. archives sourcesJar
  82. }
  83. Properties properties = new Properties()
  84. // 加载本地配置
  85. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  86. bintray {
  87. user = properties.getProperty("bintray.user")
  88. key = properties.getProperty("bintray.apikey")
  89. configurations = ['archives']
  90. pkg {
  91. repo = "CircleViewPager" //发布到Bintray的那个仓库里,默认账户有四个库,我们这里上传到maven库
  92. name = "bannerview" //发布到Bintray上的项目名字
  93. websiteUrl = siteUrl
  94. vcsUrl = gitUrl
  95. licenses = ["Apache-2.0"]
  96. publish = true
  97. }
  98. }
  99. //提交命令:gradlew bintrayUpload
  100. // mac ./gradlew bintrayUpload 没有权限使用申请 chmod +x gradlew