Skip to content

Commit

Permalink
Merge pull request #613 from groybal/UPSE-285
Browse files Browse the repository at this point in the history
UPSE-285: address Gradle file issue which seems more prominent when u…
  • Loading branch information
bjagg authored Jan 11, 2023
2 parents 1df8fbd + 88af382 commit 99d6f65
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 34 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
test:
name: "${{ matrix.platform }} with Java ${{ matrix.java-distribution }} version 8"
name: "${{ matrix.platform }} with Java ${{ matrix.java-distribution }} version ${{ matrix.java-version }}"
strategy:
matrix:
platform:
Expand All @@ -20,6 +20,9 @@ jobs:
- adopt-hotspot
- temurin
- zulu
java-version:
- 8
- 11
runs-on: ${{ matrix.platform }}
timeout-minutes: 15
steps:
Expand All @@ -29,7 +32,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: ${{ matrix.java-distribution }}
java-version: 8
java-version: ${{ matrix.java-version }}
- name: Build
run: ./gradlew -i -S build
- name: Tomcat Install
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* gradle.properties; but we can make that happen, since we have
* some properties in common.
*/
String gradlePropsLocation = new File('gradle.properties').exists() ? 'gradle.properties' : '../gradle.properties'
String gradlePropsLocation = file('gradle.properties').exists() ? 'gradle.properties' : '../gradle.properties'

Properties gradleProperties = new Properties()
gradleProperties.load(new FileInputStream(gradlePropsLocation))
gradleProperties.load(new FileInputStream(file(gradlePropsLocation)))
ext {
gradleProperties.each { name, value ->
set(name, value)
Expand Down
6 changes: 3 additions & 3 deletions gradle/tasks/portlet.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ task deployPortletApp() {
throw new GradleException("The specified portlet application does not exist: ${warfile}")
}

File destinationDir = new File(buildDir, 'pluto')
File destinationDir = file(new File(buildDir, 'pluto'))
destinationDir.mkdir()
File archiveOutput = new File(destinationDir, warfile.getName())
File archiveOutput = file(new File(destinationDir, warfile.getName()))

File serverBase = file(project.rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File(serverBase, "webapps/${FilenameUtils.removeExtension(warfile.getName())}")
File deployDir = file(new File(serverBase, "webapps/${FilenameUtils.removeExtension(warfile.getName())}"))
logger.lifecycle("Deploying portlet application ${warfile} to location ${deployDir}")

AssemblerConfig config = new AssemblerConfig()
Expand Down
2 changes: 1 addition & 1 deletion gradle/tasks/properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ task javaVersionCheck() {
description 'Ensures the current Java version is supported'

doLast {
def supportedJavaVersions = [ JavaVersion.VERSION_1_8 ];
def supportedJavaVersions = [ JavaVersion.VERSION_1_8, JavaVersion.VERSION_11 ];
def currentJavaVersion = JavaVersion.current();
if (!supportedJavaVersions.contains(currentJavaVersion)) {
throw new GradleException("Incorrect Java version; found ${currentJavaVersion} but supported versions are: ${supportedJavaVersions}");
Expand Down
6 changes: 3 additions & 3 deletions gradle/tasks/tomcat.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ task tomcatInstall() {

logger.lifecycle("Installing Tomcat servlet container version ${tomcatVersion} to location ${serverHome}")

File tomcatTmpDir = new File('build/tmp/tomcat')
File tomcatTmpDir = file('build/tmp/tomcat')

// Clear & reset the tomcat directory
tomcatTmpDir.deleteDir()
tomcatTmpDir.mkdirs()

File tomcatTarFile = new File("${tomcatTmpDir}/tomcat-gunziped.tar")
File tomcatTarFile = file("${tomcatTmpDir}/tomcat-gunziped.tar")

// Gunzip the Tomcat binaries
File tomcatTarGz = configurations.tomcat.files.iterator().next()
Expand Down Expand Up @@ -130,7 +130,7 @@ task tomcatStart() {
logger.lifecycle("Starting Tomcat servlet container in ${serverHome}")
String executable = isWindows ? 'cmd' : './catalina.sh'
ant.exec(dir: "${serverHome}/bin", executable: executable, spawn: true) {
env(key: "PORTAL_HOME", value: new File(portalHome).getCanonicalPath()) // Must be absolute
env(key: "PORTAL_HOME", value: file(portalHome).getCanonicalPath()) // Must be absolute
if (isWindows) {
arg(value: '/c')
arg(value: 'catalina.bat')
Expand Down
4 changes: 2 additions & 2 deletions overlays/Announcements/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))

ant.setLifecycleLogLevel('INFO')
ant.java(fork: true, failonerror: true, dir: rootProject.projectDir, classname: 'org.jasig.portlet.announcements.SchemaCreator') {
Expand All @@ -70,7 +70,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))
String implementationEntitiesLocation = PortalShellInvoker.createGroovySafePath(rootProject.ext['buildProperties'].getProperty('implementation.entities.location'))

ant.setLifecycleLogLevel('INFO')
Expand Down
4 changes: 2 additions & 2 deletions overlays/CalendarPortlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))

/*
* The following specifies failonerror=false because it will produce an exception like...
Expand Down Expand Up @@ -82,7 +82,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))
String implementationEntitiesLocation = PortalShellInvoker.createGroovySafePath(rootProject.ext['buildProperties'].getProperty('implementation.entities.location'))

ant.setLifecycleLogLevel('INFO')
Expand Down
8 changes: 4 additions & 4 deletions overlays/NewsReaderPortlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))

/*
* The following specifies failonerror=false because it will produce an exception like...
Expand Down Expand Up @@ -81,7 +81,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))
String implementationEntitiesLocation = PortalShellInvoker.createGroovySafePath(rootProject.ext['buildProperties'].getProperty('implementation.entities.location'))

ant.setLifecycleLogLevel('INFO')
Expand All @@ -108,7 +108,7 @@ dataImport {
println "Export directory: ${dirEscaped}"

File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))
println "classes: ${deployDir}/WEB-INF/classes"

ant.setLifecycleLogLevel('INFO')
Expand All @@ -135,7 +135,7 @@ dataExport {
println "Export directory: ${dirEscaped}"

File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))
println "classes: ${deployDir}/WEB-INF/classes"

ant.setLifecycleLogLevel('INFO')
Expand Down
2 changes: 1 addition & 1 deletion overlays/SimpleContentPortlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dataInit {
*/
doLast {
File serverBase = rootProject.file(rootProject.ext['buildProperties'].getProperty('server.base'))
File deployDir = new File (serverBase, "webapps/${project.name}")
File deployDir = rootProject.file(new File(serverBase, "webapps/${project.name}"))

ant.setLifecycleLogLevel('INFO')
ant.java(fork: true, failonerror: true, dir: rootProject.projectDir, classname: 'org.jasig.portlet.attachment.util.SchemaCreator') {
Expand Down
28 changes: 14 additions & 14 deletions overlays/uPortal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ war {
* Skinning Support
*/
import java.util.regex.Pattern
File skinsDir = new File ("${projectDir}/src/main/webapp/media/skins/respondr")
File skinsDir = rootProject.file("${projectDir}/src/main/webapp/media/skins/respondr")
task skinGenerate() {
group 'Skin'
description 'Genarate a new uPortal skin for Respondr; pass -DskinName={name} (required) to specify a name'
Expand All @@ -54,8 +54,8 @@ task skinGenerate() {
if (!Pattern.matches(/[a-zA-Z0-9]{3,20}/, skinName)) {
throw new GradleException('A valid skinName contains between 3 and 20 alphanumeric characters')
}
File skinFile = file("${projectDir}/src/main/webapp/media/skins/respondr/${skinName}.less")
File skinDir = file("${projectDir}/src/main/webapp/media/skins/respondr/${skinName}")
File skinFile = rootProject.file("${projectDir}/src/main/webapp/media/skins/respondr/${skinName}.less")
File skinDir = rootProject.file("${projectDir}/src/main/webapp/media/skins/respondr/${skinName}")
if (skinFile.exists() || skinDir.exists()) {
throw new GradleException("Unable to generate a skin with the same neame as an existing skin: ${skinName}")
}
Expand All @@ -78,8 +78,8 @@ task skinGenerate() {
}

// Copy skinList.xml if it does not exist
File skinListFile = file("${projectDir}/src/main/webapp/media/skins/respondr/skinList.xml")
File respondrDir = file("${projectDir}/src/main/webapp/media/skins/respondr")
File skinListFile = rootProject.file("${projectDir}/src/main/webapp/media/skins/respondr/skinList.xml")
File respondrDir = rootProject.file("${projectDir}/src/main/webapp/media/skins/respondr")
if (!skinListFile.exists()) {
copy {
from "${rootProject.projectDir}/etc/skin/skinList.xml"
Expand Down Expand Up @@ -159,7 +159,7 @@ else {
import org.apereo.portal.start.shell.PortalShellInvoker

ext {
shellDir = new File("${buildDir}/shell")
shellDir = rootProject.file("${buildDir}/shell")
}

dataInit {
Expand All @@ -178,7 +178,7 @@ dataInit {

shellDir.mkdirs()

File scriptFile = new File(shellDir, 'dataInit.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataInit.groovy'))
scriptFile.delete() // Clear from previous invocation, if present
scriptFile.append(
"""
Expand All @@ -195,7 +195,7 @@ portalShellBuildHelper.db('db',
boolean export = true
String outputFile = ' '

File scriptFile = new File(shellDir, 'dataInit.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataInit.groovy'))
['PortalDb', 'RawEventsDb', 'AggrEventsDb'].each { databaseQualifier ->
scriptFile.append(
"""
Expand Down Expand Up @@ -227,7 +227,7 @@ portalShellBuildHelper.hibernateCreate('db-hibernate',
String filesListFile = ' '
String logDir = PortalShellInvoker.createGroovySafePath(buildDir.getPath())

File scriptFile = new File(shellDir, 'dataInit.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataInit.groovy'))
[ baseEntitiesLocation, implementationEntitiesLocation ].each { entitiesLocation ->
scriptFile.append(
"""
Expand All @@ -245,7 +245,7 @@ portalShellBuildHelper.dataImport('data-import',
* Execute the commands in the scriptFile.
*/
doLast {
File scriptFile = new File(shellDir, 'dataInit.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataInit.groovy'))
PortalShellInvoker psi = new PortalShellInvoker()
psi.invoke(project, scriptFile.getAbsolutePath())
}
Expand Down Expand Up @@ -281,7 +281,7 @@ dataImport {

// Prepare the scriptFile
shellDir.mkdirs()
File scriptFile = new File(shellDir, 'dataImport.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataImport.groovy'))
scriptFile.delete() // Clear from previous invocation, if present
scriptFile.write(
"""
Expand Down Expand Up @@ -314,7 +314,7 @@ dataExport {

// Prepare the scriptFile
shellDir.mkdirs()
File scriptFile = new File(shellDir, 'dataExport.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataExport.groovy'))
scriptFile.delete() // Clear from previous invocation, if present
scriptFile.write(
"""
Expand Down Expand Up @@ -351,7 +351,7 @@ dataDelete {
} else {
// Prepare the scriptFile
shellDir.mkdirs()
File scriptFile = new File(shellDir, 'dataDelete.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataDelete.groovy'))
scriptFile.delete() // Clear from previous invocation, if present
scriptFile.write(
"""
Expand All @@ -377,7 +377,7 @@ dataList {

// Prepare the scriptFile
shellDir.mkdirs()
File scriptFile = new File(shellDir, 'dataList.groovy')
File scriptFile = rootProject.file(new File(shellDir, 'dataList.groovy'))
scriptFile.delete() // Clear from previous invocation, if present
scriptFile.write(
"""
Expand Down

0 comments on commit 99d6f65

Please sign in to comment.