build.gradle 4.13 KB
Newer Older
1

Misagh Moayyed's avatar
Misagh Moayyed committed
2

3 4 5
buildscript {
    repositories {
        mavenLocal()
Misagh Moayyed's avatar
Misagh Moayyed committed
6
        mavenCentral()
7
        jcenter()
8
        maven { url "https://repo.spring.io/libs-milestone" }
Misagh Moayyed's avatar
Misagh Moayyed committed
9
        maven { url "https://plugins.gradle.org/m2/" }
10 11
    }
    dependencies {
Misagh Moayyed's avatar
Misagh Moayyed committed
12
        classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
13
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
14
        classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"
15
        classpath 'com.boazj.gradle:gradle-log-plugin:0.1.0'
16 17 18 19 20 21 22
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
Misagh Moayyed's avatar
Misagh Moayyed committed
23 24
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven { url "https://build.shibboleth.net/nexus/content/repositories/releases/" }
25 26
    maven { url "https://repo.spring.io/milestone/" }
    maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
27 28
}

Misagh Moayyed's avatar
Misagh Moayyed committed
29 30 31 32 33 34
def casServerVersion = project.'cas.version'
def casWebApplicationBinaryName = "cas.war"

project.ext."casServerVersion" = casServerVersion
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName

35
apply from: "https://dl.bintray.com/scalding/generic/waroverlay.gradle"
Misagh Moayyed's avatar
Misagh Moayyed committed
36
apply from: rootProject.file("gradle/tasks.gradle")
Misagh Moayyed's avatar
Misagh Moayyed committed
37

38 39 40 41
apply plugin: "war"
apply plugin: "org.springframework.boot"
apply plugin: "eclipse"
apply plugin: "idea"
Misagh Moayyed's avatar
Misagh Moayyed committed
42 43
apply plugin: "com.google.cloud.tools.jib"

Misagh Moayyed's avatar
Misagh Moayyed committed
44 45 46
tasks.findByName("jibDockerBuild")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)
Misagh Moayyed's avatar
Misagh Moayyed committed
47

Misagh Moayyed's avatar
Misagh Moayyed committed
48 49 50 51 52 53 54 55 56
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 "******************************************************************"
}

Misagh Moayyed's avatar
Misagh Moayyed committed
57 58 59
configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

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

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

war {
76
    includeWarJars = true
77
    entryCompression = ZipEntryCompression.STORED
78 79
}

80 81 82 83 84
springBoot {
    mainClassName = "org.apereo.cas.web.CasWebApplication"
}

bootWar {
Misagh Moayyed's avatar
Misagh Moayyed committed
85 86 87 88 89 90 91 92 93 94 95 96
    doFirst {
        def executable = project.hasProperty("executable") && Boolean.valueOf(project.getProperty("executable"))
        if (executable) {
            logger.info "Including launch script for executable WAR artifact"
            launchScript()
        } else {
            logger.info "WAR artifact is not marked as an executable"
        }
        archiveName "${casWebApplicationBinaryName}"
        baseName "cas"
        excludeDevtools = true
    }
97 98 99 100 101 102 103
}

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

104 105 106 107 108
wrapper {
    distributionType = Wrapper.DistributionType.BIN
    gradleVersion = "${project.gradleVersion}"
}

109
dependencies {
Misagh Moayyed's avatar
Misagh Moayyed committed
110
    if (project.hasProperty("external")) {
Misagh Moayyed's avatar
Misagh Moayyed committed
111
        compile "org.apereo.cas:cas-server-webapp:${casServerVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
112
    } else {
Misagh Moayyed's avatar
Misagh Moayyed committed
113
        compile "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
114 115
    }
    // Other dependencies may be listed here...
116 117
}

Misagh Moayyed's avatar
Misagh Moayyed committed
118 119
jib {
    from {
hdeadman's avatar
hdeadman committed
120
        image = project.baseDockerImage
Misagh Moayyed's avatar
Misagh Moayyed committed
121 122 123 124 125 126 127 128 129
    }
    to {
        image = "${project.group}/${project.name}"
        /**
         ecr-login: Amazon Elastic Container Registry (ECR)
         gcr: Google Container Registry (GCR)
         osxkeychain: Docker Hub
         */
        credHelper = "osxkeychain"
Misagh Moayyed's avatar
Misagh Moayyed committed
130
        /**
Misagh Moayyed's avatar
Misagh Moayyed committed
131 132 133 134 135 136 137 138
        auth {
            username = "*******"
            password = "*******"
        }
        tags = [casServerVersion]
        */
    }
    container {
Misagh Moayyed's avatar
Misagh Moayyed committed
139
        useCurrentTimestamp = true
Misagh Moayyed's avatar
Misagh Moayyed committed
140 141 142 143 144 145 146 147 148 149
        entrypoint = ['docker/entrypoint.sh']
        ports = ['80', '443', '8080', '8443']
        labels = [version:casServerVersion, name:project.name, group:project.group]
    }
    extraDirectory {
        path = file('src/main/jib')
        permissions = [
            '/docker/entrypoint.sh': '755'
        ]
    }
Misagh Moayyed's avatar
Misagh Moayyed committed
150
}