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

rust: add support for workspaces #2842

Merged
merged 4 commits into from
Jan 8, 2020
Merged

Conversation

cjp256
Copy link
Contributor

@cjp256 cjp256 commented Dec 12, 2019

No description provided.

@cjp256 cjp256 force-pushed the rust-workspace branch 3 times, most recently from ba1c0be to d6b80f1 Compare December 13, 2019 19:56
@cjp256
Copy link
Contributor Author

cjp256 commented Dec 16, 2019

Tested by building alacritty snap, which makes use of workspaces.

Copy link
Collaborator

@sergiusens sergiusens left a comment

Choose a reason for hiding this comment

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

Typo and question. Looks pretty good!

If a plugin detects an error prior to attempting to build a part's
source, it can raise SnapcraftPluginAssertionError() with a brief
reason and optional details.

SnapcraftEnvironmentError() was also a viable choice, but it's slated
to be nuked and as it is too generic.  This seems like a fair middle
ground that can be re-used across the the plugins when they make an
assertion that fails to check out at runtime.

Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet:
rust-lang/cargo#7599

Alternatively, we use `cargo build`, which will respect the Cargo.lock
configuration.  It however, does require a bit more hoop jumping
to determine which binaries were built and install them.

Introudce _install_workspace_artifacts() to install the built
executables into the correct paths.  Testing has covered executables
and libraries, though dynamic linking is not quite yet supported
by the rust plugin (at least in my testing, it will have unmnet
dependencies on libstd-<id>.so).  We can address that feature gap
in the future, but likely doesn't affect snap users because they
are probably using the standard linking process which doesn't require
libstd (likely due to static linking of those dependencies).

`cargo build` has an unstable flag option for `--out-dir` which
may simplifiy the install process, but is currently unavailable
for stable use:
https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir

Add/update unit tests for coverage and add a spead test.

Signed-off-by: Chris Patterson <[email protected]>
@cjp256
Copy link
Contributor Author

cjp256 commented Jan 7, 2020

rebased/squashed

@cjp256
Copy link
Contributor Author

cjp256 commented Jan 8, 2020

Added two commits addressing comments
c5156c0
51bf9b4

@sergiusens sergiusens merged commit cd8c775 into canonical:master Jan 8, 2020
@cjp256 cjp256 deleted the rust-workspace branch March 16, 2020 18:19
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.

2 participants