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

Add support for Cargo workspaces #30

Merged
merged 3 commits into from
Jan 31, 2017
Merged

Add support for Cargo workspaces #30

merged 3 commits into from
Jan 31, 2017

Conversation

malept
Copy link
Owner

@malept malept commented Jan 30, 2017

Adds a new config variable, cargo_workspace_member, which is the path relative to the cargo_project_path directory where the member crate is located.

Fixes #29.

CC: @matthiasbeyer

Adds a new config variable, `cargo_workspace_member`, which is the path
relative to the `cargo_project_path` directory where the member crate is
located.
@matthiasbeyer
Copy link

Is there a way to test this? Maybe even within my travis setup? Would love some input here or in https://github.com/matthiasbeyer/imag/pull/871 ! 👍

@malept
Copy link
Owner Author

malept commented Jan 30, 2017

@matthiasbeyer In the Gemfile, after the gemspec line, add:

gem 'thermite', git: 'https://github.com/malept/thermite.git', branch: 'cargo-workspaces'

Then, in any file where you call Thermite::Tasks.new, you have to specify the correct cargo_workspace_member value as a named parameter.

@matthiasbeyer
Copy link

I guess I have to do it in another way, as you can see in https://github.com/matthiasbeyer/imag/pull/871/commits/98530f2dc555d85dd74b782b96421c4c99d97f4a , I do not have a Gemfile but rather a gemspec.

I also call thermite from the workspace member, so would rather need to specify the workspace root, am I right?

@matthiasbeyer
Copy link

As of https://github.com/matthiasbeyer/imag/pull/871/commits/565cdb3f2dbad2d847d51a4db9feef8c608418b3 I get:

rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /home/m/archive/development/rust/imag/libimagruby/target/release/liblibimagruby.so
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/tasks.rb:124:in `block in define_build_task'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/bin/bundle:18:in `load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/bin/bundle:18:in `<main>'
Tasks: TOP => thermite:build
(See full trace by running task with --trace)

@malept
Copy link
Owner Author

malept commented Jan 30, 2017

Oh, I forgot one part. cargo_project_path needs to point to the workspace Cargo.toml. Sorry about that.

@matthiasbeyer
Copy link

Another try with https://github.com/matthiasbeyer/imag/pull/871/commits/e6cc09857ee866b4432b103593a6025006bd232f yields

checking for cargo... yes
/nix/store/3b1qps1ixm60vsy1i4f48g6360vjg8d0-cargo-0.15.0/bin/cargo rustc --release
warning: unused manifest key: package.website
   Compiling imag-root v0.2.0 (file:///home/m/archive/development/rust/imag)
error[E0463]: can't find crate for `crossbeam`
  --> bin/src/main.rs:20:1
   |
20 | extern crate crossbeam;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

error: Could not compile `imag-root`.

To learn more, run the command again with --verbose.
rake aborted!
Command failed with status (101): [/nix/store/3b1qps1ixm60vsy1i4f48g6360vjg8d...]
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/cargo.rb:42:in `block in run_cargo'
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/cargo.rb:40:in `chdir'
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/cargo.rb:40:in `run_cargo'
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/cargo.rb:60:in `run_cargo_rustc'
/home/m/archive/development/rust/imag/libimagruby/vendor/bundle/ruby/2.3.0/bundler/gems/thermite-055c0909cff1/lib/thermite/tasks.rb:123:in `block in define_build_task'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/bin/bundle:18:in `load'
/nix/store/sznvnn582dqxl1v1fsciywdbw8984271-bundler-1.13.7/bin/bundle:18:in `<main>'
Tasks: TOP => thermite:build
(See full trace by running task with --trace)

which is also clearly not what I want...

@malept
Copy link
Owner Author

malept commented Jan 30, 2017

Oh, I think I have to specify --manifest-path here? I'll need to think about how to test this, aside from running your PR locally. (Because I also want to have an integration test - I currently use rusty_blank for that.)

@malept malept merged commit 5454beb into master Jan 31, 2017
@malept malept deleted the cargo-workspaces branch January 31, 2017 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants