build.gradle 3.25 KB
Newer Older
NicolaiO's avatar
NicolaiO committed
1
/*
NicolaiO's avatar
NicolaiO committed
2
 * Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
NicolaiO's avatar
NicolaiO committed
3
4
5
 */

plugins {
NicolaiO's avatar
NicolaiO committed
6
7
    id 'sumatra.java-conventions'
    id 'application'
NicolaiO's avatar
NicolaiO committed
8

NicolaiO's avatar
NicolaiO committed
9
10
11
    id 'com.palantir.git-version' version '0.12.3'
    id 'ca.cutterslade.analyze' version '1.4.3'
    id 'com.google.cloud.tools.jib' version '2.7.0'
12
    id "com.github.breadmoirai.github-release" version "2.2.12"
NicolaiO's avatar
NicolaiO committed
13
14
}

15
ext.versionDetails = versionDetails(prefix: "version/")
NicolaiO's avatar
NicolaiO committed
16
version gitVersion(prefix: "version/")
NicolaiO's avatar
NicolaiO committed
17

NicolaiO's avatar
NicolaiO committed
18
19
tasks.named('wrapper').configure {
    // Use the 'all' distributable when upgrading the Gradle wrapper
NicolaiO's avatar
NicolaiO committed
20
21
22
23
24
25
26
27
28
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
    distributionType = Wrapper.DistributionType.ALL
}

dependencies {
    implementation project(':autoreferee-gui')

    implementation project(':common-gui')
    implementation project(':common-gui-config')

    implementation project(':sumatra-model')
    implementation project(':sumatra-gui-log')
    implementation project(':sumatra-gui-referee')
    implementation project(':sumatra-gui-replay')
    implementation project(':sumatra-gui-visualizer')

    implementation project(':moduli-record')
    implementation project(':moduli-autoreferee')
    runtimeOnly project(':moduli-wp')
    runtimeOnly project(':moduli-referee')

    implementation 'com.github.TIGERs-Mannheim:moduli:2.2'
    implementation 'com.github.TIGERs-Mannheim:infonode:1.7.0'

    implementation 'org.apache.logging.log4j:log4j-api:2.12.1'
    runtimeOnly 'org.apache.logging.log4j:log4j-core:2.12.1'
    runtimeOnly 'org.apache.logging.log4j:log4j-1.2-api:2.12.1'
    runtimeOnly 'org.slf4j:slf4j-log4j12:1.7.25'

    implementation 'commons-cli:commons-cli:1.4'
}

application {
    mainClass.set('edu.tigers.autoref.AutoReferee')
    applicationDefaultJvmArgs = [
            '-Xms64m',
            '-Xmx2G',
            '-server',
            '-Dsun.java2d.d3d=false',
            '-Djava.net.preferIPv4Stack=true',
    ]
}

jib {
    to {
        image = "registry.hub.docker.com/tigersmannheim/auto-referee:latest"
        auth {
66
67
            username = System.getenv("DOCKER_HUB_USERNAME") ?: ""
            password = System.getenv("DOCKER_HUB_PASSWORD") ?: ""
NicolaiO's avatar
NicolaiO committed
68
69
70
71
        }
        tags = [rootProject.version]
    }
    from {
72
73
        // gcr.io/distroless/java:11
        image = "gcr.io/distroless/java@sha256:9d4092ba5e1c9dc4d1490fdead1dd7ea5c64e635b729fee11a6af55f51b337f8"
NicolaiO's avatar
NicolaiO committed
74
    }
75
76
77
78
    extraDirectories {
        paths {
            path {
                from = file('config')
NicolaiO's avatar
NicolaiO committed
79
                into = '/config'
80
81
82
            }
            path {
                from = file('src/main/jib')
NicolaiO's avatar
NicolaiO committed
83
                into = '/'
84
85
86
            }
        }
    }
NicolaiO's avatar
NicolaiO committed
87
88
89
90
91
92
93
94
95
96
97
98
}

run.workingDir = rootProject.projectDir

// set version here to avoid overriding the project version.
// version is set to null to skip it completely in the artifact names
// Thus, it is guaranteed that old artifacts are always overwritten.
distZip.archiveVersion.convention(null)
jar.archiveVersion.convention(null)

// disable tar distribution to avoid redundant artifacts
distTar.enabled = false
99

100
101
102
103
104
105
106
107
108
109
distributions {
    main {
        contents {
            from('config') {
                into 'config'
            }
        }
    }
}

110
111
112
githubRelease {
    token System.getenv("GITHUB_TOKEN") ?: ""
    owner "TIGERs-Mannheim"
113
    repo.set("AutoReferee")
114
    releaseAssets distZip
NicolaiO's avatar
NicolaiO committed
115
    tagName.set("version-${versionDetails.lastTag}")
116
}