mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 05:27:10 +08:00
212 lines
8.6 KiB
Groovy
212 lines
8.6 KiB
Groovy
// 本机和 WinBoLL Maven 仓库传输配置。
|
|
//
|
|
|
|
def getDefaultVersion(){
|
|
// 检查编译标志位配置
|
|
assert (winbollBuildProps['publishVersion'] != null)
|
|
// 返回编译版本号
|
|
return winbollBuildProps['publishVersion']
|
|
}
|
|
|
|
def siteUrl = 'https://winboll.cc/?page=studio/details.php&app=${rootProject.name}' // 项目主页
|
|
def gitUrl = 'https://gitea.winboll.cc/WinBoLL/${rootProject.name}' // 项目的git地址
|
|
def DefaultGroupId = 'cc.winboll.studio' // 类库所有者groupId
|
|
def DefaultVersion = getDefaultVersion() // 版本号
|
|
def DeveloperId='zhangsken' // 开发者账号
|
|
def DeveloperName='ZhanGSKen' // 开发者名称
|
|
def DeveloperEMail='zhangsken@188.com' // 开发者邮箱地址
|
|
def LicenseName='The Apache Software License, Version 2.0'
|
|
def LicenseUrl='http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
Properties properties = new Properties()
|
|
|
|
afterEvaluate {
|
|
publishing {
|
|
repositories {
|
|
if(file("${RootProjectDir}/${winbollFilePath}").exists()) {
|
|
properties.load(file("${RootProjectDir}/${winbollFilePath}").newDataInputStream())
|
|
def NexusUserName = properties.getProperty("Nexus.name")
|
|
def NexusPassword = properties.getProperty("Nexus.password")
|
|
// WinBoLL Release 仓库
|
|
maven{
|
|
//仓库的名字和地址
|
|
name = "WinBoLLRelease"
|
|
url="https://nexus.winboll.cc/repository/maven-releases/"
|
|
// 仓库用户名密码
|
|
credentials {
|
|
username = NexusUserName
|
|
password = NexusPassword
|
|
}
|
|
}
|
|
// WinBoLL Snapshot 仓库
|
|
maven{
|
|
//仓库的名字和地址
|
|
name = "WinBoLLSnapshot"
|
|
url="https://nexus.winboll.cc/repository/maven-snapshots/"
|
|
// 仓库用户名密码
|
|
credentials {
|
|
username = NexusUserName
|
|
password = NexusPassword
|
|
}
|
|
}
|
|
}
|
|
}
|
|
publications {
|
|
// Local Maven 仓库传输任务
|
|
//
|
|
release(MavenPublication) {
|
|
groupId = DefaultGroupId
|
|
artifactId = project.name
|
|
version = DefaultVersion
|
|
|
|
//from components.java
|
|
// 必须有这个 否则不会上传AAR包
|
|
afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) }
|
|
// 上传source,这样使用方可以看到方法注释
|
|
//artifact generateSourcesJar
|
|
//要上传的aar路径
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-release.aar"
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar"
|
|
|
|
//对pom进行的操作
|
|
pom.withXml{
|
|
Node pomNode = asNode()
|
|
pomNode.dependencies.'*'.findAll() {
|
|
//将所有的默认依赖移除
|
|
//it.parent().remove(it)
|
|
}
|
|
}
|
|
pom {
|
|
name = artifactId
|
|
url = siteUrl
|
|
licenses {
|
|
license { //证书说明
|
|
name=LicenseName // 开源协议名称
|
|
url=LicenseUrl // 协议地址
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id=DeveloperId // 开发者账号
|
|
name=DeveloperName // 开发者名称
|
|
email=DeveloperEMail // 开发者邮箱地址
|
|
}
|
|
}
|
|
//软件配置管理
|
|
scm {
|
|
connection=gitUrl
|
|
developerConnection=gitUrl
|
|
url=siteUrl
|
|
}
|
|
}
|
|
}
|
|
|
|
// WinBoLL Maven Release 仓库传输任务
|
|
//
|
|
releaseWinBoLL(MavenPublication) {
|
|
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
|
//from components.free
|
|
|
|
groupId = DefaultGroupId // 文件的groupId
|
|
artifactId = project.name //文件的名字
|
|
version = DefaultVersion //版本号
|
|
|
|
//from components.java
|
|
// 必须有这个 否则不会上传AAR包
|
|
afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) }
|
|
// 上传source,这样使用方可以看到方法注释
|
|
//artifact generateSourcesJar
|
|
//要上传的aar路径
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-release.aar"
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar"
|
|
|
|
//对pom进行的操作
|
|
pom.withXml{
|
|
Node pomNode = asNode()
|
|
pomNode.dependencies.'*'.findAll() {
|
|
//将所有的默认依赖移除
|
|
//it.parent().remove(it)
|
|
}
|
|
}
|
|
pom {
|
|
name = artifactId
|
|
url = siteUrl
|
|
licenses {
|
|
license { //证书说明
|
|
name=LicenseName // 开源协议名称
|
|
url=LicenseUrl // 协议地址
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id=DeveloperId // 开发者账号
|
|
name=DeveloperName // 开发者名称
|
|
email=DeveloperEMail // 开发者邮箱地址
|
|
}
|
|
}
|
|
//软件配置管理
|
|
scm {
|
|
connection=gitUrl
|
|
developerConnection=gitUrl
|
|
url=siteUrl
|
|
}
|
|
}
|
|
|
|
} // 创建名为 release 的任务结束
|
|
|
|
// WinBoLL Maven Snapshot 仓库传输任务
|
|
//
|
|
snapshotWinBoLL(MavenPublication) {
|
|
// 需要使用的变体,假设有free和pay两个变体,可以选择一个
|
|
//from components.free
|
|
|
|
groupId = DefaultGroupId // 文件的groupId
|
|
artifactId = project.name //文件的名字
|
|
version = DefaultVersion + "-SNAPSHOT" //版本号
|
|
|
|
//from components.java
|
|
// 必须有这个 否则不会上传AAR包
|
|
afterEvaluate { artifact(tasks.getByName("bundleReleaseAar")) }
|
|
// 上传source,这样使用方可以看到方法注释
|
|
//artifact generateSourcesJar
|
|
//要上传的aar路径
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-release.aar"
|
|
//artifact "$buildDir/outputs/aar/${project.getName()}-debug.aar"
|
|
|
|
//对pom进行的操作
|
|
pom.withXml{
|
|
Node pomNode = asNode()
|
|
pomNode.dependencies.'*'.findAll() {
|
|
//将所有的默认依赖移除
|
|
//it.parent().remove(it)
|
|
}
|
|
}
|
|
pom {
|
|
name = artifactId
|
|
url = siteUrl
|
|
licenses {
|
|
license { //证书说明
|
|
name=LicenseName // 开源协议名称
|
|
url=LicenseUrl // 协议地址
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id=DeveloperId // 开发者账号
|
|
name=DeveloperName // 开发者名称
|
|
email=DeveloperEMail // 开发者邮箱地址
|
|
}
|
|
}
|
|
//软件配置管理
|
|
scm {
|
|
connection=gitUrl
|
|
developerConnection=gitUrl
|
|
url=siteUrl
|
|
}
|
|
}
|
|
} // 创建名为 snapshot 的任务结束
|
|
}
|
|
|
|
}
|
|
}
|