-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
222 lines (207 loc) · 7.71 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.de.fuerstenau:BuildConfigPlugin:1.1.8'
}
}
println "Using JDK version (Must be JDK 1.8 or higher): "+System.getProperty("java.home")
apply plugin: "java"
apply plugin: 'idea'
apply plugin: 'de.fuerstenau.buildconfig'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
ext {
springVersion = "4.1.5.RELEASE"
jettyVersion = "9.3.5.v20151012"
cxfVersion = "3.0.4"
artifactMajorVersion = 1 // Will be overwritten during buildConfig!
artifactBuildNumber = 1 // Will be overwritten during buildConfig!
website = "C:/Users/Johan/Google Drive/Werk/Coteq/Klanten/YourHomeApp/Website"
}
project.group = 'net.yourhome.server.base'
buildConfig {
archivesBaseName = "YourHomeServer"
// Set the API keys
Properties apiProperties = new Properties()
File apiKeysFile = new File(projectDir,'api_keys.properties')
apiProperties.load(apiKeysFile.newDataInputStream())
buildConfigField ('String', 'GCM_API_CODE', (apiProperties.getProperty('GCM_API_CODE') as String))
buildConfigField ('String', 'VAILLANT_CLIENT_SECRET', (apiProperties.getProperty('VAILLANT_CLIENT_SECRET') as String))
// Increase the version number.
Properties props = new Properties()
File propsFile = new File(projectDir,'gradle.properties')
props.load(propsFile.newDataInputStream())
artifactBuildNumber = ( ((props.getProperty('artifactBuildNumber')) as BigDecimal) + 1 )
artifactMajorVersion = (props.getProperty('artifactMajorVersion') as String)
props.setProperty('artifactBuildNumber', artifactBuildNumber.toString())
props.store(propsFile.newWriter(), null)
props.load(propsFile.newDataInputStream())
version = "$artifactMajorVersion.$artifactBuildNumber"
sourceSets {
main
}
}
repositories {
mavenCentral()
maven {
url "https://raw.github.com/javanto/repository/releases"
}
maven { url "https://jitpack.io" }
flatDir {
dirs 'libs'
}
}
configurations.all {
// Don't cache changing modules at all.
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
//compile ('com.github.JohanCosemans:YourHomeCommon:master-SNAPSHOT') {
// changing = true
//}
compile project(":YourHomeCommon")
// Local jar files
compile name: "sqlite-jdbc-3.8.7.2"
compile name: "tritonus_share-0.3.6"
compile name: "zwave4j-1.0-SNAPSHOT"
compile name: "huelocalsdk"
compile name: "huesdkresources"
// Remote dependencies
compile "log4j:log4j:1.2.17"
compile "org.slf4j:slf4j-log4j12:1.7.13"
compile "com.nexmo:nexmo-java-sdk:1.2"
compile "com.googlecode.soundlibs:mp3spi:1.9.5-1"
compile "javazoom:jlayer:1.0.1"
compile "javax.mail:mail:1.4.7"
compile "javax.mail:javax.mail-api:1.5.2"
compile "commons-beanutils:commons-beanutils:1.9.2"
compile "commons-lang:commons-lang:2.6"
compile "org.apache.commons:commons-lang3:3.4"
compile "commons-logging:commons-logging:1.2"
compile "commons-collections:commons-collections:3.2.2"
compile "com.fasterxml.jackson.core:jackson-core:2.6.4"
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.6.4"
compile "org.codehaus.jackson:jackson-mapper-asl:1.9.13"
compile "javax.ws.rs:javax.ws.rs-api:2.0.1"
compile "it.sauronsoftware.cron4j:cron4j:2.2.5"
compile "org.codehaus.jackson:jackson-jaxrs:1.9.11"
compile "org.codehaus.jackson:jackson-mapper-asl:1.9.11"
compile "javax.inject:javax.inject:1"
compile "cglib:cglib-nodep:2.2"
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-web:$springVersion"
compile "org.springframework.security:spring-security-config:3.2.5.RELEASE"
compile "org.springframework.security:spring-security-web:3.2.5.RELEASE"
compile "javax.servlet:javax.servlet-api:3.1.0"
compile "org.reflections:reflections:0.9.9-RC1"
compile "com.jayway.jsonpath:json-path:2.0.0"
compile "org.apache.httpcomponents:httpclient:4.3.6"
compile "com.luckycatlabs:SunriseSunsetCalculator:1.2"
compile "org.json:json:20151123"
compile "org.eclipse.jetty.websocket:websocket-api:$jettyVersion"
compile "org.eclipse.jetty.websocket:websocket-server:$jettyVersion"
compile "org.eclipse.jetty.websocket:websocket-client:$jettyVersion"
compile "org.apache.cxf:cxf-rt-frontend-jaxrs:$cxfVersion"
compile "org.eclipse.jetty:jetty-server:$jettyVersion"
compile "org.eclipse.jetty:jetty-servlet:$jettyVersion"
compile "org.eclipse.jetty:jetty-util:$jettyVersion"
compile "org.eclipse.jetty:jetty-http:$jettyVersion"
compile "org.eclipse.jetty:jetty-security:$jettyVersion"
compile "org.eclipse.jetty:jetty-io:$jettyVersion"
compile "org.eclipse.jetty:jetty-servlets:$jettyVersion"
compile "org.eclipse.jetty:jetty-continuation:$jettyVersion"
}
task clearOldResources(type: Delete) {
println "Deleting "+"$buildDir/release/"
delete "$buildDir/release/"
}
task buildJar(type: Jar, dependsOn: 'clearOldResources') {
from(files("${buildDir}/gen/buildconfig/classes/main/")) {
include('**')
}
from(files(sourceSets.main.output.classesDir)) {
include('**')
}
version = "$artifactMajorVersion.$artifactBuildNumber"
doFirst{
manifest {
attributes(
"Manifest-Version": "1.0",
"Class-Path": configurations.compile.collect { "lib/"+it.getName() }.join(' '),
"Main-Class": "net.yourhome.server.Main"
)
}
}
destinationDir = new File(buildDir,"/release/bin/")
}
task copyDependenciesToOutputLib(type: Copy, dependsOn: 'buildJar') {
into "$buildDir/release/bin/lib"
from (configurations.runtime) {
exclude("version.properties")
}
}
task copyResources(type: Copy, dependsOn: 'buildJar') {
into "$buildDir/release/"
from ("build/resources/main") {
include('**')
exclude('config/homeserver.cfg')
exclude('config/log4j.properties')
include('config/demo/**')
exclude("database/home_history_archive.db")
exclude("database/home_history_weekly.db")
exclude("logs")
exclude("web/YourHomeDesigner/projects/**")
exclude("web/YourHomeDesigner/images/User/**")
exclude("web/YourHomeDesigner/images/psd")
exclude("web/albumImages/**")
exclude("web/serverinfo.json")
exclude("resourceFiles")
exclude("ipcamerasnapshots/*")
exclude("openZWave/*.xml")
}
rename { String fileName ->
if(fileName.equals("log4j-default.properties")) {
fileName.replace '-default', ''
}
}
}
task buildReleaseZip(type: Zip, dependsOn: [ 'copyResources', 'copyDependenciesToOutputLib' ]) {
baseName = 'YourHome-Server'
version = "$artifactMajorVersion.$artifactBuildNumber"
from(new File("$buildDir/release/")) {
include('**')
}
destinationDir(new File("$buildDir/../distributions"))
}
task buildReleaseLatestZip(type: Zip, dependsOn: [ 'buildReleaseZip' ]) {
archiveName = 'yourHome-latest.zip'
from(new File("$buildDir/release/")) {
include('**')
}
destinationDir(new File("$buildDir/../distributions"))
}
task buildDemoZip(type: Zip, dependsOn: [ 'copyResources', 'copyDependenciesToOutputLib' ]) {
baseName = 'YourHome-Server-Demo'
version = "$artifactMajorVersion.$artifactBuildNumber"
from(new File("$buildDir/release/")) {
include('**')
exclude("web/index.html")
}
from(new File("$buildDir/release/config/demo")) {
include('**')
into("config")
}
from(new File("$website")) {
include("**")
into("web/")
}
destinationDir(new File("$buildDir/../distributions/demo"))
}
gradle.projectsEvaluated {
compileJava.dependsOn generateBuildConfig
build.dependsOn buildReleaseLatestZip
build.dependsOn buildDemoZip
}