-
Notifications
You must be signed in to change notification settings - Fork 71
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
chore(actors-sdk-embed): auto-build & install manager dependencies #1964
Closed
NathanFlurry
wants to merge
1
commit into
fix_icons_typo
from
01-29-chore_actors-sdk-embed_auto-build_install_manager_dependencies
+39
−4
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,24 @@ use std::{ | |
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
// Check if yarn is installed | ||
let yarn_check = tokio::process::Command::new("yarn") | ||
.arg("--version") | ||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.status() | ||
.await; | ||
ensure!( | ||
yarn_check.is_ok() && yarn_check.unwrap().success(), | ||
"yarn is not installed, please install yarn to build this project" | ||
); | ||
|
||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR")?; | ||
let out_dir = std::env::var("OUT_DIR")?; | ||
|
||
let sdk_path = PathBuf::from(manifest_dir.clone()).join("../../../sdks/actor"); | ||
let project_root = PathBuf::from(manifest_dir.clone()).join("../../.."); | ||
let sdk_path = project_root.join("sdks/actor"); | ||
let manager_path = sdk_path.join("manager"); | ||
|
||
// Copy SDK directory to out_dir | ||
let dist_path = Path::new(&out_dir).join("actor-sdk"); | ||
|
@@ -22,7 +36,26 @@ async fn main() -> Result<()> { | |
fs::remove_dir_all(&dist_path).context("fs::remove_dir_all")?; | ||
} | ||
|
||
// Build manager | ||
// Build manager dependencies (required for building the manager itself) | ||
let status = tokio::process::Command::new("yarn") | ||
.arg("install") | ||
.arg("--immutable") | ||
.current_dir(&manager_path) | ||
.status() | ||
.await?; | ||
ensure!(status.success(), "yarn install failed"); | ||
|
||
let status = tokio::process::Command::new("yarn") | ||
.arg("run") | ||
.arg("build") | ||
.arg("--filter=@rivet-gg/actor-manager") | ||
.current_dir(&project_root) | ||
.status() | ||
.await?; | ||
ensure!(status.success(), "yarn build failed"); | ||
|
||
// Build manager using Rivet build script (not using tsup/turbo because this includes custom | ||
// polyfill functionality) | ||
build_backend_command_raw(CommandOpts { | ||
task_path: "src/tasks/build/mod.ts", | ||
input: json!({ | ||
|
@@ -38,7 +71,9 @@ async fn main() -> Result<()> { | |
}) | ||
.await?; | ||
|
||
// Rebuild if SDK changes (in order to include manager dependencies) | ||
println!("cargo:rerun-if-changed={}", sdk_path.display()); | ||
|
||
println!( | ||
"cargo:rustc-env=ACTOR_SDK_DIST_PATH={}", | ||
dist_path.display() | ||
|
@@ -83,6 +118,8 @@ pub async fn build_backend_command_raw(opts: CommandOpts) -> Result<()> { | |
// Serialize command | ||
let input_json = serde_json::to_string(&opts.input)?; | ||
|
||
// Yarn install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: empty 'Yarn install' comment should be removed since it's not followed by any code |
||
|
||
// Run backend | ||
let status = tokio::process::Command::new(deno.executable_path) | ||
.args([ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ use merkle_hash::MerkleTree; | |
use std::{ | ||
fs, | ||
path::{Path, PathBuf}, | ||
process::Stdio, | ||
}; | ||
|
||
#[tokio::main] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: unwrap() after is_ok() check is redundant and could be simplified to yarn_check?.success()