-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
84 lines (76 loc) · 2.81 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* This build file was auto generated by running the Gradle 'init' task
* by 'pablo' at '5/06/20 10:02' with Gradle 3.2.1
*
* This generated file contains a commented-out sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/3.2.1/userguide/tutorial_java_projects.html
*/
plugins {
id 'groovy'
id 'application'
id 'com.google.cloud.tools.jib' version '2.3.0'
id 'com.palantir.git-version' version '0.12.3'
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.14'
compile 'info.picocli:picocli:4.1.0'
compile 'com.networknt:json-schema-validator:1.0.40'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0'
// The production code uses the SLF4J logging API at compile time
//compile 'org.slf4j:slf4j-api:1.7.21'
runtimeOnly 'org.slf4j:slf4j-simple:1.7.30'
}
mainClassName = 'eu.indigo.jplvalidator.Cli'
project.ext.organization = 'eoscsynergy'
def details = versionDetails()
version = details.branchName
// Google's jib task
if (version == null) {
throw new GradleException('Cannot get current branch name!')
}
else {
if (version == 'master') {
jib.to.image = "${project.ext.organization}/${project.name}:latest"
}
else if (details.isCleanTag) {
jib.to.image = "${project.ext.organization}/${project.name}:${details.lastTag}"
}
else {
jib.to.image = "${project.ext.organization}/${project.name}:${details.branchName}"
}
jib.container.mainClass = mainClassName
jib.to.auth.username = "${System.env.JPL_USERNAME}"
jib.to.auth.password = "${System.env.JPL_PASSWORD}"
}
// 'fatJar' task
task fatJar(type: Jar) {
if (!version == null){
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': mainClassName
}
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
}
// 'showVersion' task
task showVersion {
doLast {
println "\nCurrent version: ${gitVersion()}\n"
println "last tag : ${details.lastTag}"
println "commit distance : ${details.commitDistance}"
println "hash : ${details.gitHash}"
println "branch name : ${details.branchName}"
println "is clean tag : ${details.isCleanTag}"
}
}