-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathRakefile
127 lines (100 loc) · 4.74 KB
/
Rakefile
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
# Copyright (c) Aemon Cannon. All rights reserved.
# The use and distribution terms for this software are covered by the
# Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
# which can be found in the file CPL.TXT at the root of this distribution.
# By using this software in any fashion, you are agreeing to be bound by
# the terms of this license.
# You must not remove this notice, or any other, from this software.
require 'rexml/document'
include REXML
$debug = true
MXMLC = PLATFORM == "win" ? "mxmlc.exe -target-player=10.0.0" : "mxmlc -target-player=10.0.0"
COMPC = PLATFORM == "win" ? "compc.exe -target-player=10.0.0" : "compc -target-player=10.0.0"
DEBUG_PROJECTOR = PLATFORM == "win" ? "sa_flashplayer_10_debug.exe" : "~/bin/flashplayer_debug_projector_10"
SHARED_CLASS_PATH = [
"src/as3"
]
COMPILE_OPTIONS = [
"+configname=flex",
"-default-frame-rate=60",
# ABCDump has tons of warnings unless we disable these:
"-compiler.warn-no-type-decl=false",
"-compiler.optimize=true",
"-compiler.source-path #{SHARED_CLASS_PATH.join(" ")}"
]
SWC_OPTIONS = [
"-include-classes com.las3r.repl.App",
"-directory=false",
"-debug=false",
"-compiler.warn-no-type-decl=false",
"-compiler.optimize=true",
"-source-path #{SHARED_CLASS_PATH.join(" ")}"
]
LAS3R_STDLIB = FileList["./src/lsr/**/*"]
LAS3R_STDLIB_SWFS = FileList["./lib/*.swf"]
# stdlib lsrs and swfs are embedded in RT.as
SHARED_SOURCES = FileList["./src/as3/**/*"] + LAS3R_STDLIB + LAS3R_STDLIB_SWFS
THIS_RAKEFILE = FileList["./Rakefile"]
TEST_DEMO_SWF_ENTRY_POINTS = FileList["src/as3/com/las3r/test/demos/*.as"]
TEST_DEMO_SWF_TARGETS = TEST_DEMO_SWF_ENTRY_POINTS.collect{|ea| "./bin/" + File.basename(ea, ".as") + ".swf" }
UNIT_TEST_RUNNER_TARGET = "./bin/unit_test_runner.swf"
file UNIT_TEST_RUNNER_TARGET => SHARED_SOURCES do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true" : "", "-default-size 1000 600", "-library-path+=lib/FlexUnit.swc"]
sh "#{MXMLC} #{options.join(" ")} -file-specs src/as3/com/las3r/test/FlexUnitTestRunner.mxml -output=#{UNIT_TEST_RUNNER_TARGET}"
end
DEMO_GARDEN_TARGET = "./bin/garden.swf"
file DEMO_GARDEN_TARGET => SHARED_SOURCES do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true": "", "-default-size 1000 600"]
sh "#{MXMLC} #{options.join(" ")} -file-specs src/as3/com/las3r/demo/garden/Garden.as -output=#{DEMO_GARDEN_TARGET}"
end
REPL_TARGET = "./bin/repl.swf"
file REPL_TARGET => SHARED_SOURCES do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true": "", "-default-size 635 450"]
sh "#{MXMLC} #{options.join(" ")} -file-specs src/as3/com/las3r/repl/App.as -output=#{REPL_TARGET}"
end
LSR_REPL_TARGET = "./bin/lsr-repl.swf"
file LSR_REPL_TARGET => SHARED_SOURCES do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true": "", "-default-size 635 450"]
sh "#{MXMLC} #{options.join(" ")} -file-specs src/as3/com/las3r/repl/StdlibTestingApp.as -output=#{LSR_REPL_TARGET}"
end
SWC_TARGET = "./dist/las3r.swc"
file SWC_TARGET => SHARED_SOURCES do
sh "#{COMPC} #{SWC_OPTIONS.join(" ")} -output=#{SWC_TARGET}"
end
task :dist => [REPL_TARGET, UNIT_TEST_RUNNER_TARGET] do
cp REPL_TARGET, "dist"
cp UNIT_TEST_RUNNER_TARGET, "dist"
end
TRACE_SWF = "./bin/trace_swf.swf"
file TRACE_SWF => SHARED_SOURCES do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true" : "", "-default-size 635 450"]
sh "#{MXMLC} #{options.join(" ")} -file-specs src/as3/com/las3r/util/TraceSwf.as -output=#{TRACE_SWF}"
end
TEST_DEMO_SWF_ENTRY_POINTS.zip(TEST_DEMO_SWF_TARGETS).each do |pair|
main, target = pair
sources = FileList["./src/as3/**/*"].exclude("./src/as3/com/las3r/test/demos") + [main]
file target => sources do
options = COMPILE_OPTIONS + [$debug ? "-compiler.debug=true" : "", "-default-size 635 450"]
sh "#{MXMLC} #{options.join(" ")} -file-specs #{main} -output=#{target}"
end
end
task :swc => [SWC_TARGET] do
end
task :repl => [REPL_TARGET] do
sh "#{DEBUG_PROJECTOR} #{REPL_TARGET}"
end
task :lsr_repl => [LSR_REPL_TARGET] do
sh "#{DEBUG_PROJECTOR} #{LSR_REPL_TARGET}"
end
task :garden => [DEMO_GARDEN_TARGET] do
sh "#{DEBUG_PROJECTOR} #{DEMO_GARDEN_TARGET}"
end
task :test_demos => TEST_DEMO_SWF_TARGETS do end
task :trace_swf => [TRACE_SWF] do end
task :units => [UNIT_TEST_RUNNER_TARGET] do
sh "#{DEBUG_PROJECTOR} #{UNIT_TEST_RUNNER_TARGET}"
end
task :clean => [] do
rm_rf UNIT_TEST_RUNNER_TARGET
end
task :default => [:units]