-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
141 lines (120 loc) · 4.37 KB
/
Copy pathbuild.gradle
File metadata and controls
141 lines (120 loc) · 4.37 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
137
138
139
140
141
apply plugin: 'java'
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'bluej.Bluejenv'
}
repositories {
mavenCentral()
// You may define additional repositories, or even remove "mavenCentral()".
// Read more about repositories here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
maven { url "http://dl.bintray.com/jmonkeyengine/org.jmonkeyengine" }
}
def jme3 = [v:'3.1.0-stable', g:'org.jmonkeyengine']
dependencies {
// TODO: Add dependencies here ...
// You can read more about how to add dependency here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
testCompile group: 'junit', name: 'junit', version: '4.10'
// These are the minimum
compile "${jme3.g}:jme3-core:${jme3.v}"
compile "${jme3.g}:jme3-lwjgl:${jme3.v}"
compile fileTree(include: ['*.jar'], dir: 'libs')
// Experimenting with extra jME3 features
compile "${jme3.g}:jme3-niftygui:${jme3.v}"
compile "${jme3.g}:jme3-jbullet:${jme3.v}"
compile "${jme3.g}:jme3-plugins:${jme3.v}"
compile "${jme3.g}:jme3-effects:${jme3.v}"
}
jar {
manifest {
attributes(
'Class-Path': 'lib/'+configurations.compile.collect { it.getName() }.join(' lib/'),
'Main-Class': 'bluej.Bluejenv'
)
}
}
def env3d_template_dir = './dist/env3d_template/'
// Need to use custom run and debug so we can set the workingDir
// Note that you will need to build at least once before running
// and debugging a single file
//
// https://github.com/kelemen/netbeans-gradle-project/issues/60
//
task run(dependsOn: classes, type: JavaExec) {
main = project.hasProperty('mainClass') ? project.mainClass : ''
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = env3d_template_dir
}
task debug(dependsOn: classes, type: JavaExec) {
main = project.hasProperty('mainClass') ? project.mainClass : ''
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = env3d_template_dir
debug = true
}
task dist(dependsOn: ['build']) {
doLast {
// Copy all the dependencies
['+libs','extensions/lib'].each { libDir ->
configurations.compile.each { artifact ->
copy {
from artifact
exclude 'jython.jar'
into env3d_template_dir+libDir
}
}
}
// The primary jar
['+libs','extensions'].each { dir ->
copy {
from './build/libs/env3d-java-gradle.jar'
into env3d_template_dir+dir
}
}
// Extract native libraries
def lwjglVersion = '2.9.3'
['osx', 'windows', 'linux'].each { platform ->
def nativeLib = "lwjgl-platform-${lwjglVersion}-natives-${platform}.jar"
copy {
from zipTree("${env3d_template_dir}+libs/${nativeLib}")
into env3d_template_dir
exclude 'META-INF/'
}
['+libs','extensions/lib'].each { dir ->
delete "${env3d_template_dir}${dir}/${nativeLib}"
}
}
// Copy the assets
copy {
from './assets'
into env3d_template_dir
}
ant.touch(file:env3d_template_dir+'bluej.pkg')
ant.touch(file:env3d_template_dir+'package.bluej')
}
}
task zip(type: Zip) {
from './dist/env3d_template'
include '**'
into 'env3d_template/'
archiveName 'env3d_template.zip'
destinationDir file('./dist')
}
task cleanDist() {
doLast {
delete './dist'
}
}
clean.dependsOn cleanDist
zip.mustRunAfter dist
build.finalizedBy(dist)