-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fan
76 lines (60 loc) · 1.63 KB
/
build.fan
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
using build::BuildPod
using compiler::CompilerInput
class Build : BuildPod {
new make() {
podName = "afGamepad"
summary = "Gamepad controller library"
version = Version("0.0.5")
meta = [
"pod.dis" : "Gamepad",
"repo.internal" : "true",
"repo.tags" : "misc, game",
"repo.public" : "true"
]
depends = [
"sys 1.0.67 - 1.0",
// ---- Test ------------------------
"concurrent 1.0.67 - 1.0",
]
srcDirs = [`fan/`, `test/`]
resDirs = [`doc/`]
docApi = true
docSrc = true
meta["afBuild.testPods"] = "concurrent"
meta["afBuild.testDirs"] = "test/"
}
override Void onCompileFan(CompilerInput ci) {
// create an uber.jar that contains all the dependent .jar files
// do it here so F4 doesn't have to
jarDir := File.createTemp("afGamepad-", "")
jarDir.delete
jarDir = Env.cur.tempDir.createDir(jarDir.name).normalize
echo
`lib/`.toFile.normalize.listFiles(Regex.glob("*.jar")).each |jar| {
echo("Expanding ${jar.name} to ${jarDir.osPath}")
zipIn := Zip.read(jar.in)
File? entry
while ((entry = zipIn.readNext) != null) {
fileOut := jarDir.plus(entry.uri.relTo(`/`))
entry.copyInto(fileOut.parent, ["overwrite" : true])
}
zipIn.close
}
jarFile := jarDir.parent.createFile("${jarDir.name}.jar")
zip := Zip.write(jarFile.out)
parentUri := jarDir.uri
jarDir.walk |src| {
if (src.isDir) return
path := src.uri.relTo(parentUri)
out := zip.writeNext(path)
src.in.pipe(out)
out.close
}
zip.close
jarDir.delete
echo
echo("Created Uber Jar: ${jarFile.osPath}")
echo
ci.resFiles.add(jarFile.deleteOnExit.uri)
}
}