-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
269 lines (230 loc) · 8.83 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
group = 'net.abesto.kotlin.js.pixi'
version = '0.0.1'
buildscript {
ext {
kotlinVersion = '0.12.613'
}
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion",
"com.eriwen:gradle-js-plugin:1.12.1",
'org.ajoberstar:gradle-git:0.10.1'
}
}
subprojects {
repositories {
jcenter()
}
}
project(':pixi-kotlin') {
apply plugin: 'kotlin2js'
task build(overwrite: true) {
logger.info "Definitions are not compiled, we only build a source jar"
}
task jarSources(type:Jar){
from sourceSets.main.allSource
classifier = 'source'
manifest.attributes.put("Specification-Title", "Kotlin JavaScript Lib")
manifest.attributes.put("Kotlin-JS-Module-Name", "pixi")
}
artifacts {
compile jarSources
}
kdoc.kdocArgs.docConfig.ignorePackages << "kotlin"
kdoc.kdocArgs.docConfig.ignorePackages << "org.w3c"
kdoc.kdocArgs.docConfig.ignorePackages << "net.abesto.kotlin.js.extensions"
kdoc.kdocArgs.docConfig.ignorePackages << "net.abesto.kotlin.js.workaround"
kdoc.kdocArgs.docConfig.title = "pixi-kotlin reference"
kdoc.kdocArgs.docConfig.packageSummaryText["net.abesto.kotlin.js.pixi"] = "Kotlin bindings for Pixi.js"
kdoc.kdocArgs.docConfig.addPackageLink("http://jetbrains.github.io/kotlin/versions/snapshot/apidocs/", "kotlin")
kdoc.kdocArgs.docConfig.addPackageLink("http://docs.oracle.com/javase/6/docs/api/", "java", "org.w3c.dom", "org.xml.sax", "org.omg", "org.ietf.jgss")
}
project(':examples') {
task generateIndexHtml(type: Copy) {
from "src/templates"
into "web"
include("index.html")
expand(project: project)
outputs.upToDateWhen { false }
}
task cleanGenerateIndexHtml(type: Delete) {
delete "${projectDir}/web/index.html"
}
task clean() {
dependsOn cleanGenerateIndexHtml
}
apply plugin: 'org.ajoberstar.github-pages'
githubPages {
repoUri = 'git@github.com:abesto/pixi-kotlin.git'
pages {
from "${projectDir}/web"
from("${project(":pixi-kotlin").buildDir}/docs/kdoc") { into "kdoc" }
from("${project(":pixi-kotlin").projectDir}/resources/docs/kdoc-assets") { into "kdoc" }
subprojects.each { example ->
from("${example.projectDir}/web") { into example.name }
}
}
}
publishGhPages.dependsOn += [generateIndexHtml, project(":pixi-kotlin").kdoc]
publishGhPages.dependsOn += subprojects.collect {"${it.name}:build"}
publishGhPages.dependsOn += subprojects.collect {"${it.name}:generateExampleIndexHtml"}
subprojects {
apply plugin: "kotlin2js"
dependencies {
compile "org.jetbrains.kotlin:kotlin-js-library:$kotlinVersion",
project(":pixi-kotlin")
}
compileKotlin2Js.kotlinOptions.outputFile = "${projectDir}/web/js/app/app.js"
compileKotlin2Js.kotlinOptions.sourceMap = true
task('copyKotlinSources', type: Copy) {
from project.sourceSets.main.allSource.files
into "${projectDir}/web/js/app"
rename '(.*)\\.kt', '$1.kt.txt'
}
tasks.build.dependsOn copyKotlinSources
task('copyKotlinJs', type: Copy) {
from zipTree(project.configurations.compile.find { it.name.contains "kotlin-js-library" })
include 'kotlin.js'
into "${projectDir}/web/js/lib/"
}
tasks.build.dependsOn copyKotlinJs
tasks.clean.dependsOn cleanCopyKotlinJs
task('cleanCopyKotlinSources', type: Delete) {
project.sourceSets.main.allSource.files.each {
delete "${projectDir}/web/js/app/${it.name}.txt"
}
}
tasks.clean.dependsOn cleanCopyKotlinSources
task('rewriteSourceMap', dependsOn: compileKotlin2Js) << {
def file = new File("${projectDir}/web/js/app/app.js.map")
def text = file.text
project.sourceSets.main.allSource.files.each {
text = text.replace("file://${it}", "${it.name}.txt")
}
file.write(text)
}
tasks.build.dependsOn rewriteSourceMap
ext {
isFullscreen = false
extraHead = ""
extraBody = ""
listTitle = { "Example ${project.name}" }
originalExampleUrl = "http://www.goodboydigital.com/pixijs/examples/${project.name.replaceFirst('^0', '')}/"
originalExampleText = { project.originalExampleUrl }
originalExampleSourceUrl = { "view-source:${project.originalExampleUrl}" }
originalExampleSourceText = { project.originalExampleSourceUrl() }
title = "pixi.js example ${project.name} (kotlin)"
}
task generateExampleIndexHtml(type: Copy) {
from "${project(":examples").projectDir}/src/templates"
into "web"
include("subproject-index.html")
rename("subproject-index.html", "index.html")
expand(project: project)
outputs.upToDateWhen { false }
}
task cleanGenerateExampleIndexHtml(type: Delete) {
delete "${generateExampleIndexHtml.destinationDir}/index.html"
}
build.dependsOn generateExampleIndexHtml
clean.dependsOn cleanGenerateExampleIndexHtml
}
}
project(':examples:pairs') {
description = "Neat little pairs game Emanuele Feronato"
ext.listTitle = { "Pairs Game" }
ext.originalExampleUrl = "http://www.emanueleferonato.com/2014/02/26/complete-html5-concentration-game-made-with-pixi-js/"
ext.originalExampleSourceUrl = { originalExampleUrl }
ext.originalExampleSourceText = { "Same as above, scroll down a bit on the page" }
}
// Examples from http://www.pixijs.com/examples/
project(':examples:01') { description = "Basics" }
project(':examples:02') { description = "Using a Sprite Sheet"}
project(':examples:03') { description = "MovieClip"}
project(':examples:04') {
description = "Lot o' Sprites"
ext.title = "Pixi Balls by Photon Storm (Kotlin port)"
ext.extraHead = """
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="storm.css">
"""
ext.extraBody = """
<a href="http://www.photonstorm.com"><img src="assets/photonstorm.png" width="121" height="18" id="photonstorm" title="Photon Storm" /></a>
<a href="http://www.html5gamedevs.com/topic/59-pixijs-has-landed/"><img src="assets/pixi.png" width="56" height="22" id="pixi" title="pixi.js" /></a>
<input type="button" id="rnd" value="Randomise" />
<div id="sx">SX: 0<br />SY: 0</div>"""
}
project(':examples:05') {
description = "Lot o' Sprites 2"
ext.title = "Pixi Morph by Photon Storm (Kotlin port)"
ext.extraHead = """
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="storm.css">
"""
ext.extraBody = """
<a href="http://www.photonstorm.com"><img src="assets/photonstorm.png" width="121" height="18" id="photonstorm" title="Photon Storm" /></a>
<a href="http://www.html5gamedevs.com/topic/59-pixijs-has-landed/"><img src="assets/pixi.png" width="56" height="22" id="pixi" title="pixi.js" /></a>
"""
}
project(':examples:06') { description = "Interactivity" }
project(':examples:07') {
description = "Transparent Renderer"
ext.extraHead = """
<style>
#textHolder{
width: 400px;
margin-top: 24px;
}
</style>
"""
ext.extraBody = """
<div>Note: in the original the text has the color set for the background of the canvas.
This is a bug in Pixi that has been fixed since.</div>
<div id="textHolder">Hi there, I'm some HTML text... blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</div>
"""
}
project(':examples:08') {
description = "Multi-touch"
ext.isFullscreen = true
}
project(':examples:09') {
description = 'Tiling Sprite'
ext.isFullscreen = true
}
project(':examples:10') { description = "Using text" }
project(':examples:11') {
description = 'Render Textures'
ext.isFullscreen = true
ext.extraBody = """
<p>Some minor differences are due to the version of Pixi.js used in the original demo and here.
You can track any progress on this in issue
<a href="https://github.com/GoodBoyDigital/pixi.js/issues/1005">pixi.js/1005</a></p>
"""
}
project(':examples:12') {
description = 'Spine: Walking dude'
ext.isFullscreen = true
}
project(':examples:12b') {
description = 'Spine: Flying Dragon'
ext.isFullscreen = true
ext.originalExampleUrl = "http://www.goodboydigital.com/pixijs/examples/12-2/"
}
project(':examples:12c') {
description = 'Spine: Pixi Dude'
ext.isFullscreen = true
ext.originalExampleUrl = "http://www.goodboydigital.com/pixijs/examples/12-3/"
}
project(':examples:13') {
description = 'Graphics'
}