forked from zepinto/imc4j
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
112 lines (97 loc) · 3.48 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
plugins {
id "com.gorylenko.gradle-git-properties" version "2.3.2"
}
allprojects {
version = '1.2.2-SNAPSHOT'
repositories {
mavenCentral()
}
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: "com.gorylenko.gradle-git-properties"
compileJava.options.encoding = 'UTF-8'
// compileJava.options.compilerArgs << '-Xlint:unchecked'
// compileJava.options.deprecation = true
// java.sourceCompatibility = JavaVersion.VERSION_1_8
// java.targetCompatibility = JavaVersion.VERSION_1_8
}
subprojects {
gitProperties {
extProperty = 'gitProps'
failOnNoGitDirectory = false
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "UTC"
gitPropertiesName = "${name}-git.info"
keys = ['git.branch',
'git.build.version',
'git.closest.tag.commit.count',
'git.closest.tag.name',
'git.commit.id',
'git.commit.id.abbrev',
'git.commit.id.describe',
'git.commit.time',
'git.dirty',
//'git.remote.origin.url',
'git.tags',
]
}
generateGitProperties.outputs.upToDateWhen { false }
publishing {
publications {
maven(MavenPublication) {
groupId = 'pt.lsts.imc4j'
from components.java
}
}
}
}
gitProperties {
extProperty = 'gitProps'
failOnNoGitDirectory = false
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "UTC"
gitPropertiesName = "git.info"
keys = ['git.branch',
'git.build.version',
'git.closest.tag.commit.count',
'git.closest.tag.name',
'git.commit.id',
'git.commit.id.abbrev',
'git.commit.id.describe',
'git.commit.time',
'git.dirty',
//'git.remote.origin.url',
'git.tags',
]
}
generateGitProperties.outputs.upToDateWhen { false }
clean {
delete fileTree(dir: 'dist' , include: '**/*.jar')
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
}
def createLauncher(proj, String launcherName, String destFolder, String jarName, String classBackseat,
boolean synckClock, boolean runAsHttpServer, String classHttpServer, String httpPort,
boolean httpConfigHotReload) {
configure(proj) {
proj.tasks.create("launcher${launcherName.capitalize().replaceAll('[-_]+(\\w?)', '$1')}", Copy) {
description = "Generate $name launcher"
group = 'Distribution'
def workTmpDirectory = "${rootDir}/${destFolder}"
outputs.upToDateWhen { false }
from("${rootProject.projectDir}/stubs") {
include 'launcher.stub'
rename ".*", "${launcherName.uncapitalize()}.sh"
filter { it.replaceAll("@JARNAME@", "${jarName}") }
filter { it.replaceAll("@CLASS_BACKSEAT@", "${classBackseat}") }
filter { it.replaceAll("@SYNC_CLOCK@", synckClock ? "" : "#") }
filter { it.replaceAll("@RUN_AS_HTTP_SERVER@", runAsHttpServer ? "" : "#") }
filter { it.replaceAll("@CLASS_SERVER@", "${classHttpServer}") }
filter { it.replaceAll("@HTTP_PORT@", "${httpPort}") }
filter { it.replaceAll("@HOT_CONFIG@", httpConfigHotReload ? "" : "#") }
}
into workTmpDirectory
}
}
}