-
Notifications
You must be signed in to change notification settings - Fork 3
GitHub Issue 774: Fix distribution file name for snapshot versions #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
e5c3fbf
408f6b6
6e878dc
504e40d
ddce5d3
908352a
58d031f
ebda202
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -452,9 +452,10 @@ class BuildUtils | |
| } | ||
| } | ||
|
|
||
| if (project.hasProperty("versioning")) | ||
| if (project.hasProperty("includeVcs")) | ||
| { | ||
| String rootBranch = project.rootProject.versioning.info.branchId | ||
| Properties vcsProps = getStandardVCSProperties(project) | ||
| String rootBranch = vcsProps.get(VCS_BRANCH_PROP_NAME) | ||
| project.logger.info("${project.path} rootBranch ${rootBranch}") | ||
| if (rootBranch.startsWith("release") && /* e.g. release20.11-SNAPSHOT */ | ||
| project.labkeyVersion.contains("-SNAPSHOT")) /* e.g. 20.11-SNAPSHOT */ | ||
|
|
@@ -490,41 +491,47 @@ class BuildUtils | |
| return version | ||
| } | ||
|
|
||
| public static final String VCS_URL_PROP_NAME = "VcsURL" | ||
| public static final String VCS_BRANCH_PROP_NAME = "VcsBranch" | ||
| public static final String VCS_TAG_PROP_NAME = "VcsTag" | ||
| public static final String VCS_REVISION_PROP_NAME = "VcsRevision" | ||
| public static final String BUILD_NUMBER_PROP_NAME = "BuildNumber" | ||
|
|
||
| static Properties getStandardVCSProperties(project) | ||
| { | ||
| String buildNumber = | ||
| (String) TeamCityExtension.getTeamCityProperty(project, "system.teamcity.agent.dotnet.build_id", // Unique build ID | ||
| TeamCityExtension.getTeamCityProperty(project,"build.number", null)) | ||
| Properties ret = new Properties() | ||
| def gitCmd = SystemUtils.IS_OS_WINDOWS ? "git.exe" : "git" | ||
| if (project.hasProperty("includeVcs") && (!project.hasProperty("lkModule") || project.lkModule.getModProperties().get("VcsURL").isEmpty())) | ||
| if (project.hasProperty("includeVcs") && (!project.hasProperty("lkModule") || project.lkModule.getModProperties().get(VCS_URL_PROP_NAME).isEmpty())) | ||
| { | ||
| def url = "${gitCmd} -C ${project.projectDir.absolutePath} config --get remote.origin.url".execute().text.trim() | ||
| Matcher matcher = GIT_URL_WITH_TOKEN.matcher(url) | ||
| if (matcher.matches()) // Strip out the token if included in the URL. | ||
| url = matcher.group(1) + "@" + matcher.group(3) | ||
| ret.setProperty("VcsURL", url) | ||
| ret.setProperty(VCS_URL_PROP_NAME, url) | ||
| project.logger.info("${project.path} git url: ${url}") | ||
| def branch = "${gitCmd} -C ${project.projectDir.absolutePath} rev-parse --abbrev-ref HEAD".execute().text.trim() | ||
| project.logger.info("${project.path} git branch: ${branch}") | ||
| ret.setProperty("VcsBranch", branch) | ||
| ret.setProperty(VCS_BRANCH_PROP_NAME, branch) | ||
| def revision = "${gitCmd} -C ${project.projectDir.absolutePath} rev-parse @".execute().text.trim() | ||
| project.logger.info("${project.path} git revision: ${revision}") | ||
| ret.setProperty("VcsRevision", revision) | ||
| ret.setProperty(VCS_REVISION_PROP_NAME, revision) | ||
| def tag = "${gitCmd} -C ${project.projectDir.absolutePath} describe --tags --exact-match 2> /dev/null".execute().text.trim() | ||
| project.logger.info("${project.path} git tag: ${revision}") | ||
| if (!tag.isEmpty() && !tag.equals(revision)) | ||
| ret.setProperty("VcsTag", tag) | ||
| ret.setProperty(VCS_TAG_PROP_NAME, tag) | ||
| else | ||
| ret.setProperty("VcsTag", "")} | ||
| else | ||
| ret.setProperty(VCS_TAG_PROP_NAME, "")} | ||
| else if (!project.hasProperty("includeVcs")) | ||
| { | ||
| ret.setProperty("VcsBranch", "Unknown") | ||
| ret.setProperty("VcsTag", "Unknown") | ||
| ret.setProperty("VcsURL", "Unknown") | ||
| ret.setProperty("VcsRevision", "Unknown") | ||
| ret.setProperty(VCS_BRANCH_PROP_NAME, "Unknown") | ||
| ret.setProperty(VCS_TAG_PROP_NAME, "Unknown") | ||
| ret.setProperty(VCS_URL_PROP_NAME, "Unknown") | ||
| ret.setProperty(VCS_REVISION_PROP_NAME, "Unknown") | ||
| } | ||
| ret.setProperty("BuildNumber", buildNumber != null ? buildNumber : "Unknown") | ||
| ret.setProperty(BUILD_NUMBER_PROP_NAME, buildNumber != null ? buildNumber : "Unknown") | ||
| return ret | ||
| } | ||
|
|
||
|
|
@@ -594,7 +601,7 @@ class BuildUtils | |
|
|
||
| static void addModuleDistributionDependency(Project distributionProject, String depProjectPath, String config, boolean addTransitive) | ||
| { | ||
| if (distributionProject.configurations.findByName(config) == null) | ||
| if (distributionProject.configurations.named(config) == null) | ||
| distributionProject.configurations { | ||
| config | ||
| } | ||
|
|
@@ -613,16 +620,16 @@ class BuildUtils | |
| return | ||
|
|
||
| distributionProject.evaluationDependsOn(depProject.getPath()) | ||
| if (depProject.configurations.findByName("modules") != null) { | ||
| if (depProject.configurations.named("modules") != null) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this will work the same way.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, you are so right. I forgot about that. (You would think I might remember since it's really annoying that this throws an exception). |
||
| depProject.configurations.modules.dependencies.each { dep -> | ||
| if (dep instanceof ProjectDependency) | ||
| { | ||
| if (!pathsAdded.contains(dep.getPath())) { | ||
| distributionProject.logger.info("${distributionProject.path}: Adding '${config}' dependency on project ${dep}") | ||
| distributionProject.logger.info("${distributionProject.path}: Adding '${config}' dependency on ${dep}") | ||
| distributionProject.dependencies.add(config, dep) | ||
| distributionProject.evaluationDependsOn(dep.getPath()) | ||
| pathsAdded.add(dep.getPath()) | ||
| distributionProject.logger.debug("${distributionProject.path}: Adding recursive '${config}' dependenices from ${dep.getPath()}") | ||
| distributionProject.logger.info("${distributionProject.path}: Adding recursive '${config}' dependenices from ${dep.getPath()}") | ||
| addTransitiveModuleDependencies(distributionProject, depProject.project(dep.getPath()), config, pathsAdded) | ||
| } | ||
| } | ||
|
|
@@ -974,7 +981,7 @@ class BuildUtils | |
| { | ||
| try { | ||
| project.configurations.named(configName) { Configuration config -> | ||
| resolutionStrategy.dependencySubstitution { DependencySubstitutions ds -> | ||
| config.resolutionStrategy.dependencySubstitution { DependencySubstitutions ds -> | ||
| project.rootProject.subprojects { | ||
| Project p -> | ||
| { | ||
|
|
@@ -985,7 +992,7 @@ class BuildUtils | |
| p.plugins.hasPlugin('org.labkey.build.javaModule') | ||
| ) { | ||
| ds.substitute ds.module("org.labkey.module:${p.name}") using ds.project(p.path) | ||
| p.logger.debug("Substituting org.labkey.module:${p.name} with ${p.path}") | ||
| p.logger.info("Substituting org.labkey.module:${p.name} with ${p.path}") | ||
| } | ||
| // if (p.plugins.hasPlugin('org.labkey.build.api')) | ||
| // { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could use
maybeCreate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done.