-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSConstruct
More file actions
executable file
·131 lines (112 loc) · 3.75 KB
/
SConstruct
File metadata and controls
executable file
·131 lines (112 loc) · 3.75 KB
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
import os
import multiprocessing
SetOption('num_jobs', multiprocessing.cpu_count())
print "running with -j", GetOption('num_jobs')
FIRST_SOURCES = [
'src/includeguard.js',
'src/es6-collections.js',
'ext/underscore-1.8.3.js',
]
BASE_SOURCES = [
'ext/backbone-0.9.10.js',
'ext/URI.js',
'src/repr.js',
'src/property.js',
'src/new.js',
'src/cookie.js',
'src/error.js',
'src/subclass.js',
'src/function.js',
'src/BaseClass.js',
'src/ServiceProvider.js',
'src/Random.js',
'src/module-common.js',
'src/EventLoop.js',
'src/Promise.js',
'src/NamedBackbone.js',
'third-party/pmxdr/pmxdr-client.js',
'third-party/libxdr/libxdr.js',
'third-party/requirejs/require.js',
'src/require.config.js',
'src/twig_template_plugin.js',
]
WEB_SOURCES = FIRST_SOURCES + [
'ext/jquery-3.3.1.js',
'src/jquery-3.3.1-deferred-exception-hook-patch.js',
'src/Timer.js',
] + BASE_SOURCES + [
'src/web-module.js',
'src/freeze-globals.js',
]
NODE_SOURCES = FIRST_SOURCES + [
'src/node-pre.js',
] + BASE_SOURCES + [
'src/node-module.js',
'src/node-export.js',
]
env = Environment(
ENV=os.environ,
toolpath=['scons-tools'],
tools=['node', 'closure', 'uglify', 'gzip', 'module_combine'])
BASE_CLOSURE_FLAGS = [
'--language_in', 'ECMASCRIPT_2017',
'--jscomp_error', 'ambiguousFunctionDecl',
'--jscomp_error', 'checkDebuggerStatement',
'--jscomp_error', 'checkRegExp',
'--jscomp_off', 'checkTypes',
'--jscomp_error', 'checkVars',
'--jscomp_error', 'deprecated',
'--jscomp_off', 'duplicate',
'--jscomp_error', 'es5Strict',
'--jscomp_off', 'missingProperties',
'--jscomp_error', 'undefinedNames',
'--jscomp_off', 'undefinedVars',
'--jscomp_off', 'uselessCode',
'--jscomp_error', 'globalThis',
]
targets = []
targets += env.ClosureCompiler(
'out/imvu.js',
['ext/esprima.js'] + WEB_SOURCES,
CLOSURE_FLAGS=BASE_CLOSURE_FLAGS+[
'--formatting', 'PRETTY_PRINT',
'--compilation_level', 'WHITESPACE_ONLY'])
targets += env.ClosureCompiler(
'out/imvu.min.js',
WEB_SOURCES,
CLOSURE_FLAGS=BASE_CLOSURE_FLAGS + ["--define='MODULE_DEBUG=false'"])
env.Gzip('out/imvu.min.js.gz', 'out/imvu.min.js')
targets += env.ClosureCompiler(
'out/imvu.node.js',
NODE_SOURCES,
CLOSURE_FLAGS=BASE_CLOSURE_FLAGS+['--formatting', 'PRETTY_PRINT', '--compilation_level', 'WHITESPACE_ONLY'])
targets += env.ClosureCompiler(
'out/pmxdr-host.min.js',
'third-party/pmxdr/pmxdr-host.js'
)
targets += env.Command(
'out/pmxdr-host.html',
['third-party/pmxdr/pmxdr-host.prefix.html', 'out/pmxdr-host.min.js', 'third-party/pmxdr/pmxdr-host.suffix.html'],
'cat $SOURCES > $TARGET'
)
#targets += env.UglifyJS(
# 'out/imvu.uglify.js',
# WEB_SOURCES)
#env.Gzip('out/imvu.uglify.js.gz', 'out/imvu.uglify.js')
targets += env.CombinedModule('out/imvu.fakes.js', 'fakes/Package.js')
targets += env.CombinedModule('out/imvutest.js', 'src/imvujstest/imvutest.js')
targets += env.CombinedModule('out/imvutest.async.js', 'src/imvujstest/imvutest.async.js')
targets += env.CombinedModule('out/ServiceProvider.real.js', 'src/ServiceProvider.real.js')
targets += env.CombinedModule('out/ServiceProvider.fake.js', 'src/ServiceProvider.fake.js')
if 'target' in ARGUMENTS:
env.Install(ARGUMENTS['target'], targets)
env.Alias('install', ARGUMENTS['target'])
env.Default('out')
# automated tests for the scons dependency scanner and combiner tool
@apply
def scons_tool_tests(env=env):
env = env.Clone()
env.Append(MODULE_ALIASES={
'short': 'tests/includes/include.js'})
env.CombinedModule('out/tests/uses_alias.js', 'tests/includes/alias.js')
env.CombinedModule('out/tests/uses_asmjs.js', 'tests/includes/uses_asmjs.js')