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

Support manifest path override #32

Merged
merged 6 commits into from
Oct 28, 2022
Merged

Conversation

GeorgeHahn
Copy link
Contributor

This adds support for building crates that aren't in the repository's root directory.

Closes #31

main.sh Outdated Show resolved Hide resolved
Copy link
Owner

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks! Could you update the inputs options table in readme?

main.sh Outdated
manifest_path="${INPUT_MANIFEST_PATH:-}"
if [[ -n "${manifest_path}" ]]; then
build_options+=("--manifest-path" "${manifest_path}")
build_options+=("--target-dir" "${RUNNER_TEMP}/target")
Copy link
Owner

Choose a reason for hiding this comment

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

It is probably preferable to use cargo metadata to get the default target directory, rather than setting our own target directory.

Something like the following:

if [[ -n "${manifest_path}" ]]; then
    build_options+=("--manifest-path" "${manifest_path}")
    target_dir=$(cargo metadata --format-version=1 --no-deps --manifest-path "${manifest_path}" | jq -r '."target_directory"')
else
    target_dir=$(cargo metadata --format-version=1 --no-deps | jq -r '."target_directory"')
fi
if [[ -n "${INPUT_TARGET:-}" ]]; then
    build_options+=("--target" "${target}")
    target_dir="${target_dir}/${target}/release"
else
    target_dir="${target_dir}/release"
fi

@GeorgeHahn
Copy link
Contributor Author

Sorry for the delay! I made the changes you asked for but have not tested it out yet. I can drop a comment here once I've tried a release.

@GeorgeHahn
Copy link
Contributor Author

I tested this out and it's working nicely. Thanks for the review & the cargo metadata help!

Copy link
Owner

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks!

@taiki-e taiki-e merged commit d1e4e2a into taiki-e:main Oct 28, 2022
@taiki-e
Copy link
Owner

taiki-e commented Oct 28, 2022

Published in 1.10.0.

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.

Support setting a custom manifest path
2 participants