示例#1
0
    def _do_install(self, tag: str) -> None:
        rustup_path = self._get_rustup_path()
        downloader.download("https://sh.rustup.rs", rustup_path)
        utils.mark_executable(rustup_path)

        args = [rustup_path, "--verbose", "--default-toolchain", "nightly", "--profile",
                "minimal", "--target", "wasm32-unknown-unknown", "--no-modify-path", "-y"]
        myprocess.run_process_async(args, env=self.get_env())
示例#2
0
def start(force=False):
    install_if_missing()

    if _is_running() and not force:
        return

    if force:
        stop()

    logger.info("Starting nodedebug...")
    myprocess.run_process_async(_get_args(), env=_get_env())
示例#3
0
    def install(self, overwrite):
        logger.debug(f"install: name={self.name}, tag={self.tag}")

        if self._should_skip(overwrite):
            logger.debug("Already exists. Skip install.")
            return

        rustup_path = self._get_rustup_path()
        downloader.download("https://sh.rustup.rs", rustup_path)
        utils.mark_executable(rustup_path)

        args = [rustup_path, "--verbose", "--default-toolchain", "nightly", "--profile",
                "minimal", "--target", "wasm32-unknown-unknown", "--no-modify-path", "-y"]
        myprocess.run_process_async(args, env=self.get_env())
示例#4
0
    def run_cargo(self):
        env = self._get_env()

        if self.debug:
            args = ["cargo", "build"]
        else:
            args = [
                "cargo", "build", "--manifest-path", self.cargo_file.path,
                "--target=wasm32-unknown-unknown", "--release"
            ]

            env["RUSTFLAGS"] = "-C link-arg=-s"

        myprocess.run_process_async(args, env=env)
示例#5
0
    def run_cargo(self):
        env = self._get_env()

        if self.debug:
            args = ["cargo", "build"]
        else:
            args = [
                "cargo", "build", "--target=wasm32-unknown-unknown",
                "--release"
            ]

            env["RUSTFLAGS"] = "-C link-arg=-s"

        cwd = path.join(self.directory, "wasm")
        result = myprocess.run_process_async(args, env=env, cwd=cwd)
        if result != 0:
            raise errors.BuildError(f"error code = {result}, see output")
示例#6
0
    def _generate_abi(self):
        if not self._has_abi():
            return

        args = ["cargo", "run"]
        self._decorate_cargo_args(args)

        env = self._get_env()
        cwd = path.join(self.directory, "abi")
        sink = myprocess.FileOutputSink(self._get_abi_filepath())
        return_code = myprocess.run_process_async(args,
                                                  env=env,
                                                  cwd=cwd,
                                                  stdout_sink=sink)
        if return_code != 0:
            raise errors.BuildError(f"error code = {return_code}, see output")

        utils.prettify_json_file(self._get_abi_filepath())
示例#7
0
    def run_cargo(self):
        env = self._get_env()

        args = [
            "cargo", "build", "--target=wasm32-unknown-unknown", "--release",
            "--out-dir",
            self._get_output_folder(), "-Z"
            "unstable-options"
        ]
        self._decorate_cargo_args(args)

        if not self.options.get("wasm_symbols"):
            env["RUSTFLAGS"] = "-C link-arg=-s"

        cwd = path.join(self.directory, "wasm")
        return_code = myprocess.run_process_async(args, env=env, cwd=cwd)
        if return_code != 0:
            raise errors.BuildError(f"error code = {return_code}, see output")
示例#8
0
    def run_cargo(self):
        env = self._get_env()

        if self.debug:
            args = ["cargo", "build"]
        else:
            args = [
                "cargo",
                "build",
                "--manifest-path",
                self.cargo_file.path,
                "--target=wasm32-unknown-unknown",
                "--release"
            ]

            env["RUSTFLAGS"] = "-C link-arg=-s"

        result = myprocess.run_process_async(args, env=env)
        if result != 0:
            raise errors.BuildError(f"error code = {result}, see output")