Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix source code packaging #19

Merged
merged 47 commits into from
Jan 25, 2023
Merged

Fix source code packaging #19

merged 47 commits into from
Jan 25, 2023

Conversation

andreibancioiu
Copy link
Contributor

@andreibancioiu andreibancioiu commented Jan 19, 2023

  • Exclude meta/Cargo.lock from the packaged source code.
  • In the packaged source code file, sort entries by path (ascending).
  • Include whole project, if necessary. Include local dependencies.
  • Handle both elrond.json and multiversx.json.
  • Save a context name in the artifacts (to keep e.g. the Docker image name).
  • Add integration tests

@andreibancioiu andreibancioiu self-assigned this Jan 19, 2023
@andreibancioiu andreibancioiu marked this pull request as ready for review January 19, 2023 21:24
@@ -75,7 +75,7 @@ def run_docker(
docker_mount_args.extend(["--volume", f"{packaged_src_path}:/packaged-src.json"])

if cargo_target_dir:
docker_mount_args += ["--volume", f"{cargo_target_dir}:/cargo-target-dir"]
docker_mount_args += ["--volume", f"{cargo_target_dir}:/rust/cargo-target-dir"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since /rust/cargo-target-dir is used in the Docker image.

# Clean directory - useful if it contains externally-generated build artifacts
clean_contract(build_directory)
build_contract(build_directory, output_subdirectory, cargo_target_dir, no_wasm_opt)
output_subfolder = parent_output_folder / f"{contract_name}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We've just moved the check if specific_contract and contract_name != specific_contract above.

def build_contract(build_folder: Path, output_folder: Path, cargo_target_dir: Path, no_wasm_opt: bool):
cargo_output_folder = build_folder / "output"
meta_folder = build_folder / "meta"
cargo_lock = build_folder / "wasm" / "Cargo.lock"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We've removed passing CARGO_TARGET_DIR as env (not necessary).

if return_code != 0:
exit(return_code)
raise ErrKnown(f"Failed to build contract {build_folder}. Return code: {return_code}.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Raising error instead of exit-ing.

ccorcoveanu
ccorcoveanu previously approved these changes Jan 25, 2023
Removing dev-dependencies, replacing test files
@andreibancioiu andreibancioiu merged commit 115d2a0 into main Jan 25, 2023
@andreibancioiu andreibancioiu deleted the package-19 branch January 25, 2023 14:00
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.

None yet

3 participants