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

feat: add spin build command to run local build command for components #352

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

radu-matei
Copy link
Member

@radu-matei radu-matei commented Apr 14, 2022

ref #384

This commit adds a new top level Spin command that simplifies building more
complex applications. Specifically, this command will execute the build commands
set in each local component configuration:

[component.build]
command = "cargo build --target wasm32-wasi --release --manifest-path http-rust/Cargo.toml"

The build commands for all components in the local application manifest are
currently run sequentially (running multiple resource-intensive compilation processes
concurrently does not seem to be the most efficient choice currently).

Optionally, after all compilation processes are finished, if the --up flag is
passed, the application can be started without calling spin up.

This means that the entire developer "inner loop" for working on a Spin application
can be spin build --up.

Signed-off-by: Radu Matei radu.matei@fermyon.com

@radu-matei radu-matei marked this pull request as ready for review April 25, 2022 03:14
crates/build/src/lib.rs Outdated Show resolved Hide resolved
.context("Component build command must have at least one item.")?;

Exec::cmd(first)
.cwd(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't need to be this PR, but it would be nice to be able to override this with e.g. component.build.workdir

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #406 to track this.

crates/build/src/lib.rs Outdated Show resolved Hide resolved
@@ -1,21 +1,11 @@
use crate::parse_buildinfo;
use crate::{opts::*, parse_buildinfo};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this supposed to be in this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nm I get it; not sure the * is worth it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are a lot of opts in this file, I'd rather not import every single one..

src/commands/build.rs Outdated Show resolved Hide resolved
src/commands/build.rs Outdated Show resolved Hide resolved
src/opts.rs Outdated Show resolved Hide resolved
@radu-matei
Copy link
Member Author

I think I addressed most of the comments, @lann.

src/commands/build.rs Outdated Show resolved Hide resolved
This commit adds a new top level Spin command that simplifies building more
complex applications. Specifically, this command will execute the build commands
set in each local component configuration:

```toml
[component.build]
command = "cargo build --target wasm32-wasi --release --manifest-path http-rust/Cargo.toml"
```

The build commands for all components in the local application manifest are
currently run sequentially (running multiple resource-intensive compilation processes
concurrently does not seem to be the most efficient choice currently).

Optionally, after all compilation processes are finished, if the `--up` flag is
passed, the application can be started without calling `spin up`.

This means that the entire developer "inner loop" for working on a Spin application
can be `spin build --up`.

Signed-off-by: Radu Matei <radu.matei@fermyon.com>

feat

Signed-off-by: Radu Matei <radu.matei@fermyon.com>

feat

Signed-off-by: Radu Matei <radu.matei@fermyon.com>
@radu-matei
Copy link
Member Author

Ok, did another round of updates to this PR, most importantly, command is now a single string, which will be executed by a shell.

@radu-matei radu-matei merged commit ce4658c into fermyon:main Apr 26, 2022
@radu-matei radu-matei deleted the spin-build-local-dev branch April 26, 2022 21:38
@radu-matei radu-matei mentioned this pull request May 18, 2022
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