Last active
November 4, 2020 09:30
-
-
Save sustacek/322318eb01fc9c5014efc0f7622b6062 to your computer and use it in GitHub Desktop.
Liferay Workspace - Tomcat version check between configs and used bundle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [root]/build.gradle | |
// A sanity check in case the Tomcat version inside the bundle changes and we miss it | |
[ | |
(initBundle): gradle.liferayWorkspace.homeDir, | |
(distBundle): file("${buildDir}/dist") | |
].each {Task task, File destDir -> | |
task.configure { | |
doLast { | |
println "Checking Tomcat files in " + destDir | |
def tomcatDirNameMatchingBundle = "tomcat-" + gradle.liferayWorkspace.appServerTomcatVersion | |
def offendingTomcatFiles = | |
fileTree(destDir) | |
.include("tomcat-*/**") | |
.exclude("${tomcatDirNameMatchingBundle}/**") | |
if (!offendingTomcatFiles.isEmpty()) { | |
throw new GradleException( | |
"Some of the files copied from '${relativePath(gradle.liferayWorkspace.configsDir)}' have a wrong " + | |
"Tomcat version. Make sure to place Tomcat files only inside '${tomcatDirNameMatchingBundle}'" + | |
" to be matching the Tomcat dir in the configured bundle.\n" + | |
offendingTomcatFiles.collect { " * ${it.absolutePath - destDir.absolutePath}" }.join("\n")) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you forget to rename your tomcat dir in {{configs}}, the build will fail, listing the files you need to move: