Skip to content

Commit

Permalink
Drop Windows support for secondary caches
Browse files Browse the repository at this point in the history
  • Loading branch information
allsey87 committed Jun 16, 2024
1 parent d7f0173 commit f75f339
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 41 deletions.
34 changes: 5 additions & 29 deletions bazel/emscripten_cache.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def get_root_and_script_ext(repository_ctx):
else:
fail('Unsupported architecture for MacOS')
elif repository_ctx.os.name.startswith('windows'):
return (repository_ctx.path(Label("@emscripten_bin_win//:BUILD.bazel")).dirname, '.bat')
fail('Using a secondary cache is not supported on Windows')
#return (repository_ctx.path(Label("@emscripten_bin_win//:BUILD.bazel")).dirname, '.bat')
else:
fail('Unsupported operating system')

Expand Down Expand Up @@ -73,35 +74,10 @@ def _emscripten_cache_impl(repository_ctx):
embuilder_args = [embuilder_path] + flags + ["build"] + libraries
# Run embuilder
repository_ctx.report_progress("Building secondary cache")
result = repository_ctx.execute(embuilder_args, quiet=False)
result = repository_ctx.execute(embuilder_args, quiet=True)
if result.return_code != 0:
### TEST

cwd = external_root
dir_result = repository_ctx.execute(['dir'], quiet=False, working_directory=str(cwd))
print('dir_result(external_root).return_code = {}\n\n'.format(dir_result.return_code))
print('dir_result(external_root).stderr = {}\n\n'.format(dir_result.stderr))
print('dir_result(external_root).stdout = {}\n\n'.format(dir_result.stdout))

cwd = cwd.get_child('nodejs_windows_amd64')
dir_result = repository_ctx.execute(['dir'], quiet=False, working_directory=str(cwd))
print('dir_result(nodejs_windows_amd64).return_code = {}\n\n'.format(dir_result.return_code))
print('dir_result(nodejs_windows_amd64).stderr = {}\n\n'.format(dir_result.stderr))
print('dir_result(nodejs_windows_amd64).stdout = {}\n\n'.format(dir_result.stdout))

cwd = cwd.get_child('bin')
dir_result = repository_ctx.execute(['dir'], quiet=False, working_directory=str(cwd))
print('dir_result(bin).return_code = {}\n\n'.format(dir_result.return_code))
print('dir_result(bin).stderr = {}\n\n'.format(dir_result.stderr))
print('dir_result(bin).stdout = {}\n\n'.format(dir_result.stdout))

cwd = cwd.get_child('nodejs')
dir_result = repository_ctx.execute(['dir'], quiet=False, working_directory=str(cwd))
print('dir_result(nodejs).return_code = {}\n\n'.format(dir_result.return_code))
print('dir_result(nodejs).stderr = {}\n\n'.format(dir_result.stderr))
print('dir_result(nodejs).stdout = {}\n\n'.format(dir_result.stdout))

### TEST
# Windows fails here because external/nodejs_windows_amd64/bin/nodejs/node.exe
# does not exist at this point (while the equivalent on Linux and MacOS does)
fail("Embuilder exited with a non-zero return code")
# Override Emscripten's cache with the secondary cache
default_config += "CACHE = '{}'\n".format(cache)
Expand Down
24 changes: 12 additions & 12 deletions test/test_bazel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ if (-not $?) { Exit $LastExitCode }

Set-Location test_external

# bazel build //:hello-world-wasm
# if (-not $?) { Exit $LastExitCode }
bazel build //:hello-world-wasm
if (-not $?) { Exit $LastExitCode }

# bazel build //long_command_line:long_command_line_wasm
# if (-not $?) { Exit $LastExitCode }
bazel build //long_command_line:long_command_line_wasm
if (-not $?) { Exit $LastExitCode }

# bazel build //:hello-embind-wasm --compilation_mode dbg # debug
# if (-not $?) { Exit $LastExitCode }
bazel build //:hello-embind-wasm --compilation_mode dbg # debug
if (-not $?) { Exit $LastExitCode }

# # Test use of the closure compiler
# bazel build //:hello-embind-wasm --compilation_mode opt # release
# if (-not $?) { Exit $LastExitCode }
# Test use of the closure compiler
bazel build //:hello-embind-wasm --compilation_mode opt # release
if (-not $?) { Exit $LastExitCode }

Set-Location ..\test_secondary_lto_cache
# Set-Location ..\test_secondary_lto_cache

bazel build //:hello-world-wasm
if (-not $?) { Exit $LastExitCode }
# bazel build //:hello-world-wasm
# if (-not $?) { Exit $LastExitCode }

0 comments on commit f75f339

Please sign in to comment.