更新构建shell

This commit is contained in:
陈云志
2020-12-23 14:15:26 +08:00
parent dbe2a5a8ad
commit 858d00b1bf
11 changed files with 43 additions and 38 deletions

View File

@@ -6,9 +6,5 @@ allprojects {
ext {
buildProduct = System.getProperty("buildProduct") ?: false
}
task abuildAllModule(type: Exec) {
workingDir("../")
executable "build-config/build_jar.sh"
args(project.name)
}

View File

@@ -4,6 +4,7 @@ ext {
lombokVersion = "1.18.16"
junitVersion = "4.13.1"
logbackVersion = "1.2.3"
repoUrl="http://192.168.8.200:8081/repository"
}
@@ -28,7 +29,7 @@ repositories {
mavenLocal()
mavenCentral()
maven { url "https://maven.aliyun.com/repository/public/" }
maven { url "http://192.168.8.200:8081/repository/public/" }
maven { url "${repoUrl}/public/" }
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, "seconds"
@@ -52,25 +53,25 @@ dependencies {
jar {
// 排除掉模块调试的资源文件, 启动类.
excludes = []
excludes = ['*.yml','logback.xml']
manifest {
attributes "releaseVersion": version + "-" + getGitVersion()
attributes "vendor": "GRIDNT山东网聪信息科技有限"
attributes "vendor": "vendor"
attributes "buildTime": new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("GMT+08:00"))
}
}
//apply plugin: "org.sonarqube"
//sonarqube {
// properties {
// property "sonar.projectKey", "${project.name}"
// property "sonar.projectName", "${project.name}"
// property "sonar.sources", "src"
// property "sonar.java.binaries", "build"
// property "sonar.exclusions", "**/**test**/**"
// property "sonar.sourceEncoding", "UTF-8"
// }
//}
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectKey", "${project.name}"
property "sonar.projectName", "${project.name}"
property "sonar.sources", "src"
property "sonar.java.binaries", "build"
property "sonar.exclusions", "**/**test**/**"
property "sonar.sourceEncoding", "UTF-8"
}
}

View File

@@ -32,7 +32,7 @@ bootJar {
// attributes "Main-Class": "org.springframework.boot.loader.PropertiesLauncher"
// attributes "Class-Path": configurations.compileClasspath.files.collect { "../lib/$it.name" }.join(" ")
attributes "releaseVersion": version + "-" + getGitVersion()
attributes "vendor": "GRIDNT山东网聪信息科技有限"
attributes "vendor": "vendor"
attributes "buildTime": new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("GMT+08:00"))
}
launchScript()

20
build-config/build-java.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
## 编译每个服务
for gfile in $(find . -name "build.gradle")
do
if [[ $1 = cl ]];then
gradle -b $gfile clean &
echo -e "\033[32m----------------- $gfile 模块 清理 成功 ---------------------- \033[0m"
else
gradle -b $gfile clean build -x test -DbuildProduct=true -DreleaseVersion=$1
echo -e "\033[32m----------------- $gfile 模块编译成功 ---------------------- \033[0m"
fi
done

View File

@@ -19,8 +19,8 @@ publishing.publications {
publishing.repositories {
maven {
def releasesRepoUrl = "http://192.168.8.200:8081/repository/releases"
def snapshotsRepoUrl = "http://192.168.8.200:8081/repository/snapshots/"
def releasesRepoUrl = "${repoUrl}/releases"
def snapshotsRepoUrl = "${repoUrl}/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
println "${group} ${archivesBaseName} publishing version is ${version}"
credentials {

14
build-config/checkThirdPaty.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
currentDir=`pwd`
shortName=${currentDir##*/}
rm -rf temp ${shortName}-third-jar.gradle
echo "dependencies { ">> ${shortName}-third-jar.gradle
find . -name "build.gradle" | xargs cat |grep -E "compile group|compile
'|implementation " >> temp
sort temp |uniq >> ${shortName}-third-jar.gradle
rm -rf temp
echo "} ">> ${shortName}-third-jar.gradle

View File

@@ -1,6 +1,6 @@
#!/bin/bash
## 格式化 jar 引用
## 格式化 jar 引用,避免出错
find . -name "build.gradle" | xargs sed -r -i "s/'/\"/g"
find . -name "build.gradle" | xargs sed -r -i 's/compile group: /compile /g'