From 31409f7f4a9b9fff318dff0fa6db3124e4c38db3 Mon Sep 17 00:00:00 2001 From: Jeff Burke Date: Thu, 19 Mar 2026 12:19:23 -0700 Subject: [PATCH] CADC-14486 cleanup citation build file --- citation/Dockerfile | 2 +- citation/build.gradle | 125 +++++------------------------------------- opencadc.gradle | 20 +++---- 3 files changed, 25 insertions(+), 122 deletions(-) diff --git a/citation/Dockerfile b/citation/Dockerfile index d47c62f2..e5203d18 100644 --- a/citation/Dockerfile +++ b/citation/Dockerfile @@ -1,3 +1,3 @@ FROM images.opencadc.org/library/cadc-tomcat:1 -COPY build/libs/citation.war /usr/share/tomcat/webapps/citation.war \ No newline at end of file +COPY build/libs/citation.war /usr/share/tomcat/webapps/citation.war diff --git a/citation/build.gradle b/citation/build.gradle index 49254650..06e52fb5 100644 --- a/citation/build.gradle +++ b/citation/build.gradle @@ -1,9 +1,6 @@ -import org.apache.tools.ant.filters.ReplaceTokens - - plugins { id 'war' - + id 'checkstyle' // IntelliJ IDEA plugin here to allow integration tests to appear properly in IDEs. id 'idea' } @@ -11,120 +8,26 @@ plugins { repositories { mavenCentral() mavenLocal() - - maven { - url = 'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/m2repo' - } -} - -dependencies { - runtimeOnly 'jstl:jstl:1.2' - - testImplementation 'junit:junit:[4.12,5.0)' - testImplementation 'org.skyscreamer:jsonassert:[1.5,2.0)' - testImplementation 'org.easymock:easymock:[3.6,4.0)' - testImplementation 'org.apache.commons:commons-text:[1.3,)' - testImplementation 'org.opencadc:cadc-web-test:[2.1.1,3.0.0)' - testImplementation 'org.seleniumhq.selenium:selenium-java:[3.14,4.0)' } -sourceCompatibility = '1.8' -group = 'ca.nrc.cadc' - -war { - // Trying to fix static file caching on new build. - eachFile { - if (it.name.endsWith('.jsp')) { - filter(ReplaceTokens, tokens: [version: project.version]) - } - } +apply from: '../opencadc.gradle' - archiveName = 'citation.war' -} +sourceCompatibility = 11 -sourceSets { - intTest -} +group = 'org.opencadc' -configurations { - intTestImplementation - intTestImplementation.extendsFrom(testImplementation) -} - -idea { - module { - //and some extra test source dirs - testSourceDirs += file('src/intTest/java') - } -} +dependencies { + runtimeOnly 'jstl:jstl:1.2' -tasks.withType(Test) { - // Assign all Java system properties from - // the command line to the tests - systemProperties System.properties + intTestImplementation 'junit:junit:[4.12,5.0)' + intTestImplementation 'org.skyscreamer:jsonassert:[1.5,2.0)' + intTestImplementation 'org.apache.commons:commons-text:[1.3,)' + intTestImplementation 'org.opencadc:cadc-web-test:[2.1.1,3.0.0)' + intTestImplementation 'org.seleniumhq.selenium:selenium-java:[3.14,4.0)' } -['firefox', 'chrome'].each { driver -> - task "intTest${driver.capitalize()}"(type: Test) { driverTest -> - testClassesDirs = sourceSets.intTest.output.classesDirs - classpath = sourceSets.intTest.runtimeClasspath - reports { - html.destination = reporting.file("$name/html") - } - dependencies { - intTestImplementation 'junit:junit:[4.12,5.0)' - intTestImplementation 'org.opencadc:cadc-web-test:[2.1.1,3.0.0)' - intTestImplementation 'org.seleniumhq.selenium:selenium-java:[3.14,4.0)' - } - - // set the configuration context - testClassesDirs = sourceSets.intTest.output.classesDirs - classpath = sourceSets.intTest.runtimeClasspath - - // run the tests always - outputs.upToDateWhen { false } - - copy { - from System.getenv('A') + '/etc/' - into 'build/resources/intTest' - include 'DelegationTokenKey.priv' - rename 'DelegationTokenKey.priv', 'RsaSignaturePriv.key' - } - copy { - from System.getenv('A') + '/etc/' - into 'build/resources/intTest' - include 'DelegationTokenKey.pub' - rename 'DelegationTokenKey.pub', 'RsaSignaturePub.key' - } - - systemProperty "driver", "${driver}" - - if (!project.hasProperty('intTest_selenium_server_url')) { - systemProperty 'selenium.server.url', 'http://mach378.cadc.dao.nrc.ca:4444' - } - else { - systemProperty 'selenium.server.url', project.intTest_selenium_server_url - logger.info('Running browser tests on ' + project.intTest_selenium_server_url) - } - - if (!project.hasProperty('intTest_web_app_url')) { - System.err.println("Please set the intTest_web_app_url property (-PintTest_web_app_url=https://www...).") - } else { - systemProperty 'web.app.url', project.intTest_web_app_url - } - - if (!project.hasProperty('intTest_user_name')) { - System.err.println("Please set the intTest_user_name property (-PintTest_user_name=cadcuser).") - } else { - systemProperty 'user.name', project.intTest_user_name - } - - if (!project.hasProperty('intTest_user_password')) { - System.err.println("Please set the intTest_user_password property (-intTest_user_password=1234pw).") - } else { - systemProperty 'user.password', project.intTest_user_password - } - - maxParallelForks = 1 +war { + from('.') { + include 'VERSION' } } diff --git a/opencadc.gradle b/opencadc.gradle index d7431dda..a2ea6557 100644 --- a/opencadc.gradle +++ b/opencadc.gradle @@ -2,13 +2,13 @@ configurations { checkstyleDep intTestImplementation.extendsFrom testImplementation - runtime.exclude module: 'slf4j-reload4j' - runtime.exclude module: 'reload4j' + runtimeOnly.exclude module: 'slf4j-reload4j' + runtimeOnly.exclude module: 'reload4j' } dependencies { testImplementation 'com.puppycrawl.tools:checkstyle:8.2' - checkstyleDep 'org.opencadc:cadc-quality:[1.0,)' + checkstyleDep 'org.opencadc:cadc-quality:[1.0,1.1)' } checkstyle { @@ -29,12 +29,12 @@ sourceSets { } } -// Temporary work around for issue https://github.com/gradle/gradle/issues/881 - +// Temporary work around for issue https://github.com/gradle/gradle/issues/881 - // gradle not displaying fail build status when warnings reported --> tasks.withType(Checkstyle).each { checkstyleTask -> checkstyleTask.doLast { reports.all { report -> - def outputFile = report.destination + def outputFile = report.outputLocation.get().asFile if (outputFile.exists() && outputFile.text.contains("