build.gradle 3.79 KB
Newer Older
1 2 3 4 5 6
buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
    dependencies {
Misagh Moayyed's avatar
Misagh Moayyed committed
7
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
8 9 10 11 12 13 14 15 16
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url 'https://build.shibboleth.net/nexus/content/repositories/releases/' }
17
    maven { url "https://repo.spring.io/libs-milestone" }
18 19 20
}

apply from: "https://dl.bintray.com/scalding/generic/waroverlay.gradle"
Misagh Moayyed's avatar
Misagh Moayyed committed
21

22 23 24 25 26 27
apply plugin: "war"
apply plugin: "org.springframework.boot"
apply plugin: "eclipse"
apply plugin: "idea"

def currentBranch = "master"
Misagh Moayyed's avatar
Misagh Moayyed committed
28
def currentVersion = "$System.env.casVersion"
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
if (!currentVersion.contains("RC")) {
    def matcher = currentVersion =~ /(\d+\.\d+\.).+/
    if (matcher.find()) {
        currentBranch = matcher.group(1) + "x"
    }
}
logger.info "Using CAS branch [${currentBranch}] to handle overrides"
apply from: "https://raw.githubusercontent.com/apereo/cas/${currentBranch}/gradle/overrides.gradle"

eclipse {
    classpath {
       downloadSources = true
       downloadJavadoc = true
    }
}

idea {
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

war {
    includeWarJars = true
    entryCompression = ZipEntryCompression.STORED
}

springBoot {
    mainClassName = "org.apereo.cas.web.CasWebApplication"
}

bootWar {
	if (project.hasProperty('executable')) {
    	launchScript()
	}

	archiveName 'cas.war'
    baseName 'cas'

    excludeDevtools = false
}

bootRun {
    sourceResources sourceSets.main
    classpath = sourceSets.main.runtimeClasspath
}

dependencies {
Misagh Moayyed's avatar
Misagh Moayyed committed
78
    if (project.hasProperty("external")) {
Misagh Moayyed's avatar
Misagh Moayyed committed
79
        compile "org.apereo.cas:cas-server-webapp${project.appServer}:${project.casVersion}@war"
Misagh Moayyed's avatar
Misagh Moayyed committed
80
    } else {
Misagh Moayyed's avatar
Misagh Moayyed committed
81
        compile "org.apereo.cas:cas-server-webapp:${project.casVersion}@war"
Misagh Moayyed's avatar
Misagh Moayyed committed
82 83
    }
    // Other dependencies may be listed here...
84 85 86
}

task explodeWar(type: Copy, group: "build", description: "Explodes the cas.war") {
Misagh Moayyed's avatar
Misagh Moayyed committed
87 88 89
    dependsOn build
    from zipTree("build/libs/cas.war")
    into "${buildDir}/cas"
90 91 92 93 94
}

task run(group: "build", description: "Run the CAS web application in embedded container mode") {
    dependsOn build
    doLast {
Misagh Moayyed's avatar
Misagh Moayyed committed
95 96
        def args = "-Xmx2048M -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y"
        def casRunArgs = Arrays.asList(args.split(" "))
97 98 99 100 101 102 103 104 105
        javaexec {
            main = "-jar";
            jvmArgs = casRunArgs
            args = ["build/libs/cas.war"]
            logger.info "Started ${commandLine}"
        }
    }
}

Misagh Moayyed's avatar
Misagh Moayyed committed
106
task debug(group: "build", description: "Debug the CAS web application in embedded mode on port 5000") {
107 108
    dependsOn build
    doLast {
Misagh Moayyed's avatar
Misagh Moayyed committed
109
        def casDebugArgs = Arrays.asList("-Xmx2048M".split(" "))
110 111 112 113 114 115 116 117 118 119 120 121

        javaexec {
            main = "-jar";
            jvmArgs = casDebugArgs
            args = ["build/libs/cas.war"]

            logger.info "Started ${commandLine}"
        }
    }
}

task wrapper(type: Wrapper, description: "Update the Gradle wrapper") {
Misagh Moayyed's avatar
Misagh Moayyed committed
122
    gradleVersion = "${project.gradleVersion}"
123 124 125 126
}

task casVersion(group: "build", description: "Display the current CAS version") {
    doFirst {
Misagh Moayyed's avatar
Misagh Moayyed committed
127
        println "${project.casVersion}"
128 129 130 131 132 133 134 135 136 137 138
    }
}

task showConfiguration(group: "build", description: "Show configurations for each dependency, etc") {
    doLast() {
        def cfg = project.hasProperty("configuration") ? project.property("configuration") : "compile"
        configurations.getByName(cfg).each { println it }
    }
}

task allDependenciesInsight(type: DependencyInsightReportTask, description: "Produce insight information for all dependencies") {}
139
task allDependencies(type: DependencyReportTask, description: "Display a graph of all project dependencies") {}