forked from miho/JCSG
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.gradle
More file actions
136 lines (117 loc) · 3.69 KB
/
Copy pathbuild.gradle
File metadata and controls
136 lines (117 loc) · 3.69 KB
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
buildscript {
dependencies {
classpath 'org.eclipse.jdt:org.eclipse.jdt.core:3.35.0'
classpath 'org.eclipse.platform:org.eclipse.text:3.14.0'
}
}
import groovy.xml.XmlSlurper
import org.eclipse.jdt.core.ToolFactory
import org.eclipse.jdt.core.formatter.CodeFormatter
import org.eclipse.jface.text.Document
plugins {
id 'eclipse'
id 'java'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.diffplug.spotless' version '6.25.0'
}
spotless {
java {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
custom('eclipseFormatterDirect') { String source ->
def configFile = new File(projectDir, 'config/eclipse-formatter.xml')
def options = new HashMap<String, String>()
def xml = new XmlSlurper().parse(configFile)
xml.profile.setting.each { setting ->
options[setting.@id.text()] = setting.@value.text()
}
def formatter = ToolFactory.createCodeFormatter(options, ToolFactory.M_FORMAT_EXISTING)
def edit = formatter.format(
CodeFormatter.K_COMPILATION_UNIT,
source, 0, source.length(), 0, System.lineSeparator()
)
if (edit == null) {
throw new GradleException("Eclipse formatter returned null — source may have a syntax error")
}
def doc = new Document(source)
edit.apply(doc)
doc.get()
}
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
withJavadocJar()
withSourcesJar()
}
base {
archivesName = "JavaCad"
}
File buildDir = file(".")
Properties props = new Properties()
props.load(new FileInputStream(buildDir.getAbsolutePath() + "/src/main/resources/com/neuronrobotics/javacad/build.properties"))
group = "com.neuronrobotics"
version = props."app.version"
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += ['--enable-preview']
}
repositories {
mavenCentral()
mavenLocal()
maven { url "https://clojars.org/repo" }
}
allprojects {
tasks.withType(Javadoc).configureEach {
options.addStringOption("encoding", "UTF-8")
options.addStringOption('Xdoclint:none', '-quiet')
}
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.0'
implementation 'commons-io:commons-io:2.7'
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
implementation 'com.google.code.gson:gson:2.8.9'
implementation group: 'eu.mihosoft.vvecmath', name: 'vvecmath', version: '0.4.0'
implementation group: 'javax.vecmath', name: 'vecmath', version: '1.5.2'
implementation 'org.slf4j:slf4j-simple:1.6.1'
implementation group: 'org.apache.xmlgraphics', name: 'batik-all', version: '1.17'
implementation fileTree(dir: 'libs', includes: ['kabeja*.jar'])
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.20.0'
implementation 'com.aparapi:aparapi:3.0.2'
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
implementation 'org.bouncycastle:bcpkix-jdk18on:1.80'
implementation("com.github.madhephaestus:manifold3d:v3.5.1-4")
}
Date buildTimeAndDate = new Date()
ext {
buildDate = new java.text.SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new java.text.SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}
tasks.withType(Test).configureEach {
jvmArgs '--enable-preview'
}
tasks.withType(JavaExec).configureEach {
jvmArgs '--enable-preview'
}
test {
dependsOn 'spotlessApply'
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
showStandardStreams = true
exceptionFormat = "full"
showExceptions = true
showCauses = true
showStackTraces = true
}
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}