Skip to content

Commit

Permalink
Add missing input for CopyJsp and missing onlyIf config for `Writ…
Browse files Browse the repository at this point in the history
…eDependenciesFile` (#213)
  • Loading branch information
labkey-susanh authored Jul 18, 2024
1 parent 88e515f commit 5c80c1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on how to do that, including how to develop and test locally and the versioning

_Note: 1.28.0 and later require Gradle 7_

### 3.0.1
*Released*: 18 July 2024
(Earliest compatible LabKey version: 24.8)
- Fix issue with JSP copying because of missing input directory
- Add missing `onlyIf` condition for `WriteDependenciesFile`

### 3.0.0
*Released*: 15 July 2024
(Earliest compatible LabKey version: 24.8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class ModuleResources
Provider<Set<ResolvedArtifactResult>> artifacts = config.getIncoming().getArtifacts().getResolvedArtifacts();
task.getArtifactIds().set(artifacts.map(new WriteDependenciesFile.IdExtractor()))
}
task.externalDependencies.set(project.extensions.findByType(ModuleExtension.class).getExternalDependencies())
} catch (UnknownDomainObjectException ignore) {

}
task.externalDependencies.set(project.extensions.findByType(ModuleExtension.class).getExternalDependencies())
}

project.tasks.named("processModuleResources").configure {dependsOn(project.tasks.named('writeDependenciesList'))}
Expand Down
6 changes: 5 additions & 1 deletion src/main/groovy/org/labkey/gradle/task/CopyJsp.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction

Expand All @@ -14,6 +15,9 @@ abstract class CopyJsp extends DefaultTask

@Inject abstract FileSystemOperations getFs()

@InputDirectory
final abstract DirectoryProperty srcDir = project.objects.directoryProperty().convention(project.layout.projectDirectory.dir('src'))

@OutputDirectory
final abstract DirectoryProperty webappDir = project.objects.directoryProperty().convention(project.layout.buildDirectory.dir(WEBAPP_DIR).get())

Expand All @@ -23,7 +27,7 @@ abstract class CopyJsp extends DefaultTask
it.delete(webappDir.get().dir("org"))
}
fs.copy {
from 'src'
from srcDir.get()
into webappDir.get()
include '**/*.jsp'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> missing = []
List<String> licenseMissing = []
Map<String, ExternalDependency> dependencies = externalDependencies.get()
Expand Down Expand Up @@ -109,6 +109,9 @@ abstract class WriteDependenciesFile extends DefaultTask

void writeJarsTxt()
{
if (externalDependencies.get().isEmpty())
return

OutputStreamWriter writer = null
try {
writer = new OutputStreamWriter(new FileOutputStream(jarsTxtFile.get().asFile), StandardCharsets.UTF_8)
Expand Down

0 comments on commit 5c80c1d

Please sign in to comment.