Commit 979a3ddc authored by Misagh Moayyed's avatar Misagh Moayyed

cleaning up build dependencies

parent 7d6ad46a
...@@ -12,7 +12,7 @@ buildscript { ...@@ -12,7 +12,7 @@ buildscript {
classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}" classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}" classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}" classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"
classpath 'com.boazj.gradle:gradle-log-plugin:0.1.0' classpath "com.boazj.gradle:gradle-log-plugin:${project.gradleLogVersion}"
} }
} }
...@@ -32,7 +32,7 @@ def casWebApplicationBinaryName = "cas.war" ...@@ -32,7 +32,7 @@ def casWebApplicationBinaryName = "cas.war"
project.ext."casServerVersion" = casServerVersion project.ext."casServerVersion" = casServerVersion
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName
apply from: "https://dl.bintray.com/scalding/generic/waroverlay.gradle" apply from: rootProject.file("gradle/waroverlay.gradle")
apply from: rootProject.file("gradle/tasks.gradle") apply from: rootProject.file("gradle/tasks.gradle")
apply plugin: "war" apply plugin: "war"
...@@ -45,17 +45,14 @@ tasks.findByName("jibDockerBuild") ...@@ -45,17 +45,14 @@ tasks.findByName("jibDockerBuild")
.dependsOn(copyWebAppIntoJib, copyConfigIntoJib) .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
.finalizedBy(deleteWebAppFromJib) .finalizedBy(deleteWebAppFromJib)
afterEvaluate { project ->
println "******************************************************************"
println "Apereo CAS $casServerVersion"
println "Enterprise Single SignOn for all earthlings and beyond"
println "- https://github.com/apereo/cas"
println "- https://apereo.github.io/cas"
println "******************************************************************"
}
configurations.all { configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
cacheDynamicVersionsFor 0, "seconds"
preferProjectModules()
failOnVersionConflict()
}
} }
eclipse { eclipse {
......
...@@ -18,6 +18,7 @@ jibVersion=0.10.0 ...@@ -18,6 +18,7 @@ jibVersion=0.10.0
shellDir=build/libs shellDir=build/libs
ivyVersion=2.4.0 ivyVersion=2.4.0
gradleDownloadTaskVersion=3.4.3 gradleDownloadTaskVersion=3.4.3
gradleLogVersion=0.1.0
# use without "-slim" in tag name if you want tools like jstack, adds about 100MB to image size # use without "-slim" in tag name if you want tools like jstack, adds about 100MB to image size
# (https://hub.docker.com/r/adoptopenjdk/openjdk11/tags/) # (https://hub.docker.com/r/adoptopenjdk/openjdk11/tags/)
......
...@@ -3,6 +3,15 @@ import org.apache.tools.ant.taskdefs.condition.Os ...@@ -3,6 +3,15 @@ import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.* import java.nio.file.*
import java.util.* import java.util.*
afterEvaluate { project ->
println "******************************************************************"
println "Apereo CAS $casServerVersion"
println "Enterprise Single SignOn for all earthlings and beyond"
println "- https://github.com/apereo/cas"
println "- https://apereo.github.io/cas"
println "******************************************************************"
}
buildscript { buildscript {
repositories { repositories {
mavenLocal() mavenLocal()
...@@ -14,10 +23,13 @@ buildscript { ...@@ -14,10 +23,13 @@ buildscript {
} }
} }
apply plugin: 'de.undercouch.download' apply plugin: "de.undercouch.download"
apply plugin: 'com.boazj.log' apply plugin: "com.boazj.log"
def tomcatDirectory = "${buildDir}/apache-tomcat-${tomcatVersion}" def tomcatDirectory = "${buildDir}/apache-tomcat-${tomcatVersion}"
project.ext."tomcatDirectory" = tomcatDirectory
def explodedDir="${buildDir}/cas"
task copyCasConfiguration(type: Copy, group: "build", description: "Copy the CAS configuration from this project to /etc/cas/config") { task copyCasConfiguration(type: Copy, group: "build", description: "Copy the CAS configuration from this project to /etc/cas/config") {
from "etc/cas/config" from "etc/cas/config"
...@@ -46,7 +58,7 @@ task deleteWebAppFromJib(type: Delete, group: "Docker", description: "Explodes t ...@@ -46,7 +58,7 @@ task deleteWebAppFromJib(type: Delete, group: "Docker", description: "Explodes t
task explodeWar(type: Copy, group: "build", description: "Explodes the CAS web application archive") { task explodeWar(type: Copy, group: "build", description: "Explodes the CAS web application archive") {
dependsOn build dependsOn build
from zipTree("build/libs/${casWebApplicationBinaryName}") from zipTree("build/libs/${casWebApplicationBinaryName}")
into "${buildDir}/cas" into explodedDir
} }
task run(group: "build", description: "Run the CAS web application in embedded container mode") { task run(group: "build", description: "Run the CAS web application in embedded container mode") {
...@@ -198,7 +210,6 @@ task listTemplateViews (group: "build", description: "List all CAS views") { ...@@ -198,7 +210,6 @@ task listTemplateViews (group: "build", description: "List all CAS views") {
dependsOn explodeWar dependsOn explodeWar
doFirst { doFirst {
def explodedDir="${buildDir}/cas"
fileTree(explodedDir).matching { fileTree(explodedDir).matching {
include "**/*.html" include "**/*.html"
} }
...@@ -212,7 +223,6 @@ task getResource(group: "build", description: "Fetch a CAS resource and move it ...@@ -212,7 +223,6 @@ task getResource(group: "build", description: "Fetch a CAS resource and move it
dependsOn explodeWar dependsOn explodeWar
doFirst { doFirst {
def explodedDir="${buildDir}/cas"
def resourceName = project.getProperty("resourceName") def resourceName = project.getProperty("resourceName")
def results = fileTree(explodedDir).matching { def results = fileTree(explodedDir).matching {
...@@ -261,44 +271,25 @@ task unzipTomcat(type: Copy) { ...@@ -261,44 +271,25 @@ task unzipTomcat(type: Copy) {
includeEmptyDirs = false includeEmptyDirs = false
} }
task setCatalinaPermissions(type:Exec) {
doFirst {
commandLine "chmod", "+x", "${tomcatDirectory}/bin/catalina.sh"
}
}
task setTomcatStartupPermissions(type:Exec) {
dependsOn setCatalinaPermissions
doFirst {
commandLine "chmod", "+x", "${tomcatDirectory}/bin/startup.sh"
}
}
task setTomcatShutdownPermissions(type:Exec) {
dependsOn setCatalinaPermissions
doFirst {
commandLine "chmod", "+x", "${tomcatDirectory}/bin/shutdown.sh"
}
}
task shutdownTomcat(type:Exec) { task shutdownTomcat(type:Exec) {
doFirst { doFirst {
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/shutdown.sh").setExecutable(true)
environment["CATALINA_HOME"] = "${tomcatDirectory}" environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/shutdown.sh", "2>/dev/null" commandLine "${tomcatDirectory}/bin/shutdown.sh", "2>/dev/null"
ignoreExitValue = true ignoreExitValue = true
} }
} }
task tomcatDeploy(type:Exec) { task tomcatDeploy(type:Exec) {
dependsOn build, downloadTomcat, unzipTomcat, dependsOn build, downloadTomcat, unzipTomcat, shutdownTomcat
setTomcatShutdownPermissions, setTomcatStartupPermissions,
shutdownTomcat
doFirst { doFirst {
Files.copy(Paths.get(bootWar.archivePath.canonicalPath), Files.copy(Paths.get(bootWar.archivePath.canonicalPath),
Paths.get("${tomcatDirectory}/webapps/${casWebApplicationBinaryName}"), Paths.get("${tomcatDirectory}/webapps/${casWebApplicationBinaryName}"),
StandardCopyOption.REPLACE_EXISTING) StandardCopyOption.REPLACE_EXISTING)
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/startup.sh").setExecutable(true)
mkdir "${tomcatDirectory}/logs" mkdir "${tomcatDirectory}/logs"
environment["CATALINA_HOME"] = "${tomcatDirectory}" environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/startup.sh" commandLine "${tomcatDirectory}/bin/startup.sh"
...@@ -313,7 +304,4 @@ tail { ...@@ -313,7 +304,4 @@ tail {
build.mustRunAfter(setExecutable) build.mustRunAfter(setExecutable)
unzipTomcat.mustRunAfter(downloadTomcat) unzipTomcat.mustRunAfter(downloadTomcat)
setTomcatStartupPermissions.mustRunAfter(unzipTomcat)
setTomcatShutdownPermissions.mustRunAfter(setTomcatStartupPermissions)
shutdownTomcat.mustRunAfter(setTomcatShutdownPermissions)
tomcatDeploy.mustRunAfter(shutdownTomcat).finalizedBy(tail) tomcatDeploy.mustRunAfter(shutdownTomcat).finalizedBy(tail)
buildscript {
repositories {
maven { url "https://dl.bintray.com/scalding/maven" }
mavenCentral()
}
dependencies {
classpath "org.scaldingspoon.gradle:gradle-waroverlay-plugin:0.9.3"
}
}
if (!project.plugins.findPlugin(scaldingspoon.gradle.WarOverlayPlugin)) {
project.apply(plugin: scaldingspoon.gradle.WarOverlayPlugin)
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment