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

cleaning up build dependencies

parent 7d6ad46a
......@@ -12,7 +12,7 @@ buildscript {
classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
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"
project.ext."casServerVersion" = casServerVersion
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 plugin: "war"
......@@ -45,17 +45,14 @@ tasks.findByName("jibDockerBuild")
.dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
.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 {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
cacheDynamicVersionsFor 0, "seconds"
preferProjectModules()
failOnVersionConflict()
}
}
eclipse {
......
......@@ -18,6 +18,7 @@ jibVersion=0.10.0
shellDir=build/libs
ivyVersion=2.4.0
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
# (https://hub.docker.com/r/adoptopenjdk/openjdk11/tags/)
......
......@@ -3,6 +3,15 @@ import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.*
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 {
repositories {
mavenLocal()
......@@ -14,10 +23,13 @@ buildscript {
}
}
apply plugin: 'de.undercouch.download'
apply plugin: 'com.boazj.log'
apply plugin: "de.undercouch.download"
apply plugin: "com.boazj.log"
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") {
from "etc/cas/config"
......@@ -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") {
dependsOn build
from zipTree("build/libs/${casWebApplicationBinaryName}")
into "${buildDir}/cas"
into explodedDir
}
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") {
dependsOn explodeWar
doFirst {
def explodedDir="${buildDir}/cas"
fileTree(explodedDir).matching {
include "**/*.html"
}
......@@ -212,7 +223,6 @@ task getResource(group: "build", description: "Fetch a CAS resource and move it
dependsOn explodeWar
doFirst {
def explodedDir="${buildDir}/cas"
def resourceName = project.getProperty("resourceName")
def results = fileTree(explodedDir).matching {
......@@ -261,44 +271,25 @@ task unzipTomcat(type: Copy) {
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) {
doFirst {
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/shutdown.sh").setExecutable(true)
environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/shutdown.sh", "2>/dev/null"
ignoreExitValue = true
}
}
task tomcatDeploy(type:Exec) {
dependsOn build, downloadTomcat, unzipTomcat,
setTomcatShutdownPermissions, setTomcatStartupPermissions,
shutdownTomcat
dependsOn build, downloadTomcat, unzipTomcat, shutdownTomcat
doFirst {
Files.copy(Paths.get(bootWar.archivePath.canonicalPath),
Paths.get("${tomcatDirectory}/webapps/${casWebApplicationBinaryName}"),
StandardCopyOption.REPLACE_EXISTING)
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/startup.sh").setExecutable(true)
mkdir "${tomcatDirectory}/logs"
environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/startup.sh"
......@@ -313,7 +304,4 @@ tail {
build.mustRunAfter(setExecutable)
unzipTomcat.mustRunAfter(downloadTomcat)
setTomcatStartupPermissions.mustRunAfter(unzipTomcat)
setTomcatShutdownPermissions.mustRunAfter(setTomcatStartupPermissions)
shutdownTomcat.mustRunAfter(setTomcatShutdownPermissions)
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