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

Ensure UI gets built and included when cargo-psibase package (or build) #964

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions package-templates/rust/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::fs;
use std::io::Path;
use std::io::Write;

use std::process::Command;

fn main() {
if !Path::new("./ui").exists() {
// no UI to build
return;
}
// Touch a marker file to ensure that cargo reruns this build script no matter what
// unless it may decide in appropriately that it doesn't need to run the script.
fs::File::create("./ui_build")
.unwrap()
.write_all(b"")
.unwrap();

Command::new("yarn")
.current_dir("./ui")
.status()
.expect("Failed to run `yarn`");
Command::new("yarn")
.args(&["build"])
.current_dir("./ui")
.status()
.expect("Failed to run build project");
}
2 changes: 1 addition & 1 deletion services/user/Branding/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions services/user/Branding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ homepage = "https://psibase.io"

[package]
name = "branding_package"
version.workspace = true
rust-version.workspace = true
edition.workspace = true
publish.workspace = true

[profile.release]
codegen-units = 1
Expand Down
28 changes: 28 additions & 0 deletions services/user/Branding/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::fs;
use std::io::Path;
use std::io::Write;

use std::process::Command;

fn main() {
if !Path::new("./ui").exists() {
// no UI to build
return;
}
// Touch a marker file to ensure that cargo reruns this build script no matter what
// unless it may decide in appropriately that it doesn't need to run the script.
fs::File::create("./ui_build")
.unwrap()
.write_all(b"")
.unwrap();

Command::new("yarn")
.current_dir("./ui")
.status()
.expect("Failed to run `yarn`");
Command::new("yarn")
.args(&["build"])
.current_dir("./ui")
.status()
.expect("Failed to run build project");
}
2 changes: 1 addition & 1 deletion services/user/Branding/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ serde = { version = "1.0.208", features = ["derive"] }
serde_json = "1.0.120"

[dev-dependencies]
branding_package = { path = ".." }
branding_package = { path = "..", version = "0.14.0" }
1 change: 0 additions & 1 deletion services/user/Branding/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub use branding;
pub use branding-plugin;
Loading