Skip to content

Master#1

Merged
shivamc21 merged 307 commits intoshivamc21:masterfrom
emscripten-core:master
Jun 20, 2024
Merged

Master#1
shivamc21 merged 307 commits intoshivamc21:masterfrom
emscripten-core:master

Conversation

@shivamc21
Copy link
Owner

@shivamc21 shivamc21 commented Jun 20, 2024

Pull request summary created by Squire AI

Summary

This pull request introduces several significant updates and new features. It adds comprehensive CircleCI configuration for testing across multiple environments and replaces Travis CI. The emsdk scripts have been refactored and simplified, with a new shell script replacing the Python script. Bazel build configurations and dependencies for the Emscripten toolchain have been added, along with new Docker support for building and testing the Emscripten SDK. Additionally, the README and various configuration files have been updated to reflect these changes.

0ff164f...7e3c046

File Summary

File Changes

  • .flake8: Updated ignore and exclude rules for flake8 configuration.
  • .gitignore: Updated .gitignore to include Python cache files and other directories.
  • README.md: Updated README with new CircleCI badge and revised installation instructions.
  • emscripten-releases-tags.txt: Updated emscripten-releases-tags.txt with new release tags.
  • emsdk: Replaced Python script with a shell script for emsdk.
  • emsdk.bat: Updated emsdk.bat to use new Python script location.
  • emsdk.ps1: Updated emsdk.ps1 to use new Python script location.
  • emsdk_env.bat: Simplified emsdk_env.bat to call the new emsdk script.
  • emsdk_env.fish: Simplified emsdk_env.fish to call the new emsdk script.
  • emsdk_env.ps1: Simplified emsdk_env.ps1 to call the new emsdk script.
  • emsdk_env.sh: Simplified emsdk_env.sh to call the new emsdk script.
  • emsdk_manifest.json: Updated emsdk_manifest.json with new tool and SDK definitions.

New Files

  • config.yml: New CircleCI configuration file added with multiple jobs for different environments (Linux, Mac, Windows) and workflows for testing, building, and publishing Docker images.
  • .dockerignore: New .dockerignore file added to ignore unnecessary files and directories in Docker builds.
  • stale.yml: New GitHub Actions configuration file to mark issues as stale after 365 days of inactivity and close them after 30 more days.
  • (bazel)/BUILD: New Bazel build configuration file added for Emscripten toolchain with settings for different OS and CPU architectures.
  • (bazel)/README.md: New README file added with setup instructions and build commands for Bazel Emscripten toolchain.
  • (bazel)/WORKSPACE: New Bazel WORKSPACE file added with dependencies for Emscripten toolchain.
  • bazelrc: New Bazel configuration file added with build settings for WebAssembly.
  • deps.bzl: New Bazel dependencies file added for Emscripten toolchain.
  • emscripten_deps.bzl: New Bazel dependencies file added for Emscripten toolchain with specific versions and URLs.
  • BUILD.bazel: New Bazel build file for Emscripten toolchain with toolchain configuration and file groups.
  • crosstool.bzl: New Bazel toolchain configuration file for Emscripten with settings for different build actions and features.
  • emar.sh: New shell script for Emscripten archive tool.
  • emcc.sh: New shell script for Emscripten compiler.
  • emcc_link.sh: New shell script for Emscripten linker.
  • emscripten.BUILD: New Bazel build file for Emscripten toolchain with file group for all sources.
  • emscripten_config: New configuration file for Emscripten toolchain with environment variables.
  • env.sh: New shell script to set environment variables for Emscripten toolchain.
  • link_wrapper.py: New Python script for wrapping Emscripten link step with additional functionality.
  • wasm_binary.py: New Python script for unpacking Bazel Emscripten archives.
  • wasm_cc_binary.bzl: New Bazel rule for compiling C++ targets to WebAssembly.
  • wasm_rules.bzl: New Bazel rules related to C++ and WebAssembly.
  • (hello-world)/BUILD: New Bazel build file for hello-world example with WebAssembly support.
  • hello-world-simd.cc: New C++ source file for hello-world example with SIMD support.
  • (hello-world)/hello-world.cc: New C++ source file for hello-world example.
  • revisions.bzl: New Bazel file with Emscripten version revisions.
  • (test_external)/BUILD: New Bazel build file for external hello-world example with WebAssembly support.
  • (test_external)/WORKSPACE: New Bazel WORKSPACE file for external hello-world example with Emscripten dependencies.
  • (test_external)/hello-world.cc: New C++ source file for external hello-world example.
  • Dockerfile: New Dockerfile for building a self-contained Emscripten SDK.
  • Makefile: New Makefile for building, testing, tagging, and publishing the Emscripten SDK Docker container.
  • (docker)/README.md: New README file with usage instructions for the Emscripten SDK Docker container.
  • test_dockerimage.sh: New shell script for testing the Emscripten SDK Docker container.
  • emsdk.py: New Python script for managing the Emscripten SDK.
  • emsdk_env.csh: New C shell script for setting up the Emscripten SDK environment.
  • llvm-tags-64bit.txt: New text file listing available LLVM tags for 64-bit builds.
  • create_release.py: New Python script for creating new Emscripten releases.
  • update_bazel_workspace.sh: New shell script for updating Bazel WORKSPACE file with the latest Emscripten version.
  • update_node.py: New Python script for updating Node.js binaries used by Emscripten.
  • update_python.py: New Python script for updating Python binaries used by Emscripten.
  • test.bat: New batch script for testing Emscripten SDK on Windows.
  • test.py: New Python script for running unit tests on the Emscripten SDK.
  • test.sh: New shell script for testing the standard workflow of the Emscripten SDK.
  • test_activation.ps1: New PowerShell script for testing the activation of the Emscripten SDK.
  • test_bazel.sh: New shell script for testing Bazel builds with Emscripten.
  • test_bazel_mac.sh: New shell script for testing Bazel builds with Emscripten on macOS.
  • test_path_preservation.ps1: New PowerShell script for testing PATH preservation during Emscripten SDK activation.
  • test_source_env.sh: New shell script for testing the sourcing of emsdk_env.sh in different shells.

Deleted Files

  • .travis.yml
  • Dockerfile
  • bin/elevate.exe
  • upstream/lkgr.json

Moved/Renamed Files

  • legacy-binaryen-tags.txt
  • legacy-emscripten-tags.txt

0ff164f...7e3c046

Summary by CodeRabbit

  • New Features

    • Introduced support for building and testing across multiple platforms (Linux, macOS, Windows) with Emscripten SDK using Bazel.
    • Added Docker support for Emscripten SDK, providing an isolated development environment.
    • Implemented automation scripts for release creation, Bazel workspace updates, and Node.js/Python version management.
  • Documentation

    • Enhanced README with comprehensive installation and usage instructions for Emscripten SDK.
    • Added detailed setup guides for using Bazel with Emscripten.
  • Chores

    • Updated various configuration files to streamline builds, tests, and dependency management.
    • Improved .gitignore and .dockerignore to filter out unnecessary files during development and Docker builds.

sbc100 and others added 30 commits August 29, 2019 00:35
- Add EMSDK_NOTTY variable which we can use on CI to prevent tty output.
- Add test.bat for windows which mirrors test.sh.
- Remove travis support
Now that we have much better testing in CI this kind of change
should be much easier to make with confidence.
Turns out 10.16.3 has issues running some emscripten tests due to a
v8 bug: https://bugs.chromium.org/p/v8/issues/detail?id=8347.
Previously we were asserting and generating a stack track if a
download failed.  However the assert is only relevant if the download
succeeds.

Also:

- Remove an unused function
- Remove extra braces from tuple destructuring
Remove obsolete docs links.

Remove downloading of the old releases list, and bundle the file in the repo.

Also the message in update-tags was wrong: we need git to do anything there now, as update-tags gets emscripten-releases using git currently (which is ok as update-tags is run by users that installed with git; otherwise they installed without git and just update the entire emsdk normally).
The OSX message is [SSL: CERTIFICATE_VERIFY_FAILED] while trying to download files.
While, the Linux Python message is less descriptive.
Error downloading URL 'https://xxxx.xxx.xxx': <urlopen error unknown url type: https>.

This hopefully reduces the stream of common issues raised during installation as a result of the change of Python TLS certs to 2048 or greater.
This change relates to  #133 #136 #140 #176 #6275 #6548 #6723 #9036 … and possibly more.

Installation can be accomplished by installing the latest Python certificates (pip install certifi), symbolic linking a new python version, and relying on the python shebang line to run $ ./emsdk.py install latest.
- Remove some unneeded use of `global` keyword
- Use OrderedDict
- Add exit_with_error helper
- Remove SPIDERMONKY_ENGINE from emscripten config
As a continuation from: emscripten-core/emscripten#8742

This PR provides adopted Dockerfile from https://github.com/trzecieu/emscripten-docker/blob/master/docker/trzeci/emscripten-fastcomp/Dockerfile which supports builds:
  * fastcomp
  * upstream

Features:
* An image can be build with fastcomp and upstream version of Emscripten SDK
* It applies some extra size optimizations (that might be removed in sake of clarity / stability)
* It creates conventional `1000:1000` user `emscripten`
* It creates extra entrypoint that mitigates running as non-root user (Some context: https://trzeci.eu/fixing-permission-of-files-created-from-docker/)
* It has simple-stupid tests performed during building
Opening it and saving it in an editor can add a newline, and we have user
reports of this happening for users.

Fixes emscripten-core/emscripten#9651
These are part of `releases-fastcomp` but for some reason are not
included in the upstream equivalent.  I imagine they were simply
overlooked.
When users as for 'latest' or just '1.39.0' we now default to the
upstream llvm backend.

For versions before 1.39.0 we continue to default to fastcomp.

Fixes: emscripten-core/emscripten#5488
juj and others added 20 commits March 17, 2021 17:26
* allow the bazel toolchain to output html files

* allow for cc_binary rule names to end in .js

* fix python name

* continue to call emcc instead of em++ for now

* small cleanup

Co-authored-by: Mitch Foley <mitchfoley@chromium.org>
…SH (#767)

Previously this had to be

emsdk install sdk-releases-upstream-HASH

The only thing preventing using just the hash was that there was no
default for the backend, so defaulting to upstream fixes this. And then
we can do

emsdk install HASH
* Makes provided bazel rules look up @emsdk workspace instead of local workspace
* Uses system-specific emscripten binaries instead of defaulting to linux
* Provides macros for loading emsdk dependencies (nodejs and emscripten binaries)
* Unhardcodes paths in bazel rules and .sh wrappers
* `update_bazel_workspace.sh` now updates `revisions.bzl`
* `emscripten_deps()` can be fed with specific emscripten version
* Adds external usage test

Addresses #650 and #696
* Update bazel/README.md

* Add deps instantiation to readme

* Add bazelrc explanations to readme

* Note the preferred way of using bazel emsdk
… should reuse system temp directory instead, that is what it is there for. (#791)
This avoid polluting the global environment which makes
side-by-side installational of different emscripten version
harder.

See emscripten-core/emscripten#13954
* Add option --override-repository to allow controlling where git clones happen from.

* Address review
When we deactivate a tool we also want to remove its environment
variables.   One driver for this is that modern sdks don't set
`EM_CACHE` whereas old ones did and we want to make sure that
`EM_CACHE` gets unset when folks upgrade (and then re-set if
they downgrade).  See #797.
This works regardless of the name of the primary branch so that
the code will continue to work if/when we rename `main` to `master`.

See: #805
…already seem to install google-closure-compiler-windows at least. (#803)
See #805

The behavior is now:

$ ./emsdk install 2.0.0
****
Error: You appear to be using the `master` branch of emsdk.
We recently made the switch to using `main`
In order to continue to receive updates you will need to make the switch locally too.
For normal clones without any local branches simply running the following command should be enough:
  `git checkout main`
For more information see #805
****
$ echo $?
1

If you see this error, you are using master, and should switch to main,
which is where development now occurs.
@ghost
Copy link

ghost commented Jun 20, 2024

Hi there, Squire here! 👋

Here's what I can do today:

  • /squire review - Call me to perform a review of this PR
  • /squire clear - delete all comments Squire has left in this PR.
  • /squire summary - I'll summarize the current state of the PR in a comment based on the latest commits.
  • /squire update-description - I'll update the PR description with a summary of the current state of the PR based on the latest commits.
  • /squire help - I'll remind you of all the commands I can do.

You can always clear and then run review again if you've committed more to get a fresh review.

For more info, including how to add our generated PR descriptions to a template, check out our docs: https://docs.squire.ai/

@coderabbitai
Copy link

coderabbitai bot commented Jun 20, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The recent updates encompass various enhancements across the Emscripten SDK project, including improvements in CI configurations, Docker setup, Bazel integration, and environment scripts. These changes aim to enhance the development and deployment processes, including multi-platform support, automated release management, updated documentation, and optimized build and test workflows for WebAssembly projects.

Changes

Files/Groups Change Summary
.circleci/config.yml Added job configurations for different platforms and tasks such as testing, Docker image building, and linting
.dockerignore, .gitignore Introduced rules to ignore unnecessary files in Docker builds, and updated ignore rules for various files
.flake8 Modified ignored error codes and excluded new directories
.github/stale.yml Configured settings for managing stale GitHub issues
README.md Refactored and improved clarity in Emscripten SDK instructions
bazel/... Introduced and updated various Bazel toolchain files and configurations for Emscripten integration
docker/Dockerfile, docker/Makefile Created a Dockerfile for Emscripten SDK environment and a Makefile for building, testing, and publishing Docker images
scripts/... Added scripts for automating release creation, updating Bazel workspace, and handling node binaries
emscripten-releases-tags.txt Updated versioning information and added new versions
emsdk_env.* Enhanced environment setup scripts for different shells

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant CircleCI
    participant DockerHub
    participant GitHub

    Developer->>GitHub: Push changes
    GitHub->>CircleCI: Trigger CI Pipeline
    CircleCI->>CircleCI: Run jobs (lint, test, build, etc.)
    CircleCI->>DockerHub: Publish Docker Image
    CircleCI->>GitHub: Update Release Info
Loading

Poem

In code we trust, enhancements weave,
Across the platforms, dreams we achieve.
With Docker rising, seamless build,
Bazel rules set, our hopes fulfilled.
CircleCI springs, testing all night,
Emscripten’s future, shining bright. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@shivamc21 shivamc21 merged commit c934d6f into shivamc21:master Jun 20, 2024
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed by Squire AI

19 comments were added to this review.

Help make Squire better by providing feedback - the good, the bad, & the ugly.
https://cal.com/saumil/chat-with-squire-ai

Comment on lines +19 to +51
def flag_set(flags = None, features = None, not_features = None, **kwargs):
"""Extension to flag_set which allows for a "simple" form.

The simple form allows specifying flags as a simple list instead of a flag_group
if enable_if or expand_if semantics are not required.

Similarly, the simple form allows passing features/not_features if they are a simple
list of semantically "and" features.
(i.e. "asan" and "dbg", rather than "asan" or "dbg")

Args:
flags: list, set of flags
features: list, set of features required to be enabled.
not_features: list, set of features required to not be enabled.
**kwargs: The rest of the args for flag_set.

Returns:
flag_set
"""
if flags:
if kwargs.get("flag_groups"):
fail("Cannot set flags and flag_groups")
else:
kwargs["flag_groups"] = [flag_group(flags = flags)]

if features or not_features:
if kwargs.get("with_features"):
fail("Cannot set features/not_feature and with_features")
kwargs["with_features"] = [with_feature_set(
features = features or [],
not_features = not_features or [],
)]
return _flag_set(**kwargs)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming the flag_set function to avoid potential conflicts with existing flag_set definitions.

Comment on lines +57 to +1100
def _impl(ctx):
target_cpu = ctx.attr.cpu
toolchain_identifier = "emscripten-" + target_cpu
target_system_name = target_cpu + "-unknown-emscripten"

host_system_name = "i686-unknown-linux-gnu"

target_libc = "musl/js"

abi_version = "emscripten_syscalls"

compiler = "emscripten"
abi_libc_version = "default"

cc_target_os = "emscripten"

emscripten_dir = ctx.attr.emscripten_binaries.label.workspace_root

builtin_sysroot = emscripten_dir + "/emscripten/cache/sysroot"

################################################################
# Tools
################################################################
clang_tool = tool(path = "emcc.sh")
clif_match_tool = tool(path = "dummy_clif_matcher")
link_tool = tool(path = "emcc_link.sh")
archive_tool = tool(path = "emar.sh")
strip_tool = tool(path = "NOT_USED_STRIP_TOOL")

#### Legacy tool paths (much of this is redundant with action_configs, but
#### these are still used for some things)
tool_paths = [
tool_path(name = "ar", path = "emar.sh"),
tool_path(name = "cpp", path = "/bin/false"),
tool_path(name = "gcc", path = "emcc.sh"),
tool_path(name = "gcov", path = "/bin/false"),
tool_path(name = "ld", path = "emcc_link.sh"),
tool_path(name = "nm", path = "NOT_USED"),
tool_path(name = "objdump", path = "/bin/false"),
tool_path(name = "strip", path = "NOT_USED"),
]

################################################################
# Action Configs
################################################################

cpp_compile_action = action_config(
action_name = ACTION_NAMES.cpp_compile,
tools = [clang_tool],
)

cpp_module_compile_action = action_config(
action_name = ACTION_NAMES.cpp_module_compile,
tools = [clang_tool],
)

cpp_module_codegen_action = action_config(
action_name = ACTION_NAMES.cpp_module_codegen,
tools = [clang_tool],
)

clif_match_action = action_config(
action_name = ACTION_NAMES.clif_match,
tools = [clif_match_tool],
)

cpp_link_dynamic_library_action = action_config(
action_name = ACTION_NAMES.cpp_link_dynamic_library,
tools = [link_tool],
)

strip_action = action_config(
action_name = ACTION_NAMES.strip,
tools = [strip_tool],
)

preprocess_assemble_action = action_config(
action_name = ACTION_NAMES.preprocess_assemble,
tools = [clang_tool],
)

cpp_header_parsing_action = action_config(
action_name = ACTION_NAMES.cpp_header_parsing,
tools = [clang_tool],
)

cpp_link_static_library_action = action_config(
action_name = ACTION_NAMES.cpp_link_static_library,
enabled = True,
flag_sets = [
flag_set(
flag_groups = [
flag_group(
flags = ["rcsD", "%{output_execpath}"],
expand_if_available = "output_execpath",
),
],
),
flag_set(
flag_groups = [
flag_group(
iterate_over = "libraries_to_link",
flag_groups = [
flag_group(
flags = ["%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file",
),
),
flag_group(
flags = ["%{libraries_to_link.object_files}"],
iterate_over = "libraries_to_link.object_files",
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file_group",
),
),
],
expand_if_available = "libraries_to_link",
),
],
),
flag_set(
flag_groups = [
flag_group(
flags = ["@%{linker_param_file}"],
expand_if_available = "linker_param_file",
),
],
),
],
tools = [archive_tool],
)

c_compile_action = action_config(
action_name = ACTION_NAMES.c_compile,
tools = [clang_tool],
)

linkstamp_compile_action = action_config(
action_name = ACTION_NAMES.linkstamp_compile,
tools = [clang_tool],
)

assemble_action = action_config(
action_name = ACTION_NAMES.assemble,
tools = [clang_tool],
)

cpp_link_executable_action = action_config(
action_name = ACTION_NAMES.cpp_link_executable,
tools = [link_tool],
)

cpp_link_nodeps_dynamic_library_action = action_config(
action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
tools = [link_tool],
)

action_configs = [
strip_action,
c_compile_action,
cpp_compile_action,
linkstamp_compile_action,
assemble_action,
preprocess_assemble_action,
cpp_header_parsing_action,
cpp_module_compile_action,
cpp_module_codegen_action,
cpp_link_executable_action,
cpp_link_dynamic_library_action,
cpp_link_nodeps_dynamic_library_action,
cpp_link_static_library_action,
clif_match_action,
]

all_compile_actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
ACTION_NAMES.lto_backend,
]

all_cpp_compile_actions = [
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
]

preprocessor_compile_actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.clif_match,
]

all_link_actions = [
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
]

################################################################
# Features
################################################################

features = [
# This set of magic "feature"s are important configuration information for blaze.
feature(name = "no_legacy_features", enabled = True),
feature(
name = "has_configured_linker_path",
enabled = True,
),

# Blaze requests this feature by default, but we don't care.
feature(name = "dependency_file"),

# Blaze requests this feature by default, but we don't care.
feature(name = "random_seed"),

# Formerly "needsPic" attribute
feature(name = "supports_pic", enabled = False),

# Blaze requests this feature by default.
# Blaze also tests if this feature is supported, before setting the "pic" build-variable.
feature(name = "pic"),

# Blaze requests this feature if fission is requested
# Blaze also tests if it's supported to see if we support fission.
feature(name = "per_object_debug_info"),

# Blaze requests this feature by default.
# Blaze also tests if this feature is supported before setting preprocessor_defines
# (...but why?)
feature(name = "preprocessor_defines"),

# Blaze requests this feature by default.
# Blaze also tests if this feature is supported before setting includes. (...but why?)
feature(name = "include_paths"),

# Blaze tests if this feature is enabled in order to create implicit
# "nodeps" .so outputs from cc_library rules.
feature(name = "supports_dynamic_linker", enabled = False),

# Blaze requests this feature when linking a cc_binary which is
# "dynamic" aka linked against nodeps-dynamic-library cc_library
# outputs.
feature(name = "dynamic_linking_mode"),

#### Configuration features
feature(
name = "crosstool_cpu",
enabled = True,
implies = ["crosstool_cpu_" + target_cpu],
),
feature(
name = "crosstool_cpu_asmjs",
provides = ["variant:crosstool_cpu"],
),
feature(
name = "crosstool_cpu_wasm",
provides = ["variant:crosstool_cpu"],
),

# These 3 features will be automatically enabled by blaze in the
# corresponding build mode.
feature(
name = "opt",
provides = ["variant:crosstool_build_mode"],
),
feature(
name = "dbg",
provides = ["variant:crosstool_build_mode"],
),
feature(
name = "fastbuild",
provides = ["variant:crosstool_build_mode"],
),

#### User-settable features

# Set if enabling exceptions.
feature(name = "exceptions"),

# This feature overrides the default optimization to prefer execution speed
# over binary size (like clang -O3).
feature(
name = "optimized_for_speed",
provides = ["variant:crosstool_optimization_mode"],
),

# This feature overrides the default optimization to prefer binary size over
# execution speed (like clang -Oz).
feature(
name = "optimized_for_size",
provides = ["variant:crosstool_optimization_mode"],
),

# Convenience aliases / alt-spellings.
feature(
name = "optimize_for_speed",
implies = ["optimized_for_speed"],
),
feature(
name = "optimize_for_size",
implies = ["optimized_for_size"],
),

# This feature allows easier use of profiling tools by preserving mangled
# C++ names. This does everything profiling_funcs does and more.
feature(name = "profiling"),

# This feature emits only enough debug info for function names to appear
# in profiles.
feature(name = "profiling_funcs"),

# This feature allows source maps to be generated.
feature(
name = "source_maps",
implies = ["full_debug_info"],
),
feature(
name = "dwarf_debug_info",
implies = ["profiling"],
),

# Turns on full debug info (-g4).
feature(name = "full_debug_info"),

# Enables the use of "Emscripten" Pthread implementation.
# https://kripken.github.io/emscripten-site/docs/porting/pthreads.html
# https://github.com/kripken/emscripten/wiki/Pthreads-with-WebAssembly
feature(name = "use_pthreads"),

# If enabled, the runtime will exit when main() completes.
feature(name = "exit_runtime"),

# Primarily for toolchain maintainers:
feature(name = "emcc_debug"),
feature(name = "emcc_debug_link"),
feature(
name = "llvm_backend",
requires = [feature_set(features = ["crosstool_cpu_wasm"])],
enabled = True,
),

# Remove once flag is flipped.
# See https://github.com/bazelbuild/bazel/issues/7687
feature(
name = "do_not_split_linking_cmdline",
),

# Adds simd support, only available with the llvm backend.
feature(
name = "wasm_simd",
requires = [feature_set(features = ["llvm_backend"])],
),
feature(
name = "precise_long_double_printf",
enabled = True,
),
feature(
name = "wasm_warnings_as_errors",
enabled = True,
),

# ASan and UBSan. See also:
# https://emscripten.org/docs/debugging/Sanitizers.html
feature(name = "wasm_asan"),
feature(name = "wasm_ubsan"),

feature(
name = "output_format_js",
enabled = True,
),
]

crosstool_default_flag_sets = [
# Compile, Link, and CC_FLAGS make variable
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
],
flag_groups = [
flag_group(
flags = ["--sysroot=%{sysroot}"],
expand_if_available = "sysroot",
),
],
),
# Compile + Link
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
],
# This forces color diagnostics even on Forge (where we don't have an
# attached terminal).
flags = [
"-fdiagnostics-color",
],
),
# C++ compiles (and implicitly link)
flag_set(
actions = all_cpp_compile_actions,
flags = [
"-fno-exceptions",
],
not_features = ["exceptions"],
),
flag_set(
actions = all_cpp_compile_actions,
flags = [
"-fexceptions",
],
features = ["exceptions"],
),
# All compiles (and implicitly link)
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = [
"-fno-strict-aliasing",
"-funsigned-char",
"-no-canonical-prefixes",
],
),
# Language Features
flag_set(
actions = all_cpp_compile_actions,
flags = ["-std=gnu++17", "-nostdinc", "-nostdinc++",],
),

# Emscripten-specific settings:
flag_set(
actions = all_compile_actions + all_link_actions,
flags = ["-s", "WASM=0"],
features = ["crosstool_cpu_asmjs"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-s", "USE_PTHREADS=1"],
features = ["use_pthreads"],
),
flag_set(
actions = all_link_actions,
flags = ["-s", "EXIT_RUNTIME=1"],
features = ["exit_runtime"],
),
flag_set(
actions = all_compile_actions + all_link_actions,
flags = ["-pthread"],
features = ["llvm_backend", "use_pthreads"],
),
flag_set(
actions = all_compile_actions + all_link_actions,
flags = ["-msimd128"],
features = ["wasm_simd"],
),
flag_set(
actions = all_link_actions,
flags = ["-s", "PRINTF_LONG_DOUBLE=1"],
features = ["precise_long_double_printf"],
),
flag_set(
actions = all_link_actions,
flags = ["--oformat=js"],
features = ["output_format_js"],
),

# Opt
flag_set(
actions = preprocessor_compile_actions,
flags = ["-DNDEBUG"],
features = ["opt"],
),
flag_set(
actions = all_compile_actions,
flags = ["-fomit-frame-pointer"],
features = ["opt"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-O3"],
features = ["opt"],
),
# Users can override opt-level with semantic names...
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-Oz"],
features = ["optimized_for_size", "opt"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-O3"],
features = ["optimized_for_speed", "opt"],
),

# Fastbuild
flag_set(
actions = all_compile_actions,
flags = ["-fomit-frame-pointer"],
features = ["fastbuild"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-O2"],
features = ["fastbuild"],
),

# Dbg
flag_set(
actions = all_compile_actions,
flags = ["-fno-omit-frame-pointer"],
features = ["dbg"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-g", "-O0"],
features = ["dbg"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = [
"-g4",
"-fsanitize=address",
"-O1",
"-DADDRESS_SANITIZER=1",
"-fno-omit-frame-pointer",
],
features = ["wasm_asan"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = [
"-g4",
"-fsanitize=undefined",
"-O1",
"-DUNDEFINED_BEHAVIOR_SANITIZER=1",
"-fno-omit-frame-pointer",
"-fno-sanitize=vptr",
],
features = ["wasm_ubsan"],
),

# Profiling provides full debug info and a special --profiling flag
# to control name mangling
flag_set(
actions = all_link_actions,
flags = ["--profiling"],
features = ["profiling"],
),
flag_set(
actions = all_link_actions,
flags = ["--profiling_funcs"],
features = ["profiling_funcs"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-g4"],
features = ["full_debug_info"],
),
flag_set(
actions = all_link_actions,
flags = ["-gseparate-dwarf"],
features = ["dwarf_debug_info"],
),
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-fdebug-compilation-dir=."],
features = ["dwarf_debug_info"],
),
# Generic warning flag list
flag_set(
actions = all_compile_actions,
flags = CROSSTOOL_DEFAULT_WARNINGS,
),

# Defines and Includes and Paths and such
flag_set(
actions = all_compile_actions,
flag_groups = [
flag_group(flags = ["-fPIC"], expand_if_available = "pic"),
],
),
flag_set(
actions = preprocessor_compile_actions,
flag_groups = [
flag_group(
flags = ["-D%{preprocessor_defines}"],
iterate_over = "preprocessor_defines",
),
],
),
flag_set(
actions = preprocessor_compile_actions,
flag_groups = [
flag_group(
flags = ["-include", "%{includes}"],
iterate_over = "includes",
expand_if_available = "includes",
),
],
),
flag_set(
actions = preprocessor_compile_actions,
flag_groups = [
flag_group(
flags = ["-iquote", "%{quote_include_paths}"],
iterate_over = "quote_include_paths",
),
flag_group(
flags = ["-I%{include_paths}"],
iterate_over = "include_paths",
),
flag_group(
flags = ["-isystem", "%{system_include_paths}"],
iterate_over = "system_include_paths",
),
],
),

## Linking options (not libs -- those go last)

# Generic link options
flag_set(
actions = [
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
],
flags = ["-shared"],
),

# Linker search paths and objects:
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
iterate_over = "runtime_library_search_directories",
flag_groups = [
flag_group(
flags = [
"-Wl,-rpath,$EXEC_ORIGIN/%{runtime_library_search_directories}",
],
expand_if_true = "is_cc_test",
),
flag_group(
flags = [
"-Wl,-rpath,$ORIGIN/%{runtime_library_search_directories}",
],
expand_if_false = "is_cc_test",
),
],
expand_if_available = "runtime_library_search_directories",
),
],
),
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = ["-L%{library_search_directories}"],
iterate_over = "library_search_directories",
expand_if_available = "library_search_directories",
),
],
),
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
# This is actually a list of object files from the linkstamp steps
flags = ["%{linkstamp_paths}"],
iterate_over = "linkstamp_paths",
expand_if_available = "linkstamp_paths",
),
],
),
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = ["@%{thinlto_param_file}"],
expand_if_available = "libraries_to_link",
expand_if_true = "thinlto_param_file",
),
flag_group(
iterate_over = "libraries_to_link",
flag_groups = [
flag_group(
flags = ["-Wl,--start-lib"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file_group",
),
),
flag_group(
flags = ["-Wl,-whole-archive"],
expand_if_true = "libraries_to_link.is_whole_archive",
),
flag_group(
flags = ["%{libraries_to_link.object_files}"],
iterate_over = "libraries_to_link.object_files",
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file_group",
),
),
flag_group(
flags = ["%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file",
),
),
flag_group(
flags = ["%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "interface_library",
),
),
flag_group(
flags = ["%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "static_library",
),
),
flag_group(
flags = ["-l%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "dynamic_library",
),
),
flag_group(
flags = ["-l:%{libraries_to_link.name}"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "versioned_dynamic_library",
),
),
flag_group(
flags = ["-Wl,-no-whole-archive"],
expand_if_true = "libraries_to_link.is_whole_archive",
),
flag_group(
flags = ["-Wl,--end-lib"],
expand_if_equal = variable_with_value(
name = "libraries_to_link.type",
value = "object_file_group",
),
),
],
expand_if_available = "libraries_to_link",
),
],
),

# Configure the header parsing and preprocessing.
flag_set(
actions = [ACTION_NAMES.cpp_header_parsing],
flags = ["-xc++-header", "-fsyntax-only"],
features = ["parse_headers"],
),

# Note: user compile flags should be nearly last -- you probably
# don't want to put any more features after this!
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
],
flag_groups = [
flag_group(
flags = ["%{user_compile_flags}"],
iterate_over = "user_compile_flags",
expand_if_available = "user_compile_flags",
),
],
),
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = ["%{user_link_flags}"],
iterate_over = "user_link_flags",
expand_if_available = "user_link_flags",
),
],
),
## Options which need to go late -- after all the user options -- go here.
flag_set(
# One might hope that these options would only be needed for C++
# compiles. But, sadly, users compile ".c" files with custom
# copts=["-x", "c++"], and expect that to be able to find C++ stdlib
# headers. It might be worth pondering how blaze could support this sort
# of use-case better.
actions = preprocessor_compile_actions +
[ACTION_NAMES.cc_flags_make_variable],
flags = [
"-iwithsysroot" + "/include/c++/v1",
"-iwithsysroot" + "/include/compat",
"-iwithsysroot" + "/include",
"-isystem", emscripten_dir + "/lib/clang/13.0.0/include",
],
),
# Inputs and outputs
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
],
flag_groups = [
flag_group(
flags = ["-MD", "-MF", "%{dependency_file}"],
expand_if_available = "dependency_file",
),
],
),
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
],
flag_groups = [
flag_group(
flags = ["-c", "%{source_file}"],
expand_if_available = "source_file",
),
],
),
flag_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.clif_match,
],
flag_groups = [
flag_group(
flags = ["-S"],
expand_if_available = "output_assembly_file",
),
flag_group(
flags = ["-E"],
expand_if_available = "output_preprocess_file",
),
flag_group(
flags = ["-o", "%{output_file}"],
expand_if_available = "output_file",
),
],
),
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = ["-o", "%{output_execpath}"],
expand_if_available = "output_execpath",
),
],
),
# And finally, the params file!
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
flags = ["@%{linker_param_file}"],
expand_if_available = "linker_param_file",
),
],
),
flag_set(
actions = all_compile_actions,
flags = [
"-Wno-builtin-macro-redefined",
# Genrules may not escape quotes enough for these, so
# don't put them into $(CC_FLAGS):
'-D__DATE__="redacted"',
'-D__TIMESTAMP__="redacted"',
'-D__TIME__="redacted"',
],
),
flag_set(
actions = all_compile_actions,
flags = ["-Werror"],
features = ["wasm_warnings_as_errors"],
),
]

crosstool_default_env_sets = [
# Globals
env_set(
actions = all_compile_actions +
all_link_actions +
[ACTION_NAMES.cpp_link_static_library],
env_entries = [
env_entry(
key = "EM_BIN_PATH",
value = emscripten_dir,
),
env_entry(
key = "EM_CONFIG_PATH",
value = ctx.file.em_config.path,
),
],
),
# Use llvm backend. Off by default, enabled via --features=llvm_backend
env_set(
actions = all_compile_actions +
all_link_actions +
[ACTION_NAMES.cpp_link_static_library],
env_entries = [env_entry(key = "EMCC_WASM_BACKEND", value = "1")],
with_features = [with_feature_set(features = ["llvm_backend"])],
),
# Debug compile and link. Off by default, enabled via --features=emcc_debug
env_set(
actions = all_compile_actions,
env_entries = [env_entry(key = "EMCC_DEBUG", value = "1")],
with_features = [with_feature_set(features = ["emcc_debug"])],
),

# Debug only link step. Off by default, enabled via --features=emcc_debug_link
env_set(
actions = all_link_actions,
env_entries = [env_entry(key = "EMCC_DEBUG", value = "1")],
with_features = [
with_feature_set(features = ["emcc_debug"]),
with_feature_set(features = ["emcc_debug_link"]),
],
),
]

crosstool_default_flags_feature = feature(
name = "crosstool_default_flags",
enabled = True,
flag_sets = crosstool_default_flag_sets,
env_sets = crosstool_default_env_sets,
)

features.append(crosstool_default_flags_feature)

cxx_builtin_include_directories = [
emscripten_dir + "/emscripten/cache/sysroot/include/c++/v1",
emscripten_dir + "/emscripten/cache/sysroot/include/compat",
emscripten_dir + "/emscripten/cache/sysroot/include",
emscripten_dir + "/lib/clang/13.0.0/include",
]

artifact_name_patterns = []

make_variables = []

return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
action_configs = action_configs,
artifact_name_patterns = artifact_name_patterns,
cxx_builtin_include_directories = cxx_builtin_include_directories,
toolchain_identifier = toolchain_identifier,
host_system_name = host_system_name,
target_system_name = target_system_name,
target_cpu = target_cpu,
target_libc = target_libc,
compiler = compiler,
abi_version = abi_version,
abi_libc_version = abi_libc_version,
tool_paths = tool_paths,
make_variables = make_variables,
builtin_sysroot = builtin_sysroot,
cc_target_os = cc_target_os,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider breaking down the _impl function into smaller helper functions for better readability and maintainability.

Comment on lines +1102 to +1110
emscripten_cc_toolchain_config_rule = rule(
implementation = _impl,
attrs = {
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
"em_config": attr.label(mandatory = True, allow_single_file=True),
"emscripten_binaries": attr.label(mandatory = True),
},
provides = [CcToolchainConfigInfo],
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the attributes cpu, em_config, and emscripten_binaries are correctly passed and validated in the emscripten_cc_toolchain_config_rule.

if WINDOWS:
print('warning: skipping part of failing_call_with_output() due to error codes not being propagated (see #592)')
else:
assert proc.returncode, 'call must have failed: ' + str([stdout, "\n========\n", stderr])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the assert statement in failing_call_with_output to check for a non-zero return code:

assert proc.returncode != 0, f'call must have failed: {str([stdout, "\n========\n", stderr])}'

Comment on lines +21 to +24
- run: python2 -m pip install --upgrade pip
- run: python3 -m pip install --upgrade pip
- run: python2 -m pip install flake8==3.7.8
- run: python3 -m pip install flake8==3.7.8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a single command to install and upgrade pip and flake8 for both Python versions to improve maintainability:

- run: |
    for py in python2 python3; do
      $py -m pip install --upgrade pip
      $py -m pip install flake8==3.7.8
    done

Comment on lines 1 to +2
[flake8]
ignore = E111,E114,E501,E261,E266,E121,E402,E241,E701
filename = emsdk
ignore =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of E261, E266, E402, E241, and E701 from the ignore list should be reviewed to ensure the codebase adheres to these flake8 rules, which can improve code quality.


./emsdk construct_env "$argv"
. ./emsdk_set_env.sh
eval ($dir/emsdk construct_env)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using eval unless absolutely necessary. If required, ensure the evaluated string is sanitized and does not contain untrusted data.

Comment on lines +6 to +12
BINARYEN_ROOT = ROOT_DIR + "/" + os.environ["EM_BIN_PATH"]
LLVM_ROOT = BINARYEN_ROOT + "/bin"
FROZEN_CACHE = True

system = platform.system()
nodejs_binary = "node.exe" if(system =="Windows") else "bin/node"
NODE_JS = ROOT_DIR + "/external/nodejs_{}_amd64/{}".format(system.lower(), nodejs_binary)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add checks to verify that the constructed paths (e.g., BINARYEN_ROOT, LLVM_ROOT, NODE_JS) are valid and accessible. This can prevent potential runtime errors due to incorrect paths.

Comment on lines +1 to +7
:: equivilent of test.sh as windows bat file
set PATH=%PATH%;%PYTHON_BIN%
CALL emsdk install latest
CALL emsdk activate latest
CALL emsdk_env.bat
CALL python -c "import sys; print(sys.executable)"
CALL emcc.bat -v
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding comments to explain each command would improve readability and maintainability. For example:

:: Add Python binary to PATH
set PATH=%PATH%;%PYTHON_BIN%

:: Install the latest version of emsdk
CALL emsdk install latest

:: Activate the latest version of emsdk
CALL emsdk activate latest

:: Set up the emsdk environment
CALL emsdk_env.bat

:: Print the Python executable path
CALL python -c "import sys; print(sys.executable)"

:: Verify emcc installation
CALL emcc.bat -v

@@ -0,0 +1,5 @@
#!/bin/bash

source external/emsdk/emscripten_toolchain/env.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a check to ensure external/emsdk/emscripten_toolchain/env.sh exists and is executable before sourcing it. For example:

if [ ! -x external/emsdk/emscripten_toolchain/env.sh ]; then
  echo 'env.sh not found or not executable'
  exit 1
fi

@shivamc21
Copy link
Owner Author

/squire help

@ghost
Copy link

ghost commented Jun 21, 2024

Here's what I can do today:

  • /squire review - Call me to perform a review of this PR
  • /squire clear - delete all comments Squire has left in this PR.
  • /squire summary - I'll summarize the current state of the PR in a comment based on the latest commits.
  • /squire update-description - I'll update the PR description with a summary of the current state of the PR based on the latest commits.
  • /squire help - I'll remind you of all the commands I can do.

You can always clear and then run review again if you've committed more to get a fresh review.

For more info, including how to add our generated PR descriptions to a template, check out our docs: https://docs.squire.ai/

@shivamc21
Copy link
Owner Author

e

@shivamc21
Copy link
Owner Author

4

@shivamc21
Copy link
Owner Author

r

@shivamc21
Copy link
Owner Author

rr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.