-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
215 lines (191 loc) · 7.56 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
//
// =BEGIN MIT LICENSE
//
// The MIT License (MIT)
//
// Copyright (c) 2014 The CrossBridge Team
// https://www.github.com/crossbridge-community
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// =END MIT LICENSE
//
// needed for deploying
apply plugin: 'maven'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://raw.githubusercontent.com/vpmedia/mvnrepository/master'
}
maven {
url 'https://oss.sonatype.org/content/groups/public/'
}
}
configurations {
antClassPath
compile
test
}
dependencies {
test group: 'org.apache', name: 'flexunit-tasks', version: '4.2.0-20140410', ext: 'jar'
test group: 'org.apache', name: 'flexunit-as3', version: '4.2.0-20140410', ext: 'swc'
test group: 'org.apache', name: 'flexunit-cilistener', version: '4.2.0-20140410', ext: 'swc'
test group: 'org.apache', name: 'flexunit-uilistener', version: '4.2.0-20140410', ext: 'swc'
test group: 'org.apache', name: 'hamcrest-as3', version: '1.1.3', ext: 'swc'
test group: 'org.apache', name: 'flex-pmd-ant-task', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-files', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-core', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-ruleset', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-ruleset-api', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-cpd', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-cpd-ant-task', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-metrics', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'flex-pmd-metrics-ant-task', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'as3-parser', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'as3-parser-api', version: '1.3', ext: 'jar'
test group: 'org.apache', name: 'as3-plugin-utils', version: '1.3', ext: 'jar'
test group: 'pmd', name: 'pmd', version: '4.2.5', ext: 'jar'
test group: 'commons-lang', name: 'commons-lang', version: '2.4', ext: 'jar'
test group: 'org.codehaus.plexus', name: 'plexus-utils', version: '3.0.17', ext: 'jar'
antClassPath 'ant-contrib:ant-contrib:1.0b3', 'org.apache.ant:ant-junit:1.9.4'
}
// add additional jars to the AntBuilder classpath for use within the imported build.
ClassLoader antClassLoader = org.apache.tools.ant.Project.class.classLoader
configurations.antClassPath.each { File f ->
antClassLoader.addURL(f.toURI().toURL())
}
//----------------------------------
// SDK
//----------------------------------
String AIR_HOME = System.getenv('AIR_HOME')
String FLEX_HOME = System.getenv('FLEX_HOME')
ant.FLEX_HOME = "${FLEX_HOME}"
//----------------------------------
// Core
//----------------------------------
// Set default properties
version = '0.0.1'
group = 'hu.vpmedia'
// Get version from Jenkins CI
if("${System.env.JENKINS_BUILD_VERSION}" != "null") {
version = "${System.env.JENKINS_BUILD_VERSION}"
}
//----------------------------------
// Folders
//----------------------------------
def binDir = new File(projectDir, '/bin')
def buildDir = new File(projectDir, '/build')
def confDir = new File(projectDir, '/src/main/temp')
def publishDir = new File(projectDir, '/publish')
def reportDir = new File(projectDir, '/build/reports')
def tempDir = new File(projectDir, '/temp')
def tempDirPath = tempDir.absolutePath
def srcDir = new File(projectDir, '/src/main/actionscript')
def testDir = new File(projectDir, '/src/test/actionscript')
def swcDir = new File(projectDir, '/src/main/libs')
//----------------------------------
// Tasks
//----------------------------------
task clean_init << {
if (binDir.isDirectory()) {
delete(binDir)
}
if (buildDir.isDirectory()) {
delete(buildDir)
}
if (confDir.isDirectory()) {
delete(confDir)
}
}
task copyDeps(type: Copy) {
from configurations.all
into binDir
}
task copyRes(type: Copy) {
from file("src/main/resources")
into buildDir
}
task compile(type: JavaExec) {
main = "com.adobe.flash.compiler.clients.MXMLC"
classpath = files("${AIR_HOME}/lib/compiler.jar")
workingDir = "${projectDir}"
def argsList = []
argsList.push('src/main/actionscript/LuaStarling.as')
argsList.push('-debug=true')
def includeSources = '-source-path+=' + srcDir
argsList.push(includeSources)
def libraryPath = '-library-path+=' + swcDir
argsList.push(libraryPath)
argsList.push('-output="build/Main.swf"');
def flexConfig = "${AIR_HOME}" + '/frameworks/flex-config.xml'
def loadFlexConfig = '-load-config+='+"${flexConfig}";
argsList.push(loadFlexConfig)
args = argsList
}
task test << {
if (reportDir.isDirectory()) {
delete("${reportDir}")
}
if(testDir.isDirectory()) {
reportDir.mkdirs()
ant.taskdef(resource: 'flexUnitTasks.tasks', classpath: configurations.test.asPath)
ant.flexunit(workingDir:'bin',toDir:'build/reports',haltonfailure:'false',verbose:'true',player:'flash',headless:'false',localTrusted:'true') {
source(dir: srcDir)
testSource(dir: testDir) {
include(name: '**/*Test.as')
}
library(dir: 'bin')
}
ant.junitreport(todir: reportDir) {
fileset(dir: reportDir, includes: 'TEST-*.xml')
report(format:'frames', todir:'build/reports/html')
}
}
}
task analyze << {
reportDir.mkdirs()
ant.taskdef(name: 'flexPmd', classname: 'com.adobe.ac.pmd.ant.FlexPmdAntTask', classpath: configurations.test.asPath)
ant.taskdef(name: 'flexCpd', classname: 'com.adobe.ac.cpd.ant.FlexCpdAntTask', classpath: configurations.test.asPath)
ant.flexPmd(sourceDirectory: "${srcDir}", outputDirectory: reportDir )
}
task document << {
ant.taskdef(resource: 'flexTasks.tasks', classpath: "${FLEX_HOME}/ant/lib/flexTasks.jar")
ant.asdoc(output: 'build/docs', lenient: true) {
'doc-sources'("${srcDir}")
'compiler.source-path'("${srcDir}")
'external-library-path'(dir: "${AIR_HOME}/frameworks/libs/air", append: true) {
'include'(name: '*.swc')
}
'external-library-path'(dir: swcDir, append: true) {
'include'(name: '*.swc')
}
}
}
artifacts {
archives file('build/Main.swc')
}
uploadArchives {
repositories {
mavenLocal()
}
}
compile.dependsOn copyDeps
compile.dependsOn copyRes
defaultTasks 'clean_init', 'compile', 'test', 'analyze'