-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
147 lines (130 loc) · 3.81 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
/*
* build.gradle
*
* Copyright (c) 2011-2016, Daniel Ellermann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.JavaVersion
// plugins
plugins {
id "edu.sc.seis.macAppBundle" version "2.1.5"
}
// build script properties
ext {
groovyVersion = '2.4.4'
tomcatVersion = '7.0.68'
springcrmDir = '../springcrm'
}
// plugins
apply plugin: 'eclipse'
apply plugin: 'groovy'
loadAmcDefault()
// pre-defined properties
version = getAppVersion()
targetCompatibility = JavaVersion.VERSION_1_6
ext.springcrmWar = "${ext.springcrmDir}/target/springcrm-${version}.war"
// repositories
repositories {
mavenCentral()
}
// dependencies
dependencies {
compile 'org.apache.logging.log4j:log4j-core:2.1'
compile "org.apache.tomcat:tomcat-catalina:${tomcatVersion}"
compile "org.apache.tomcat:tomcat-coyote:${tomcatVersion}"
compile "org.apache.tomcat:tomcat-servlet-api:${tomcatVersion}"
compile "org.codehaus.groovy:groovy-all:${groovyVersion}"
}
// task definitions
task createBatConfig {
description 'Creates a Window batch file containing configurations.'
doLast {
def config = """\
set APP_VERSION=${version}
set PRODUCT_GUID=${UUID.randomUUID()}
""".replaceAll '\n', '\r\n'
uploadArchives.repositories.each {
it.dirs.each {
file(new File(it, 'config.bat')).write config
}
}
}
}
// task type configurations
jar {
manifest {
attributes 'Implementation-Title': 'SpringCRM standalone',
'Implementation-Version': version,
'Main-Class': 'org.amcworld.springcrm.launcher.Launcher'
}
baseName = 'springcrm-standalone'
from {
configurations.compile.collect { it.directory ? it : zipTree(it) }
}
from(springcrmWar) { rename { 'embedded.war' } }
}
processResources.from(sourceSets.main.resources, {
exclude '**/*.properties'
}).from(sourceSets.main.resources, {
include '**/*.properties'
filter ReplaceTokens, tokens: [
version: version, copyrightYear: new Date().format('yyyy')
]
})
uploadArchives {
dependsOn createBatConfig
uploadDescriptor = false
}
// Mac package generation
macAppBundle {
appName = "SpringCRM"
volumeName = "springcrm-${version}"
dmgName = "springcrm-${version}"
mainClassName = 'org.amcworld.springcrm.launcher.Launcher'
bundleJRE = true
javaProperties.put 'apple.laf.useScreenMenuBar', 'true'
javaProperties.put 'apple.awt.brushMetalLook', 'true'
backgroundImage = 'background.png'
backgroundImageWidth = 600
backgroundImageHeight = 400
icon = 'springcrm.icns'
appIconX = 124
appIconY = 192
appFolderX = 297
appFolderY = 192
}
// publishing
artifacts {
archives jar
}
// auxiliary functions
String getAppVersion() {
def stream
try {
def props = new Properties()
stream = new FileInputStream("${springcrmDir}/application.properties")
props.load stream
props.get('app.version')
} finally {
stream?.close()
}
}
void loadAmcDefault() {
File f = project.file('../amc-default.gradle')
if (f.exists()) {
project.apply from: f
}
}