From b177ba19fbbc389a9e776024e3d07844602e25a7 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 08:22:47 -0700 Subject: [PATCH 01/26] Add issue reference --- src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy index 17ae9ebb..27e0e15e 100644 --- a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy +++ b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy @@ -941,6 +941,7 @@ class BuildUtils return project.rootProject.layout.buildDirectory.get().asFile.path } + // See Issue 49316: https://www.labkey.org/home/Developer/issues/Secure/issues-details.view?issueId=49316 static void substituteModuleDependencies(Project project, String configName) { try { From ba326c3b27eac217d85c38f6fa66cb8cf0f7c6ff Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 08:23:18 -0700 Subject: [PATCH 02/26] Use "named" instead of "findByName" for configuration avoidance --- .../labkey/gradle/plugin/FileModule.groovy | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy index 37f30fef..0cbf9c2a 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy @@ -19,6 +19,8 @@ import org.gradle.api.GradleException import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.UnknownDomainObjectException +import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.file.CopySpec @@ -431,24 +433,29 @@ class FileModule implements Plugin // This is done after the project is evaluated otherwise the dependencies for the modules configuration will not have been added yet. project.afterEvaluate({ BuildUtils.addLabKeyDependency(project: serverProject, config: 'modules', depProjectPath: project.path, depProjectConfig: 'published', depExtension: 'module') - if (project.configurations.findByName("modules") != null) - project.configurations.modules.dependencies.each { - Dependency dep -> - if (dep instanceof ProjectDependency) - { - ProjectDependency projectDep = (ProjectDependency) dep - if (shouldDoBuild(projectDep.dependencyProject, false)) { - BuildUtils.addLabKeyDependency(project: serverProject, config: 'modules', depProjectPath: projectDep.dependencyProject.getPath(), depProjectConfig: 'published', depExtension: 'module') - } - else { - serverProject.dependencies.add("modules", BuildUtils.getLabKeyArtifactName(project, projectDep.dependencyProject.getPath(), projectDep.version, "module")) - } - } - else - { - serverProject.dependencies.add("modules", dep) + try { + project.configurations.named("modules") { + Configuration config -> { + config.dependencies.each { + Dependency dep -> + if (dep instanceof ProjectDependency) { + ProjectDependency projectDep = (ProjectDependency) dep + if (shouldDoBuild(projectDep.dependencyProject, false)) { + BuildUtils.addLabKeyDependency(project: serverProject, config: 'modules', depProjectPath: projectDep.dependencyProject.getPath(), depProjectConfig: 'published', depExtension: 'module') + BuildUtils.addLabKeyDependency(project: serverProject, config: 'builtModules', depProjectPath: projectDep.dependencyProject.getPath(), depProjectConfig: 'published', depExtension: 'module') + } else { + serverProject.dependencies.add("modules", BuildUtils.getLabKeyArtifactName(project, projectDep.dependencyProject.getPath(), projectDep.version, "module")) + serverProject.dependencies.add("downloadedModules", BuildUtils.getLabKeyArtifactName(project, projectDep.dependencyProject.getPath(), projectDep.version, "module")) + } + } else { + serverProject.dependencies.add("modules", dep) + serverProject.dependencies.add("downloadedModules", dep) + } } + } } + + } catch (UnknownDomainObjectException ignore) { } }) } From efb1aac4ff9cff06dc5ed430c48d5568eaf96c6b Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 08:24:21 -0700 Subject: [PATCH 03/26] Remove `checkModuleTasks` task and update `stageModules` to not use deprecated `fileCollection` method --- README.md | 2 + build.gradle | 2 +- .../labkey/gradle/plugin/ServerDeploy.groovy | 77 +++++++------------ 3 files changed, 30 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 64ec401d..ffa3f385 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ on how to do that, including how to develop and test locally and the versioning (Earliest compatible LabKey version: 24.11) - Stop adding the standalone `VERSION` file to distribution archives; the `distribution.properties` file now contains the `version` and `buildUrl` properties that `EmbeddedExtractor.java` reads. +- Remove `checkModuleTasks` tasks, added to get us through a transition from plugins being declared more centrally +- Update `stageModules` to remove use of deprecated `fileCollection` method ### 4.2.0 *Released*: 11 October 2024 diff --git a/build.gradle b/build.gradle index c971ad14..bb6d443c 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ dependencies { } group 'org.labkey.build' -project.version = "4.3.0-SNAPSHOT" +project.version = "4.3.0-configCache-SNAPSHOT" gradlePlugin { plugins { diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index 72c007fb..ed702d99 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -16,19 +16,15 @@ package org.labkey.gradle.plugin import org.apache.commons.lang3.SystemUtils -import org.gradle.api.UnknownTaskException import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.DefaultTask import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.Dependency import org.gradle.api.file.CopySpec import org.gradle.api.file.DeleteSpec import org.gradle.api.file.FileCollection -import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency -import org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency import org.gradle.api.tasks.Delete import org.labkey.gradle.plugin.extension.ServerDeployExtension import org.labkey.gradle.plugin.extension.StagingExtension @@ -66,6 +62,17 @@ class ServerDeploy implements Plugin project.evaluationDependsOn(BuildUtils.getEmbeddedProjectPath(project.gradle)) addTasks(project) + addConfigurations(project) + } + + private void addConfigurations(project) + { + project.configurations + { + builtModules + downloadedModules + } + } private void addTasks(Project project) @@ -81,9 +88,6 @@ class ServerDeploy implements Plugin StagingExtension staging = project.getExtensions().getByType(StagingExtension.class) - // The staging step complicates things, but it is currently needed for the following reasons: - // - We want to make sure tomcat doesn't restart multiple times when deploying the application. - // (seems like it could be avoided as the copy being done here is just as atomic as the copy from deployModules) project.tasks.register("stageModules") { Task task -> task.group = GroupNames.DEPLOY @@ -94,17 +98,18 @@ class ServerDeploy implements Plugin task.doLast( { // copy over the module dependencies first (things not built from source that might bring in // transitive dependencies) - FileCollection remoteModules = project.configurations.modules.fileCollection ({ - Dependency dependency -> dependency instanceof DefaultExternalModuleDependency - }) - if (!remoteModules.isEmpty()) + if (!project.configurations.downloadedModules.dependencies.isEmpty()) { - project.ant.copy( + task.ant.copy( todir: staging.modulesDir, preserveLastModified: true // this is important so we don't re-explode modules that have not changed ) { - remoteModules.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) + project.configurations.downloadedModules + { + Configuration config -> + config.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) + } } } @@ -114,18 +119,20 @@ class ServerDeploy implements Plugin // what it is designed for, but that allows substitution of a project for an ExternalModuleDependency // and since a .module file is only one of the artifacts produced by our projects (e.g., :server:modules:platform:experiment) // and is not the default artifact, DependencySubstitution does not seem to work. - FileCollection localModules = project.configurations.modules.fileCollection ({ - Dependency dependency -> dependency instanceof DefaultProjectDependency - }) - if (!localModules.isEmpty()) + // See BuildUtils.substituteModuleDependencies for an almost-working attempt at this. + if (!project.configurations.builtModules.dependencies.isEmpty()) { - project.ant.copy( + task.ant.copy( overwrite: true, // overwrite existing files even if the destination files are newer todir: staging.modulesDir, preserveLastModified: true // this is important so we don't re-explode modules that have not changed ) { - localModules.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) + project.configurations.builtModules + { + Configuration config -> + config.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) + } } } }) @@ -189,7 +196,7 @@ class ServerDeploy implements Plugin task.description = "Copy files needed for using remote pipeline jobs into ${staging.pipelineLibDir}" task.doLast({ if (!project.configurations.remotePipelineJars.getFiles().isEmpty()) { - project.ant.copy( + task.ant.copy( todir: staging.pipelineLibDir, preserveLastModified: true ) @@ -321,36 +328,6 @@ class ServerDeploy implements Plugin } project.tasks.named('deployApp').configure {mustRunAfter(project.tasks.cleanBuild)} - // TODO is this still useful? - project.tasks.register( - 'checkModuleTasks', DefaultTask) { - DefaultTask task -> - task.group = GroupNames.MODULE - task.description = "Verify that all modules with module.properties files have a module task" - task.doLast({ - String[] projectsMissingTasks = [] - project.subprojects({ - Project sub -> - if (sub.file("module.properties").exists()) { - try { - sub.tasks.named("module") - } catch (UnknownTaskException ignore) { - projectsMissingTasks += sub.path - } - } - }) - if (projectsMissingTasks.length > 0) - project.logger.quiet("Each of the following projects has a 'module.properties' file but no 'module' task. " + - "These modules will not be included in the deployed server. " + - "You should apply either the 'org.labkey.build.fileModule' or 'org.labkey.build.module' plugin in each project's 'build.gradle' file. " + - "See https://www.labkey.org/Documentation/wiki-page.view?name=gradleModules for more information.\n\t" + - "${projectsMissingTasks.join("\n\t")}") - - }) - task.notCompatibleWithConfigurationCache("Needs to walk the project tree") - } - project.tasks.named('deployApp').configure {dependsOn(project.tasks.named("checkModuleTasks"))} - project.tasks.named('checkModuleTasks').configure {mustRunAfter(project.tasks.stageApp)} // do this so the message appears at the bottom of the output project.tasks.named("cleanBuild").configure { it.dependsOn(project.tasks.stopTomcat) } From 90cf71fa6aa3edb1752cdc37c2e7e32a76f3a00b Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 10:57:56 -0700 Subject: [PATCH 04/26] Create `StageModules` task class that is (more?) compatible with configuration cache --- README.md | 3 +- .../labkey/gradle/plugin/ServerDeploy.groovy | 51 ++------------ .../labkey/gradle/task/StageModules.groovy | 67 +++++++++++++++++++ 3 files changed, 73 insertions(+), 48 deletions(-) create mode 100644 src/main/groovy/org/labkey/gradle/task/StageModules.groovy diff --git a/README.md b/README.md index ffa3f385..141cd86f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ on how to do that, including how to develop and test locally and the versioning - Stop adding the standalone `VERSION` file to distribution archives; the `distribution.properties` file now contains the `version` and `buildUrl` properties that `EmbeddedExtractor.java` reads. - Remove `checkModuleTasks` tasks, added to get us through a transition from plugins being declared more centrally -- Update `stageModules` to remove use of deprecated `fileCollection` method +- Update `stageModules` to remove use of deprecated `fileCollection` method and make compatible with configuration cache +- Make `jsp2Java` compatible with configuration cache ### 4.2.0 *Released*: 11 October 2024 diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index ed702d99..0d3c003b 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -88,56 +88,13 @@ class ServerDeploy implements Plugin StagingExtension staging = project.getExtensions().getByType(StagingExtension.class) - project.tasks.register("stageModules") { - Task task -> + project.tasks.register("stageModules", StageModules) { + StageModules task -> task.group = GroupNames.DEPLOY task.description = "Stage the modules for the application into ${staging.dir}" - task.doFirst({ - project.delete staging.modulesDir - }) - task.doLast( { - // copy over the module dependencies first (things not built from source that might bring in - // transitive dependencies) - if (!project.configurations.downloadedModules.dependencies.isEmpty()) - { - task.ant.copy( - todir: staging.modulesDir, - preserveLastModified: true // this is important so we don't re-explode modules that have not changed - ) - { - project.configurations.downloadedModules - { - Configuration config -> - config.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) - } - } - } - - // Then copy over the project dependencies (things built from source) so they will replace - // any transitive dependencies that were brought in). - // One might like to do this overriding/overwriting using DependencySubstitution, as that is very much - // what it is designed for, but that allows substitution of a project for an ExternalModuleDependency - // and since a .module file is only one of the artifacts produced by our projects (e.g., :server:modules:platform:experiment) - // and is not the default artifact, DependencySubstitution does not seem to work. - // See BuildUtils.substituteModuleDependencies for an almost-working attempt at this. - if (!project.configurations.builtModules.dependencies.isEmpty()) - { - task.ant.copy( - overwrite: true, // overwrite existing files even if the destination files are newer - todir: staging.modulesDir, - preserveLastModified: true // this is important so we don't re-explode modules that have not changed - ) - { - project.configurations.builtModules - { - Configuration config -> - config.addToAntBuilder(project.ant, "fileset", FileCollection.AntType.FileSet) - } - } - } - }) + task.downloadedModules.setFrom(project.configurations.downloadedModules) + task.builtModules.setFrom(project.configurations.builtModules) } - project.tasks.named('stageModules').configure {dependsOn project.configurations.modules} project.tasks.register("checkModuleVersions", CheckForVersionConflicts) { CheckForVersionConflicts task -> diff --git a/src/main/groovy/org/labkey/gradle/task/StageModules.groovy b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy new file mode 100644 index 00000000..5119b785 --- /dev/null +++ b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy @@ -0,0 +1,67 @@ +package org.labkey.gradle.task + +import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.file.FileCollection +import org.gradle.api.file.FileSystemOperations +import org.gradle.api.tasks.InputFiles +import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.extension.StagingExtension +import org.labkey.gradle.util.BuildUtils + +import javax.inject.Inject + +abstract class StageModules extends DefaultTask +{ + @Inject abstract FileSystemOperations getFs() + + @OutputDirectory + final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$StagingExtension.STAGING_MODULES_DIR")) + + @InputFiles + abstract ConfigurableFileCollection getDownloadedModules() + + @InputFiles + abstract ConfigurableFileCollection getBuiltModules() + + @TaskAction + void action() + { + fs.delete({ + it.delete(stagingModulesDir.get()) + }) + // copy over the module dependencies first (things not built from source that might bring in + // transitive dependencies) + if (!getDownloadedModules().isEmpty()) + { + ant.copy( + todir: stagingModulesDir.get(), + preserveLastModified: true // this is important so we don't re-explode modules that have not changed + ) + { + getDownloadedModules().addToAntBuilder(ant, "fileset", FileCollection.AntType.FileSet) + } + } + + // Then copy over the project dependencies (things built from source) so they will replace + // any transitive dependencies that were brought in). + // One might like to do this overriding/overwriting using DependencySubstitution, as that is very much + // what it is designed for, but that allows substitution of a project for an ExternalModuleDependency + // and since a .module file is only one of the artifacts produced by our projects (e.g., :server:modules:platform:experiment) + // and is not the default artifact, DependencySubstitution does not seem to work. + // See BuildUtils.substituteModuleDependencies for an almost-working attempt at this. + if (!getBuiltModules().isEmpty()) + { + ant.copy( + overwrite: true, // overwrite existing files even if the destination files are newer + todir: stagingModulesDir.get(), + preserveLastModified: true // this is important so we don't re-explode modules that have not changed + ) + { + getBuiltModules().addToAntBuilder(ant, "fileset", FileCollection.AntType.FileSet) + } + } + } +} From b09a619c24a10b3017fd03f8c7565e25e5f4091f Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 10:58:23 -0700 Subject: [PATCH 05/26] Relocate onlyIf configuration for writeDependenciesList task --- .../groovy/org/labkey/gradle/plugin/ModuleResources.groovy | 7 +++++-- .../org/labkey/gradle/task/WriteDependenciesFile.groovy | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/ModuleResources.groovy b/src/main/groovy/org/labkey/gradle/plugin/ModuleResources.groovy index ea8270f1..8e590c3a 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ModuleResources.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ModuleResources.groovy @@ -41,9 +41,12 @@ class ModuleResources Provider> artifacts = config.getIncoming().getArtifacts().getResolvedArtifacts(); task.getArtifactIds().set(artifacts.map(new WriteDependenciesFile.IdExtractor())) } - task.externalDependencies.set(project.extensions.findByType(ModuleExtension.class).getExternalDependencies()) + def externals = project.extensions.findByType(ModuleExtension.class).getExternalDependencies() + task.externalDependencies.set(externals) + task.onlyIf { + return !externals.isEmpty() + } } catch (UnknownDomainObjectException ignore) { - } } diff --git a/src/main/groovy/org/labkey/gradle/task/WriteDependenciesFile.groovy b/src/main/groovy/org/labkey/gradle/task/WriteDependenciesFile.groovy index 70f3d76b..4b32a59b 100644 --- a/src/main/groovy/org/labkey/gradle/task/WriteDependenciesFile.groovy +++ b/src/main/groovy/org/labkey/gradle/task/WriteDependenciesFile.groovy @@ -57,13 +57,13 @@ abstract class WriteDependenciesFile extends DefaultTask { this.inputs.file(project.file("gradle.properties")) } - onlyIf { - !externalDependencies.get().isEmpty() - } } private void writeDependencies(OutputStreamWriter writer) { + if (externalDependencies.get().isEmpty()) + return + List missing = [] List licenseMissing = [] Map dependencies = externalDependencies.get() From e3889be31dc4b783ea413b8de2168acfcd2b65e2 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 10:58:46 -0700 Subject: [PATCH 06/26] Make jsp2Java compatible with configuration cache --- .../org/labkey/gradle/plugin/Jsp.groovy | 4 --- .../labkey/gradle/task/JspCompile2Java.groovy | 28 ++++++++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/Jsp.groovy b/src/main/groovy/org/labkey/gradle/plugin/Jsp.groovy index b6c39e55..a2ebb656 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/Jsp.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/Jsp.groovy @@ -153,10 +153,6 @@ class Jsp implements Plugin task.dependsOn('jar') } - project.tasks.named('jsp2Java') { - notCompatibleWithConfigurationCache("ant.jasper doesn't seem completely compatible") - } - project.tasks.named('compileJspJava').configure { Task task -> task.dependsOn project.tasks.jsp2Java diff --git a/src/main/groovy/org/labkey/gradle/task/JspCompile2Java.groovy b/src/main/groovy/org/labkey/gradle/task/JspCompile2Java.groovy index 660a1c0c..7a316189 100644 --- a/src/main/groovy/org/labkey/gradle/task/JspCompile2Java.groovy +++ b/src/main/groovy/org/labkey/gradle/task/JspCompile2Java.groovy @@ -21,8 +21,16 @@ import org.gradle.api.GradleException import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.FileSystemOperations -import org.gradle.api.tasks.* -import org.labkey.gradle.util.BuildUtils +import org.gradle.api.provider.Property +import org.gradle.api.tasks.CacheableTask +import org.gradle.api.tasks.CompileClasspath +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.InputFiles +import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +import org.gradle.api.tasks.TaskAction import javax.inject.Inject @@ -33,6 +41,12 @@ abstract class JspCompile2Java extends DefaultTask private FileSystemOperations fileSystemOperations + @Input + final abstract Property targetCompatibility = project.objects.property(String).convention((String) project.property('targetCompatibility')) + + @Input + final abstract Property sourceCompatibility = project.objects.property(String).convention((String) project.property('sourceCompatibility')) + @PathSensitive(PathSensitivity.RELATIVE) @InputDirectory File webappDirectory @@ -51,11 +65,11 @@ abstract class JspCompile2Java extends DefaultTask @TaskAction - void compile() { - + void compile() + { if (!webappDirectory.exists()) { - project.logger.info("${webappDirectory.getAbsolutePath()}: no such file or directory. Nothing to do here.") + logger.info("${webappDirectory.getAbsolutePath()}: no such file or directory. Nothing to do here.") return } @@ -85,8 +99,8 @@ abstract class JspCompile2Java extends DefaultTask uriroot: "${webappDirectory.getAbsolutePath()}", outputDir: getClassesDirectory().get(), package: "org.labkey.jsp.compiled", - compilerTargetVM: project.targetCompatibility, - compilerSourceVM: project.sourceCompatibility, + compilerTargetVM: targetCompatibility.get(), + compilerSourceVM: sourceCompatibility.get(), compile: false, listErrors: true ) From 6d94c03e29c0b059ddfdfb06ff100727d400240f Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 16:32:19 -0700 Subject: [PATCH 07/26] separate task for CopyToExplodedLib --- .../gradle/task/CopyToExplodedLib.groovy | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy diff --git a/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy b/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy new file mode 100644 index 00000000..76258790 --- /dev/null +++ b/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy @@ -0,0 +1,38 @@ +package org.labkey.gradle.task + +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.file.FileSystemOperations +import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.JavaModule +import org.labkey.gradle.plugin.extension.LabKeyExtension +import org.labkey.gradle.util.BuildUtils +import org.labkey.gradle.util.TaskUtils + +import javax.inject.Inject + +abstract class CopyToExplodedLib extends DefaultTask +{ + @Inject abstract FileSystemOperations getFs() + + @OutputDirectory + final abstract DirectoryProperty explodedModuleLibDir = project.objects.directoryProperty() + .convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$LabKeyExtension.EXPLODED_MODULE_DIR_NAME/lib")) + + @TaskAction + void action() + { + File libDir = explodedModuleLibDir.getAsFile().get() + if (libDir.exists()) + libDir.delete() + List copyFromTasks = JavaModule.JAR_TASK_NAMES + "copyExternalLibs" + fs.copy { + into explodedModuleLibDir.get() + for (String taskName : copyFromTasks) + TaskUtils.doIfTaskPresent(project, taskName, inputTask -> { + from inputTask + }) + } + } +} From 49ab1db41d3fa1abc8c7fc03c7ec1526f34f5271 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 16:56:30 -0700 Subject: [PATCH 08/26] Mark populateExplodedLib as incompatible with configuration cache for now --- .../labkey/gradle/plugin/JavaModule.groovy | 9 ++--- .../gradle/task/CopyToExplodedLib.groovy | 38 ------------------- 2 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy diff --git a/src/main/groovy/org/labkey/gradle/plugin/JavaModule.groovy b/src/main/groovy/org/labkey/gradle/plugin/JavaModule.groovy index 538726d1..0e6fe16d 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/JavaModule.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/JavaModule.groovy @@ -156,12 +156,9 @@ class JavaModule implements Plugin copy.from task }) } - populateLib.configure { - it.doFirst { - File explodedLibDir = new File(project.labkey.explodedModuleLibDir) - if (explodedLibDir.exists()) - explodedLibDir.delete() - } + + project.tasks.named('populateExplodedLib') { + notCompatibleWithConfigurationCache("Need to figure out how to make the inputs from the optional tasks work.") } project.tasks.named('module').configure {dependsOn(populateLib)} diff --git a/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy b/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy deleted file mode 100644 index 76258790..00000000 --- a/src/main/groovy/org/labkey/gradle/task/CopyToExplodedLib.groovy +++ /dev/null @@ -1,38 +0,0 @@ -package org.labkey.gradle.task - -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.file.FileSystemOperations -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.TaskAction -import org.labkey.gradle.plugin.JavaModule -import org.labkey.gradle.plugin.extension.LabKeyExtension -import org.labkey.gradle.util.BuildUtils -import org.labkey.gradle.util.TaskUtils - -import javax.inject.Inject - -abstract class CopyToExplodedLib extends DefaultTask -{ - @Inject abstract FileSystemOperations getFs() - - @OutputDirectory - final abstract DirectoryProperty explodedModuleLibDir = project.objects.directoryProperty() - .convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$LabKeyExtension.EXPLODED_MODULE_DIR_NAME/lib")) - - @TaskAction - void action() - { - File libDir = explodedModuleLibDir.getAsFile().get() - if (libDir.exists()) - libDir.delete() - List copyFromTasks = JavaModule.JAR_TASK_NAMES + "copyExternalLibs" - fs.copy { - into explodedModuleLibDir.get() - for (String taskName : copyFromTasks) - TaskUtils.doIfTaskPresent(project, taskName, inputTask -> { - from inputTask - }) - } - } -} From 8920807f02b6a6659bce5d898d9d43319bce65d8 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 16:56:54 -0700 Subject: [PATCH 09/26] nodeModulesDir -> nodProjectDir for latest release of node plugin --- src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy index 8c9a1a7b..2f813558 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy @@ -91,7 +91,7 @@ class NpmRun implements Plugin download = project.hasProperty('nodeVersion') && project.hasProperty('npmVersion') // Set the work directory where node_modules should be located - nodeModulesDir = project.file("${project.projectDir}") + nodeProjectDir = project.file("${project.projectDir}") npmInstallCommand = project.hasProperty('npmInstallCommand') ? project.npmInstallCommand : 'ci' } From dc646c53e6f7f5f60a1af5dbca6c46e5997b43d6 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 17:26:57 -0700 Subject: [PATCH 10/26] Make `ServerSideJS` task compatible with configuration cache --- README.md | 3 ++ .../org/labkey/gradle/plugin/Webapp.groovy | 10 ++-- .../plugin/extension/LabKeyExtension.groovy | 4 +- .../labkey/gradle/task/ServerSideJS.groovy | 51 +++++++++++-------- 4 files changed, 40 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 141cd86f..2221471a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ on how to do that, including how to develop and test locally and the versioning - Remove `checkModuleTasks` tasks, added to get us through a transition from plugins being declared more centrally - Update `stageModules` to remove use of deprecated `fileCollection` method and make compatible with configuration cache - Make `jsp2Java` compatible with configuration cache +- Update property in node plugin configuration for latest version +- Mark `copyExternalLibs` task as not compatible with configuration cache for now +- Update `ServerSideJS` task for configuraiton cache compatibility ### 4.2.0 *Released*: 11 October 2024 diff --git a/src/main/groovy/org/labkey/gradle/plugin/Webapp.groovy b/src/main/groovy/org/labkey/gradle/plugin/Webapp.groovy index d013bb88..13c68aeb 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/Webapp.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/Webapp.groovy @@ -59,11 +59,11 @@ class Webapp implements Plugin else { // We should only redistribute the ExtJS resource files, not the full dev kit - exclude "${project.labkey.ext3Dir}/src/**" - exclude "${project.labkey.ext4Dir}/builds/**" - exclude "${project.labkey.ext4Dir}/cmd/**" - exclude "${project.labkey.ext4Dir}/locale/**" - exclude "${project.labkey.ext4Dir}/src/**" + exclude "${LabKeyExtension.ext3Dir}/src/**" + exclude "${LabKeyExtension.ext4Dir}/builds/**" + exclude "${LabKeyExtension.ext4Dir}/cmd/**" + exclude "${LabKeyExtension.ext4Dir}/locale/**" + exclude "${LabKeyExtension.ext4Dir}/src/**" exclude "d3/examples/**" exclude "d3/test/**" } diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/LabKeyExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/LabKeyExtension.groovy index d0fac3a6..5740970b 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/LabKeyExtension.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/extension/LabKeyExtension.groovy @@ -58,8 +58,8 @@ class LabKeyExtension String srcGenDir String externalDir - String ext3Dir = "ext-3.4.1" - String ext4Dir = "ext-4.2.1" + public static final String ext3Dir = "ext-3.4.1" + public static final String ext4Dir = "ext-4.2.1" static String getDeployModeName(Project project) { diff --git a/src/main/groovy/org/labkey/gradle/task/ServerSideJS.groovy b/src/main/groovy/org/labkey/gradle/task/ServerSideJS.groovy index 4c810545..77637574 100644 --- a/src/main/groovy/org/labkey/gradle/task/ServerSideJS.groovy +++ b/src/main/groovy/org/labkey/gradle/task/ServerSideJS.groovy @@ -17,15 +17,17 @@ package org.labkey.gradle.task import org.gradle.api.DefaultTask import org.gradle.api.GradleException +import org.gradle.api.file.DirectoryProperty import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.extension.LabKeyExtension import org.labkey.gradle.util.BuildUtils /** * N.B. This task requires that you have the platform/api project source as it needs access to directories in that project */ -class ServerSideJS extends DefaultTask +abstract class ServerSideJS extends DefaultTask { @InputDirectory File scriptFragmentsDir = project.file("script-fragments") @@ -33,6 +35,14 @@ class ServerSideJS extends DefaultTask @OutputDirectory File scriptsDir = project.file("resources/scripts") + @InputDirectory + final abstract DirectoryProperty ext3SrcDir = project.objects.directoryProperty() + .convention(project.project(BuildUtils.getApiProjectPath(project.gradle)).layout.projectDirectory.dir("webapp/${LabKeyExtension.ext3Dir}/src")) + + @InputDirectory + final abstract DirectoryProperty ext4SrcDir = project.objects.directoryProperty() + .convention(project.project(BuildUtils.getApiProjectPath(project.gradle)).layout.projectDirectory.dir("webapp/${LabKeyExtension.ext4Dir}/src")) + @TaskAction void action() { @@ -43,22 +53,21 @@ class ServerSideJS extends DefaultTask // create combined Ext.js usable by the core module's server-side scripts private void concatenateExt3JsFiles() { - - File ext3SrcDir = project.project(BuildUtils.getApiProjectPath(project.gradle)).file("webapp/${project.labkey.ext3Dir}/src") - if (!ext3SrcDir.exists()) - throw new GradleException("Unable to create server-side javascript files. Missing ext3 source directory: ${ext3SrcDir}") + File srcDir = ext3SrcDir.get().asFile + if (!srcDir.exists()) + throw new GradleException("Unable to create server-side javascript files. Missing ext3 source directory: ${srcDir}") if (!scriptsDir.canWrite()) throw new GradleException("Unable to create server-side javascript files. Output directory ${scriptsDir} not writable.") ant.concat(destFile: "${scriptsDir}/Ext.js", force: true) { header(file: "${scriptFragmentsDir}/Ext.header.js") - fileset(file: new File(ext3SrcDir, "Ext.js")) + fileset(file: new File(srcDir, "Ext.js")) fileset(file: "${scriptFragmentsDir}/Ext.middle.js") - fileset(file: new File(ext3SrcDir, "Observable.js")) - fileset(file: new File(ext3SrcDir, "JSON.js")) - fileset(file: new File(ext3SrcDir, "Connection.js")) - fileset(file: new File(ext3SrcDir, "Format.js")) + fileset(file: new File(srcDir, "Observable.js")) + fileset(file: new File(srcDir, "JSON.js")) + fileset(file: new File(srcDir, "Connection.js")) + fileset(file: new File(srcDir, "Format.js")) footer(file: "${scriptFragmentsDir}/Ext.footer.js") } File destFile = new File("${scriptsDir}/Ext.js") @@ -69,24 +78,24 @@ class ServerSideJS extends DefaultTask // create a combined Ext4.js usable by the core module's server-side scripts private void concatenateExt4JsFiles() { - File ext4SrcDir = project.project(BuildUtils.getApiProjectPath(project.gradle)).file("webapp/${project.labkey.ext4Dir}/src") - if (!ext4SrcDir.exists()) - throw new GradleException("Unable to create server-side javascript files. Missing ext4 source directory: ${ext4SrcDir}") + File srcDir = ext4SrcDir.get().asFile + if (!srcDir.exists()) + throw new GradleException("Unable to create server-side javascript files. Missing ext4 source directory: ${srcDir}") if (!scriptsDir.canWrite()) throw new GradleException("Unable to create server-side javascript files. Output directory ${scriptsDir} not writable.") ant.concat(destFile: "${scriptsDir}/Ext4.js", force: true) { header(file: "${scriptFragmentsDir}/Ext4.header.js") - fileset(file: new File(ext4SrcDir, "Ext.js")) - fileset(file: new File(ext4SrcDir, "lang/Array.js")) - fileset(file: new File(ext4SrcDir, "lang/Date.js")) - fileset(file: new File(ext4SrcDir, "lang/Number.js")) - fileset(file: new File(ext4SrcDir, "lang/Object.js")) - fileset(file: new File(ext4SrcDir, "lang/String.js")) - fileset(file: new File(ext4SrcDir, "lang/Error.js")) + fileset(file: new File(srcDir, "Ext.js")) + fileset(file: new File(srcDir, "lang/Array.js")) + fileset(file: new File(srcDir, "lang/Date.js")) + fileset(file: new File(srcDir, "lang/Number.js")) + fileset(file: new File(srcDir, "lang/Object.js")) + fileset(file: new File(srcDir, "lang/String.js")) + fileset(file: new File(srcDir, "lang/Error.js")) fileset(file: "${scriptFragmentsDir}/Ext4.middle.js") - fileset(file: new File(ext4SrcDir, "misc/JSON.js")) + fileset(file: new File(srcDir, "misc/JSON.js")) footer(file: "${scriptFragmentsDir}/Ext4.footer.js") } File destFile = new File("${scriptsDir}/Ext4.js") From f844234031febab5e9acb5a30b635236cbeb0668 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Thu, 31 Oct 2024 18:05:31 -0700 Subject: [PATCH 11/26] Gradle v8.10.2 --- README.md | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2221471a..d3afd434 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ on how to do that, including how to develop and test locally and the versioning - Update property in node plugin configuration for latest version - Mark `copyExternalLibs` task as not compatible with configuration cache for now - Update `ServerSideJS` task for configuraiton cache compatibility +- Upgrade to Gradle 8.10.2 ### 4.2.0 *Released*: 11 October 2024 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0aaefbca..df97d72b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 2b5ce21eb74c34f3cad65241597c4c2fb697a2df Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 09:38:49 -0700 Subject: [PATCH 12/26] All built modules should be in the builtModules config --- src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy index 0cbf9c2a..7ce2e7db 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy @@ -433,6 +433,7 @@ class FileModule implements Plugin // This is done after the project is evaluated otherwise the dependencies for the modules configuration will not have been added yet. project.afterEvaluate({ BuildUtils.addLabKeyDependency(project: serverProject, config: 'modules', depProjectPath: project.path, depProjectConfig: 'published', depExtension: 'module') + BuildUtils.addLabKeyDependency(project: serverProject, config: 'builtModules', depProjectPath: project.path, depProjectConfig: 'published', depExtension: 'module') try { project.configurations.named("modules") { Configuration config -> { From 8ac4033799ff98b58f05a6c885693697731e7533 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 09:59:37 -0700 Subject: [PATCH 13/26] Closer to configuration cache compatibility for `DeployApp` --- README.md | 3 +- .../labkey/gradle/plugin/ServerDeploy.groovy | 50 +++++++++++-------- .../extension/ServerDeployExtension.groovy | 11 ++-- .../plugin/extension/StagingExtension.groovy | 3 +- .../org/labkey/gradle/task/DeployApp.groovy | 31 +++++++----- .../labkey/gradle/task/DeployAppBase.groovy | 43 ++++++++++------ .../gradle/task/DeployDistribution.groovy | 6 +-- .../org/labkey/gradle/task/DoThenSetup.groovy | 4 +- .../gradle/task/RestartTriggerTask.groovy | 43 ++++++++++++++++ .../org/labkey/gradle/util/BuildUtils.groovy | 8 +-- 10 files changed, 136 insertions(+), 66 deletions(-) create mode 100644 src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy diff --git a/README.md b/README.md index d3afd434..c4e164ba 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ on how to do that, including how to develop and test locally and the versioning - Make `jsp2Java` compatible with configuration cache - Update property in node plugin configuration for latest version - Mark `copyExternalLibs` task as not compatible with configuration cache for now -- Update `ServerSideJS` task for configuraiton cache compatibility +- Update `ServerSideJS` task for configuration cache compatibility +- Update `DeployApp` and relatives for better configuration cache compatibility - Upgrade to Gradle 8.10.2 ### 4.2.0 diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index 0d3c003b..e6de78e5 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -42,19 +42,23 @@ import java.nio.file.Paths */ class ServerDeploy implements Plugin { + public static final String DEPLOY_DIR = "deploy" + public static final String MODULES_DIR = "${DEPLOY_DIR}/modules" + public static final String WEBAPP_DIR = "${DEPLOY_DIR}/labkeyWebapp" + public static final String PIPELINE_DIR = "${DEPLOY_DIR}/pipelineLib" + public static final String BIN_DIR = "${DEPLOY_DIR}/bin" + private ServerDeployExtension serverDeploy + String deployDir + String embeddedDir @Override void apply(Project project) { serverDeploy = project.extensions.create("serverDeploy", ServerDeployExtension) - serverDeploy.dir = ServerDeployExtension.getServerDeployDirectory(project) - serverDeploy.embeddedDir = ServerDeployExtension.getEmbeddedServerDeployDirectory(project) - serverDeploy.modulesDir = "${serverDeploy.dir}/modules" - serverDeploy.webappDir = "${serverDeploy.dir}/labkeyWebapp" - serverDeploy.binDir = "${serverDeploy.dir}/bin" - serverDeploy.pipelineLibDir = "${serverDeploy.dir}/pipelineLib" + deployDir = ServerDeployExtension.getServerDeployDirectory(project) + embeddedDir = ServerDeployExtension.getEmbeddedServerDeployDirectory(project) project.apply plugin: 'org.labkey.build.base' // we depend on the jar task from the embedded project, if available @@ -80,10 +84,8 @@ class ServerDeploy implements Plugin project.tasks.register("deployApp", DeployApp) { DeployApp task -> task.group = GroupNames.DEPLOY - task.description = "Deploy the application locally into ${serverDeploy.dir}" - task.doLast( { - BuildUtils.updateRestartTriggerFile(project) - } ) + task.description = "Deploy the application locally into ${deployDir}" + task.binaries.setFrom(project.configurations.binaries) } StagingExtension staging = project.getExtensions().getByType(StagingExtension.class) @@ -98,16 +100,17 @@ class ServerDeploy implements Plugin project.tasks.register("checkModuleVersions", CheckForVersionConflicts) { CheckForVersionConflicts task -> - task.directory = new File(serverDeploy.modulesDir) + String modulesDir = "${deployDir}/${MODULES_DIR}" + task.directory = new File(modulesDir) task.extension = "module" task.cleanTask = ":server:cleanDeploy" task.collection = project.configurations.modules task.group = GroupNames.DEPLOY task.description = "Check for conflicts in version numbers of module files to be deployed and files in the deploy directory. " + "Default action on detecting a conflict is to fail. Use -PversionConflictAction=[delete|fail|warn] to change this behavior. The value 'delete' will cause the " + - "conflicting version(s) in the ${serverDeploy.modulesDir} directory to be removed." + "conflicting version(s) in the ${modulesDir} directory to be removed." task.onlyIf({ - return new File(serverDeploy.modulesDir).exists() + return new File(modulesDir).exists() }) } @@ -144,6 +147,7 @@ class ServerDeploy implements Plugin linkBinaries(project, "yarn", project.yarnVersion, project.yarnWorkDirectory) }) } + project.tasks.symlinkNode.notCompatibleWithConfigurationCache("References project properties. Need to add task class with input properties") project.tasks.named('deployApp').configure {dependsOn(project.tasks.symlinkNode)} } @@ -168,7 +172,10 @@ class ServerDeploy implements Plugin }) } - project.tasks.named('stageRemotePipelineJars').configure {dependsOn project.configurations.remotePipelineJars} + project.tasks.named('stageRemotePipelineJars').configure { + dependsOn project.configurations.remotePipelineJars + notCompatibleWithConfigurationCache("TODO Needs dedicated task class with configuration as input") + } project.tasks.register( "stageApp") { @@ -191,6 +198,7 @@ class ServerDeploy implements Plugin project.tasks.named('deployApp').configure { dependsOn(project.tasks.setup) dependsOn(project.tasks.stageApp) +// notCompatibleWithConfigurationCache("Uses project.zipTree") } if (BuildUtils.embeddedProjectExists(project)) { @@ -199,9 +207,9 @@ class ServerDeploy implements Plugin project.tasks.register("cleanEmbeddedDeploy", DefaultTask) { DefaultTask task -> task.group = GroupNames.DEPLOY - task.description = "Remove the ${project.serverDeploy.embeddedDir} directory" + task.description = "Remove the ${embeddedDir} directory" task.doLast { - project.delete project.serverDeploy.embeddedDir + project.delete embeddedDir } } project.tasks.named('deployApp').configure { @@ -210,7 +218,7 @@ class ServerDeploy implements Plugin project.copy { CopySpec copy -> copy.from embeddedProject.tasks.bootJar - copy.into project.serverDeploy.embeddedDir + copy.into embeddedDir copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) } } @@ -235,6 +243,7 @@ class ServerDeploy implements Plugin task.group = GroupNames.DISTRIBUTION task.description = "Extract the executable jar from a distribution and put it and the included binaries in the appropriate deploy directory" task.dependsOn(project.tasks.cleanEmbeddedDeploy, project.tasks.setup) + task.binaries.setFrom(project.configurations.binaries) } // This may prevent multiple Tomcat restarts @@ -260,10 +269,10 @@ class ServerDeploy implements Plugin 'cleanDeploy', Delete) { Delete task -> task.group = GroupNames.DEPLOY - task.description = "Removes the deploy directory ${serverDeploy.dir}" + task.description = "Removes the deploy directory ${deployDir}" task.dependsOn (project.tasks.cleanStaging) task.configure({ DeleteSpec spec -> - spec.delete serverDeploy.dir + spec.delete deployDir }) } project.tasks.named('deployApp').configure {mustRunAfter(project.tasks.cleanDeploy)} @@ -271,7 +280,8 @@ class ServerDeploy implements Plugin project.tasks.register("cleanAndDeploy", DeployApp) { DeployApp task -> task.group = GroupNames.DEPLOY - task.description = "Removes the deploy directory ${serverDeploy.dir} then deploys the application locally" + task.binaries.setFrom(project.configurations.binaries) + task.description = "Removes the deploy directory ${deployDir} then deploys the application locally" task.dependsOn(project.tasks.cleanDeploy) } diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy index 8e693c0a..dfa109b0 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy @@ -16,21 +16,16 @@ package org.labkey.gradle.plugin.extension import org.gradle.api.Project +import org.labkey.gradle.plugin.ServerDeploy import org.labkey.gradle.util.BuildUtils class ServerDeployExtension { - String dir - String embeddedDir - String modulesDir - String webappDir - String binDir - String pipelineLibDir Map foundModules = new HashMap<>(); static String getServerDeployDirectory(Project project) { - return BuildUtils.getRootBuildDirFile(project, "deploy").path + return BuildUtils.getRootBuildDirFile(project, ServerDeploy.DEPLOY_DIR).path } static String getEmbeddedServerDeployDirectory(Project project) @@ -40,7 +35,7 @@ class ServerDeployExtension static String getModulesDeployDirectory(Project project) { - return "${getServerDeployDirectory(project)}/modules" + return "${getServerDeployDirectory(project)}/${ServerDeploy.MODULES_DIR}" } String getFoundModule(String key) diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy index cf5f0a72..a5e73134 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy @@ -24,6 +24,7 @@ class StagingExtension public static final String STAGING_MODULES_DIR = "${STAGING_DIR}/modules/" public static final String STAGING_WEBAPP_DIR = "${STAGING_DIR}/labkeyWebapp" public static final String STAGING_WEBINF_DIR = "${STAGING_WEBAPP_DIR}/WEB-INF/" + public static final String STAGING_PIPELINE_DIR = "${STAGING_DIR}/pipelineLib" String dir String webappClassesDir @@ -42,6 +43,6 @@ class StagingExtension webInfDir = "${buildDirPath}/${STAGING_WEBINF_DIR}" webappDir = "${buildDirPath}/${STAGING_WEBAPP_DIR}" modulesDir = "${buildDirPath}/${STAGING_MODULES_DIR}" - pipelineLibDir = "${dir}/pipelineLib" + pipelineLibDir = "${buildDirPath}/${STAGING_PIPELINE_DIR}" } } diff --git a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy index 442557e5..10995bda 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy @@ -16,55 +16,60 @@ package org.labkey.gradle.task import org.gradle.api.file.CopySpec +import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.ServerDeploy +import org.labkey.gradle.plugin.extension.StagingExtension -class DeployApp extends DeployAppBase +abstract class DeployApp extends DeployAppBase { @InputDirectory - File stagingModulesDir = new File((String) project.staging.modulesDir) + final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(StagingExtension.STAGING_MODULES_DIR)) @InputDirectory - File stagingPipelineJarDir = new File((String) project.staging.pipelineLibDir) + final abstract DirectoryProperty stagingPipelineJarDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(StagingExtension.STAGING_PIPELINE_DIR)) @OutputDirectory - File deployModulesDir = new File((String) project.serverDeploy.modulesDir) + final abstract DirectoryProperty deployModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.MODULES_DIR)) + // We declare this as an output so it will be created by this task, even though not actually populated here @OutputDirectory - File deployWebappDir = new File((String) project.serverDeploy.webappDir) + final abstract DirectoryProperty deployWebappDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.WEBAPP_DIR)) @OutputDirectory - File deployPipelineLibDir = new File((String) project.serverDeploy.pipelineLibDir) + final abstract DirectoryProperty deployPipelineLibDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.PIPELINE_DIR)) @OutputDirectory - File deployBinDir = new File((String) project.serverDeploy.binDir) + final abstract DirectoryProperty deployBinDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.BIN_DIR)) @TaskAction void action() { deployModules() deployPipelineJars() - deployPlatformBinaries(deployBinDir) + deployPlatformBinaries(deployBinDir.get().asFile) + updateRestartTriggerFile() } private void deployModules() { ant.copy ( - todir: deployModulesDir, + todir: deployModulesDir.get().asFile, preserveLastModified: true, ) { - fileset(dir: stagingModulesDir) + fileset(dir: stagingModulesDir.get().asFile) } } private void deployPipelineJars() { - project.copy( { CopySpec copy -> - copy.from stagingPipelineJarDir - copy.into deployPipelineLibDir + fs.copy( { CopySpec copy -> + copy.from stagingPipelineJarDir.get().asFile + copy.into deployPipelineLibDir.get().asFile copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) }) } diff --git a/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy b/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy index 21f2ef10..d118aad6 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy @@ -1,34 +1,47 @@ package org.labkey.gradle.task import org.apache.commons.lang3.SystemUtils -import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.file.CopySpec +import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.file.FileSystemOperations +import org.gradle.api.tasks.InputFiles +import org.gradle.api.tasks.OutputDirectory -class DeployAppBase extends DefaultTask { +import javax.inject.Inject - private File _externalDir = new File((String) project.labkey.externalDir) +abstract class DeployAppBase extends RestartTriggerTask { + + @Inject abstract FileSystemOperations getFs() + + @InputFiles + abstract ConfigurableFileCollection getBinaries() + + @OutputDirectory + final abstract DirectoryProperty _externalDir = project.objects.directoryProperty() + .convention(project.rootProject.layout.projectDirectory.dir("external")) protected void deployPlatformBinaries(File deployBinDir) { deployBinDir.mkdirs() - if (project.configurations.findByName("binaries") != null) + if (getBinaries() != null && !getBinaries().isEmpty()) { - project.logger.debug("Copying from binaries configuration to ${deployBinDir}") - project.copy({ + this.logger.debug("Copying from binaries configuration to ${deployBinDir}") + fs.copy({ CopySpec copy -> copy.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) - copy.from(project.configurations.binaries.collect { project.zipTree(it) }) + copy.from(getBinaries().collect { project.zipTree(it) }) copy.into deployBinDir.path }) - project.logger.debug("Contents of ${deployBinDir}\n" + deployBinDir.listFiles()) + this.logger.debug("Contents of ${deployBinDir}\n" + deployBinDir.listFiles()) } // For TC builds, we deposit the artifacts of the Linux TPP Tools and Windows Proteomics Tools into // the external directory, so we want to copy those over as well. // TODO: package the output of these builds into the Artifactory artifact to simplify - if (project.file(_externalDir).exists()) { - project.logger.info("Copying from ${_externalDir} to ${project.serverDeploy.binDir}") + if (_externalDir.get().asFile.exists()) { + this.logger.info("Copying from ${_externalDir.get()} to ${deployBinDir}") if (SystemUtils.IS_OS_MAC) deployBinariesViaProjectCopy("osx", deployBinDir) else if (SystemUtils.IS_OS_LINUX) @@ -41,7 +54,7 @@ class DeployAppBase extends DefaultTask { // Use this method to preserve file permissions, since ant.copy does not, but this does not preserve last modified times private void deployBinariesViaProjectCopy(String osDirectory, File deployBinDir) { - File parentDir = new File(_externalDir, "${osDirectory}") + File parentDir = new File(_externalDir.get().asFile, "${osDirectory}") if (parentDir.exists()) { List subDirs = parentDir.listFiles new FileFilter() { @@ -51,7 +64,7 @@ class DeployAppBase extends DefaultTask { } } for (File dir : subDirs) { - project.copy { CopySpec copy -> + fs.copy { CopySpec copy -> copy.from dir copy.into deployBinDir.getPath() copy.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) @@ -62,8 +75,8 @@ class DeployAppBase extends DefaultTask { private void deployBinariesViaAntCopy(String osDirectory, File deployBinDir) { - def fromDir = "${_externalDir}/${osDirectory}" - if (project.file(fromDir).exists()) + File fromDir = _externalDir.get().file(osDirectory).asFile + if (fromDir.exists()) { ant.copy( todir: deployBinDir.getPath(), @@ -71,7 +84,7 @@ class DeployAppBase extends DefaultTask { ) { ant.cutdirsmapper(dirs: 1) - fileset(dir: fromDir) + fileset(dir: fromDir.path) { exclude(name: "**.*") } diff --git a/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy b/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy index e6ff80ca..b4e50e01 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy @@ -6,7 +6,7 @@ import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import org.labkey.gradle.plugin.extension.DistributionExtension -class DeployDistribution extends DeployAppBase { +abstract class DeployDistribution extends DeployAppBase { @OutputDirectory File deployDir = new File((String) project.serverDeploy.embeddedDir) @@ -23,13 +23,13 @@ class DeployDistribution extends DeployAppBase { private void deployExecutableJar() { File distributionFile = DistributionExtension.getDistributionFile(project) - project.copy({ CopySpec copy -> + fs.copy({ CopySpec copy -> copy.from project.tarTree(distributionFile).files copy.into deployDir copy.include "*.jar" copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) }) - project.copy({ CopySpec copy -> + fs.copy({ CopySpec copy -> copy.from project.tarTree(distributionFile).files copy.into deployBinDir copy.include "*.exe", "*.dll" diff --git a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy index 59a8ce45..7fd3f944 100644 --- a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy @@ -29,7 +29,7 @@ import org.labkey.gradle.util.PropertiesUtils import java.util.function.Function -class DoThenSetup extends DefaultTask +class DoThenSetup extends RestartTriggerTask { @Optional @Input protected DatabaseProperties databaseProperties @@ -118,7 +118,7 @@ class DoThenSetup extends DefaultTask return PropertiesUtils.replaceProps(line, configProperties, false) }) }) - BuildUtils.updateRestartTriggerFile(project) + updateRestartTriggerFile() } } diff --git a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy new file mode 100644 index 00000000..0b8a5a25 --- /dev/null +++ b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy @@ -0,0 +1,43 @@ +package org.labkey.gradle.task + +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.OutputDirectory + +import java.nio.charset.StandardCharsets +import java.text.SimpleDateFormat + +abstract class RestartTriggerTask extends DefaultTask +{ + public static final String RESTART_FILE_NAME = ".restartTrigger" + @Input + final abstract Property useLocalBuild = project.objects.property(String).convention(project.hasProperty('useLocalBuild') ? (String) project.property('useLocalBuild') : null) + + @OutputDirectory + final abstract DirectoryProperty triggerFileDir = project.objects.directoryProperty() + .convention(project.rootProject.layout.buildDirectory.dir("deploy/modules")) + + @Input + void updateRestartTriggerFile() + { + if (useLocalBuild.get() == null || "false" == useLocalBuild.get()) + return + + if (!triggerFileDir.get().asFile.exists()) + return + + OutputStreamWriter writer = null + try { + File triggerFile = new File(triggerFileDir.get().asFile, RESTART_FILE_NAME) + writer = new OutputStreamWriter(new FileOutputStream(triggerFile), StandardCharsets.UTF_8) + writer.write(SimpleDateFormat.getDateTimeInstance().format(new Date())) + } + finally + { + if (writer != null) + writer.close() + } + } +} diff --git a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy index 27e0e15e..b13a050b 100644 --- a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy +++ b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy @@ -30,6 +30,7 @@ import org.labkey.gradle.plugin.extension.LabKeyExtension import org.labkey.gradle.plugin.extension.ModuleExtension import org.labkey.gradle.plugin.extension.ServerDeployExtension import org.labkey.gradle.plugin.extension.TeamCityExtension +import org.labkey.gradle.task.RestartTriggerTask import java.nio.charset.StandardCharsets import java.nio.file.Files @@ -49,7 +50,6 @@ class BuildUtils public static final String PLATFORM_MODULES_DIR = "server/modules/platform" public static final String COMMON_ASSAYS_MODULES_DIR = "server/modules/commonAssays" public static final String CUSTOM_MODULES_DIR = "server/modules/customModules" - private static final String RESTART_FILE_NAME = ".restartTrigger" public static final List EHR_MODULE_NAMES = [ "EHR_ComplianceDB", @@ -845,7 +845,7 @@ class BuildUtils static String getEmbeddedConfigPath(Project project) { - return new File(project.serverDeploy.embeddedDir, "config").absolutePath + return new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project), "config").absolutePath } static File getExecutableServerJar(Project project) @@ -879,7 +879,9 @@ class BuildUtils * spring.devtools.restart.additional-paths * * @param project - for use in getting the rootProject's build directory + * @deprecated Use RestartTriggerTask as a base class for your task instead */ + @Deprecated(forRemoval=true) static void updateRestartTriggerFile(Project project) { if (!project.hasProperty('useLocalBuild') || "false" == project.property("useLocalBuild")) @@ -891,7 +893,7 @@ class BuildUtils OutputStreamWriter writer = null try { - File triggerFile = new File(triggerFileDir, RESTART_FILE_NAME) + File triggerFile = new File(triggerFileDir, RestartTriggerTask.RESTART_FILE_NAME) writer = new OutputStreamWriter(new FileOutputStream(triggerFile), StandardCharsets.UTF_8) writer.write(SimpleDateFormat.getDateTimeInstance().format(new Date())) } From 12bdf68c5e1e97b2bb6678e0cc60bb0bc2a6ccab Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 10:20:35 -0700 Subject: [PATCH 14/26] Remove unused method --- .../org/labkey/gradle/task/DoThenSetup.groovy | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy index 7fd3f944..24f31506 100644 --- a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy @@ -36,21 +36,6 @@ class DoThenSetup extends RestartTriggerTask @Input boolean dbPropertiesChanged = false - private static boolean canCreate(File file) - { - file = file.getParentFile() - - while (file != null) - { - if (file.exists()) - { - return file.canWrite() && file.canRead() - } - file = file.getParentFile() - } - return false - } - protected void doDatabaseTask() { setDatabaseProperties() From 9b3fde6fdfeb4c9c1d9911dd951f35267e4aa068 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 10:20:56 -0700 Subject: [PATCH 15/26] Add notes on in compatibility --- src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index e6de78e5..11532e6e 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -86,6 +86,7 @@ class ServerDeploy implements Plugin task.group = GroupNames.DEPLOY task.description = "Deploy the application locally into ${deployDir}" task.binaries.setFrom(project.configurations.binaries) + task.notCompatibleWithConfigurationCache("TODO 'cannot serialize project' error, but unclear where it comes from") } StagingExtension staging = project.getExtensions().getByType(StagingExtension.class) @@ -283,6 +284,7 @@ class ServerDeploy implements Plugin task.binaries.setFrom(project.configurations.binaries) task.description = "Removes the deploy directory ${deployDir} then deploys the application locally" task.dependsOn(project.tasks.cleanDeploy) + task.notCompatibleWithConfigurationCache("TODO 'cannot serialize project' error, but unclear where it comes from") } project.tasks.register("cleanBuild", Delete) { From f4da38bbe92092ef5309b9917898f6356accc3e8 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 11:32:03 -0700 Subject: [PATCH 16/26] Remove `StagingExtension`and update `PickDb` with injected FSOperations --- README.md | 2 + .../org/labkey/gradle/plugin/LabKey.groovy | 4 -- .../labkey/gradle/plugin/ServerDeploy.groovy | 22 +++++---- .../plugin/extension/StagingExtension.groovy | 48 ------------------- .../org/labkey/gradle/task/DeployApp.groovy | 5 +- .../org/labkey/gradle/task/DoThenSetup.groovy | 1 - .../org/labkey/gradle/task/PickDb.groovy | 9 +++- .../gradle/task/StageDistribution.groovy | 32 ++++++++----- .../labkey/gradle/task/StageModules.groovy | 4 +- 9 files changed, 47 insertions(+), 80 deletions(-) delete mode 100644 src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy diff --git a/README.md b/README.md index c4e164ba..f9daf2c5 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,13 @@ on how to do that, including how to develop and test locally and the versioning contains the `version` and `buildUrl` properties that `EmbeddedExtractor.java` reads. - Remove `checkModuleTasks` tasks, added to get us through a transition from plugins being declared more centrally - Update `stageModules` to remove use of deprecated `fileCollection` method and make compatible with configuration cache +- Remove `StagingExtension` - Make `jsp2Java` compatible with configuration cache - Update property in node plugin configuration for latest version - Mark `copyExternalLibs` task as not compatible with configuration cache for now - Update `ServerSideJS` task for configuration cache compatibility - Update `DeployApp` and relatives for better configuration cache compatibility +- Update `PickDb` task for better configuration cache compatibility - Upgrade to Gradle 8.10.2 ### 4.2.0 diff --git a/src/main/groovy/org/labkey/gradle/plugin/LabKey.groovy b/src/main/groovy/org/labkey/gradle/plugin/LabKey.groovy index 93321044..356d179c 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/LabKey.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/LabKey.groovy @@ -18,7 +18,6 @@ package org.labkey.gradle.plugin import org.gradle.api.Plugin import org.gradle.api.Project import org.labkey.gradle.plugin.extension.LabKeyExtension -import org.labkey.gradle.plugin.extension.StagingExtension import org.labkey.gradle.util.ModuleFinder import org.labkey.gradle.util.BuildUtils @@ -56,9 +55,6 @@ class LabKey implements Plugin LabKeyExtension labKeyExt = project.extensions.create("labkey", LabKeyExtension) labKeyExt.setDirectories(project) - - StagingExtension stagingExt = project.extensions.create("staging", StagingExtension) - stagingExt.setDirectories(project) } // These configurations are used for deploying the app. We declare them here diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index 11532e6e..fd4aacf5 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -27,7 +27,6 @@ import org.gradle.api.file.DeleteSpec import org.gradle.api.file.FileCollection import org.gradle.api.tasks.Delete import org.labkey.gradle.plugin.extension.ServerDeployExtension -import org.labkey.gradle.plugin.extension.StagingExtension import org.labkey.gradle.task.* import org.labkey.gradle.util.BuildUtils import org.labkey.gradle.util.GroupNames @@ -47,10 +46,14 @@ class ServerDeploy implements Plugin public static final String WEBAPP_DIR = "${DEPLOY_DIR}/labkeyWebapp" public static final String PIPELINE_DIR = "${DEPLOY_DIR}/pipelineLib" public static final String BIN_DIR = "${DEPLOY_DIR}/bin" + public static final String STAGING_DIR = "staging" + public static final String STAGING_MODULES_DIR = "${STAGING_DIR}/modules/" + public static final String STAGING_PIPELINE_DIR = "${STAGING_DIR}/pipelineLib" private ServerDeployExtension serverDeploy String deployDir String embeddedDir + String stagingDir @Override void apply(Project project) @@ -59,6 +62,7 @@ class ServerDeploy implements Plugin deployDir = ServerDeployExtension.getServerDeployDirectory(project) embeddedDir = ServerDeployExtension.getEmbeddedServerDeployDirectory(project) + stagingDir = BuildUtils.getRootBuildDirFile(project, STAGING_DIR) project.apply plugin: 'org.labkey.build.base' // we depend on the jar task from the embedded project, if available @@ -89,12 +93,10 @@ class ServerDeploy implements Plugin task.notCompatibleWithConfigurationCache("TODO 'cannot serialize project' error, but unclear where it comes from") } - StagingExtension staging = project.getExtensions().getByType(StagingExtension.class) - project.tasks.register("stageModules", StageModules) { StageModules task -> task.group = GroupNames.DEPLOY - task.description = "Stage the modules for the application into ${staging.dir}" + task.description = "Stage the modules for the application into ${stagingDir}" task.downloadedModules.setFrom(project.configurations.downloadedModules) task.builtModules.setFrom(project.configurations.builtModules) } @@ -152,14 +154,16 @@ class ServerDeploy implements Plugin project.tasks.named('deployApp').configure {dependsOn(project.tasks.symlinkNode)} } + String stagingPipelineLibDir = BuildUtils.getRootBuildDirFile(project, STAGING_PIPELINE_DIR) + project.tasks.register("stageRemotePipelineJars") { Task task -> task.group = GroupNames.DEPLOY - task.description = "Copy files needed for using remote pipeline jobs into ${staging.pipelineLibDir}" + task.description = "Copy files needed for using remote pipeline jobs into ${stagingPipelineLibDir}" task.doLast({ if (!project.configurations.remotePipelineJars.getFiles().isEmpty()) { task.ant.copy( - todir: staging.pipelineLibDir, + todir: stagingPipelineLibDir, preserveLastModified: true ) { @@ -182,7 +186,7 @@ class ServerDeploy implements Plugin "stageApp") { Task task -> task.group = GroupNames.DEPLOY - task.description = "Stage modules and jar files into ${staging.dir}" + task.description = "Stage modules and jar files into ${stagingDir}" task.dependsOn project.tasks.stageModules task.dependsOn project.tasks.stageRemotePipelineJars } @@ -260,9 +264,9 @@ class ServerDeploy implements Plugin 'cleanStaging',Delete) { Delete task -> task.group = GroupNames.DEPLOY - task.description = "Removes the staging directory ${staging.dir}" + task.description = "Removes the staging directory ${stagingDir}" task.configure({ DeleteSpec spec -> - spec.delete staging.dir + spec.delete stagingDir }) } diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy deleted file mode 100644 index a5e73134..00000000 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/StagingExtension.groovy +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2017-2018 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.gradle.plugin.extension - -import org.gradle.api.Project -import org.labkey.gradle.util.BuildUtils - -class StagingExtension -{ - public static final String STAGING_DIR = "staging" - public static final String STAGING_MODULES_DIR = "${STAGING_DIR}/modules/" - public static final String STAGING_WEBAPP_DIR = "${STAGING_DIR}/labkeyWebapp" - public static final String STAGING_WEBINF_DIR = "${STAGING_WEBAPP_DIR}/WEB-INF/" - public static final String STAGING_PIPELINE_DIR = "${STAGING_DIR}/pipelineLib" - - String dir - String webappClassesDir - String jspDir - String webInfDir - String webappDir - String modulesDir - String pipelineLibDir - - void setDirectories(Project project) - { - String buildDirPath = BuildUtils.getRootBuildDirPath(project) - dir = "${buildDirPath}/${STAGING_DIR}" - webappClassesDir = "${buildDirPath}/${STAGING_WEBINF_DIR}/classes" - jspDir = "${buildDirPath}/${STAGING_WEBINF_DIR}/jsp" - webInfDir = "${buildDirPath}/${STAGING_WEBINF_DIR}" - webappDir = "${buildDirPath}/${STAGING_WEBAPP_DIR}" - modulesDir = "${buildDirPath}/${STAGING_MODULES_DIR}" - pipelineLibDir = "${buildDirPath}/${STAGING_PIPELINE_DIR}" - } -} diff --git a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy index 10995bda..3438d7d4 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy @@ -22,15 +22,14 @@ import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import org.labkey.gradle.plugin.ServerDeploy -import org.labkey.gradle.plugin.extension.StagingExtension abstract class DeployApp extends DeployAppBase { @InputDirectory - final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(StagingExtension.STAGING_MODULES_DIR)) + final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.STAGING_MODULES_DIR)) @InputDirectory - final abstract DirectoryProperty stagingPipelineJarDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(StagingExtension.STAGING_PIPELINE_DIR)) + final abstract DirectoryProperty stagingPipelineJarDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.STAGING_PIPELINE_DIR)) @OutputDirectory final abstract DirectoryProperty deployModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.MODULES_DIR)) diff --git a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy index 24f31506..7f5c8ef5 100644 --- a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy @@ -15,7 +15,6 @@ */ package org.labkey.gradle.task -import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.file.CopySpec import org.gradle.api.file.DuplicatesStrategy diff --git a/src/main/groovy/org/labkey/gradle/task/PickDb.groovy b/src/main/groovy/org/labkey/gradle/task/PickDb.groovy index d7b604f2..03972edd 100644 --- a/src/main/groovy/org/labkey/gradle/task/PickDb.groovy +++ b/src/main/groovy/org/labkey/gradle/task/PickDb.groovy @@ -17,12 +17,17 @@ package org.labkey.gradle.task import org.gradle.api.file.CopySpec import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.file.FileSystemOperations import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputDirectory import org.labkey.gradle.util.BuildUtils -class PickDb extends DoThenSetup +import javax.inject.Inject + +abstract class PickDb extends DoThenSetup { + @Inject abstract FileSystemOperations getFs() + @Input String dbType @@ -33,7 +38,7 @@ class PickDb extends DoThenSetup protected void doDatabaseTask() { //copies the correct config file. - project.copy({ CopySpec copy -> + fs.copy({ CopySpec copy -> copy.from configsDir copy.into configsDir.parent copy.include "${dbType}.properties" diff --git a/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy b/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy index 09727ef7..9e5e95aa 100644 --- a/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy +++ b/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy @@ -17,26 +17,34 @@ package org.labkey.gradle.task import org.gradle.api.DefaultTask import org.gradle.api.file.CopySpec +import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileCopyDetails +import org.gradle.api.file.FileSystemOperations import org.gradle.api.file.FileTree import org.gradle.api.file.RelativePath import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.ServerDeploy import org.labkey.gradle.plugin.extension.DistributionExtension +import org.labkey.gradle.util.BuildUtils -class StageDistribution extends DefaultTask +import javax.inject.Inject + +abstract class StageDistribution extends DefaultTask { + @Inject abstract FileSystemOperations getFs() + protected File distributionFile = null @OutputDirectory - File modulesStagingDir = new File((String) project.staging.modulesDir) + final abstract DirectoryProperty modulesStagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR")) @OutputDirectory - File stagingDir = new File((String) project.staging.dir) + final abstract DirectoryProperty stagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_DIR")) @OutputDirectory - File pipelineJarStagingDir = new File((String) project.staging.pipelineLibDir) + final abstract DirectoryProperty pipelineJarStagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_PIPELINE_DIR")) @TaskAction void action() @@ -46,20 +54,22 @@ class StageDistribution extends DefaultTask FileTree distArchiveTree = project.tarTree(distributionFile) // first clean out the staging directory so we don't pick up modules not in this distribution - project.delete modulesStagingDir + fs.delete { + it.delete(modulesStagingDir.get()) + } - project.copy({ CopySpec spec -> + fs.copy({ CopySpec spec -> spec.from distArchiveTree.files - spec.into modulesStagingDir + spec.into modulesStagingDir.get() spec.include "**/*.module" spec.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) }) String baseName = distributionFile.getName().substring(0, distributionFile.getName().length() - (extension.length() + 1)) - project.copy({ CopySpec spec -> + fs.copy({ CopySpec spec -> spec.from distArchiveTree - spec.into stagingDir + spec.into stagingDir.get() spec.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) spec.eachFile { FileCopyDetails fcp -> @@ -79,9 +89,9 @@ class StageDistribution extends DefaultTask spec.includeEmptyDirs = false }) - project.copy({ CopySpec spec -> + fs.copy({ CopySpec spec -> spec.from distArchiveTree - spec.into pipelineJarStagingDir + spec.into pipelineJarStagingDir.get() spec.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) spec.eachFile { FileCopyDetails fcp -> diff --git a/src/main/groovy/org/labkey/gradle/task/StageModules.groovy b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy index 5119b785..cba73961 100644 --- a/src/main/groovy/org/labkey/gradle/task/StageModules.groovy +++ b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy @@ -8,7 +8,7 @@ import org.gradle.api.file.FileSystemOperations import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction -import org.labkey.gradle.plugin.extension.StagingExtension +import org.labkey.gradle.plugin.ServerDeploy import org.labkey.gradle.util.BuildUtils import javax.inject.Inject @@ -18,7 +18,7 @@ abstract class StageModules extends DefaultTask @Inject abstract FileSystemOperations getFs() @OutputDirectory - final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$StagingExtension.STAGING_MODULES_DIR")) + final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR")) @InputFiles abstract ConfigurableFileCollection getDownloadedModules() From 756f936e4510e02104ec6c50a5589587c6a27c6b Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 13:42:27 -0700 Subject: [PATCH 17/26] Method renaming and resolve reference to removed extension properties --- .../org/labkey/gradle/plugin/NpmRun.groovy | 10 ++++++++++ .../labkey/gradle/plugin/ServerDeploy.groovy | 4 ++-- .../org/labkey/gradle/plugin/TeamCity.groovy | 2 +- .../org/labkey/gradle/plugin/Tomcat.groovy | 2 +- .../extension/ServerDeployExtension.groovy | 19 +++++++++++++++---- .../plugin/extension/TeamCityExtension.groovy | 3 +-- .../gradle/task/DeployDistribution.groovy | 13 ++++++++----- .../org/labkey/gradle/task/StartLabKey.groovy | 10 +++++----- .../org/labkey/gradle/util/BuildUtils.groovy | 4 ++-- 9 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy index 2f813558..0e3a74bb 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy @@ -85,10 +85,20 @@ class NpmRun implements Plugin // Base URL for fetching node distributions (change if you have a mirror). if (project.hasProperty('nodeRepo')) distBaseUrl = project.nodeRepo +// +// // The directory where Node.js is unpacked (when download is true) +// workDir = project.file("${project.rootProject.projectDir}/.gradle/nodejs") +// +// // The directory where npm is installed (when a specific version is defined) +// npmWorkDir = project.file("${project.rootProject.projectDir}/.gradle/npm") +// +// // The directory where yarn is installed (when a Yarn task is used) +// yarnWorkDir = project.file("${project.rootProject.projectDir}/.gradle/yarn") // If true, it will download node using above parameters. // If false, it will try to use globally installed node. download = project.hasProperty('nodeVersion') && project.hasProperty('npmVersion') +// download = project.path === project.rootProject.path && project.hasProperty('nodeVersion') && project.hasProperty('npmVersion') // Set the work directory where node_modules should be located nodeProjectDir = project.file("${project.projectDir}") diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index fd4aacf5..2926cf0c 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -60,8 +60,8 @@ class ServerDeploy implements Plugin { serverDeploy = project.extensions.create("serverDeploy", ServerDeployExtension) - deployDir = ServerDeployExtension.getServerDeployDirectory(project) - embeddedDir = ServerDeployExtension.getEmbeddedServerDeployDirectory(project) + deployDir = ServerDeployExtension.getServerDeployDirectoryPath(project) + embeddedDir = ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project) stagingDir = BuildUtils.getRootBuildDirFile(project, STAGING_DIR) project.apply plugin: 'org.labkey.build.base' diff --git a/src/main/groovy/org/labkey/gradle/plugin/TeamCity.groovy b/src/main/groovy/org/labkey/gradle/plugin/TeamCity.groovy index ad916dd3..240c0c28 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/TeamCity.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/TeamCity.groovy @@ -164,7 +164,7 @@ class TeamCity extends Tomcat return newLine } ) - task.destinationDir = new File("${ServerDeployExtension.getServerDeployDirectory(project)}/config") + task.destinationDir = new File("${ServerDeployExtension.getServerDeployDirectoryPath(project)}/config") } diff --git a/src/main/groovy/org/labkey/gradle/plugin/Tomcat.groovy b/src/main/groovy/org/labkey/gradle/plugin/Tomcat.groovy index 9331e19f..4383d899 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/Tomcat.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/Tomcat.groovy @@ -79,7 +79,7 @@ class Tomcat implements Plugin project.tasks.register("cleanLogs", Delete) { Delete task -> - var logDir = "${ServerDeployExtension.getEmbeddedServerDeployDirectory(project)}/logs" + var logDir = "${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)}/logs" task.group = GroupNames.WEB_APPLICATION task.description = "Delete logs from ${logDir}" task.configure { DeleteSpec spec -> spec.delete project.fileTree(logDir) } diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy index dfa109b0..1a24fe54 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/extension/ServerDeployExtension.groovy @@ -16,6 +16,7 @@ package org.labkey.gradle.plugin.extension import org.gradle.api.Project +import org.gradle.api.file.Directory import org.labkey.gradle.plugin.ServerDeploy import org.labkey.gradle.util.BuildUtils @@ -23,19 +24,29 @@ class ServerDeployExtension { Map foundModules = new HashMap<>(); - static String getServerDeployDirectory(Project project) + static String getServerDeployDirectoryPath(Project project) { return BuildUtils.getRootBuildDirFile(project, ServerDeploy.DEPLOY_DIR).path } - static String getEmbeddedServerDeployDirectory(Project project) + static String getEmbeddedServerDeployDirectoryPath(Project project) { - return "${getServerDeployDirectory(project)}/embedded" + return "${getServerDeployDirectoryPath(project)}/embedded" + } + + static Directory getEmbeddedDir(Project project) + { + return project.rootProject.layout.buildDirectory.dir(ServerDeploy.DEPLOY_DIR + "/embedded").get() + } + + static Directory getEmbeddedBinDir(Project project) + { + return project.rootProject.layout.buildDirectory.dir(ServerDeploy.DEPLOY_DIR + "/embedded/bin").get() } static String getModulesDeployDirectory(Project project) { - return "${getServerDeployDirectory(project)}/${ServerDeploy.MODULES_DIR}" + return "${getServerDeployDirectoryPath(project)}/${ServerDeploy.MODULES_DIR}" } String getFoundModule(String key) diff --git a/src/main/groovy/org/labkey/gradle/plugin/extension/TeamCityExtension.groovy b/src/main/groovy/org/labkey/gradle/plugin/extension/TeamCityExtension.groovy index b7241f96..0f27bf3c 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/extension/TeamCityExtension.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/extension/TeamCityExtension.groovy @@ -17,7 +17,6 @@ package org.labkey.gradle.plugin.extension import org.apache.commons.io.FileUtils import org.gradle.api.Project -import org.labkey.gradle.util.BuildUtils import org.labkey.gradle.util.DatabaseProperties import java.nio.charset.StandardCharsets @@ -116,7 +115,7 @@ class TeamCityExtension } File startupPropertiesDir() { - File startupDir = new File(new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project)), 'startup') + File startupDir = new File(new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)), 'startup') FileUtils.forceMkdir(startupDir) return startupDir } diff --git a/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy b/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy index b4e50e01..a5ffaa7c 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployDistribution.groovy @@ -1,37 +1,40 @@ package org.labkey.gradle.task import org.gradle.api.file.CopySpec +import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction +import org.labkey.gradle.plugin.ServerDeploy import org.labkey.gradle.plugin.extension.DistributionExtension +import org.labkey.gradle.plugin.extension.ServerDeployExtension abstract class DeployDistribution extends DeployAppBase { @OutputDirectory - File deployDir = new File((String) project.serverDeploy.embeddedDir) + final abstract DirectoryProperty deployDir = project.objects.directoryProperty().convention(ServerDeployExtension.getEmbeddedDir(project)) @OutputDirectory - File deployBinDir = new File((String) project.serverDeploy.embeddedDir, "bin") + final abstract DirectoryProperty deployBinDir = project.objects.directoryProperty().convention(ServerDeployExtension.getEmbeddedBinDir(project)) @TaskAction void action() { deployExecutableJar() - deployPlatformBinaries(deployBinDir) + deployPlatformBinaries(deployBinDir.get().asFile) } private void deployExecutableJar() { File distributionFile = DistributionExtension.getDistributionFile(project) fs.copy({ CopySpec copy -> copy.from project.tarTree(distributionFile).files - copy.into deployDir + copy.into deployDir.get() copy.include "*.jar" copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) }) fs.copy({ CopySpec copy -> copy.from project.tarTree(distributionFile).files - copy.into deployBinDir + copy.into deployBinDir.get() copy.include "*.exe", "*.dll" copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) }) diff --git a/src/main/groovy/org/labkey/gradle/task/StartLabKey.groovy b/src/main/groovy/org/labkey/gradle/task/StartLabKey.groovy index a1f0f444..680c59be 100644 --- a/src/main/groovy/org/labkey/gradle/task/StartLabKey.groovy +++ b/src/main/groovy/org/labkey/gradle/task/StartLabKey.groovy @@ -47,7 +47,7 @@ class StartLabKey extends DefaultTask File jarFile = BuildUtils.getExecutableServerJar(project) if (jarFile == null) { - throw new GradleException("No jar file found in ${ServerDeployExtension.getEmbeddedServerDeployDirectory(project)}.") + throw new GradleException("No jar file found in ${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)}.") } else { @@ -63,20 +63,20 @@ class StartLabKey extends DefaultTask commandParts += getStartupOpts(project) commandParts += ["-jar", jarFile.getName()] - File logFile = new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project), Tomcat.EMBEDDED_LOG_FILE_NAME) + File logFile = new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project), Tomcat.EMBEDDED_LOG_FILE_NAME) if (!logFile.getParentFile().exists()) logFile.getParentFile().mkdirs() if (!logFile.exists()) logFile.createNewFile() FileOutputStream outputStream = new FileOutputStream(logFile) def envMap = new HashMap<>(System.getenv()) - envMap.put('PATH', "${ServerDeployExtension.getEmbeddedServerDeployDirectory(project)}/bin${File.pathSeparator}${System.getenv("PATH")}") + envMap.put('PATH', "${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)}/bin${File.pathSeparator}${System.getenv("PATH")}") def env = [] for (String key : envMap.keySet()) { env += "${key}=${envMap.get(key)}" } - this.logger.info("Starting LabKey with command ${commandParts} and env ${env} in directory ${ServerDeployExtension.getEmbeddedServerDeployDirectory(project)}") - Process process = commandParts.execute(env, new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project))) + this.logger.info("Starting LabKey with command ${commandParts} and env ${env} in directory ${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)}") + Process process = commandParts.execute(env, new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project))) process.consumeProcessOutput(outputStream, outputStream) } } diff --git a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy index b13a050b..a96ceee2 100644 --- a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy +++ b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy @@ -845,12 +845,12 @@ class BuildUtils static String getEmbeddedConfigPath(Project project) { - return new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project), "config").absolutePath + return new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project), "config").absolutePath } static File getExecutableServerJar(Project project) { - File deployDir = new File(ServerDeployExtension.getEmbeddedServerDeployDirectory(project)) + File deployDir = new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)) File[] jarFiles = deployDir.listFiles(new FilenameFilter() { @Override boolean accept(File dir, String name) { From 5e86ac680cc0f1cfcfa9fee5afced9f21f45307f Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Fri, 1 Nov 2024 13:48:15 -0700 Subject: [PATCH 18/26] One more reference to staging extension --- src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy index 7ce2e7db..9526f5de 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy @@ -199,7 +199,7 @@ class FileModule implements Plugin project.copy { CopySpec copy -> copy.from moduleTask copy.from project.configurations.modules - copy.into project.staging.modulesDir + copy.into "${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR" copy.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) } project.copy { CopySpec copy -> @@ -305,7 +305,8 @@ class FileModule implements Plugin // staging has only the .modules files if (includeStaging) { - File stagingDir = new File((String) project.staging.modulesDir) + + File stagingDir = new File("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR") if (stagingDir.isDirectory()) { files.addAll(stagingDir.listFiles(new FilenameFilter() { From 16eb09acb71b0b49e3ddc6de218f8df8f3c7b89c Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Mon, 4 Nov 2024 07:01:38 -0800 Subject: [PATCH 19/26] Utility methods for better readability --- .../org/labkey/gradle/plugin/FileModule.groovy | 2 +- .../groovy/org/labkey/gradle/task/DeployApp.groovy | 13 +++++++------ .../org/labkey/gradle/task/DeployAppBase.groovy | 4 ++-- .../labkey/gradle/task/RestartTriggerTask.groovy | 4 ++-- .../org/labkey/gradle/task/StageDistribution.groovy | 6 +++--- .../org/labkey/gradle/task/StageModules.groovy | 2 +- .../groovy/org/labkey/gradle/util/BuildUtils.groovy | 13 +++++++++++++ 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy index 9526f5de..8fc32eaf 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/FileModule.groovy @@ -306,7 +306,7 @@ class FileModule implements Plugin if (includeStaging) { - File stagingDir = new File("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR") + File stagingDir = BuildUtils.getRootBuildDirFile(project, ServerDeploy.STAGING_MODULES_DIR) if (stagingDir.isDirectory()) { files.addAll(stagingDir.listFiles(new FilenameFilter() { diff --git a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy index 3438d7d4..0c248636 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployApp.groovy @@ -22,27 +22,28 @@ import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import org.labkey.gradle.plugin.ServerDeploy +import org.labkey.gradle.util.BuildUtils abstract class DeployApp extends DeployAppBase { @InputDirectory - final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.STAGING_MODULES_DIR)) + final abstract DirectoryProperty stagingModulesDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_MODULES_DIR) @InputDirectory - final abstract DirectoryProperty stagingPipelineJarDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.STAGING_PIPELINE_DIR)) + final abstract DirectoryProperty stagingPipelineJarDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_PIPELINE_DIR) @OutputDirectory - final abstract DirectoryProperty deployModulesDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.MODULES_DIR)) + final abstract DirectoryProperty deployModulesDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.MODULES_DIR) // We declare this as an output so it will be created by this task, even though not actually populated here @OutputDirectory - final abstract DirectoryProperty deployWebappDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.WEBAPP_DIR)) + final abstract DirectoryProperty deployWebappDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.WEBAPP_DIR) @OutputDirectory - final abstract DirectoryProperty deployPipelineLibDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.PIPELINE_DIR)) + final abstract DirectoryProperty deployPipelineLibDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.PIPELINE_DIR) @OutputDirectory - final abstract DirectoryProperty deployBinDir = project.objects.directoryProperty().convention(project.rootProject.layout.buildDirectory.dir(ServerDeploy.BIN_DIR)) + final abstract DirectoryProperty deployBinDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.BIN_DIR) @TaskAction void action() diff --git a/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy b/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy index d118aad6..f1efbc63 100644 --- a/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DeployAppBase.groovy @@ -8,6 +8,7 @@ import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.FileSystemOperations import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.OutputDirectory +import org.labkey.gradle.util.BuildUtils import javax.inject.Inject @@ -19,8 +20,7 @@ abstract class DeployAppBase extends RestartTriggerTask { abstract ConfigurableFileCollection getBinaries() @OutputDirectory - final abstract DirectoryProperty _externalDir = project.objects.directoryProperty() - .convention(project.rootProject.layout.projectDirectory.dir("external")) + final abstract DirectoryProperty _externalDir = BuildUtils.getRootBuildDirectoryProperty(project, "external") protected void deployPlatformBinaries(File deployBinDir) { diff --git a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy index 0b8a5a25..c9a77332 100644 --- a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy +++ b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy @@ -5,6 +5,7 @@ import org.gradle.api.file.DirectoryProperty import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.OutputDirectory +import org.labkey.gradle.util.BuildUtils import java.nio.charset.StandardCharsets import java.text.SimpleDateFormat @@ -16,8 +17,7 @@ abstract class RestartTriggerTask extends DefaultTask final abstract Property useLocalBuild = project.objects.property(String).convention(project.hasProperty('useLocalBuild') ? (String) project.property('useLocalBuild') : null) @OutputDirectory - final abstract DirectoryProperty triggerFileDir = project.objects.directoryProperty() - .convention(project.rootProject.layout.buildDirectory.dir("deploy/modules")) + final abstract DirectoryProperty triggerFileDir = BuildUtils.getRootBuildDirectoryProperty(project, "deploy/modules") @Input void updateRestartTriggerFile() diff --git a/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy b/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy index 9e5e95aa..2e4247cd 100644 --- a/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy +++ b/src/main/groovy/org/labkey/gradle/task/StageDistribution.groovy @@ -38,13 +38,13 @@ abstract class StageDistribution extends DefaultTask protected File distributionFile = null @OutputDirectory - final abstract DirectoryProperty modulesStagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR")) + final abstract DirectoryProperty modulesStagingDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_MODULES_DIR) @OutputDirectory - final abstract DirectoryProperty stagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_DIR")) + final abstract DirectoryProperty stagingDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_DIR) @OutputDirectory - final abstract DirectoryProperty pipelineJarStagingDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_PIPELINE_DIR")) + final abstract DirectoryProperty pipelineJarStagingDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_PIPELINE_DIR) @TaskAction void action() diff --git a/src/main/groovy/org/labkey/gradle/task/StageModules.groovy b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy index cba73961..0bb8a50b 100644 --- a/src/main/groovy/org/labkey/gradle/task/StageModules.groovy +++ b/src/main/groovy/org/labkey/gradle/task/StageModules.groovy @@ -18,7 +18,7 @@ abstract class StageModules extends DefaultTask @Inject abstract FileSystemOperations getFs() @OutputDirectory - final abstract DirectoryProperty stagingModulesDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir("${BuildUtils.getRootBuildDirPath(project)}/$ServerDeploy.STAGING_MODULES_DIR")) + final abstract DirectoryProperty stagingModulesDir = BuildUtils.getRootBuildDirectoryProperty(project, ServerDeploy.STAGING_MODULES_DIR) @InputFiles abstract ConfigurableFileCollection getDownloadedModules() diff --git a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy index a96ceee2..9ad0f858 100644 --- a/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy +++ b/src/main/groovy/org/labkey/gradle/util/BuildUtils.groovy @@ -24,8 +24,11 @@ import org.gradle.api.UnknownDomainObjectException import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.DependencySubstitutions import org.gradle.api.artifacts.ProjectDependency +import org.gradle.api.file.Directory +import org.gradle.api.file.DirectoryProperty import org.gradle.api.initialization.Settings import org.gradle.api.invocation.Gradle +import org.gradle.api.provider.Provider import org.labkey.gradle.plugin.extension.LabKeyExtension import org.labkey.gradle.plugin.extension.ModuleExtension import org.labkey.gradle.plugin.extension.ServerDeployExtension @@ -943,6 +946,16 @@ class BuildUtils return project.rootProject.layout.buildDirectory.get().asFile.path } + static Provider getRootBuildDirectoryProvider(Project project, String directoryPath) + { + return project.rootProject.layout.buildDirectory.dir(directoryPath) + } + + static DirectoryProperty getRootBuildDirectoryProperty(Project project, String defaultDirectoryPath) + { + return project.objects.directoryProperty().convention(getRootBuildDirectoryProvider(project, defaultDirectoryPath)) + } + // See Issue 49316: https://www.labkey.org/home/Developer/issues/Secure/issues-details.view?issueId=49316 static void substituteModuleDependencies(Project project, String configName) { From 8c74fb99083957f4fc9f6a79fb05a51c2b424e17 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Mon, 4 Nov 2024 07:43:26 -0800 Subject: [PATCH 20/26] Remove comment --- src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy index 2926cf0c..958b11ed 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/ServerDeploy.groovy @@ -203,7 +203,6 @@ class ServerDeploy implements Plugin project.tasks.named('deployApp').configure { dependsOn(project.tasks.setup) dependsOn(project.tasks.stageApp) -// notCompatibleWithConfigurationCache("Uses project.zipTree") } if (BuildUtils.embeddedProjectExists(project)) { From 0ed8e44ceb9127f711b9b45fc95bcb250a3abc73 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Mon, 4 Nov 2024 07:46:34 -0800 Subject: [PATCH 21/26] Remove commented out code for experimenting with node/npm install --- src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy index 0e3a74bb..2f813558 100644 --- a/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy +++ b/src/main/groovy/org/labkey/gradle/plugin/NpmRun.groovy @@ -85,20 +85,10 @@ class NpmRun implements Plugin // Base URL for fetching node distributions (change if you have a mirror). if (project.hasProperty('nodeRepo')) distBaseUrl = project.nodeRepo -// -// // The directory where Node.js is unpacked (when download is true) -// workDir = project.file("${project.rootProject.projectDir}/.gradle/nodejs") -// -// // The directory where npm is installed (when a specific version is defined) -// npmWorkDir = project.file("${project.rootProject.projectDir}/.gradle/npm") -// -// // The directory where yarn is installed (when a Yarn task is used) -// yarnWorkDir = project.file("${project.rootProject.projectDir}/.gradle/yarn") // If true, it will download node using above parameters. // If false, it will try to use globally installed node. download = project.hasProperty('nodeVersion') && project.hasProperty('npmVersion') -// download = project.path === project.rootProject.path && project.hasProperty('nodeVersion') && project.hasProperty('npmVersion') // Set the work directory where node_modules should be located nodeProjectDir = project.file("${project.projectDir}") From 2a48f81875671ba13d337dd82cd6cd293526e4b1 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Mon, 4 Nov 2024 09:07:19 -0800 Subject: [PATCH 22/26] Use try with resources --- .../org/labkey/gradle/task/RestartTriggerTask.groovy | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy index c9a77332..b8b027ab 100644 --- a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy +++ b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy @@ -28,16 +28,10 @@ abstract class RestartTriggerTask extends DefaultTask if (!triggerFileDir.get().asFile.exists()) return - OutputStreamWriter writer = null - try { - File triggerFile = new File(triggerFileDir.get().asFile, RESTART_FILE_NAME) - writer = new OutputStreamWriter(new FileOutputStream(triggerFile), StandardCharsets.UTF_8) - writer.write(SimpleDateFormat.getDateTimeInstance().format(new Date())) - } - finally + File triggerFile = new File(triggerFileDir.get().asFile, RESTART_FILE_NAME) + try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(triggerFile), StandardCharsets.UTF_8)) { - if (writer != null) - writer.close() + writer.write(SimpleDateFormat.getDateTimeInstance().format(new Date())) } } } From a1ade56b6d7758902f6a2c3d084498cf3129a2f7 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Mon, 4 Nov 2024 12:40:36 -0800 Subject: [PATCH 23/26] void method is not an input --- .../groovy/org/labkey/gradle/task/RestartTriggerTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy index b8b027ab..891aec07 100644 --- a/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy +++ b/src/main/groovy/org/labkey/gradle/task/RestartTriggerTask.groovy @@ -13,13 +13,13 @@ import java.text.SimpleDateFormat abstract class RestartTriggerTask extends DefaultTask { public static final String RESTART_FILE_NAME = ".restartTrigger" + @Input final abstract Property useLocalBuild = project.objects.property(String).convention(project.hasProperty('useLocalBuild') ? (String) project.property('useLocalBuild') : null) @OutputDirectory final abstract DirectoryProperty triggerFileDir = BuildUtils.getRootBuildDirectoryProperty(project, "deploy/modules") - @Input void updateRestartTriggerFile() { if (useLocalBuild.get() == null || "false" == useLocalBuild.get()) From 2c3b80a9adb0dcdd45c026c378369284dabe1f4b Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Tue, 5 Nov 2024 07:10:24 -0800 Subject: [PATCH 24/26] Use BuildUtils for restartTrigger update instead of base class --- src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy index 7f5c8ef5..957c6bd2 100644 --- a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy @@ -15,6 +15,7 @@ */ package org.labkey.gradle.task +import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.file.CopySpec import org.gradle.api.file.DuplicatesStrategy @@ -28,10 +29,11 @@ import org.labkey.gradle.util.PropertiesUtils import java.util.function.Function -class DoThenSetup extends RestartTriggerTask +class DoThenSetup extends DefaultTask { @Optional @Input protected DatabaseProperties databaseProperties + @Input boolean dbPropertiesChanged = false @@ -102,7 +104,7 @@ class DoThenSetup extends RestartTriggerTask return PropertiesUtils.replaceProps(line, configProperties, false) }) }) - updateRestartTriggerFile() + BuildUtils.updateRestartTriggerFile(project) } } From b1ec953ae396b7065cf282f0dd7858495b347cdc Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Tue, 5 Nov 2024 08:34:44 -0800 Subject: [PATCH 25/26] Add TODOs --- src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy index 957c6bd2..6d18fc7c 100644 --- a/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy +++ b/src/main/groovy/org/labkey/gradle/task/DoThenSetup.groovy @@ -29,8 +29,12 @@ import org.labkey.gradle.util.PropertiesUtils import java.util.function.Function +// TODO making this extend from RestartTriggerTask causes the following error on TeamCity: +// Cannot fingerprint input property 'databaseProperties': value 'org.labkey.gradle.util.DatabaseProperties@286cb41a' cannot be serialized. +// Even though RestartTriggerTask has nothing to do with the `databaseProperties` class DoThenSetup extends DefaultTask { + // TODO rethink this input declaration. Dependence on a file makes more sense @Optional @Input protected DatabaseProperties databaseProperties From eda0b246d600cab162785716b40af299dc153234 Mon Sep 17 00:00:00 2001 From: labkey-susanh Date: Tue, 5 Nov 2024 10:45:25 -0800 Subject: [PATCH 26/26] prepare for merge to develop --- README.md | 6 +++++- build.gradle | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f9daf2c5..67854d63 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,13 @@ on how to do that, including how to develop and test locally and the versioning ## Release Notes -### 4.3.0-SNAPSHOT +### 5.1.0-SNAPSHOT *Released*: TBD (Earliest compatible LabKey version: 24.11) + +### 5.0.0 +*Released*: 5 November 2024 +(Earliest compatible LabKey version: 24.11) - Stop adding the standalone `VERSION` file to distribution archives; the `distribution.properties` file now contains the `version` and `buildUrl` properties that `EmbeddedExtractor.java` reads. - Remove `checkModuleTasks` tasks, added to get us through a transition from plugins being declared more centrally diff --git a/build.gradle b/build.gradle index bb6d443c..9f87c84e 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ dependencies { } group 'org.labkey.build' -project.version = "4.3.0-configCache-SNAPSHOT" +project.version = "5.1.0-SNAPSHOT" gradlePlugin { plugins {