Skip to content

Commit 539249d

Browse files
Replace buildDir with layout.buildDirectory and add an excludedModules property (#621)
1 parent 8e7c4bf commit 539249d

File tree

7 files changed

+35
-19
lines changed

7 files changed

+35
-19
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ allprojects {
2222
// Comment in to enable the tasks for owasp dependency checking
2323
apply plugin: 'org.owasp.dependencycheck'
2424
dependencyCheck {
25-
outputDirectory = "${project.rootProject.buildDir}/reports/dependencyCheck/${project.path.replaceAll(':', '_').substring(1)}"
25+
outputDirectory = project.rootProject.layout.buildDirectory.file("reports/dependencyCheck/${project.path.replaceAll(':', '_').substring(1)}").get().asFile
2626
suppressionFile = "${project.rootProject.rootDir}/dependencyCheckSuppression.xml"
2727
analyzers {
2828
assemblyEnabled = false // Sets whether the .NET Assembly Analyzer should be used.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ windowsProteomicsBinariesVersion=1.0
6262
# The current version numbers for the gradle plugins.
6363
artifactoryPluginVersion=4.31.9
6464
gradleNodePluginVersion=3.5.1
65-
gradlePluginsVersion=1.42.2
65+
gradlePluginsVersion=1.43.0
6666
owaspDependencyCheckPluginVersion=8.4.2
6767
versioningPluginVersion=1.1.2
6868

gradle/settings/all.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,22 @@ import org.labkey.gradle.util.BuildUtils
4949
/*
5050
This settings file include all currently enlisted modules and API projects (JDBC, Java, SAS).
5151
*/
52-
List<String> excludedDirs = ["test"]
52+
List<String> exclusions = ["test"]
5353

5454
if (hasProperty('gradleExcludeModuleDirs'))
5555
{
5656
excludedDirs.addAll("${gradleExcludeModuleDirs}".toLowerCase().split(","))
5757
}
58+
if (hasProperty('excludedModules'))
59+
exclusions.addAll("${excludedModules}".split(","))
5860

5961
// Include ':server:embedded' unless explicitly excluded
60-
if (!excludedDirs.contains("embedded"))
62+
if (!exclusions.contains("embedded"))
6163
{
6264
include BuildUtils.getEmbeddedProjectPath(gradle)
6365
}
6466

65-
BuildUtils.includeModules(this.settings, rootDir, ["server/modules"], excludedDirs, true)
67+
BuildUtils.includeModules(this.settings, rootDir, ["server/modules"], exclusions, true)
6668

6769
// include the test distribution, which is used to create an artifact for TeamCity to pass around to the agents
6870
include "${BuildUtils.getTestProjectPath(this.settings.gradle)}:distributions:teamcity"

gradle/settings/distributions.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ import org.labkey.gradle.util.BuildUtils
4444

4545
apply from: 'all.gradle'
4646

47-
BuildUtils.includeModules(this.settings, rootDir, ["distributions"], [])
47+
List<String> excludedModules = []
48+
if (hasProperty('excludedModules'))
49+
excludedModules.addAll("${excludedModules}".split(","))
50+
51+
BuildUtils.includeModules(this.settings, rootDir, ["distributions"], excludedModules)

gradle/settings/ehr.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ List<String> ehrModulesDirs = [
5757
"server/modules/LabDevKitModules"
5858
]
5959

60-
BuildUtils.includeModules(this.settings, rootDir, [BuildUtils.PLATFORM_MODULES_DIR, BuildUtils.COMMON_ASSAYS_MODULES_DIR], [])
61-
BuildUtils.includeModules(this.settings, rootDir, ehrModulesDirs, [])
60+
List<String> excludedModules = []
61+
if (hasProperty('excludedModules'))
62+
excludedModules.addAll("${excludedModules}".split(","))
63+
64+
65+
BuildUtils.includeModules(this.settings, rootDir, [BuildUtils.PLATFORM_MODULES_DIR, BuildUtils.COMMON_ASSAYS_MODULES_DIR], excludedModules)
66+
BuildUtils.includeModules(this.settings, rootDir, ehrModulesDirs, excludedModules)
6267

6368
include ":server:modules:snd"
6469
include ":server:modules:tnprc_ehr"

server/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ project.tasks.register("tomcatLibsZip", Zip) {
4040
zip.description = "produce jar file with jars to be deployed in \$CATALINA_HOME/lib"
4141
zip.from project.configurations.tomcatJars.getAsFileTree()
4242
zip.archiveBaseName.set("tomcat-libs")
43-
zip.destinationDirectory = project.file(project.labkey.explodedModuleLibDir)
43+
zip.destinationDirectory.set(project.file(project.labkey.explodedModuleLibDir))
4444
}
4545

4646
configurations
@@ -210,8 +210,8 @@ tasks.register('createModule', CreateModule) {
210210
// Each project that requires node will have its own downloaded version of node and npm, but for the symlinkNode
211211
// task we need a single location, and one that works even when not building from source (Issue 35207)
212212
project.node {
213-
workDir = project.file("${project.rootProject.buildDir}/.node")
214-
npmWorkDir = project.file("${project.rootProject.buildDir}/.node")
215-
yarnWorkDir = project.file("${project.rootProject.buildDir}/.node")
213+
workDir = BuildUtils.getRootBuildDirFile(project, ".node")
214+
npmWorkDir = BuildUtils.getRootBuildDirFile(project, ".node")
215+
yarnWorkDir = BuildUtils.getRootBuildDirFile(project, ".node")
216216
}
217217
project.tasks.named('deployApp').configure { dependsOn(project.tasks.npmSetup) }

settings.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,28 @@ if (hasProperty("useEmbeddedTomcat"))
103103

104104
include BuildUtils.getMinificationProjectPath(gradle)
105105

106+
// A list of directory names or fully qualified module paths that correspond to modules to be excluded from configuration.
107+
// Items may be individual module names (e.g. 'luminex'), module container names (e.g. 'customModules'), or paths (e.g., ':server:modules:commonAssays:flow')
108+
// You must make sure to pass this list to the appropriate calls to `BuildUtils.includeModules`
109+
List<String> excludedModules = []
110+
if (hasProperty('excludedModules'))
111+
{
112+
excludedModules.addAll("${excludedModules}".split(","))
113+
}
114+
106115
if (new File(getRootDir(), BuildUtils.convertPathToRelativeDir(BuildUtils.getPlatformProjectPath(gradle))).exists()
107116
&& !hasProperty('excludeBaseModules'))
108117
{
109118
// The line below includes the set of modules for a minimally functional LabKey server
110-
BuildUtils.includeBaseModules(this.settings)
119+
BuildUtils.includeBaseModules(this.settings, excludedModules)
111120

112121
// Some test modules require base modules to build JSPs.
113122
// TODO: Un-nest this 'if' once test modules can build without platform present.
114123
if (new File(getRootDir(), BuildUtils.convertPathToRelativeDir(BuildUtils.getTestProjectPath(gradle))).exists()
115124
&& !hasProperty('excludeTestModules'))
116125
{
117126
// The line below will include the server/testAutomation project as well as the server/testAutomation/modules projects
118-
BuildUtils.includeTestModules(this.settings, rootDir)
127+
BuildUtils.includeTestModules(this.settings, rootDir, excludedModules)
119128
}
120129
}
121130
else if (new File(getRootDir(), BuildUtils.convertPathToRelativeDir(BuildUtils.getTestProjectPath(gradle))).exists())
@@ -149,10 +158,6 @@ else if (hasProperty('moduleSet'))
149158
}
150159
else
151160
{
152-
// A list of directory names that correspond to modules to be excluded from configuration.
153-
// Items may be individual module names (e.g. 'luminex') or module container names (e.g. 'customModules')
154-
// You must make sure to pass this list to the appropriate calls to `BuildUtils.includeModules`
155-
List<String> excludedModules = []
156161

157162
// The line below recursively includes all modules in server/modules
158163
BuildUtils.includeModules(this.settings, rootDir, [BuildUtils.SERVER_MODULES_DIR], excludedModules, true)
@@ -188,7 +193,7 @@ if (hasProperty('extraIncludes'))
188193

189194
if (hasProperty('extraModuleDirs'))
190195
{
191-
BuildUtils.includeModules(this.settings, rootDir, Arrays.asList("${extraModuleDirs}".split(",")), [])
196+
BuildUtils.includeModules(this.settings, rootDir, Arrays.asList("${extraModuleDirs}".split(",")), excludedModules)
192197
}
193198

194199
if (hasProperty('inheritedDistPath'))

0 commit comments

Comments
 (0)