-
Notifications
You must be signed in to change notification settings - Fork 7
/
SConstruct
33 lines (27 loc) · 1019 Bytes
/
SConstruct
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
import os
import json
env = Environment(ENV = os.environ)
try:
paths = [os.environ.get('CBANG_HOME'), os.environ.get('CBANG_CONFIG_HOME')]
env.Tool('config', toolpath = paths)
except Exception as e:
raise Exception('CBANG_HOME not set?\n' + str(e))
env.CBLoadTools('dist packager')
conf = env.CBConfigure()
with open('package.json', 'r') as f: package_info = json.load(f)
env.Replace(PACKAGE_VERSION = package_info['version'])
env.Replace(dist_build = '')
conf.Finish()
if 'dist' in COMMAND_LINE_TARGETS:
if not env.GetOption('clean'):
env.RunCommandOrRaise(['npm', 'install'])
env.RunCommandOrRaise(['npm', 'run', 'build'])
distfiles = ['dist', 'LICENSE']
tar = env.ZipDist(package_info['name'], distfiles)
AlwaysBuild(tar)
Alias('dist', tar)
Clean(tar, ['dist', 'dist.txt'])
if 'distclean' in COMMAND_LINE_TARGETS:
Clean('distclean', ['.sconsign.dblite', '.sconf_temp', 'config.log',
'node_modules', 'package-lock.json',
Glob('*.tar.bz2'), Glob('*.zip'),'dist', 'dist.txt'])