加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
build.gradle 2.91 KB
一键复制 编辑 原始数据 按行查看 历史
ben.wangz 提交于 2022-08-29 09:57 . v1.2 publish
import groovy.text.SimpleTemplateEngine
buildscript {
repositories {
maven { url("https://maven.aliyun.com/repository/public") }
maven { url("https://maven.aliyun.com/repository/spring") }
maven { url("https://maven.aliyun.com/repository/mapr-public") }
maven { url("https://maven.aliyun.com/repository/spring-plugin") }
maven { url("https://maven.aliyun.com/repository/gradle-plugin") }
maven { url("https://maven.aliyun.com/repository/google") }
maven { url("https://maven.aliyun.com/repository/jcenter") }
}
}
HashMap<String, String> systemEnv = new HashMap<String, String>(System.getenv())
ext {
mainVersion = systemEnv.getOrDefault("MAIN_VERSION", "1.0.0")
mavenRepositoryUrlList = [
"https://maven.aliyun.com/repository/public",
"https://maven.aliyun.com/repository/spring",
"https://maven.aliyun.com/repository/mapr-public",
"https://maven.aliyun.com/repository/spring-plugin",
"https://maven.aliyun.com/repository/gradle-plugin",
"https://maven.aliyun.com/repository/google",
"https://maven.aliyun.com/repository/jcenter",
]
gitCommitId = { ->
String gitCommitIdKey = "GIT_COMMIT_ID"
if (!systemEnv.containsKey(gitCommitIdKey)) {
String defaultGitCommitId = 'developing'
println("WARNING: ${gitCommitIdKey} not found in env, using '${defaultGitCommitId}'")
return defaultGitCommitId
}
return systemEnv.get(gitCommitIdKey).trim()
}
fullVersion = "${ext.mainVersion}-C${ext.gitCommitId()}"
renderText = { File templateFile, Map<String, String> dataMap ->
return doRenderText(templateFile, dataMap)
}
renderFile = { File templateFile, Map<String, String> dataMap, File targetFile ->
doRenderFile(templateFile, dataMap, targetFile)
}
dockerRegistry = systemEnv.getOrDefault("DOCKER_REGISTRY", "docker.io")
chartMuseum = systemEnv.getOrDefault("CHART_MUSEUM", "http://insecure.chart.museum.local")
namespace = "nebula"
backendSoftwareName = "nebula-ce-backend"
frontendSoftwareName = "nebula-ce-frontend"
graphAnalysisNamespace = "graph-analysis"
graphAnalysisSoftwareName = "graph-analysis-frontend"
algoSoftwareName = "nebula-ce-algo"
}
version = project.rootProject.ext.fullVersion
private void doRenderFile(File templateFile, Map<String, String> dataMap, File targetFile) {
println("templateFile(${templateFile.getAbsolutePath()}) -> targetFile(${targetFile.getAbsolutePath()})")
project.file(targetFile).parentFile.mkdirs()
project.file(targetFile).text = doRenderText(templateFile, dataMap)
}
private String doRenderText(File templateFile, Map<String, String> dataMap) {
println("templateFile(${templateFile.getAbsolutePath()})")
return new SimpleTemplateEngine()
.createTemplate(templateFile.text)
.make(dataMap)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化