-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.gradle
104 lines (92 loc) · 4.55 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
buildscript {
ext.pi4j_version = '1.2' // '2.2.0' // ''2.1.1' // '1.2'
ext.google_gson_gson = '2.8.5'
ext.junit_version = '4.13.2'
}
plugins {
id 'java'
id 'scala'
id 'idea'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.0.0' // '5.2.0'
}
//compileJava.options.encoding = 'ISO-8859-1'
compileJava.options.compilerArgs += ["-Xlint:unchecked"]
group = 'oliv.raspi.coffee'
version = '1.0'
// sourceCompatibility = 1.8
// targetCompatibility = 1.8
tasks.withType(JavaCompile) {
if (JavaVersion.current() != project.targetCompatibility) {
// throw new GradleException(
println "+------ Warning: Java version (JAVA_HOME) possible mismatch -----\n" +
"| In task $name ($project.name), the java version used ${JavaVersion.current()} is not the expected version ${project.targetCompatibility}.\n" +
"+----------------------------------------------------------------"
// )
} else {
println ">> From task $name (in $project.name), using java version ${JavaVersion.current()} "
}
println ">>> When needed, using PI4J v$pi4j_version"
options.encoding = 'UTF-8'
}
dependencies {
// none
}
repositories {
mavenLocal()
mavenCentral()
// // maven { url "https://raw.githubusercontent.com/OlivierLD/raspberry-coffee/repository" }
// maven { url "http://lediouris.net/maven2" }
// maven { url "https://plugins.gradle.org/m2/" }
// maven { url "https://www.datanucleus.org/downloads/maven2" } // Contains xmlparserv2 from Oracle
maven { url "https://mvnrepository.com/artifact" }
// maven { url "https://oss.sonatype.org/content/groups/public" } // PI4J ?
}
tasks.register('info') {
// See this https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
println "+------------------- B U I L D I N F O R M A T I O N ---------------------------------"
println "| This (root) build file allows you to validate the whole project ($project.name) "
println "| Note that all sub-modules can be built independently, like (for example) : "
println "| \$ cd RESTNavServer "
println "| \$ ../gradlew clean build "
println "| or "
println "| \$ ../gradlew clean shadowJar "
println "+---------------------------------------------------------------------------------------"
println "| >>> You may want to comment or uncomment several modules in 'settings.gradle':"
println "| - opencv"
println "| - Project-Trunk:REST-clients:REST-assembler:springboot-sensors"
println "| Also, depending on your environment, scala nd kotlin steps might be too demanding..."
println "| If needed, you can exclude them, like in ./gradlew clean build -x :<module-name>:compileScala "
println "| -x :RasPISamples:compileScala " +
"-x :OtherJVMLanguages:compileScala " +
"-x :http-client-paradigm:compileScala " +
"-x :http-client-paradigm:compileKotlin " +
"-x :Project-Trunk:System-Languages:compileKotlin " +
"-x :Project-Trunk:System-Languages:compileScala " +
"-x :Project-Trunk:Weather-Station-Implementation:compileScala " +
"-x :Project-Trunk:REST-clients:REST-assembler:compileScala " +
"-x :Project-Trunk:REST-clients:REST-assembler:compileKotlin " +
"-x :Project-Trunk:REST-clients:REST-assembler:compileScala"
println "| On low-RAM boards, use --no-daemon, like in ./gradlew --no-daemon clean build "
println "| "
println "| Also consider trying ./gradlew clean build -x test "
println "| If you've not installed opencv:"
println "| Also you can try ./gradlew clean build [-x test] -x :opencv:compileJava -x :Project-Trunk:WebcamTemplate:compileJava"
println "+---------------------------------------------------------------------------------------"
println " ... and the --continue flag is still available."
println "+---------------------------------------------------------------------------------------"
println "-- Note on OpenCV --"
println " Projects opencv and Project-Trunk:WebcamTemplate use OpenCV "
println " They require OpenCV to be installed, and they refer to OpenCV's jar files."
println " In their gradle.build file, modify the variable opencvVersion, and possibly the location of the required jar-files"
println "+---------------------------------------------------------------------------------------"
}
task printInfo() {
dependsOn tasks.info
}
build.doFirst () {
tasks.info
}
build.doLast() {
println "Build is finished. Really?"
}