Skip to content

Commit

Permalink
OZ-462: O3 frontend rebuild: only clean output directory if needed (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored Mar 11, 2024
1 parent 0fe3ca7 commit 403f16a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/openmrs/frontend_assembly/build-openmrs-frontend.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def outputDirectory = "${project.groupId}" == "com.ozonehis" && "${project.artif
"${project.build.directory}/${project.artifactId}-${project.version}/distro/binaries/openmrs/frontend"

def outputDirectoryFile = new File(outputDirectory)
if (outputDirectoryFile.exists()) {
outputDirectoryFile.eachFile(it -> it.delete())
outputDirectoryFile.eachDir(it -> { if (it.getName() != "ozone") { it.deleteDir() } })
}

def assembleCommand = "npx --legacy-peer-deps openmrs@${openmrsVersion} assemble --manifest --mode config --target ${outputDirectory} --config ${refAppConfigFile.getAbsolutePath()}"
log.info("Project: ${project.groupId}:${project.artifactId}")
Expand All @@ -32,6 +28,12 @@ if (!shouldBuildFrontend) {
}

if (shouldBuildFrontend) {
log.info("Cleaning ${outputDirectory}...")
if (outputDirectoryFile.exists()) {
outputDirectoryFile.eachFile(it -> it.delete())
outputDirectoryFile.eachDir(it -> { if (it.getName() != "ozone") { it.deleteDir() } })
}

log.info("Running assemble command...")

def assembleProcess = assembleCommand.execute()
Expand Down

0 comments on commit 403f16a

Please sign in to comment.