@@ -7,120 +7,76 @@ apply plugin: 'maven'
77version = pluginVersion
88project. archivesBaseName = " android-gradle-plugin2"
99
10- task javadocJar (type : Jar , dependsOn : javadoc) {
11- classifier = ' javadoc'
12- from javadoc. destinationDir
13- }
14-
1510task sourceJar (type : Jar ) {
1611 classifier = ' sources'
1712 from sourceSets. main. allSource
1813}
1914
20- ext {
21- pomFilePath = " ${ project.buildDir.absolutePath} /tmp/pom.xml"
22- pomFile = file(pomFilePath)
23- }
24-
25- configurations {
26- pom
27- }
28-
29- artifacts {
30- archives jar
31- archives sourceJar
32- archives javadocJar
33- if (pomFile. exists()) {
34- pom pomFile
15+ javadoc {
16+ options {
17+ encoding " UTF-8"
18+ charSet ' UTF-8'
3519 }
3620}
3721
38- task signJars (type : Sign , dependsOn : [jar, javadocJar, sourceJar]) {
39- sign configurations. archives
40- }
41-
42- task signPom (type : Sign ) {
43- sign configurations. pom
44- }
45-
46- if (project. ext. pomFile. exists()) {
47- task preparePublication(dependsOn : [signJars, signPom])
48- } else {
49- task preparePublication(dependsOn : signJars)
50- }
51-
52- def getSignatureFiles = {
53- def allFiles = project. tasks. signJars. signatureFiles. collect{it}
54- def signedSources = allFiles. find{ it. name. contains(' -sources' ) }
55- def signedJavadoc = allFiles. find{ it. name. contains(' -javadoc' ) }
56- def signedJar = (allFiles - [signedSources, signJars])[0 ]
57- return [
58- [archive : signedSources, classifier : ' sources' , extension : ' jar.asc' ],
59- [archive : signedJavadoc, classifier : ' javadoc' , extension : ' jar.asc' ],
60- [archive : signedJar, classifier : ' null' , extension : ' jar.asc' ]
61- ]
62- }
63-
64- def getPomSignature = {
65- return project. tasks. signPom. signatureFiles. collect{ it }[0 ]
22+ task javadocJar (type : Jar , dependsOn : javadoc) {
23+ classifier = ' javadoc'
24+ from javadoc. destinationDir
6625}
6726
68- def siteUrl = ' https://github.com/sensorsdata/sa-sdk-android-plugin2'
69- def gitUrl = ' https://github.com/sensorsdata/sa-sdk-android-plugin2.git'
70- def issueUrl = ' https://github.com/sensorsdata/sa-sdk-android-plugin2/issues'
71- group = " com.sensorsdata.analytics.android"
72-
73- install {
74- repositories. mavenInstaller {
75- // generates POM.xml with proper parameters
76- pom {
77- project {
27+ publishing {
28+ publications {
29+ mavenAndroid(MavenPublication ) {
30+ groupId = ' com.sensorsdata.analytics.android'
31+ artifactId = ' android-gradle-plugin2'
32+ version = version
33+ artifact sourceJar
34+ artifact javadocJar
35+ artifact jar
36+ // 配置 pop 文件格式
37+ pom {
7838 packaging ' jar'
79- name ' The official Android SDK Plugin for Sensors Analytics.'
80- description ' The official Android SDK Plugin for Sensors Analytics.'
81- url siteUrl
82-
39+ name = ' The official Android SDK Plugin for Sensors Analytics.'
40+ description = ' The official Android SDK Plugin for Sensors Analytics.'
41+ url = ' The official Android SDK Plugin for Sensors Analytics.'
8342 licenses {
8443 license {
85- name ' The Apache Software License, Version 2.0'
86- url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
44+ name= ' The Apache Software License, Version 2.0'
45+ url= ' http://www.apache.org/licenses/LICENSE-2.0.txt'
8746 }
8847 }
8948 developers {
9049 developer {
91- id ' zouyuhan '
92- name ' Yuhan ZOU '
93- email ' zouyuhan @sensorsdata.cn '
50+ id = ' dengshiwei '
51+ name = ' dengshiwei '
52+ email = ' dengshiwei @sensorsdata.com '
9453 }
9554 }
96-
9755 scm {
98- connection gitUrl
99- developerConnection gitUrl
100- url siteUrl
56+ connection = ' https://github.com/sensorsdata/sa-sdk-android-plugin2 '
57+ developerConnection = ' https://github.com/sensorsdata/sa-sdk-android-plugin2.git '
58+ url = ' https://github.com/sensorsdata/sa-sdk-android-plugin2 '
10159 }
10260 }
10361 }
10462 }
63+ // 配置远程仓库
64+ repositories {
65+ Properties properties = new Properties ()
66+ properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
67+ def mavenUser = properties. getProperty(" maven.user" )
68+ def mavenPassword = properties. getProperty(" maven.password" )
69+ maven {
70+ url = ' https://oss.sonatype.org/service/local/staging/deploy/maven2/'
71+ credentials {
72+ username mavenUser
73+ password mavenPassword
74+ }
75+ }
76+ }
10577}
10678
107- Properties properties = new Properties ()
108- properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
109-
110- bintray {
111- user = properties. getProperty(" bintray.user" )
112- key = properties. getProperty(" bintray.apikey" )
113- configurations = [' archives' ]
114- pkg {
115- repo = " maven"
116- name = " SensorsAnalyticsSDKPlugin2"
117- desc = ' The official Android SDK Plugin for Sensors Analytics.'
118- websiteUrl = siteUrl
119- vcsUrl = gitUrl
120- issueTrackerUrl = issueUrl
121- licenses = [" Apache-2.0" ]
122- labels = ' Groovy'
123- publicDownloadNumbers = true
124- publish = true
125- }
79+ // 对 mavenAndroid 发布内容进行签名
80+ signing {
81+ sign publishing. publications. mavenAndroid
12682}
0 commit comments