Commit 8368ee89 by 万齐军

发布脚本修改

parent 75d26624
...@@ -13,6 +13,9 @@ buildscript { ...@@ -13,6 +13,9 @@ buildscript {
arouter_compiler = '1.2.2' arouter_compiler = '1.2.2'
ydlrouter_version = '1.2.3' ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2' constrait_support_version = '1.0.2'
ydlVersion = '0.0.0.0-a'
moduleVersion = '0.0.0.0-b'
} }
repositories { repositories {
maven { maven {
...@@ -33,8 +36,13 @@ buildscript { ...@@ -33,8 +36,13 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
allprojects { p ->
allprojects { if (p.name.startsWith("ydl-")) {
p.version = ydlVersion
}
if (p.name.startsWith("m-")) {
p.version = moduleVersion
}
repositories { repositories {
//壹点灵android maven私服 开发版 //壹点灵android maven私服 开发版
maven { maven {
...@@ -54,26 +62,6 @@ allprojects { ...@@ -54,26 +62,6 @@ allprojects {
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
task packYdl1 {
doLast {
println("doLast packYdl1!!!!")
}
}
task packYdl2 {
doLast {
println("doLast packYdl2!!!!")
}
}
task packYdl {
doLast {
println("doLast packYdl!!!!")
}
}
task packM{
doLast {
println("doLast packM!!!!")
}
}
subprojects { subprojects {
project.configurations.all { project.configurations.all {
......
ext { ext {
dev_mode = false//组件发布的时候需要设置为false dev_mode = false //组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.17" ydl2PublishVersion = "0.2.0.4-SNAPSHOT"
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
...@@ -208,30 +208,30 @@ ext { ...@@ -208,30 +208,30 @@ ext {
"ydl-hnet" : "com.ydl:h-net:0.0.8", "ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar", "ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
"ydl-device" : "com.ydl:device-id:0.0.31", "ydl-device" : "com.ydl:device-id:0.0.31",
"ydl-net" : "com.ydl:ydl-net:${ydl2PublishVersion}", "ydl-net" : "com.ydl:ydl-net:${ydlVersion}",
"ydl-utils" : "com.ydl:ydl-utils:${ydl2PublishVersion}", "ydl-utils" : "com.ydl:ydl-utils:${ydlVersion}",
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块 //flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydl2PublishVersion}", //组件化项目中的flutter base模块 "ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlVersion}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.51@aar", //flutter aar "ydl-flutter" : "com.ydl:ydl-flutter:0.0.51@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar // "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号 //基础组件 <<--- 先发这个,发完改这里的版本号
"ydl-platform" : "com.ydl:ydl-platform:${ydl2PublishVersion}", "ydl-platform" : "com.ydl:ydl-platform:${ydlVersion}",
"ydl-tuicore" : "com.ydl:ydl-tuicore:${ydlPublishVersion["ydl-tuicore"]}", "ydl-tuicore" : "com.ydl:ydl-tuicore:${ydlPublishVersion["ydl-tuicore"]}",
//功能组件 <<--- 再发这些,发完改这里的版本号 //功能组件 <<--- 再发这些,发完改这里的版本号
"ydl-webview" : "com.ydl:ydl-webview:${ydl2PublishVersion}", "ydl-webview" : "com.ydl:ydl-webview:${ydlVersion}",
"ydl-media" : "com.ydl:ydl-media:${ydl2PublishVersion}", "ydl-media" : "com.ydl:ydl-media:${ydlVersion}",
"ydl-pay" : "com.ydl:ydl-pay:${ydl2PublishVersion}", "ydl-pay" : "com.ydl:ydl-pay:${ydlVersion}",
"m-audioim" : "com.ydl:m-audioim:${ydl2PublishVersion}", "m-audioim" : "com.ydl:m-audioim:${ydlVersion}",
//业务组件 <<--- 最后发这些(只发改过的) //业务组件 <<--- 最后发这些(只发改过的)
"ydl-m-user-api" : "com.ydl:m-user-api:1.0.0", "ydl-m-user-api" : "com.ydl:m-user-api:1.0.0",
"ydl-m-fm-api" : "com.ydl:m-fm-api:1.0.0", "ydl-m-fm-api" : "com.ydl:m-fm-api:1.0.0",
"ydl-m-tests-api" : "com.ydl:m-tests-api:1.0.0", "ydl-m-tests-api" : "com.ydl:m-tests-api:1.0.0",
"ydl-m-im-api" : "com.ydl:m-im-api:1.0.3", "ydl-m-im-api" : "com.ydl:m-im-api:1.0.3",
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlPublishVersion["m-home-api"]}", "ydl-m-home-api" : "com.ydl:m-home-api:1.0.0",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:1.0.3", "ydl-m-consultant-api" : "com.ydl:m-consultant-api:1.0.0",
"ydl-m-dynamic-api" : "com.ydl:m-dynamic-api:1.0.0", "ydl-m-dynamic-api" : "com.ydl:m-dynamic-api:1.0.0",
"ydl-m-confide-api" : "com.ydl:m-confide-api:1.0.4", "ydl-m-confide-api" : "com.ydl:m-confide-api:1.0.4",
"ydl-m-course-api" : "com.ydl:m-course-api:1.0.0", "ydl-m-course-api" : "com.ydl:m-course-api:1.0.0",
......
apply plugin: 'maven'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def mavenRepositoryUrl2 = "http://nexus.yidianling.com/repository/AndroidSnapshots/"
def getVersionName() {
def publishVersion = rootProject.ext.ydl2PublishVersion
return publishVersion
}
def isLocal(){
Properties properties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
properties.load(inputStream)
def local = properties.getProperty("packageLocal")
return local
}
task sourceJar(type:Jar){
classifier = 'source'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives sourceJar
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.artifactId = project.getName().replace('_', "-")
pom.groupId = "com.ydl"
pom.version = getVersionName()
def local = isLocal()
if (local == "true") {
repository(url: mavenLocal().url)
} else if (local == "false") {
def snapshot = getVersionName().endsWith("-SNAPSHOT")
repository(url: snapshot ? mavenRepositoryUrl2 : mavenRepositoryUrl) {
authentication(userName: "admin", password: "fjoi#1+#@")
}
} else {
println("请在local.properties中指定packageLocal的值[true|false]")
}
}
}
}
uploadArchives.doFirst {
// log
println String.format(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n>>>>> [%s] 正在将[%s]版本的[%s]包上传到Maven的[%s]仓库 >>>>>\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
, project.getName()
, getVersionName()
, "aar"
, "packageLocal:" + isLocal()
)
}
// rootProject.getTasksByName("aa",false).forEach{println(it)}
//pay依赖platform,platform依赖utils和net
//confide依赖audioim
if (project.name.startsWith("ydl")) {
if (project.name == "ydl-utils" || project.name == "ydl-net") {
rootProject.getTasksByName("packYdl1", false).forEach { it.dependsOn(uploadArchives) }
}
if (project.name == "ydl-platform") {
rootProject.getTasksByName("packYdl2", false).forEach { it.dependsOn(uploadArchives) }
}
rootProject.getTasksByName("packYdl", false).forEach { it.dependsOn(uploadArchives) }
} else {
if (project.name != "m-audioim") {
rootProject.getTasksByName("packM", false).forEach { it.dependsOn(uploadArchives) }
}
}
}
\ No newline at end of file
apply plugin: 'maven'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def getVersionName() {
return hasProperty('VERSION_NAME') ? VERSION_NAME : rootProject.ext.ydlPublishVersion[project.getName()]
}
task sourceJar(type:Jar){
classifier = 'source'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives sourceJar
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.artifactId = "m-" + project.name + "-api"
pom.groupId = "com.ydl"
pom.version = project.version
repository(url: mavenRepositoryUrl) {
authentication(userName: "admin", password: "fjoi#1+#@")
}
// repository(url:mavenLocal().url)
}
}
}
uploadArchives.doFirst {
// log
println String.format(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n>>>>> [%s] 正在将[%s]版本的[%s]包上传到Maven的[%s]仓库 >>>>>\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
, project.getName()
, project.version
, "aar"
, "release"
)
}
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/" def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def mavenRepositoryUrl2 = "http://nexus.yidianling.com/repository/AndroidSnapshots/"
def getVersionName() {
return "0.0.0"//0rootProject.ext.componentVersion
// return hasProperty('VERSION_NAME') ? VERSION_NAME : rootProject.ext.ydlPublishVersion[project.getName()]
}
def pVersion = "0.0.0"//rootProject.ext.componentVersion
def sourceJar(String name, String path) { def sourceJar(String name, String path) {
return project.tasks.create("source${name.capitalize()}Jar", Jar) { return project.tasks.create("source${name.capitalize()}Jar", Jar) {
group = "publishing" group = "publishing"
...@@ -17,6 +13,7 @@ def sourceJar(String name, String path) { ...@@ -17,6 +13,7 @@ def sourceJar(String name, String path) {
classifier = 'sources' classifier = 'sources'
} }
} }
def setScm(scm) { def setScm(scm) {
// scm.appendNode('connection', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow.git") // scm.appendNode('connection', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow.git")
// //
...@@ -29,50 +26,67 @@ def setScm(scm) { ...@@ -29,50 +26,67 @@ def setScm(scm) {
// scm.appendNode('url', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow/commit/$commit") // scm.appendNode('url', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow/commit/$commit")
} }
def modifyPom = { def checkPomVersion = {
def root = asNode() def root = asNode()
def dependencies = root.get('dependencies').first() def dependencyNodes = root.get('dependencies')
def children = dependencies.children() for (def dependency : dependencyNodes) {
for (def child : children) { def children = dependency.children()
def versionNode = child.get("version").first() for (def child : children) {
def childVersion = versionNode.value().first() def versionNode = child.get("version").first()
def groupIdText = child.get("groupId").first().value().first() def version = versionNode.value().first()
if (childVersion == "unspecified" && groupIdText.startsWith("com.ydl")) { def groupId = child.get("groupId").first().value().first()
versionNode.setValue(pVersion) def artifactId = child.get("artifactId").first().value().first()
def scope = child.get("scope").first().value().first()
println "$scope $groupId:$artifactId:$version"
if (version == "unspecified") {
throw new IllegalStateException("版本检查出错了!")
}
} }
} }
} }
def multiComponent = [':m-home', ':ydl-resource']
afterEvaluate { afterEvaluate {
def pVersion = ''
if (project.version == "unspecified") {
throw new IllegalStateException("请指定${project.name}的Version")
} else {
pVersion = project.version
}
publishing { publishing {
publications { publications {
if (project.name.startsWith("ydl-")||project.name.endsWith("-api")||project.name=="m-audioim") { if (multiComponent.contains(project.path)) {
component(MavenPublication) {
version pVersion
from components.release
artifact sourceJar(getName(), "${project.projectDir}")
pom.withXml(modifyPom)
}
}
if (project.name.startsWith("m-")&&!project.name.endsWith("-api")&&project.name!="m-audioim") {
ydlComponent(MavenPublication) { ydlComponent(MavenPublication) {
group 'com.ydl' group 'com.ydl'
version pVersion version pVersion + "-ydl"
from components.ydlRelease from components.ydlRelease
artifact sourceJar(getName(), "${project.projectDir}") artifact sourceJar(getName(), "${project.projectDir}")
// pom.withXml(modifyPom) pom.withXml(checkPomVersion)
} }
xlzxComponent(MavenPublication) { xlzxComponent(MavenPublication) {
version pVersion group 'com.ydl'
version pVersion + "-xlzx"
from components.xlzxRelease from components.xlzxRelease
artifact sourceJar(getName(), "${project.projectDir}") artifact sourceJar(getName(), "${project.projectDir}")
pom.withXml(modifyPom) pom.withXml(checkPomVersion)
}
} else {
component(MavenPublication) {
group 'com.ydl'
version pVersion
from components.release
artifact sourceJar(getName(), "${project.projectDir}")
pom.withXml(checkPomVersion)
} }
} }
} }
repositories { repositories {
// mavenLocal() def snapshot = pVersion.endsWith("-SNAPSHOT")
maven { maven {
url "${rootProject.projectDir}/aaaaa"//mavenLocal().url url snapshot ? mavenRepositoryUrl2 : mavenRepositoryUrl
credentials {
username "admin"
password "fjoi#1+#@"
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment