Commit 8368ee89 by 万齐军

发布脚本修改

parent 75d26624
......@@ -13,6 +13,9 @@ buildscript {
arouter_compiler = '1.2.2'
ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2'
ydlVersion = '0.0.0.0-a'
moduleVersion = '0.0.0.0-b'
}
repositories {
maven {
......@@ -33,8 +36,13 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
allprojects { p ->
if (p.name.startsWith("ydl-")) {
p.version = ydlVersion
}
if (p.name.startsWith("m-")) {
p.version = moduleVersion
}
repositories {
//壹点灵android maven私服 开发版
maven {
......@@ -54,26 +62,6 @@ allprojects {
task clean(type: Delete) {
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 {
project.configurations.all {
......
ext {
dev_mode = false//组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.17"
dev_mode = false //组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.4-SNAPSHOT"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
......@@ -208,30 +208,30 @@ ext {
"ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
"ydl-device" : "com.ydl:device-id:0.0.31",
"ydl-net" : "com.ydl:ydl-net:${ydl2PublishVersion}",
"ydl-utils" : "com.ydl:ydl-utils:${ydl2PublishVersion}",
"ydl-net" : "com.ydl:ydl-net:${ydlVersion}",
"ydl-utils" : "com.ydl:ydl-utils:${ydlVersion}",
//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-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-webview" : "com.ydl:ydl-webview:${ydl2PublishVersion}",
"ydl-media" : "com.ydl:ydl-media:${ydl2PublishVersion}",
"ydl-pay" : "com.ydl:ydl-pay:${ydl2PublishVersion}",
"m-audioim" : "com.ydl:m-audioim:${ydl2PublishVersion}",
"ydl-webview" : "com.ydl:ydl-webview:${ydlVersion}",
"ydl-media" : "com.ydl:ydl-media:${ydlVersion}",
"ydl-pay" : "com.ydl:ydl-pay:${ydlVersion}",
"m-audioim" : "com.ydl:m-audioim:${ydlVersion}",
//业务组件 <<--- 最后发这些(只发改过的)
"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-tests-api" : "com.ydl:m-tests-api:1.0.0",
"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-consultant-api" : "com.ydl:m-consultant-api:1.0.3",
"ydl-m-home-api" : "com.ydl:m-home-api:1.0.0",
"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-confide-api" : "com.ydl:m-confide-api:1.0.4",
"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'
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) {
return project.tasks.create("source${name.capitalize()}Jar", Jar) {
group = "publishing"
......@@ -17,6 +13,7 @@ def sourceJar(String name, String path) {
classifier = 'sources'
}
}
def setScm(scm) {
// scm.appendNode('connection', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow.git")
//
......@@ -29,50 +26,67 @@ def setScm(scm) {
// scm.appendNode('url', "https://github.com/${System.getenv("GITHUB_ACTOR")}/Shadow/commit/$commit")
}
def modifyPom = {
def checkPomVersion = {
def root = asNode()
def dependencies = root.get('dependencies').first()
def children = dependencies.children()
for (def child : children) {
def versionNode = child.get("version").first()
def childVersion = versionNode.value().first()
def groupIdText = child.get("groupId").first().value().first()
if (childVersion == "unspecified" && groupIdText.startsWith("com.ydl")) {
versionNode.setValue(pVersion)
def dependencyNodes = root.get('dependencies')
for (def dependency : dependencyNodes) {
def children = dependency.children()
for (def child : children) {
def versionNode = child.get("version").first()
def version = versionNode.value().first()
def groupId = child.get("groupId").first().value().first()
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 {
def pVersion = ''
if (project.version == "unspecified") {
throw new IllegalStateException("请指定${project.name}的Version")
} else {
pVersion = project.version
}
publishing {
publications {
if (project.name.startsWith("ydl-")||project.name.endsWith("-api")||project.name=="m-audioim") {
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") {
if (multiComponent.contains(project.path)) {
ydlComponent(MavenPublication) {
group 'com.ydl'
version pVersion
version pVersion + "-ydl"
from components.ydlRelease
artifact sourceJar(getName(), "${project.projectDir}")
// pom.withXml(modifyPom)
pom.withXml(checkPomVersion)
}
xlzxComponent(MavenPublication) {
version pVersion
group 'com.ydl'
version pVersion + "-xlzx"
from components.xlzxRelease
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 {
// mavenLocal()
def snapshot = pVersion.endsWith("-SNAPSHOT")
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