This repository has been archived by the owner on Nov 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
186 lines (165 loc) · 5.73 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
plugins {
id 'java'
id 'maven'
id 'eclipse'
id 'application'
}
// these environment variables are available during a Jenkins build
ext.buildNumber = System.getenv( "BUILD_NUMBER" ) ?: 'SNAPSHOT'
ext.gitCommit = System.getenv( "GIT_COMMIT" ) ?: 'HEAD'
ext.appName = 'vZome'
ext.edition = appName
group = 'com.vzome'
version = '6.0'
description = 'vzome-desktop'
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
task wrapper(type: Wrapper) {
gradleVersion = '4.1' //version required
}
task recordBuildProperties {
def propsFile = file( "$buildDir/buildPropsResource/build.properties" )
ext.outputDir = propsFile .getParentFile()
doFirst {
writeProjectProperties( [ 'version', 'edition', 'buildNumber', 'gitCommit' ], propsFile )
}
println 'recorded build properties'
}
processResources {
dependsOn recordBuildProperties
from recordBuildProperties.outputDir
}
// used by the 'application' plugin
// as well as the 'macappbundle' and 'launch4j' Gradle plugins in sub-projects
ext.jvmArgs = [
"apple.laf.useScreenMenuBar": "true",
"apple.awt.antialiasing": "true",
"apple.awt.application.name": appName,
"com.apple.macos.use-file-dialog-packages": "true",
"com.apple.macos.useScreenMenuBar": "true",
"com.apple.smallTabs": "true",
"java.util.logging.config.file": "logging.properties" ]
ext.vzomeArgs = [ // a list, not a map
'-entitlement.model.edit', 'true', '-entitlement.lesson.edit', 'true', '-entitlement.all.tools', 'true',
'-licensed.user', 'whomever' ]
// used by both 'application' and 'launch4j' Gradle plugins
mainClassName = 'org.vorthmann.zome.ui.ApplicationUI'
// used by the 'application' Gradle plugin
run.args( vzomeArgs )
applicationDefaultJvmArgs = [ '-Xmx3048M', "-Djava.ext.dirs=${System.env.'JAVA_HOME'}/jre/lib" ]
jvmArgs.each { entry ->
applicationDefaultJvmArgs << "-D$entry.key=$entry.value"
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
// this one is for javax.media.jai
maven { url 'http://repository.springsource.com/maven/bundles/external' }
ivy { // not really an Ivy repo, but this pattern lets us automate the bare JAR downloads for java3d/*
url "http://jogamp.org/deployment"
layout "pattern", {
artifact "[organization]/[revision]/[artifact].[ext]"
}
}
}
}
// Not sure why the 'test' sourceSet has to be specifically declared here
// before it will show up in the NetBeans 'Projects' window.
// It shows up in the vzome-core project without explicitly being listed.
sourceSets {
test {
java.srcDir file('src/test/java')
}
}
dependencies {
compile group: 'com.vzome.core', name: 'vzome-core', version:'0.16.0'
compile group: 'java3d', name: 'j3dcore', version:'1.6.0-pre12'
compile group: 'java3d', name: 'j3dutils', version:'1.6.0-pre12'
compile group: 'java3d', name: 'vecmath', version:'1.6.0-pre12'
compile group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:'2.3.2'
compile group: 'org.jogamp.jogl', name: 'jogl-all-main', version:'2.3.2'
compile group: 'javax.media.jai', name: 'com.springsource.javax.media.jai.core', version:'1.1.3'
testCompile group: 'junit', name: 'junit', version:'4.12'
}
sourceSets {
main {
java {
exclude 'org/vorthmann/zome/render/jogl/**' // initial framework for a pure JOGL renderer is not ready for use
}
resources {
// The convention-based default built-in srcDir is 'src/main/resources'
// Append any additional SrcDir entries here...
// listed alphabetically
include '**/*.gif'
include '**/*.jpg'
include '**/*.pdf'
include '**/*.png'
include '**/*.properties'
include '**/*.py'
include '**/*.vef'
include '**/*.vZome'
include '**/*.zomic'
include '**/*.html'
include '**/*.js'
}
}
}
jar {
manifest {
attributes 'Implementation-Title': 'vzome-desktop',
'Implementation-Version': version
}
}
// These options apply to all java projects
// More info at http://www.javaworld.com/article/2073587/javac-s--xlint-options.html
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs \
<< "-Xdiags:verbose" \
<< "-Xlint:all" \
<< "-Xlint:cast" \
<< "-Xlint:deprecation" \
<< "-Xlint:divzero" \
<< "-Xlint:empty" \
<< "-Xlint:fallthrough" \
<< "-Xlint:finally" \
<< "-Xlint:overrides" \
<< "-Xlint:path" \
<< "-Xlint:rawtypes" \
<< "-Xlint:unchecked" \
<< "-Xlint:-serial"
// TODO: Enable the serial warning and look into fixing ~33 issues.
// Most of them are classes which extend a generic Collection or Exception.
}
}
// The mainClass property is needed to run a Gradle project from the Netbeans IDE (and maybe others too).
if (!hasProperty('mainClass')) {
ext.mainClass = mainClassName
}
// Specify common settings for all subprojects
subprojects {
// see platform/mac/build.gradle, search for "error -5341"
// buildDir = rootProject.buildDir
group = rootProject.group
version = rootProject.version
description = rootProject.name + '-' + project.name
}
def writeProjectProperties( keys, propsFile )
{
def outputDir = propsFile .getParentFile()
outputDir.exists() || outputDir.mkdirs()
def buildProps = new Properties()
project.properties.findAll( { it.key in keys } ) .each {
buildProps .put( it.key, it.value.toString() )
}
def writer = new FileWriter( propsFile )
try {
buildProps .store( writer, null )
writer.flush()
} finally {
writer.close()
}
}