Fixed build on cloud
This commit is contained in:
@@ -1,12 +1,60 @@
|
||||
pub fn main() {
|
||||
println!("pwd: {}", std::env::current_dir().unwrap().display());
|
||||
println!("cargo:rerun-if-changed=../../action_schema.xsd");
|
||||
let output = std::process::Command::new("xml_schema_generator.exe")
|
||||
|
||||
// Find xml_schema_generator in the path or in cargo bin directory
|
||||
let cargo_home = std::env::var("CARGO_HOME").unwrap_or_else(|_| {
|
||||
if cfg!(windows) {
|
||||
format!("{}/.cargo", std::env::var("USERPROFILE").unwrap())
|
||||
} else {
|
||||
format!("{}/.cargo", std::env::var("HOME").unwrap())
|
||||
}
|
||||
});
|
||||
|
||||
let bin_dir = format!("{}/bin", cargo_home);
|
||||
let paths = vec![bin_dir];
|
||||
|
||||
// Find the executable
|
||||
let executable_name = if cfg!(windows) {
|
||||
"xml_schema_generator.exe"
|
||||
} else {
|
||||
"xml_schema_generator"
|
||||
};
|
||||
|
||||
let executable_path = paths.iter()
|
||||
.map(|p| format!("{}/{}", p, executable_name))
|
||||
.find(|p| std::path::Path::new(p).exists());
|
||||
|
||||
// If the executable isn't in any of the checked paths, try to install it
|
||||
let executable = match executable_path {
|
||||
Some(path) => path,
|
||||
None => {
|
||||
println!("cargo:warning=xml_schema_generator not found, trying to install it");
|
||||
// Install xml_schema_generator using cargo install
|
||||
let status = std::process::Command::new("cargo")
|
||||
.args(["install", "xml_schema_generator"])
|
||||
.status()
|
||||
.expect("Failed to run cargo install");
|
||||
|
||||
if !status.success() {
|
||||
panic!("Failed to install xml_schema_generator");
|
||||
}
|
||||
|
||||
// Now it should be in the cargo bin directory
|
||||
format!("{}/bin/{}", cargo_home, executable_name)
|
||||
}
|
||||
};
|
||||
|
||||
println!("cargo:warning=Using xml_schema_generator at: {}", executable);
|
||||
|
||||
// Run the generator
|
||||
let output = std::process::Command::new(&executable)
|
||||
.arg("--derive")
|
||||
.arg("Clone, Debug, Deserialize, Serialize")
|
||||
.arg("../../action_schema.xsd")
|
||||
.arg("src/schema.rs")
|
||||
.output()
|
||||
.expect("Failed to execute xml_schema_generator");
|
||||
.expect(&format!("Failed to execute {}", executable));
|
||||
|
||||
if !output.status.success() {
|
||||
panic!("xml_schema_generator failed: {}",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
trap 'return 1' ERR
|
||||
|
||||
# Check if required environment variables are set
|
||||
if [ -z "$SIA_REPO_URL" ]; then
|
||||
echo "Error: SIA_REPO_URL environment variable is not set"
|
||||
@@ -67,7 +69,7 @@ npm run build
|
||||
ln -s "/root/sia/web/dist" "/root/static"
|
||||
|
||||
# Install SIA dependencies
|
||||
cd /root/sia/desktop
|
||||
cd /root/desktop
|
||||
source "/root/sia/scripts/install.sh"
|
||||
|
||||
# Add venvs to path in .bashrc
|
||||
|
||||
Reference in New Issue
Block a user