Skip to content
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

Remove redundant plugin identifiers and other misc changes #190

Merged
merged 12 commits into from
Jan 9, 2024
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ on how to do that, including how to develop and test locally and the versioning

_Note: 1.28.0 and later require Gradle 7_

### 2.0.0
*Released*: TBD
(Earliest compatible LabKey version: 24.2)
* Remove redundant plugin identifiers using org.labkey namespace instead of org.labkey.build
(e.g., org.labkey.module removed in favor of org.labkey.build.module)
* Add support for using the net.nemerosa.versioning plugin directly instead of our forked version
* Update dependency versions
* Add `substituteModuleDependecies` utility method for experimentation with some dependency substitution ([Issue 49316](https://www.labkey.org/home/Developer/issues/Secure/issues-details.view?issueId=49316))

### 1.44.1
*Released*: 28 December 2023
(Earliest compatible LabKey version: 23.3)
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ dependencies {
}

group 'org.labkey.build'
project.version = "1.45.0-SNAPSHOT"
project.version = "1.45.0-miscMaintenance-SNAPSHOT"

gradlePlugin {
// TODO after transitioning to using these plugin ids, remove the properties files from resources/META-INF.gradle-plugins
plugins {
antBuild {
id = 'org.labkey.build.antBuild'
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ artifactory_contextUrl=https://labkey.jfrog.io/artifactory

artifactoryPluginVersion=4.28.2

commonsIoVersion=2.11.0
commonsLang3Version=3.12.0
commonsTextVersion=1.10.0
commonsIoVersion=2.15.1
commonsLang3Version=3.14.0
commonsTextVersion=1.11.0

grgitGradleVersion=5.0.0
graphqlJavaVersion=21.0
grgitGradleVersion=5.2.1
graphqlJavaVersion=21.3

httpclientVersion=4.5.14
httpcoreVersion=4.4.16

jacksonVersion=2.14.1
jsonVersion=20230227
jacksonVersion=2.16.1
jsonVersion=20231013
6 changes: 4 additions & 2 deletions src/main/groovy/org/labkey/gradle/plugin/LabKey.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.labkey.gradle.util.BuildUtils
/**
* Defines a set of extension properties for ease of reference. This also adds a two extensions
* for some basic properties.
* Created by susanh on 4/13/16.
*/
class LabKey implements Plugin<Project>
{
Expand All @@ -38,7 +37,10 @@ class LabKey implements Plugin<Project>
{
if (project.hasProperty('includeVcs'))
{
project.apply plugin: 'org.labkey.versioning'
if (project.hasProperty('nemerosaVersioningPluginVersion'))
project.apply plugin: 'net.nemerosa.versioning'
else
project.apply plugin: 'org.labkey.versioning'
}

project.group = LabKeyExtension.LABKEY_GROUP
Expand Down
6 changes: 1 addition & 5 deletions src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,8 @@ class DoThenSetup extends DefaultTask
line = line.replace("#server.ssl", "server.ssl")
}
if (project.hasProperty("useLocalBuild")) {
// Let properties file specify which properties require 'useLocalBuild'
// Enable properties that require 'useLocalBuild' (e.g. 'context.webAppLocation' and 'spring.devtools.restart.additional-paths')
line = line.replace("#useLocalBuild#", "")

// Old method enables specific properties for 'useLocalBuild' (before 24.1)
line = line.replace("#context.webAppLocation=", "context.webAppLocation=")
line = line.replace("#spring.devtools.restart.additional-paths=", "spring.devtools.restart.additional-paths=")
}
else {
// Remove placeholder
Expand Down
68 changes: 67 additions & 1 deletion src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
*/
package org.labkey.gradle.util

import org.ajoberstar.grgit.Grgit
import org.ajoberstar.grgit.Remote
import org.apache.commons.lang3.StringUtils
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.UnknownDomainObjectException
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.DependencySubstitutions
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.initialization.Settings
Expand Down Expand Up @@ -503,6 +508,25 @@ class BuildUtils
ret.setProperty("VcsRevision", vcsProject.versioning.info.commit)
ret.setProperty("BuildNumber", buildNumber != null ? buildNumber : vcsProject.versioning.info.build)
}
else if (project.plugins.hasPlugin("net.nemerosa.versioning"))
{
// In our fork of the plugin (above), we added the url property to the VersioningInfo object
Project vcsProject = project
String url = getGitUrl(vcsProject)
while (url == null && vcsProject != project.rootProject)
{
vcsProject = vcsProject.parent
url = getGitUr(vcsProject)
}
vcsProject.println("${project.path} versioning info ${ vcsProject.versioning.info}")
ret.setProperty("VcsURL", url)
if (vcsProject.versioning.info.branch != null)
ret.setProperty("VcsBranch", vcsProject.versioning.info.branch)
if (vcsProject.versioning.info.tag != null)
ret.setProperty("VcsTag", vcsProject.versioning.info.tag)
ret.setProperty("VcsRevision", vcsProject.versioning.info.commit)
ret.setProperty("BuildNumber", buildNumber != null ? buildNumber : vcsProject.versioning.info.build)
}
else
{
ret.setProperty("VcsBranch", "Unknown")
Expand All @@ -525,6 +549,19 @@ class BuildUtils
'tomcat7-websocket'
]

static String getGitUrl(Project project)
{
def grgit = Grgit.open(currentDir: project.projectDir)
List<Remote> remotes = grgit.remote.list()
grgit.close()
if (remotes) {
return remotes.get(0).url
} else {
return null
}

}

static void setTomcatLibs(List<String> libs)
{
TOMCAT_LIBS = new ArrayList(libs)
Expand Down Expand Up @@ -607,7 +644,6 @@ class BuildUtils
distributionProject.logger.info("${distributionProject.path}: Adding ${config} dependency on artifact ${dep}")
distributionProject.dependencies.add(config, dep)
}

}
}
}
Expand Down Expand Up @@ -888,4 +924,34 @@ class BuildUtils
return project.rootProject.layout.buildDirectory.get().asFile.path
}

static void substituteModuleDependencies(Project project, String configName)
{
try {
project.configurations.named(configName) { Configuration config ->
resolutionStrategy.dependencySubstitution { DependencySubstitutions ds ->
project.rootProject.subprojects {
Project p ->
{
p.logger.debug("Considering substitution for ${p.path}.")
if (shouldBuildFromSource(p)) {
if (p.plugins.hasPlugin('org.labkey.build.module') ||
p.plugins.hasPlugin('org.labkey.build.fileModule') ||
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}")
}
// if (p.plugins.hasPlugin('org.labkey.build.api'))
// {
// ds.substitute ds.module("org.labkey.api:${p.name}") using ds.project(p.path)
// }
}
}
}
}
}
} catch (UnknownDomainObjectException ignore) {
project.logger.debug("No ${configName} configuration found for ${project.path}.")
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.