build.gradle 3.87 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:${project.gradleLogVersion}"
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: rootProject.file("gradle/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 48

configurations.all {
49 50 51 52 53 54 55
    resolutionStrategy {
        cacheChangingModulesFor 0, "seconds"
        cacheDynamicVersionsFor 0, "seconds"

        preferProjectModules()
        failOnVersionConflict()
    }
Misagh Moayyed's avatar
Misagh Moayyed committed
56
}
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

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

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

war {
73
    includeWarJars = true
74
    entryCompression = ZipEntryCompression.STORED
75 76
}

77 78 79 80 81
springBoot {
    mainClassName = "org.apereo.cas.web.CasWebApplication"
}

bootWar {
Misagh Moayyed's avatar
Misagh Moayyed committed
82 83 84 85 86 87 88 89 90 91 92 93
    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
    }
94 95 96 97 98 99 100
}

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

101 102 103 104 105
wrapper {
    distributionType = Wrapper.DistributionType.BIN
    gradleVersion = "${project.gradleVersion}"
}

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

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