diff --git a/Cargo.lock b/Cargo.lock index e5c5e57..0f2f0e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -199,9 +199,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.13" +version = "4.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "c937d4061031a6d0c8da4b9a4f98a172fc2976dfb1c19213a9cf7d0d3c837e36" dependencies = [ "clap_builder", "clap_derive", @@ -209,9 +209,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "85379ba512b21a328adf887e85f7742d12e96eb31f3ef077df4ffc26b506ffed" dependencies = [ "anstream", "anstyle", @@ -586,18 +586,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" dependencies = [ "proc-macro2", "quote", diff --git a/src/commands/package.rs b/src/commands/package.rs index 624beb1..1318254 100644 --- a/src/commands/package.rs +++ b/src/commands/package.rs @@ -268,7 +268,10 @@ fn prompt_platforms(accept_all: bool) -> Vec { let items = platforms.map(|p| p.display_name()); if accept_all { - return platforms.to_vec(); + return platforms + .into_iter() + .filter(|p| !p.is_experimental()) + .collect(); } let theme = prompt_theme(); diff --git a/src/main.rs b/src/main.rs index 105dbff..63035bf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,14 @@ enum Action { // Initialize the project without any explanatory boilerplate code plain: bool, + #[arg(long = "udl")] + // Use .udl files instead of macros to declare which types and functions should be exported + // for use in Swift + udl: bool, + #[arg(long = "macro")] + // (Deprecated) This flag is no longer neccessary, as this is the default mode. This flag + // is ignored now and will be removed in future releases // Initialize the project as a macro-only crate without .udl files macro_only: bool, }, @@ -117,8 +124,9 @@ fn main() -> ExitCode { vcs, lib_type, plain, - macro_only, - } => init::run(crate_name, config, vcs, lib_type, plain, macro_only), + macro_only: _, + udl + } => init::run(crate_name, config, vcs, lib_type, plain, !udl), Action::Package { platforms, diff --git a/testing/end-to-end/init.swift b/testing/end-to-end/init.swift index 425074a..b00fba2 100755 --- a/testing/end-to-end/init.swift +++ b/testing/end-to-end/init.swift @@ -13,7 +13,7 @@ func fileExists(atPath path: String) -> Bool { return exists && !isDirectory.boolValue } -print("Running tests for cargo swift init...") +print("Running tests for cargo swift init in macro mode...") let cargoSwiftInit = Process() let projectName = "ExampleProject" @@ -31,10 +31,6 @@ guard fileExists(atPath: "\(projectName)/Cargo.toml") else { error("No Cargo.toml found in project directory") exit(1) } -guard fileExists(atPath: "\(projectName)/build.rs") else { - error("No build.rs file found in project directory") - exit(1) -} guard fileExists(atPath: "\(projectName)/.gitignore") else { error("No .gitignore found in project directory") exit(1) @@ -48,4 +44,43 @@ guard fileExists(atPath: "\(projectName)/src/lib.rs") else { exit(1) } +print("Running tests for cargo swift init in udl mode...") + +let cargoSwiftInitUdl = Process() +let projectNameUdl = "\(projectName)_udl" +cargoSwiftInitUdl.executableURL = URL(fileURLWithPath: "/usr/bin/env") +cargoSwiftInitUdl.arguments = ["cargo", "swift", "init", projectNameUdl, "-y", "--silent", "--udl"] + +try! cargoSwiftInitUdl.run() +cargoSwiftInitUdl.waitUntilExit() + +guard dirExists(atPath: projectNameUdl) else { + error("Project directory does not exist") + exit(1) +} +guard fileExists(atPath: "\(projectNameUdl)/Cargo.toml") else { + error("No Cargo.toml found in project directory") + exit(1) +} +guard fileExists(atPath: "\(projectNameUdl)/build.rs") else { + error("No build.rs file found in project directory") + exit(1) +} +guard fileExists(atPath: "\(projectNameUdl)/.gitignore") else { + error("No .gitignore found in project directory") + exit(1) +} +guard dirExists(atPath: "\(projectNameUdl)/src") else { + error("No src-directory found in project directory") + exit(1) +} +guard fileExists(atPath: "\(projectNameUdl)/src/lib.rs") else { + error("No lib.rs file found in src directory") + exit(1) +} +guard fileExists(atPath: "\(projectNameUdl)/src/lib.udl") else { + error("No lib.udl file found in src directory") + exit(1) +} + print("Tests for cargo swift init passed!")