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

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

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

24 25 26 27 28 29
apply plugin: "war"
apply plugin: "org.springframework.boot"
apply plugin: "eclipse"
apply plugin: "idea"

def currentBranch = "master"
Misagh Moayyed's avatar
Misagh Moayyed committed
30
def currentVersion = "$System.env.casVersion"
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 78 79
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
80
    if (project.hasProperty("external")) {
Misagh Moayyed's avatar
Misagh Moayyed committed
81
        compile "org.apereo.cas:cas-server-webapp:${project.casVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
82
    } else {
Misagh Moayyed's avatar
Misagh Moayyed committed
83
        compile "org.apereo.cas:cas-server-webapp${project.appServer}:${project.casVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
84 85
    }
    // Other dependencies may be listed here...
86 87 88
}

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

task run(group: "build", description: "Run the CAS web application in embedded container mode") {
    dependsOn build
    doLast {
Misagh Moayyed's avatar
Misagh Moayyed committed
97 98
        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(" "))
99 100 101 102 103 104 105 106 107
        javaexec {
            main = "-jar";
            jvmArgs = casRunArgs
            args = ["build/libs/cas.war"]
            logger.info "Started ${commandLine}"
        }
    }
}

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

        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
124
    gradleVersion = "${project.gradleVersion}"
125 126 127 128
}

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

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") {}
Daniel Ramos's avatar
Daniel Ramos committed
141
task allDependencies(type: DependencyReportTask, description: "Display a graph of all project dependencies") {}