@@ -50,16 +50,19 @@ def _emscripten_cache_impl(repository_ctx):
50
50
51
51
if repository_ctx .attr .libraries or repository_ctx .attr .flags :
52
52
binaryen_root = get_binaryen_root (repository_ctx )
53
- embuilder_path = binaryen_root .get_child ('emscripten/embuilder' )
54
53
llvm_root = binaryen_root .get_child ("bin" )
55
- nodejs = repository_ctx .path (Label ("@nodejs//:node_files" )).dirname .get_child ('bin/node' )
54
+ emscripten_root = binaryen_root .get_child ("emscripten" )
55
+ embuilder_path = emscripten_root .get_child ("embuilder" )
56
+ cache_path = repository_ctx .path ('cache' )
57
+ nodejs = repository_ctx .path (Label ("@nodejs//:node_files" )).dirname .get_child ("bin/node" )
56
58
# Create configuration file
57
- embuilder_config_content = "LLVM_ROOT = '{}'\n " .format (llvm_root )
58
- embuilder_config_content += "NODE_JS = '{}'\n " .format (nodejs )
59
+ embuilder_config_content = "NODE_JS = '{}'\n " .format (nodejs )
60
+ embuilder_config_content += "LLVM_ROOT = '{}'\n " .format (llvm_root )
59
61
embuilder_config_content += "BINARYEN_ROOT = '{}'\n " .format (binaryen_root )
60
- embuilder_config_content += "CACHE = 'cache'\n "
61
- repository_ctx .file ('embuilder_config' , embuilder_config_content )
62
- embuilder_config_path = repository_ctx .path ('embuilder_config' )
62
+ embuilder_config_content += "EMSCRIPTEN_ROOT = '{}'\n " .format (emscripten_root )
63
+ embuilder_config_content += "CACHE = '{}'\n " .format (cache_path )
64
+ repository_ctx .file ("embuilder_config" , embuilder_config_content )
65
+ embuilder_config_path = repository_ctx .path ("embuilder_config" )
63
66
# Prepare the command line
64
67
if repository_ctx .attr .libraries :
65
68
libraries = repository_ctx .attr .libraries
@@ -70,11 +73,11 @@ def _emscripten_cache_impl(repository_ctx):
70
73
embuilder_args = [embuilder_path ] + flags + ["build" ] + libraries
71
74
# Run embuilder
72
75
repository_ctx .report_progress ("Building secondary cache" )
73
- result = repository_ctx .execute (embuilder_args , quiet = False )
74
- if result != 0 :
76
+ result = repository_ctx .execute (embuilder_args , quiet = True )
77
+ if result . return_code != 0 :
75
78
fail ("Embuilder exited with a non-zero return code" )
76
79
# Override Emscripten's cache with the secondary cache
77
- default_config += "CACHE = '{}'\n " .format (repository_ctx . path ( 'cache' ) )
80
+ default_config += "CACHE = '{}'\n " .format (cache_path )
78
81
79
82
# Create the configuration file for the toolchain and export
80
83
repository_ctx .file ('emscripten_config' , default_config )
0 commit comments