Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 10acbda

Browse files
committedApr 16, 2020
Use embedded configuration by default
I can't see any reason why the embedded mode isn't always preferable. The emsdk is designed to be used as-is, and per-user customizations don't make sense. I'm hoping if this sicks we can just remove this options completely. This is part of a wider plan to remove the use of the user's HOME directory completely: emscripten-core/emscripten#9543
1 parent c523a65 commit 10acbda

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed
 

‎.circleci/config.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ jobs:
3636
name: Install debian packages
3737
command: apt-get update -q && apt-get install -q -y cmake build-essential openjdk-8-jre-headless
3838
- run: ./test.sh
39-
- run: ./test.py
39+
- run: |
40+
- source emsdk_env.sh
41+
- ./test.py
4042
test-mac:
4143
macos:
4244
xcode: "9.0"
@@ -54,7 +56,9 @@ jobs:
5456
name: Install python 3
5557
command: brew install python3
5658
- run: ./test.sh
57-
- run: ./test.py
59+
- run: |
60+
- source emsdk_env.sh
61+
- ./test.py
5862
test-windows:
5963
executor:
6064
name: win/vs2019

‎emsdk.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,15 +2793,15 @@ def main():
27932793

27942794
if WINDOWS:
27952795
print('''
2796-
emsdk activate [--global] [--embedded] [--build=type] [--vs2013/--vs2015/--vs2017] <tool/sdk>
2796+
emsdk activate [--global] [--[no-]embedded] [--build=type] [--vs2013/--vs2015/--vs2017] <tool/sdk>
27972797
27982798
- Activates the given tool or SDK in the
27992799
environment of the current shell. If the
28002800
--global option is passed, the registration
28012801
is done globally to all users in the system
2802-
environment. If the --embedded option is
2803-
passed, all Emcripten configuration files as
2804-
well as the temp, cache and ports directories
2802+
environment. In embedded mode (the default)
2803+
all Emcripten configuration files as well as
2804+
the temp, cache and ports directories
28052805
are located inside the Emscripten SDK
28062806
directory rather than the user home
28072807
directory. If a custom compiler version was
@@ -2812,11 +2812,11 @@ def main():
28122812
emcmdprompt.bat - Spawns a new command prompt window with the
28132813
Emscripten environment active.''')
28142814
else:
2815-
print(''' emsdk activate [--embedded] [--build=type] <tool/sdk>
2815+
print(''' emsdk activate [--[no-]embedded] [--build=type] <tool/sdk>
28162816
28172817
- Activates the given tool or SDK in the
2818-
environment of the current shell. If the
2819-
--embedded option is passed, all Emcripten
2818+
environment of the current shell. In
2819+
embedded mode (the default), all Emcripten
28202820
configuration files as well as the temp, cache
28212821
and ports directories are located inside the
28222822
Emscripten SDK directory rather than the user
@@ -2843,6 +2843,7 @@ def extract_bool_arg(name):
28432843
arg_uses = extract_bool_arg('--uses')
28442844
arg_global = extract_bool_arg('--global')
28452845
arg_embedded = extract_bool_arg('--embedded')
2846+
arg_embedded = not extract_bool_arg('--no-embedded')
28462847
arg_notty = extract_bool_arg('--notty')
28472848
if arg_notty:
28482849
TTY_OUTPUT = False

‎test.py‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
WINDOWS = sys.platform.startswith('win')
1010
MACOS = sys.platform == 'darwin'
1111

12+
assert 'EM_CONFIG' in os.environ
13+
1214
upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc')
1315
fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc')
1416
emsdk = './emsdk'
1517
if WINDOWS:
1618
upstream_emcc += '.bat'
1719
fastcomp_emcc += '.bat'
1820
emsdk = 'emsdk.bat'
19-
else:
20-
emsdk = './emsdk'
2121

2222
# Utilities
2323

@@ -76,13 +76,13 @@ def hack_emsdk(marker, replacement):
7676

7777
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
7878

79-
LIBC = os.path.expanduser('~/.emscripten_cache/wasm/libc.a')
79+
LIBC = '.emscripten_cache/wasm/libc.a'
8080

8181
# Tests
8282

8383
print('test .emscripten contents (latest was installed/activated in test.sh)')
84-
assert 'fastcomp' not in open(os.path.expanduser('~/.emscripten')).read()
85-
assert 'upstream' in open(os.path.expanduser('~/.emscripten')).read()
84+
assert 'fastcomp' not in open('.emscripten').read()
85+
assert 'upstream' in open('.emscripten').read()
8686

8787
# Test we don't re-download unnecessarily
8888
checked_call_with_output(emsdk + ' install latest', expected='already installed', unexpected='Downloading:')
@@ -134,9 +134,9 @@ def run_emsdk(cmd):
134134
run_emsdk('activate latest-fastcomp')
135135

136136
test_lib_building(fastcomp_emcc, use_asmjs_optimizer=False)
137-
assert open(os.path.expanduser('~/.emscripten')).read().count('LLVM_ROOT') == 1
138-
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
139-
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
137+
assert open('.emscripten').read().count('LLVM_ROOT') == 1
138+
assert 'upstream' not in open('.emscripten').read()
139+
assert 'fastcomp' in open('.emscripten').read()
140140

141141
print('verify version')
142142
checked_call_with_output(fastcomp_emcc + ' -v', TAGS['latest'], stderr=subprocess.STDOUT)
@@ -154,9 +154,9 @@ def run_emsdk(cmd):
154154
print('test tot-upstream')
155155
run_emsdk('install tot-upstream')
156156
assert not os.path.exists(LIBC)
157-
old_config = open(os.path.expanduser('~/.emscripten')).read()
157+
old_config = open('.emscripten').read()
158158
run_emsdk('activate tot-upstream')
159-
assert old_config == open(os.path.expanduser('~/.emscripten.old')).read()
159+
assert old_config == open('.emscripten.old').read()
160160
# TODO; test on latest as well
161161
assert os.path.exists(LIBC), 'activation supplies prebuilt libc'
162162
check_call(upstream_emcc + ' hello_world.c')
@@ -175,8 +175,8 @@ def run_emsdk(cmd):
175175
print('another install, but no need for re-download')
176176
checked_call_with_output(emsdk + ' install 1.38.33', expected='Skipped', unexpected='Downloading:')
177177
run_emsdk('activate 1.38.33')
178-
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
179-
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
178+
assert 'upstream' not in open('.emscripten').read()
179+
assert 'fastcomp' in open('.emscripten').read()
180180

181181
print('test specific release (new, full name)')
182182
run_emsdk('install sdk-1.38.33-upstream-64bit')

0 commit comments

Comments
 (0)
Please sign in to comment.