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

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

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

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

33
apply from: rootProject.file("gradle/waroverlay.gradle")
Misagh Moayyed's avatar
Misagh Moayyed committed
34
apply from: rootProject.file("gradle/tasks.gradle")
35

36 37 38 39
apply plugin: "war"
apply plugin: "org.springframework.boot"
apply plugin: "eclipse"
apply plugin: "idea"
40 41
apply plugin: "com.google.cloud.tools.jib"

Misagh Moayyed's avatar
Misagh Moayyed committed
42
dependencies {
Misagh Moayyed's avatar
Misagh Moayyed committed
43
    compile "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}"
Misagh Moayyed's avatar
Misagh Moayyed committed
44 45 46
    // Other CAS dependencies/modules may be listed here...
}

Misagh Moayyed's avatar
Misagh Moayyed committed
47 48 49
tasks.findByName("jibDockerBuild")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)
50 51

configurations.all {
52 53 54 55 56
    resolutionStrategy {
        cacheChangingModulesFor 0, "seconds"
        cacheDynamicVersionsFor 0, "seconds"

        preferProjectModules()
57 58 59 60 61

        def failIfConflict = project.hasProperty("failOnVersionConflict") && Boolean.valueOf(project.getProperty("failOnVersionConflict"))
        if (failIfConflict) {
            failOnVersionConflict()
        }
62
    }
63
}
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

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

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

war {
80
    includeWarJars = true
81
    entryCompression = ZipEntryCompression.STORED
82 83
}

84 85 86 87 88
springBoot {
    mainClassName = "org.apereo.cas.web.CasWebApplication"
}

bootWar {
89 90 91 92 93 94 95 96 97 98 99 100
    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
    }
101 102 103 104 105 106 107
}

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

108 109 110 111 112
wrapper {
    distributionType = Wrapper.DistributionType.BIN
    gradleVersion = "${project.gradleVersion}"
}

113 114
jib {
    from {
hdeadman's avatar
hdeadman committed
115
        image = project.baseDockerImage
116 117 118 119 120 121 122 123 124
    }
    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
125
        /**
126 127 128 129 130 131 132 133
        auth {
            username = "*******"
            password = "*******"
        }
        tags = [casServerVersion]
        */
    }
    container {
Misagh Moayyed's avatar
Misagh Moayyed committed
134
        useCurrentTimestamp = true
135 136 137 138 139 140 141 142 143 144
        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
145
}