diff options
| -rw-r--r-- | .cargo/config.toml | 20 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | deploy.ps1 | 2 | ||||
| -rwxr-xr-x | deploy.sh | 2 | ||||
| -rw-r--r-- | scripts/deploy/jv_cli.ps1 | 8 | ||||
| -rw-r--r-- | scripts/deploy/jv_cli.sh | 8 | ||||
| -rw-r--r-- | tools/build_helper/Cargo.toml (renamed from crates/build_helper/Cargo.toml) | 0 | ||||
| -rw-r--r-- | tools/build_helper/src/bin/exporter.rs (renamed from crates/build_helper/src/bin/exporter.rs) | 22 |
8 files changed, 47 insertions, 17 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index 93f2182..ca6a8cb 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -21,16 +21,19 @@ binaries = [ # Completions [copies.completion_jv_bash] from = "scripts/deploy/completions/bash/completion_jv.sh" -to = "completions/bash/completion_jv.sh" +to = "comp/jv.sh" +platform = [ "linux", "macos" ] [copies.completion_jvv_bash] from = "scripts/deploy/completions/bash/completion_jvv.sh" -to = "completions/bash/completion_jvv.sh" +to = "comp/jvv.sh" +platform = [ "linux", "macos" ] # Entries [copies.entry_bash] from = "scripts/deploy/jv_cli.sh" to = "jv_cli.sh" +platform = [ "linux", "macos" ] ################## ### Powershell ### @@ -39,16 +42,19 @@ to = "jv_cli.sh" # Completions [copies.completion_jv_powershell] from = "scripts/deploy/completions/powershell/completion_jv.ps1" -to = "completions/powershell/completion_jv.ps1" +to = "comp/jv.ps1" +platform = [ "windows" ] [copies.completion_jvv_powershell] from = "scripts/deploy/completions/powershell/completion_jvv.ps1" -to = "completions/powershell/completion_jvv.ps1" +to = "comp/jvv.ps1" +platform = [ "windows" ] # Entries [copies.entry_powershell] from = "scripts/deploy/jv_cli.ps1" to = "jv_cli.ps1" +platform = [ "windows" ] ################## ### Zsh Plugin ### @@ -56,8 +62,10 @@ to = "jv_cli.ps1" [copies.zsh_plugin] from = "scripts/deploy/zsh_support/jvcs.plugin.zsh" -to = "scripts/zsh_support/jvcs.plugin.zsh" +to = "zsh_support/jvcs.plugin.zsh" +platform = [ "linux", "macos" ] [copies.zsh_plugin_installation] from = "scripts/deploy/zsh_support/how_to_install.md" -to = "scripts/zsh_support/how_to_install.md" +to = "zsh_support/how_to_install.md" +platform = [ "linux", "macos" ] @@ -6,7 +6,7 @@ authors = ["JustEnoughVCS Team"] homepage = "http://jvcs.cc/" [workspace] -members = ["crates/build_helper"] +members = ["tools/build_helper"] [workspace.package] version = "0.1.0-dev" @@ -28,7 +28,7 @@ if ($LASTEXITCODE -ne 0) { } else { # Build succeeded # Export - if (cargo run --manifest-path crates/build_helper/Cargo.toml --bin exporter) { + if (cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter) { Copy-Item -Path templates\compile_info.rs -Destination src\data\compile_info.rs -Force ISCC /Q .\setup\windows\setup_jv_cli.iss } @@ -8,7 +8,7 @@ cd "$(dirname "$0")" || exit 1 # Build if FORCE_BUILD=$(date +%s) cargo build --workspace --release; then # Export - if cargo run --manifest-path crates/build_helper/Cargo.toml --bin exporter; then + if cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter; then # Copy compile_info.rs.template to compile_info.rs after successful export cp -f templates/compile_info.rs src/data/compile_info.rs fi diff --git a/scripts/deploy/jv_cli.ps1 b/scripts/deploy/jv_cli.ps1 index 22836c7..2761137 100644 --- a/scripts/deploy/jv_cli.ps1 +++ b/scripts/deploy/jv_cli.ps1 @@ -47,11 +47,11 @@ Set-Alias jmv jmv ### COMPLETION ### ################## -if (Test-Path "$SCRIPT_DIR\completions\powershell\completion_jv.ps1") { - . "$SCRIPT_DIR\completions\powershell\completion_jv.ps1" +if (Test-Path "$SCRIPT_DIR\comp\jv.ps1") { + . "$SCRIPT_DIR\comp\jv.ps1" } -if (Test-Path "$SCRIPT_DIR\completions\powershell\completion_jvv.ps1") { - . "$SCRIPT_DIR\completions\powershell\completion_jvv.ps1" +if (Test-Path "$SCRIPT_DIR\comp\jvv.ps1") { + . "$SCRIPT_DIR\comp\jvv.ps1" } ################### diff --git a/scripts/deploy/jv_cli.sh b/scripts/deploy/jv_cli.sh index d732d95..80ff757 100644 --- a/scripts/deploy/jv_cli.sh +++ b/scripts/deploy/jv_cli.sh @@ -58,11 +58,11 @@ alias jvu='jv update' ### COMPLETION ### ################## -if [ -f "$SCRIPT_DIR/completions/bash/completion_jv.sh" ]; then - source "$SCRIPT_DIR/completions/bash/completion_jv.sh" +if [ -f "$SCRIPT_DIR/comp/jv.sh" ]; then + source "$SCRIPT_DIR/comp/jv.sh" fi -if [ -f "$SCRIPT_DIR/completions/bash/completion_jvv.sh" ]; then - source "$SCRIPT_DIR/completions/bash/completion_jvv.sh" +if [ -f "$SCRIPT_DIR/comp/jvv.sh" ]; then + source "$SCRIPT_DIR/comp/jvv.sh" fi ################## diff --git a/crates/build_helper/Cargo.toml b/tools/build_helper/Cargo.toml index deadd4c..deadd4c 100644 --- a/crates/build_helper/Cargo.toml +++ b/tools/build_helper/Cargo.toml diff --git a/crates/build_helper/src/bin/exporter.rs b/tools/build_helper/src/bin/exporter.rs index 27c1274..c8f7ba2 100644 --- a/crates/build_helper/src/bin/exporter.rs +++ b/tools/build_helper/src/bin/exporter.rs @@ -91,6 +91,14 @@ fn export( // Copy additional files based on configuration let current = current_dir()?; for config in copy_configs { + // Check if platforms are specified and if current platform matches + if !config.platforms.is_empty() { + let current_platform = std::env::consts::OS; + if !config.platforms.contains(¤t_platform.to_string()) { + continue; + } + } + let source_path = current.join(&config.from); let dest_path = publish_dir.join(&config.to); @@ -125,6 +133,7 @@ fn export( struct CopyConfig { from: String, to: String, + platforms: Vec<String>, } /// Get a target directory from the cargo config @@ -193,9 +202,22 @@ fn copy_configs() -> Result<Vec<CopyConfig>, std::io::Error> { for (_, table) in tables { if let Some(from) = table.get("from").and_then(|v| v.as_str()) { let to = table.get("to").and_then(|v| v.as_str()).unwrap_or(""); + + // Parse platforms array + let mut platforms = Vec::new(); + if let Some(platforms_array) = table.get("platform").and_then(|v| v.as_array()) + { + for platform in platforms_array { + if let Some(platform_str) = platform.as_str() { + platforms.push(platform_str.to_string()); + } + } + } + copy_configs.push(CopyConfig { from: from.to_string(), to: to.to_string(), + platforms, }); } } |
