-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
97 lines (82 loc) · 3.11 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
/*
* Build ippo assignment2
*
* common tasks are:
* 'gradle run' - build and run the code
* 'gradle submission' - create a zip file for assignment submission
*
*/
apply plugin: 'java'
/*********************************************************************************************
* dependencies
********************************************************************************************/
// this specifies the JavaFx libraries that the application requires, and the
// online repository where they are found. gradle will automatically download
// these as required, so you do not need to manually download any library code.
repositories { mavenCentral() }
def currentOS = org.gradle.internal.os.OperatingSystem.current()
def platform
if (currentOS.isWindows()) {
platform = 'win'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'mac'
}
dependencies {
compile "org.openjfx:javafx-base:11:${platform}"
compile "org.openjfx:javafx-graphics:11:${platform}"
compile "org.openjfx:javafx-controls:11:${platform}"
compile "org.openjfx:javafx-fxml:11:${platform}"
compile "org.json:json:20190722"
}
/*********************************************************************************************
* execution
********************************************************************************************/
// this specifies how to run the program from either the jar, or from IntelliJ
// if you change the name of the main class, you need to change this
// otherwise, you probably don't want to change anything here
def mainClassName='Main'
task run(type: JavaExec) {
group = "ippo"
description = "run assignment 2"
classpath sourceSets.main.runtimeClasspath
main = "${mainClassName}"
}
jar {
group = "ippo"
description = "create runnable jar file for assignment 2"
manifest { attributes 'Main-Class': "${mainClassName}" }
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
/*********************************************************************************************
* create submission zip file
********************************************************************************************/
def zipFile = 'ippo-submission2.zip'
def zipDir = projectDir.getPath()+'/submission'
task prep(type: Copy) {
group = "other"
description = "prepare files for submission"
outputs.upToDateWhen { false }
from '.'
include 'doc/worksheet.pdf'
include 'src/'
include 'build.gradle'
include 'settings.gradle'
into "${project.buildDir}/submission"
}
task submission(type: Zip, dependsOn: prep) {
group = "ippo"
description = "create zip file for submission"
from "${project.buildDir}/submission"
archiveFileName = zipFile
destinationDirectory = new File(zipDir)
outputs.upToDateWhen { false }
doLast {
println "*************************************************************"
println "your submission is in the file: ${zipFile}"
println "in the directory: ${zipDir}"
println "Make sure that this is what you expect before submitting it."
println "*************************************************************"
}
}