-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.1.3 migrate from Jcenter to MavenCentral
- Loading branch information
Showing
6 changed files
with
146 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// 依赖信息 | ||
def groupIdDefined = "com.licheedev" | ||
def artifactIdDefined = "android-serialport" | ||
// 如果是测试版,版本号后面加上 -SNAPSHOT | ||
def versionDefined = rootProject.ext.versionName | ||
// 其他信息 | ||
def gitUrl = "https://github.com/licheedev/Android-SerialPort-API" | ||
|
||
// 配置是否上传 | ||
def toUpload = true | ||
|
||
//在根build.gradle中加入,最新版本号参考 https://github.com/Kotlin/dokka#using-dokka | ||
//classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32' | ||
|
||
//在module的build.gradle末位加入 | ||
//apply from: '../maven_publish.gradle' | ||
|
||
if (toUpload) { | ||
apply plugin: 'signing' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'org.jetbrains.dokka' | ||
|
||
//<editor-fold desc="打包源码和javadoc"> | ||
// 打包源码 | ||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
failOnError false | ||
source = android.sourceSets.main.java.sourceFiles | ||
options { | ||
encoding = "utf-8" | ||
charSet 'UTF-8' | ||
} | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
classpath += configurations.compile | ||
} | ||
|
||
// 打包javadoc | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
// 打包包含kotlin源码的javadoc | ||
task kotlinDocJar(type: Jar, dependsOn: dokkaHtml) { | ||
classifier = 'javadoc' | ||
from dokkaHtml.outputDirectory | ||
} | ||
//</editor-fold> | ||
|
||
afterEvaluate { | ||
|
||
publishing { | ||
publications { | ||
mavenAndroid(MavenPublication) { | ||
from components.release | ||
|
||
groupId "$groupIdDefined" | ||
artifactId "$artifactIdDefined" | ||
version "$versionDefined" | ||
// 上传source | ||
artifact sourcesJar | ||
// 上传javadoc | ||
if (project.plugins.hasPlugin('kotlin-android')) { | ||
artifact kotlinDocJar | ||
} else { | ||
artifact javadocJar | ||
} | ||
|
||
pom { | ||
name = 'Android-SerialPort-API' | ||
description = 'Android-SerialPort-API' | ||
url = "$gitUrl" | ||
|
||
//licenses { | ||
// license { | ||
// name = 'The MIT License' | ||
// url = 'https://opensource.org/licenses/MIT' | ||
// } | ||
//} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'licheedev' | ||
name = 'John Lee' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection = "$gitUrl" | ||
developerConnection = "${gitUrl}.git" | ||
url = "$gitUrl" | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
|
||
maven { | ||
// 依赖发布地址 | ||
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
|
||
// 配置账号密码 | ||
println "user=${ossrhUsername},key=${ossrhPassword}" | ||
credentials { | ||
username "${ossrhUsername}" | ||
password "${ossrhPassword}" | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.mavenAndroid | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters