|
1 | | -apply plugin: 'com.android.library' |
2 | | -apply plugin: 'kotlin-android' |
3 | | -apply plugin: 'maven-publish' |
4 | | -apply plugin: 'signing' |
5 | | -apply plugin: 'com.kezong.fat-aar' |
| 1 | +plugins { |
| 2 | + id 'com.android.library' |
| 3 | + id 'kotlin-android' |
| 4 | + id 'com.kezong.fat-aar' |
| 5 | + id "com.vanniktech.maven.publish" version "0.25.3" |
| 6 | +} |
6 | 7 |
|
7 | 8 | android { |
8 | 9 | compileSdkVersion 29 |
@@ -59,102 +60,35 @@ configurations.all { |
59 | 60 | resolutionStrategy.cacheChangingModulesFor 0, 'seconds' |
60 | 61 | } |
61 | 62 |
|
62 | | -task androidJavadocs(type: Javadoc) { |
63 | | - failOnError false |
64 | | - source = android.sourceSets.main.java.srcDirs |
65 | | - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
66 | | - android.libraryVariants.all { variant -> |
67 | | - if (variant.name == 'release') { |
68 | | - owner.classpath += variant.javaCompile.classpath |
69 | | - } |
70 | | - } |
71 | | - exclude '**/R.html', '**/R.*.html', '**/index.html' |
72 | | -} |
73 | | - |
74 | | -task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { |
75 | | - classifier = 'javadoc' |
76 | | - from androidJavadocs.destinationDir |
77 | | -} |
78 | | - |
79 | | -task androidSourcesJar(type: Jar) { |
80 | | - classifier = 'sources' |
81 | | - from android.sourceSets.main.java.srcDirs |
82 | | -} |
83 | | - |
84 | 63 | def libVersion = rootProject.ext.android.videoSdkSnapshotVersion + '-SNAPSHOT' |
85 | 64 | ext.isReleaseVersion = !libVersion.endsWith("SNAPSHOT") |
86 | | -publishing { |
87 | | - publications { |
88 | | - aar(MavenPublication) { |
89 | | - groupId 'com.tencent.iot.video' |
90 | | - artifactId 'video-link-android' |
91 | | - version libVersion |
92 | | - artifact(androidSourcesJar) |
93 | | - artifact(androidJavadocsJar) |
94 | | - artifact file('build/outputs/aar/video-link-android-release.aar') |
| 65 | +mavenPublishing { |
95 | 66 |
|
96 | | - pom { |
97 | | - name = 'video link android' |
98 | | - description = 'Tencent Video Link Android library' |
99 | | - url = 'https://github.com/tencentyun/iot-link-android/tree/master/video-link-android' |
100 | | - licenses { |
101 | | - license { |
102 | | - name = 'Tencent Binary License' |
103 | | - url = 'https://github.com/tencentyun/iot-link-android/blob/master/explorer-link-android/LICENSE' |
104 | | - } |
105 | | - } |
106 | | - developers { |
107 | | - developer { |
108 | | - id = 'tencent_archurtan' |
109 | | - name = 'Tencent archurtan' |
110 | | - |
111 | | - } |
112 | | - } |
113 | | - scm { |
114 | | - url = 'scm:[email protected]:tencentyun/iot-link-android.git' |
115 | | - connection = 'scm:[email protected]:tencentyun/iot-link-android.git' |
116 | | - developerConnection = 'scm:[email protected]:tencentyun/iot-link-android.git' |
117 | | - } |
118 | | - } |
119 | | - |
120 | | - pom.withXml { |
121 | | - def dependenciesNode = asNode().appendNode('dependencies') |
122 | | - configurations.implementation.allDependencies.withType(ModuleDependency) { ModuleDependency dp -> |
123 | | - if (dp.version != "unspecified") { // 过滤项目内library引用 |
124 | | - def dependencyNode = dependenciesNode.appendNode('dependency') |
125 | | - dependencyNode.appendNode('groupId', dp.group) |
126 | | - dependencyNode.appendNode('artifactId', dp.name) |
127 | | - dependencyNode.appendNode('version', dp.version) |
| 67 | + coordinates("com.tencent.iot.video.android", "video-link-android", libVersion) |
| 68 | + publishToMavenCentral() |
| 69 | + signAllPublications() |
128 | 70 |
|
129 | | - // for exclusions |
130 | | - if (dp.excludeRules.size() > 0) { |
131 | | - def exclusions = dependencyNode.appendNode('exclusions') |
132 | | - dp.excludeRules.each { ExcludeRule ex -> |
133 | | - def exclusion = exclusions.appendNode('exclusion') |
134 | | - exclusion.appendNode('groupId', ex.group) |
135 | | - exclusion.appendNode('artifactId', ex.module) |
136 | | - } |
137 | | - } |
138 | | - } |
139 | | - } |
| 71 | + pom { |
| 72 | + name = 'video link android' |
| 73 | + description = 'Tencent Video Link Android library' |
| 74 | + url = 'https://github.com/tencentyun/iot-link-android/tree/master/video-link-android' |
| 75 | + licenses { |
| 76 | + license { |
| 77 | + name = 'Tencent Binary License' |
| 78 | + url = 'https://github.com/tencentyun/iot-link-android/blob/master/explorer-link-android/LICENSE' |
140 | 79 | } |
141 | 80 | } |
142 | | - } |
143 | | - repositories { |
144 | | - maven { |
145 | | - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" |
146 | | - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" |
147 | | - url = libVersion.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl |
148 | | - credentials { |
149 | | - username = System.getenv("IOT_SONATYPE_USERNAME") |
150 | | - password = System.getenv("IOT_SONATYPE_PASSWORD") |
| 81 | + developers { |
| 82 | + developer { |
| 83 | + id = 'tencent_archurtan' |
| 84 | + name = 'Tencent archurtan' |
| 85 | + |
151 | 86 | } |
152 | 87 | } |
153 | | - } |
154 | | -} |
155 | | - |
156 | | -signing { |
157 | | - if (isReleaseVersion) { |
158 | | - sign publishing.publications.aar |
| 88 | + scm { |
| 89 | + url = 'scm:[email protected]:tencentyun/iot-link-android.git' |
| 90 | + connection = 'scm:[email protected]:tencentyun/iot-link-android.git' |
| 91 | + developerConnection = 'scm:[email protected]:tencentyun/iot-link-android.git' |
| 92 | + } |
159 | 93 | } |
160 | 94 | } |
0 commit comments