-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
91 lines (81 loc) · 2.27 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
85
86
87
88
89
90
91
group 'dbaltor'
version '1.0.0'
apply plugin: 'application'
apply plugin: "io.spring.dependency-management"
apply plugin: 'com.palantir.docker'
mainClassName = 'map.Supplier'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
classpath('gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.13.0')
}
}
dependencyManagement {
imports {
mavenBom 'software.amazon.awssdk:bom:2.1.0'
}
}
dependencies {
compile 'software.amazon.awssdk:sns'
compile 'software.amazon.awssdk:sqs'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
jar {
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': "${mainClassName}"
// 'Main-Class': 'qm.QueueManager'
)
}
}
//task finalise(type: Exec) {
task finalise {
dependsOn build
doLast {
if (project.hasProperty('local')) {
println("Will copy generated archive at the end.\n cp ./build/libs/${project.name}-${project.version}.jar ./build/distributions/${project.name}-${project.version}/lib/")
exec {
commandLine "cmd", "/c", "cp ./build/libs/${project.name}-${project.version}.jar ./build/distributions/${project.name}-${project.version}/lib/"
}
}
else {
exec {
println("Will expand tar file")
//workingDir './build/distributions/'
commandLine "tar", "xf", "./build/distributions/${project.name}-${project.version}.tar"
}
println("Will create the file ./files/start.sh")
new File("$projectDir/files/start.sh").text = """
#!/bin/sh
set -e
exec ./${project.name}-${project.version}/bin/${project.name} ./files/test1.csv
"""
exec {
println("Will give it run permission")
commandLine "chmod", "a+x", "./files/start.sh"
}
}
}
}
//finalise.onlyIf { project.hasProperty('local') }
build.finalizedBy(finalise)
docker {
dependsOn build
name "${project.group}/${project.name}:${project.version}"
files tasks.distTar.outputs
copySpec.from("files").into(".")
buildArgs(['TAR_FILE': "${project.name}-${project.version}.tar"])
}
dockerfileZip.enabled = false