publish.gradle 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. apply plugin: 'maven'
  2. apply plugin: 'signing'
  3. def PUBLISH_GROUP_ID = "io.github.suyghur.dolin"
  4. def PUBLISH_ARTIFACT_ID = "zap"
  5. def PUBLISH_VERSION = "0.0.1"
  6. Properties properties = new Properties()
  7. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  8. def ossrhUsername = properties.getProperty("SonaType.user")
  9. def ossrhPassword = properties.getProperty("SonaType.pwd")
  10. task androidSourcesJar(type: Jar) {
  11. archiveClassifier.set('source')
  12. if (project.plugins.findPlugin('com.android.library')) {
  13. from android.sourceSets.main.java.srcDirs
  14. } else {
  15. form sourceSets.main.java.srcDirs
  16. }
  17. }
  18. artifacts {
  19. archives androidSourcesJar
  20. }
  21. signing {
  22. required {
  23. gradle.taskGraph.hasTask("uploadArchives")
  24. }
  25. sign configurations.archives
  26. }
  27. uploadArchives {
  28. repositories {
  29. mavenDeployer {
  30. beforeDeployment {
  31. MavenDeployment deployment -> signing.signPom(deployment)
  32. }
  33. repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
  34. authentication(userName: ossrhUsername, password: ossrhPassword)
  35. }
  36. snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
  37. authentication(userName: ossrhUsername, password: ossrhPassword)
  38. }
  39. pom.groupId = PUBLISH_GROUP_ID
  40. pom.artifactId = PUBLISH_ARTIFACT_ID
  41. pom.version = PUBLISH_VERSION
  42. pom.project {
  43. name "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
  44. packaging 'aar'
  45. description 'a log framework of Android'
  46. url 'https://github.com/Suyghur'
  47. scm {
  48. connection 'scm:git:github.com/Suyghur/Dolin.git'
  49. developerConnection 'scm:git:ssh://github.com/Suyghur/Dolin.git'
  50. url 'https://github.com/Suyghur/Dolin'
  51. }
  52. licenses {
  53. license {
  54. name 'The Apache License, Version 2.0'
  55. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  56. }
  57. }
  58. developers {
  59. developer {
  60. id 'Suyghur'
  61. name 'Suyghur'
  62. email 'suyghurmjp@outlook.com'
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }