forked from GuntherRademacher/rr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
171 lines (144 loc) · 4.54 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* Gradle build file for RR - Railroad Diagram Generator.
*/
plugins {
id 'java'
id 'war'
id 'com.github.jk1.dependency-license-report' version '1.16'
id 'maven-publish'
}
defaultTasks 'build'
build.dependsOn 'distZip'
version = '1.63'
group = 'de.bottlecaps.rr'
def buildTime = new Date()
def generatedSrc = "$buildDir/generated-src/main/java"
sourceSets {
main {
java {
srcDirs += ["$generatedSrc"]
}
}
}
repositories {
jcenter()
}
dependencies {
compileOnly 'org.apache.tomcat:tomcat-servlet-api:8.5.72'
implementation 'net.sf.saxon:Saxon-HE:10.6'
implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
implementation 'org.apache.xmlgraphics:batik-all:1.14'
implementation 'xml-apis:xml-apis-ext:1.3.04'
implementation 'org.apache.xmlgraphics:xmlgraphics-commons:2.6'
}
configurations.all {
transitive = false
}
jar {
manifest {
attributes (
'Implementation-Version': archiveVersion,
'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(buildTime)
)
}
rootSpec.exclude '**/de/bottlecaps/fatjar'
archiveFileName = "${project.name}.jar"
}
licenseReport {
outputDir = "$buildDir/LICENSE"
renderers = [new com.github.jk1.license.render.TextReportRenderer()]
}
task generateSrc {
doFirst {
def railroadVersion = new File("$generatedSrc/de/bottlecaps/railroad", 'RailroadVersion.java')
railroadVersion.parentFile.exists() || railroadVersion.parentFile.mkdirs()
railroadVersion.withWriter {
it << $/package de.bottlecaps.railroad;
public class RailroadVersion
{
public static final String PROJECT_NAME = "$project.name";
public static final String VERSION = "$version";
public static final String DATE = "${new java.text.SimpleDateFormat("MMM dd, yyyy", Locale.US).format(buildTime)}";
}
/$
}
}
}
compileJava {
dependsOn generateSrc
}
task generateLicense {
doFirst {
def calendar = Calendar.getInstance()
calendar.setTime(buildTime)
def year = calendar.get(Calendar.YEAR)
def licenseTxt = new File("$buildDir", 'LICENSE.TXT')
licenseTxt.parentFile.exists() || licenseTxt.parentFile.mkdirs()
licenseTxt.withWriter {
it << $/RR - Railroad Diagram Generator
Copyright 2010-$year Gunther Rademacher <grd@gmx.net>
Licensed under the Apache 2.0 License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
This distribution also includes
- Saxon-HE from Saxonica.com
- TagSoup
- Apache Batik
- Apache XML Graphics Commons
- Apache XML Commons XML APIs
For their license information see THIRD-PARTY-NOTICES.txt.
Thank you for choosing RR - Railroad Diagram Generator.
/$
}
}
}
war {
dependsOn jar, generateLicense, generateLicenseReport
manifest {
attributes (
'Main-Class': 'de.bottlecaps.fatjar.Loader',
'FatJar-Main-Class': 'de.bottlecaps.railroad.Railroad',
'FatJar-Jars': 'WEB-INF/lib/' + jar.archiveName + ' ' + configurations.runtimeClasspath.collect{'WEB-INF/lib/' + it.name}.join(' '),
'Implementation-Version': archiveVersion,
'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(buildTime)
)
}
into('de/bottlecaps/fatjar') {
from("$buildDir/classes/java/main/de/bottlecaps/fatjar")
}
into('LICENSE') {
from "$buildDir/LICENSE.txt"
from "$buildDir/LICENSE/THIRD-PARTY-NOTICES.txt"
}
classpath jar
rootSpec.exclude '**/de'
rootSpec.exclude '**/htdocs'
archiveFileName = "${project.name}.war"
}
task distZip(type:JavaExec) {
dependsOn war
main = '-jar'
args "$buildDir/libs/rr.war", '-distZip'
workingDir = "$buildDir/distributions"
doFirst {
mkdir workingDir
}
}
publishing {
publications {
jar(MavenPublication) {
artifactId = 'rr-lib'
from components.java
}
war(MavenPublication) {
artifactId = 'rr-webapp'
from components.web
}
}
}