diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e25105..b52942f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,71 +2,60 @@ name: "Build CrossCode" on: push: + # "**" (not "*") so pushes to slash-containing branches such as + # feature/foo are built too — "*" does not match "/". branches: - - "*" + - "**" pull_request: branches: - - "*" + - "**" workflow_dispatch: release: types: [published] +concurrency: + group: build-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'release' }} + jobs: build: permissions: contents: write + timeout-minutes: 30 strategy: fail-fast: false matrix: include: - - platform: "ubuntu-22.04" - args: "--bundles deb" - - platform: "ubuntu-22.04" - args: "--bundles rpm" - - platform: "ubuntu-22.04" - args: "--bundles appimage" - platform: "windows-latest" - args: "" - - platform: "macos-latest" - args: "--target aarch64-apple-darwin" - - platform: "macos-15-intel" - args: "--target x86_64-apple-darwin" runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Cache Rust and bun dependencies - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | ~/.cargo/registry ~/.cargo/git src-tauri/target node_modules - key: ${{ matrix.platform }}-crosscode-${{ hashFiles('**/Cargo.lock', 'package-lock.json') }} + key: ${{ runner.os }}-crosscode-v3-${{ hashFiles('src-tauri/Cargo.lock', 'bun.lock') }} restore-keys: | + ${{ runner.os }}-crosscode-v3- + ${{ matrix.platform }}-crosscode- ${{ runner.os }}-crosscode- - name: Install Rust stable uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ (matrix.platform == 'macos-latest' || matrix.platform == 'macos-15-intel') && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - - - name: Install Linux dependencies - if: matrix.platform == 'ubuntu-22.04' - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf perl make - name: Add MSVC to PATH - if: matrix.platform == 'windows-latest' uses: ilammy/msvc-dev-cmd@v1 - - name: Install Perl and Make for Windows - if: matrix.platform == 'windows-latest' + - name: Verify native build tools + shell: pwsh run: | - choco install strawberryperl make --no-progress + perl --version | Select-Object -First 2 - uses: oven-sh/setup-bun@v2 with: @@ -75,61 +64,35 @@ jobs: - name: Install frontend dependencies run: bun i --frozen-lockfile - - name: Clean old bundles - if: matrix.platform != 'macos-latest' && matrix.platform != 'macos-15-intel' - run: bunx rimraf src-tauri/target/release/bundle + - name: Frontend typecheck and build + run: bun run build - - name: Clean old bundles - if: matrix.platform == 'macos-latest' - run: bunx rimraf src-tauri/target/aarch64-apple-darwin/release/bundle + - name: Frontend unit tests (UI builder, Xcode importer, file system) + run: bun test src + + - name: Rust check + working-directory: src-tauri + run: cargo check --locked - name: Clean old bundles - if: matrix.platform == 'macos-15-intel' - run: bunx rimraf src-tauri/target/x86_64-apple-darwin/release/bundle + shell: pwsh + run: Remove-Item -Recurse -Force src-tauri/target/release/bundle -ErrorAction SilentlyContinue - name: Build - uses: tauri-apps/tauri-action@v0 + uses: tauri-apps/tauri-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} with: - args: ${{ matrix.args }} - includeUpdaterJson: ${{ github.event_name == 'release' }} + args: ${{ github.event_name == 'release' && '--bundles msi,nsis' || '--bundles nsis' }} + uploadUpdaterJson: ${{ github.event_name == 'release' }} releaseId: ${{ github.event_name == 'release' && github.event.release.id || '' }} - - name: Upload macOS DMG - uses: actions/upload-artifact@v4 - if: matrix.platform == 'macos-latest' || matrix.platform == 'macos-15-intel' - with: - name: macos-dmg-${{ matrix.args == '--target aarch64-apple-darwin' && 'arm64' || 'x64' }} - path: ${{ github.workspace }}/src-tauri/target/**/release/bundle/**/*.dmg - - - name: Upload Linux DEB - uses: actions/upload-artifact@v4 - if: matrix.platform == 'ubuntu-22.04' && matrix.args == '--bundles deb' - with: - name: linux-deb - path: ${{ github.workspace }}/src-tauri/target/release/bundle/**/*.deb - - - name: Upload Linux RPM - uses: actions/upload-artifact@v4 - if: matrix.platform == 'ubuntu-22.04' && matrix.args == '--bundles rpm' - with: - name: linux-rpm - path: ${{ github.workspace }}/src-tauri/target/release/bundle/**/*.rpm - - - name: Upload Linux AppImage - uses: actions/upload-artifact@v4 - if: matrix.platform == 'ubuntu-22.04' && matrix.args == '--bundles appimage' - with: - name: linux-appimage - path: ${{ github.workspace }}/src-tauri/target/release/bundle/**/*.AppImage - - name: Upload Windows EXE - uses: actions/upload-artifact@v4 - if: matrix.platform == 'windows-latest' + uses: actions/upload-artifact@v7 with: name: windows-exe path: | ${{ github.workspace }}/src-tauri/target/release/bundle/**/*.exe + if-no-files-found: error diff --git a/README.md b/README.md index 4df0379..f2dc1bf 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ iOS Swift development IDE for Windows/Linux. Create, build, and test apps without owning a Mac. -Supports Swift 6.2 and the Swift Package Manager. +Supports Swift 6.4 (and the in-development Swift 6.5 snapshots), the iOS SDK shipped with Xcode 27.0, and the Swift Package Manager. ### Demo @@ -30,12 +30,15 @@ Check out the [Getting Started](https://github.com/nab138/CrossCode/wiki#getting ## Features -- Generate a Darwin SDK for linux from a user provided copy of Xcode 26 to build the apps -- Build apps using swift package manager +- Generate a Darwin SDK for linux from a user provided copy of the latest Xcode (e.g. Xcode 27.0) to build the apps +- Build apps using swift package manager, or hand Xcode projects to a Mac over SSH +- Visual SwiftUI builder: assemble views on a canvas, edit their properties, wire up tap actions, and generate the SwiftUI source +- Import an existing Xcode project into a buildable CrossCode package - Log in with your Apple ID to sign apps - Install apps on device - Create projects from templates - Code editing including error reporting, autocomplete, go to definition, and other language features +- Manage the project from the explorer (new file/folder, rename, delete) and with `File -> New File...` / `File -> Save As...` - Light/dark mode and other customizations - View and manage certificates, app IDs, and more - View the syslog or the stdout (console) of your device/app @@ -49,10 +52,136 @@ Please note that I am one person, so development may be slow. If you want to hel ## How it works -- A darwin SDK is generated from a user provided copy of Xcode 26 (extracted with [unxip-rs](https://github.com/nab138/unxip-rs)) and darwin tools from [darwin-tools-linux-llvm](https://github.com/xtool-org/darwin-tools-linux-llvm) +- A darwin SDK is generated from a user provided copy of the latest Xcode (e.g. Xcode 27.0; extracted with [unxip-rs](https://github.com/nab138/unxip-rs)), the darwin tools from [darwin-tools-linux-llvm](https://github.com/xtool-org/darwin-tools-linux-llvm) (currently v1.1.0), and the macro server from [OpenAppleMacros](https://github.com/xtool-org/OpenAppleMacros) (currently v1.3.0), which is what makes Apple's SwiftUI/Previews/FoundationModels macros usable on Linux. - Swift uses the darwin SDK to build an executable which is packaged into an .app bundle. - The code to sign and install apps onto a device has been removed from CrossCode's source and moved to a standalone package, [isideload](https://github.com/nab138/isideload). It was built on a lot of other libraries, so check out its README for more info. +## UI Builder + +`View -> Panels -> UI Builder` opens a visual editor for SwiftUI views next to +the code editor: + +- the **Package** and **Target** pickers at the top choose what the builder + writes into; it follows the file that is open in the editor and can also be + pointed at any other Swift package folder on disk (each package keeps its own + layout file), + +- drag components from the palette onto the canvas (or click to append them), +- select a view to edit its properties, bindings and modifiers in the inspector, +- give a view a **tap action**: a button runs its action in its own closure and + any other view gets an `.onTapGesture`. Pick what happens — flip a toggle, + add to or subtract from a number, assign a value, or dismiss the view — and + name the state variable it changes; the little preview in the inspector shows + the Swift that will be emitted, and `@State` (or `@Environment(\.dismiss)`) is + declared for you, +- reorder, duplicate or delete views in the structure tree, and +- watch the generated SwiftUI code update live. + +`Save .swift` writes the result to `/Sources/.swift`, which +`Open in Editor` then opens in Monaco. The layout itself is stored in the +project as `.crosscode/ui-builder.json` (the same folder that keeps your open +tabs), so it survives restarts. Controls that need state (Toggle, TextField, +Slider, ...) declare their `@State` variables automatically. + +The canvas is a preview approximation, not a simulator; build the app to see +the real thing on a device. + +## Files and editing + +The project explorer shows the folder you opened. Right click an entry to +create a file or folder inside it, rename it, delete it, reveal it in the file +manager or open it in the UI Builder. `File -> New File...` (Ctrl+N) asks for a +path inside the project and opens the result; `File -> Save As...` +(Ctrl+Shift+S) writes a copy of the file in the editor and switches to it. + +The editor is a full Monaco workbench wired to the same files through a custom +file system provider, so creating, renaming and deleting folders works from +both sides and the editor is told about changes made outside the app. + +## Package metadata + +CrossCode reads the manifest when it opens a package and shows what it found in +the project bar: + +- **`iOS 17.0+`** — the deployment target the manifest declares. A package that + declares other platforms but no iOS gets a warning instead, because building + it for a device is likely to fail. +- **`N asset catalogs`** — `.xcassets` bundles were found. They cannot be + compiled on Linux (`actool` lives in Xcode), so their contents are copied into + the app bundle as files instead of being compiled into `Assets.car`; the badge + says so, and the tooltip names the folders. +- **`N warnings`** — anything else worth knowing before a build, such as a + target that cannot be built for iOS. + +The metadata also feeds the packer: resource folders the manifest declares (or +the ones found next to a target's sources, `Resources/` and `assets/`) are +copied into the bundle, preserving their layout, rather than only the +`Resources/` folder at the project root. + +## Building on a remote Mac + +An `.xcodeproj` or `.xcworkspace` cannot be built with SwiftPM on Linux, so for +those projects CrossCode can hand the build to a Mac you already own over SSH. +Open the `Remote Mac` button in the project bar (it is only shown for Xcode +projects and workspaces): + +1. turn on **Use this Mac for Xcode builds**, +2. enter the host, the macOS user and the port, +3. choose how to authenticate — the SSH agent/default key, or a private key file + you pick with **Browse** (the file has to exist on the machine running + CrossCode), +4. enter the path of the project **on the Mac** (the folder, not the + `.xcodeproj` — CrossCode adds the entry point itself), +5. optionally set an `xcodebuild` destination (`generic/platform=iOS`, + `platform=iOS Simulator,name=iPhone 17`, ...), a result bundle path and + switch on **Run tests instead of building**, +6. **Test Connection** runs `xcodebuild -version` over the same SSH settings, so + a mistake in the key, the host or the port is reported before a build starts. + +`Build .ipa (Debug/Release)` and `Test Selected Workspace` then run their +`xcodebuild` invocation on the Mac, and the output (including compiler +diagnostics) streams into the normal build console. Paths printed by the remote +Mac are mapped back onto your local workspace, so a problem in the Problems +panel opens the right file and line locally. + +What this does **not** do: it does not upload your sources. The Mac builds the +copy of the project that is in `projectPath` on its own disk, so keep the two in +sync (git, a shared folder, a sync tool). If the local and remote copies differ, +the build reflects the remote one. + +`Import Xcode Project` on the welcome page (or *File -> Open -> Import Xcode +Project...*) converts an existing `.xcodeproj` into a package CrossCode can +build and install: + +1. pick the folder containing the project, +2. review the plan: the app target, the files that will be created, the package + dependencies that were found and every warning, +3. import — CrossCode writes `Package.swift`, `crosscode.toml` and an + Info.plist, and copies plain resources into `Resources/`. + +The sources stay where they are: the generated manifest points at them with +`path:` and `exclude:`, so Xcode and CrossCode keep working on the same files. + +What the importer does and does not do: + +- framework targets become libraries and app targets become the executable + product (`swift-tools-version: 6.4`, `platforms: [.iOS("")]`), +- local Swift packages (including the folder references Xcode creates when you + add a package without a `PackageReference`) and remote package URLs are + carried over into `Package.swift`, +- the Info.plist is converted: the fields CrossCode manages become `[[bundle_id]]`, + `[[product]]`, `[[version_num]]` and `[[version_string]]`, and every other + `$(SETTING)` is expanded from the project's build settings, +- only one app target is imported (SwiftPM cannot have two targets compiling the + same files), test targets and app extensions are skipped, and a file compiled + by several targets is assigned to the app, +- **asset catalogs, storyboards and Metal sources cannot be compiled on Linux** + (they need `actool`, `ibtool` or the Metal toolchain from Xcode), so apps that + depend on them will build without those assets, +- shared files, alternate app targets and remote package requirements are + reported as warnings rather than silently dropped. + ## Credits - [idevice](https://github.com/jkcoxson/idevice) is used to communicate with iOS devices. diff --git a/sdkmover/src/lib.rs b/sdkmover/src/lib.rs index 67271ba..52eea6e 100644 --- a/sdkmover/src/lib.rs +++ b/sdkmover/src/lib.rs @@ -1,11 +1,32 @@ use std::{ collections::HashSet, fs::{self, read_link}, - io::ErrorKind, - os::unix::fs::symlink, + io::{self, ErrorKind}, path::{Component, Path}, }; +#[cfg(target_family = "unix")] +fn create_symlink(target: &Path, dst: &Path, _src: &Path) -> io::Result<()> { + std::os::unix::fs::symlink(target, dst) +} + +#[cfg(target_family = "windows")] +fn create_symlink(target: &Path, dst: &Path, src: &Path) -> io::Result<()> { + if fs::metadata(src).map(|metadata| metadata.is_dir()).unwrap_or(false) { + std::os::windows::fs::symlink_dir(target, dst) + } else { + std::os::windows::fs::symlink_file(target, dst) + } +} + +#[cfg(not(any(target_family = "unix", target_family = "windows")))] +fn create_symlink(_target: &Path, _dst: &Path, _src: &Path) -> io::Result<()> { + Err(io::Error::new( + ErrorKind::Unsupported, + "symbolic links are unsupported on this platform", + )) +} + #[derive(Debug, Clone)] struct SDKEntry { names: HashSet, @@ -82,17 +103,25 @@ fn wanted_sdk_entry() -> SDKEntry { .iter() .map(|plat| { SDKEntry::e( - Some(&format!("{}.platform/Developer", plat)), + Some(&format!("{}.platform", plat)), vec![ - SDKEntry::e(Some("SDKs"), vec![]), + // The platform manifest carries the platform's + // default build properties; xtool keeps it too. + SDKEntry::e(Some("Info.plist"), vec![]), SDKEntry::e( - Some("Library"), + Some("Developer"), vec![ - SDKEntry::e(Some("Frameworks"), vec![]), - SDKEntry::e(Some("PrivateFrameworks"), vec![]), + SDKEntry::e(Some("SDKs"), vec![]), + SDKEntry::e( + Some("Library"), + vec![ + SDKEntry::e(Some("Frameworks"), vec![]), + SDKEntry::e(Some("PrivateFrameworks"), vec![]), + ], + ), + SDKEntry::e(Some("usr/lib"), vec![]), ], ), - SDKEntry::e(Some("usr/lib"), vec![]), ], ) }) @@ -188,7 +217,8 @@ pub fn copy_developer( fs::create_dir_all(parent) .map_err(|e| format!("Failed to create parent dir: {}", e))?; } - symlink(&target, &dst_path).map_err(|e| format!("Failed to create symlink: {}", e))?; + create_symlink(&target, &dst_path, &src_path) + .map_err(|e| format!("Failed to create symlink: {}", e))?; } else if metadata.is_dir() { fs::create_dir_all(&dst_path).map_err(|e| format!("Failed to create dir: {}", e))?; copy_developer(&src_path, dst, &rel_path, has_crossed_device)?; diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 9fac9b5..6e92e2d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -2,16 +2,14 @@ name = "crosscode" version = "0.0.5" description = "Cross platform iOS IDE" -authors = ["nab138"] +authors = ["nab138", "R0GUEEE"] edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [build-dependencies] tauri-build = { version = "2.4.0", features = [] } [dependencies] -tauri = { version = "2.8.3", features = ["devtools"] } +tauri = { version = "2.8.3", features = [] } serde = { version = "1", features = ["derive"] } serde_json = "1" tauri-plugin-shell = "2.3.0" @@ -47,8 +45,8 @@ fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" } sdkmover = { path = "../sdkmover" } [features] -# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! custom-protocol = ["tauri/custom-protocol"] +devtools = ["tauri/devtools"] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] tauri-plugin-cli = "2.4.0" diff --git a/src-tauri/src/builder/config.rs b/src-tauri/src/builder/config.rs index f849c06..4a0c7b4 100644 --- a/src-tauri/src/builder/config.rs +++ b/src-tauri/src/builder/config.rs @@ -6,17 +6,639 @@ use crate::builder::swift::SwiftBin; pub const FORMAT_VERSION: u32 = 1; +/// A platform a package declares support for, e.g. `.iOS("17.0")` or `.macOS(.v14)`. +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PackagePlatform { + pub name: String, + pub version: String, +} + +/// The pieces of a manifest that decide whether a package can be built for a +/// device, and which files have to be copied into the app bundle. +#[derive(Debug, Clone, Default, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PackageMetadata { + pub platforms: Vec, + /// Paths of asset catalogs / `.xcassets` folders found under the target roots. + pub asset_catalogs: Vec, + /// Paths of copied resources (`.process`, `.copy` and plain files). + pub resources: Vec, + /// Target names that build for iOS, i.e. that are not macOS-only. + pub ios_targets: Vec, + /// Every target in the package. + pub supported_targets: Vec, + /// Minimum iOS version declared by the manifest, when there is one. + pub deployment_target: Option, +} + +impl PackageMetadata { + /// The smallest iOS version the package declares, if any. + pub fn minimum_ios(&self) -> Option<&PackagePlatform> { + self.platforms + .iter() + .find(|platform| platform.name.eq_ignore_ascii_case("ios")) + } + + /// Warnings worth showing before a build starts. Empty means "nothing to say". + pub fn warnings(&self) -> Vec { + let mut warnings = Vec::new(); + if !self.platforms.is_empty() && self.minimum_ios().is_none() { + let names: Vec<&str> = self + .platforms + .iter() + .map(|platform| platform.name.as_str()) + .collect(); + warnings.push(format!( + "Package declares support for {} but not iOS; building for a device may fail.", + names.join(", ") + )); + } + let missing: Vec<&String> = self + .supported_targets + .iter() + .filter(|name| !self.ios_targets.contains(*name)) + .collect(); + if !missing.is_empty() { + let names: Vec<&str> = missing.iter().map(|name| name.as_str()).collect(); + warnings.push(format!( + "Target(s) {} cannot be built for iOS.", + names.join(", ") + )); + } + for catalog in &self.asset_catalogs { + warnings.push(format!( + "Asset catalog {} cannot be compiled on Linux; its assets will be missing.", + catalog + )); + } + warnings + } + +} + +/// Relevant part of `swift package dump-package`. Everything is optional so a +/// manifest written for a different tools version still parses. +#[derive(Debug, Deserialize)] +struct SwiftPackageDump { + name: String, + #[serde(default)] + targets: Vec, + #[serde(default)] + platforms: Vec, +} + +#[derive(Debug, Deserialize)] +struct SwiftPackageTarget { + name: String, + #[serde(default)] + path: Option, + #[serde(default)] + #[serde(rename = "type")] + target_type: Option, + /// `.process(...)` / `.copy(...)` declarations. + #[serde(default)] + resources: Vec, + #[serde(default)] + settings: Vec, +} + +#[derive(Debug, Deserialize)] +struct SwiftPackageResource { + #[serde(default)] + path: Option, + #[serde(default)] + rule: Option, +} + +/// A platform in the manifest. The declared version is either a string +/// (`"17.0"`) or an enum (`{"macos": {"_0": "v14"}}`), so keep it as `Value`. +#[derive(Debug, Deserialize)] +struct SwiftPackagePlatform { + #[serde(default)] + platform_name: Option, + #[serde(default)] + version: Option, + #[serde(default)] + options: Vec, +} + +impl PackageMetadata { + fn from_dump(package: &SwiftPackageDump) -> Self { + let mut platforms = Vec::new(); + for declared in &package.platforms { + if let Some(name) = &declared.platform_name { + platforms.push(PackagePlatform { + name: name.clone(), + version: format_platform_version(declared.version.as_ref()), + }); + } + } + + let mut resources = Vec::new(); + let mut asset_catalogs = Vec::new(); + for target in &package.targets { + let root = PathBuf::from(target.path.clone().unwrap_or_else(|| { + // SwiftPM's default locations. + let base = format!("Sources/{}", target.name); + base + })); + for resource in &target.resources { + if let Some(path) = &resource.path { + let full = root.join(path); + let text = full.to_string_lossy().replace('\\', "/"); + if text.ends_with(".xcassets") || text.contains(".xcassets/") { + asset_catalogs.push(text.clone()); + } + resources.push(text); + } + } + } + + // A target is "available on iOS" unless its settings exclude it. SwiftPM + // does not expose the resolved conditionals through dump-package, so the + // check is deliberately conservative: a `settings` entry mentioning + // macOS or SwiftPM's unsupported-platform error is treated as a hint. + let ios_targets = package + .targets + .iter() + .filter(|target| !target.settings.iter().any(|setting| mentions_macos(setting))) + .map(|target| target.name.clone()) + .collect(); + + let supported_targets = package + .targets + .iter() + .map(|target| target.name.clone()) + .collect(); + + let deployment_target = platforms + .iter() + .find(|platform| platform.name.eq_ignore_ascii_case("ios")) + .map(|platform| platform.version.clone()) + .filter(|version| !version.is_empty()); + + PackageMetadata { + platforms, + asset_catalogs, + resources, + ios_targets, + supported_targets, + deployment_target, + } + } + + /// Finds asset catalogs and resource folders on disk, for manifests that do + /// not declare them (a plain Xcode-style layout). + fn discover_on_disk(root: &PathBuf, targets: &[String]) -> (Vec, Vec) { + let mut catalogs = Vec::new(); + let mut directories = Vec::new(); + for target in targets { + for base in [ + root.join("Sources").join(target), + root.join(target), + ] { + if !base.is_dir() { + continue; + } + collect_resources(&base, &mut catalogs, &mut directories); + } + } + let mut flattened = directories.clone(); + // Only the top-level folders matter: a copy of `Resources/` already + // brings everything below it into the bundle. + flattened.retain(|candidate| { + !directories + .iter() + .any(|other| other != candidate && candidate.starts_with(&format!("{}/", other))) + }); + (catalogs, flattened) + } +} + +/// Walks a target folder collecting `.xcassets` bundles and resource folders. +fn collect_resources(base: &PathBuf, catalogs: &mut Vec, directories: &mut Vec) { + let entries = match std::fs::read_dir(base) { + Ok(entries) => entries, + Err(_) => return, + }; + for entry in entries.filter_map(Result::ok) { + let path = entry.path(); + let name = entry.file_name().to_string_lossy().to_string(); + if name.starts_with('.') { + continue; + } + let text = path.to_string_lossy().replace('\\', "/"); + if path.is_dir() { + if text.ends_with(".xcassets") { + catalogs.push(text); + continue; + } + if name == "Resources" || name == "assets" || name == "Assets" { + directories.push(text); + continue; + } + } + } +} + +fn mentions_macos(value: &serde_json::Value) -> bool { + let text = value.to_string().to_lowercase(); + text.contains("macos") || text.contains("unsupportedplatform") +} + +/// `"17.0"`, `{"_0": "v14"}` and `{"_0": null}` -> `"17.0"`, `"14"`, `""`. +fn format_platform_version(version: Option<&serde_json::Value>) -> String { + match version { + Some(serde_json::Value::String(text)) => text.clone(), + Some(serde_json::Value::Object(map)) => { + for key in ["_0", "string", "version"] { + if let Some(value) = map.get(key) { + let text = format_platform_version(Some(value)); + if !text.is_empty() { + // `v14` is SwiftPM's short form for `14.0`. + return text.trim_start_matches('v').to_string(); + } + } + } + String::new() + } + Some(serde_json::Value::Number(number)) => number.to_string(), + _ => String::new(), + } +} + +impl SwiftPackageDump { + /// Reads what the manifest declares without running Swift. + /// + /// Detection must work before a toolchain is selected, so this parses + /// `Package.swift` with the SwiftPM manifest parser only if it is already + /// available, and otherwise keeps the metadata empty and falls back to + /// looking at the target folders on disk. + fn load(root: &PathBuf, targets: &[String], kind: &ProjectKind) -> PackageMetadata { + if !matches!( + kind, + ProjectKind::CrosscodePackage | ProjectKind::SwiftPackage + ) { + return PackageMetadata::default(); + } + if let Some(dump) = read_manifest_with_swift(root) { + let mut metadata = PackageMetadata::from_dump(&dump); + fill_missing_resources(&mut metadata, root, targets); + return metadata; + } + PackageMetadata::discover(root, targets) + } +} + +/// Runs `swift package dump-package` when a `swift` is on PATH. Absence is not +/// an error: the metadata is a convenience, not a requirement. +fn read_manifest_with_swift(root: &PathBuf) -> Option { + let output = std::process::Command::new("swift") + .arg("package") + .arg("dump-package") + .current_dir(root) + .output() + .ok()?; + if !output.status.success() { + return None; + } + serde_json::from_slice(&output.stdout).ok() +} + +/// Adds the resource folders that exist on disk but were not declared, and the +/// asset catalogs found next to the sources. +fn fill_missing_resources(metadata: &mut PackageMetadata, root: &PathBuf, targets: &[String]) { + let (catalogs, directories) = PackageMetadata::discover_on_disk(root, targets); + for catalog in catalogs { + if !metadata.asset_catalogs.contains(&catalog) { + metadata.asset_catalogs.push(catalog); + } + } + for directory in directories { + if !metadata.resources.contains(&directory) { + metadata.resources.push(directory); + } + } +} + +impl PackageMetadata { + /// The metadata that can be read from the filesystem alone. + fn discover(root: &PathBuf, targets: &[String]) -> Self { + let (asset_catalogs, resources) = PackageMetadata::discover_on_disk(root, targets); + PackageMetadata { + platforms: Vec::new(), + asset_catalogs, + resources, + ios_targets: targets.to_vec(), + supported_targets: targets.to_vec(), + deployment_target: None, + } + } +} + + + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub enum ProjectKind { + CrosscodePackage, + SwiftPackage, + XcodeWorkspace, + XcodeProject, + CocoaPods, + Tuist, + XcodeGen, + Make, + Bazel, + CMake, + Fastlane, + Unknown, +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ProjectInfo { + pub kind: ProjectKind, + pub root: String, + pub build_root: String, + pub entry_point: Option, + pub capabilities: Vec, + pub targets: Vec, + pub schemes: Vec, + pub configurations: Vec, + pub build_type: String, + pub detected_files: Vec, + /// Declared platforms, resources and asset catalogs, for SwiftPM packages. + pub package_metadata: PackageMetadata, + /// Anything worth telling the user about before a build starts. + pub warnings: Vec, +} + +impl ProjectInfo { + pub fn detect(root: PathBuf) -> Result { + if !root.is_dir() { + return Err(format!("Project path is not a directory: {}", root.display())); + } + + let mut entries = std::fs::read_dir(&root) + .map_err(|e| format!("Failed to read project directory: {}", e))? + .filter_map(Result::ok) + .collect::>(); + entries.sort_by_key(|entry| entry.file_name()); + + let has = |name: &str| root.join(name).exists(); + let find_extension = |extension: &str| { + entries.iter().find_map(|entry| { + let path = entry.path(); + (path.extension().and_then(|value| value.to_str()) == Some(extension)) + .then(|| path) + }) + }; + + let find_named = |name: &str| { + let direct = root.join(name); + if direct.exists() { + return Some(direct); + } + find_files(&root, 2, &|path| path.file_name().and_then(|value| value.to_str()) == Some(name)) + .into_iter() + .next() + }; + let find_nested_extension = |extension: &str| { + find_files(&root, 2, &|path| { + path.extension().and_then(|value| value.to_str()) == Some(extension) + }) + .into_iter() + .next() + }; + + let (kind, entry_point) = if let Some(path) = find_extension("xcworkspace") { + (ProjectKind::XcodeWorkspace, Some(path)) + } else if let Some(path) = find_nested_extension("xcworkspace") { + (ProjectKind::XcodeWorkspace, Some(path)) + } else if let Some(path) = find_extension("xcodeproj") { + (ProjectKind::XcodeProject, Some(path)) + } else if let Some(path) = find_nested_extension("xcodeproj") { + (ProjectKind::XcodeProject, Some(path)) + } else if has("Package.swift") && has("crosscode.toml") { + (ProjectKind::CrosscodePackage, Some(root.join("Package.swift"))) + } else if let Some(path) = find_named("Package.swift") { + (ProjectKind::SwiftPackage, Some(path)) + } else if let Some(path) = find_named("Podfile") { + (ProjectKind::CocoaPods, Some(path)) + } else if has("Project.swift") || has("Tuist.swift") || has("ProjectDescriptionHelpers") { + (ProjectKind::Tuist, find_extension("swift")) + } else if has("project.yml") || has("project.yaml") { + (ProjectKind::XcodeGen, Some(if has("project.yml") { root.join("project.yml") } else { root.join("project.yaml") })) + } else if has("Makefile") || has("makefile") { + (ProjectKind::Make, Some(if has("Makefile") { root.join("Makefile") } else { root.join("makefile") })) + } else if has("WORKSPACE") || has("BUILD") || has("MODULE.bazel") { + (ProjectKind::Bazel, find_extension("bazel")) + } else if has("CMakeLists.txt") { + (ProjectKind::CMake, Some(root.join("CMakeLists.txt"))) + } else if has("Fastfile") || has("fastlane") { + (ProjectKind::Fastlane, find_named("Fastfile")) + } else { + (ProjectKind::Unknown, None) + }; + + let (targets, schemes) = discover_targets_and_schemes(&root, entry_point.as_ref(), &kind); + let detected_files = detected_files(&root, &kind, entry_point.as_ref()); + let build_root = project_build_root(&root, &kind, entry_point.as_ref()); + + let mut capabilities = vec!["edit".to_string(), "sourceKitLsp".to_string()]; + if matches!(kind, ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace) { + capabilities.push("xcodeBuild".to_string()); + capabilities.push("simulator".to_string()); + capabilities.push("archive".to_string()); + } + if matches!(kind, ProjectKind::SwiftPackage | ProjectKind::CrosscodePackage | ProjectKind::Tuist | ProjectKind::Make | ProjectKind::Bazel | ProjectKind::CMake) { + capabilities.push("swiftBuild".to_string()); + } + if matches!(kind, ProjectKind::Tuist | ProjectKind::XcodeGen) { + capabilities.push("generate".to_string()); + } + if matches!(kind, ProjectKind::CocoaPods) { + capabilities.push("cocoapods".to_string()); + } + if matches!(kind, ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace) { + capabilities.push("remoteBuild".to_string()); + } + if matches!(kind, ProjectKind::SwiftPackage | ProjectKind::CrosscodePackage | ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace | ProjectKind::Tuist | ProjectKind::XcodeGen | ProjectKind::Make | ProjectKind::Bazel) { + capabilities.push("test".to_string()); + } + + let build_type = project_kind_label(&kind).to_string(); + // `swift package dump-package` needs a toolchain, which detection does + // not have; read the manifest itself, and fall back to the filesystem + // for packages whose manifest does not declare its resources. + let package_metadata = SwiftPackageDump::load(&root, &targets, &kind); + let warnings = package_metadata.warnings(); + + Ok(ProjectInfo { + kind, + root: root.to_string_lossy().to_string(), + build_root: build_root.to_string_lossy().to_string(), + entry_point: entry_point.map(|path| path.to_string_lossy().to_string()), + capabilities, + targets, + schemes, + configurations: vec!["Debug".to_string(), "Release".to_string()], + build_type, + detected_files, + package_metadata, + warnings, + }) + } +} + +fn discover_targets_and_schemes( + root: &PathBuf, + entry_point: Option<&PathBuf>, + kind: &ProjectKind, +) -> (Vec, Vec) { + let mut targets = Vec::new(); + let mut schemes = Vec::new(); + if matches!(kind, ProjectKind::SwiftPackage | ProjectKind::CrosscodePackage) { + if let Ok(contents) = std::fs::read_to_string(root.join("Package.swift")) { + for marker in ["target(name:", "executableTarget(name:", "testTarget(name:"] { + let mut rest = contents.as_str(); + while let Some(index) = rest.find(marker) { + rest = &rest[index + marker.len()..]; + if let Some(start) = rest.find('"') { + let value = &rest[start + 1..]; + if let Some(end) = value.find('"') { + let name = value[..end].to_string(); + if !targets.contains(&name) { targets.push(name); } + } + } + } + } + } + } + if matches!(kind, ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace) { + if let Some(entry) = entry_point { + let project_root = if entry.extension().and_then(|value| value.to_str()) == Some("xcodeproj") { + entry.join("project.pbxproj") + } else { + find_files(root, 3, &|path| path.file_name().and_then(|value| value.to_str()) == Some("project.pbxproj")) + .into_iter() + .next() + .unwrap_or_else(|| root.join("project.pbxproj")) + }; + if let Ok(contents) = std::fs::read_to_string(project_root) { + for line in contents.lines() { + if line.contains("name =") && line.contains("; /*") { + let name = line.split("name =").nth(1).unwrap_or("").split(';').next().unwrap_or("").trim().trim_matches('"'); + if !name.is_empty() && !targets.contains(&name.to_string()) { targets.push(name.to_string()); } + } + } + } + } + for scheme_path in find_files(root, 4, &|path| { + path.extension().and_then(|value| value.to_str()) == Some("xcscheme") + && path.components().any(|component| component.as_os_str().to_str() == Some("xcshareddata")) + }) { + if let Some(name) = scheme_path.file_stem().and_then(|value| value.to_str()) { + schemes.push(name.to_string()); + } + } + } + targets.sort(); + schemes.sort(); + (targets, schemes) +} + +fn find_files(root: &PathBuf, max_depth: usize, predicate: &dyn Fn(&PathBuf) -> bool) -> Vec { + if max_depth == 0 { + return Vec::new(); + } + let mut matches = Vec::new(); + let Ok(entries) = std::fs::read_dir(root) else { return matches }; + for entry in entries.flatten() { + let path = entry.path(); + let name = path.file_name().and_then(|value| value.to_str()).unwrap_or(""); + if path.is_dir() { + if matches!(name, ".git" | ".build" | "node_modules" | "target" | ".crosscode") { + continue; + } + matches.extend(find_files(&path, max_depth - 1, predicate)); + } else if predicate(&path) { + matches.push(path); + } + } + matches.sort(); + matches +} + +fn detected_files(root: &PathBuf, kind: &ProjectKind, entry_point: Option<&PathBuf>) -> Vec { + let mut files = entry_point + .into_iter() + .map(|path| path.to_string_lossy().to_string()) + .collect::>(); + let marker = match kind { + ProjectKind::CrosscodePackage => Some("crosscode.toml"), + ProjectKind::CocoaPods => Some("Podfile.lock"), + ProjectKind::Tuist => Some("Project.swift"), + ProjectKind::Bazel => Some("MODULE.bazel"), + ProjectKind::CMake => Some("CMakeLists.txt"), + ProjectKind::Fastlane => Some("Fastfile"), + _ => None, + }; + if let Some(marker) = marker { + let path = root.join(marker); + if path.exists() { + files.push(path.to_string_lossy().to_string()); + } + } + files.sort(); + files.dedup(); + files +} + +pub fn project_kind_label(kind: &ProjectKind) -> &'static str { + match kind { + ProjectKind::CrosscodePackage => "CrossCode Package", + ProjectKind::SwiftPackage => "Swift Package Manager", + ProjectKind::XcodeWorkspace => "Xcode Workspace", + ProjectKind::XcodeProject => "Xcode Project", + ProjectKind::CocoaPods => "CocoaPods", + ProjectKind::Tuist => "Tuist", + ProjectKind::XcodeGen => "XcodeGen", + ProjectKind::Make => "Make", + ProjectKind::Bazel => "Bazel", + ProjectKind::CMake => "CMake", + ProjectKind::Fastlane => "Fastlane", + ProjectKind::Unknown => "Unknown", + } +} + +fn project_build_root(root: &PathBuf, kind: &ProjectKind, entry_point: Option<&PathBuf>) -> PathBuf { + if matches!(kind, ProjectKind::SwiftPackage | ProjectKind::CocoaPods | ProjectKind::Make | ProjectKind::Bazel | ProjectKind::CMake | ProjectKind::Fastlane) { + if let Some(entry) = entry_point { + if let Some(parent) = entry.parent() { + return parent.to_path_buf(); + } + } + } + root.clone() +} + pub struct BuildSettings { pub debug: bool, } -// TODO: Min ios version, etc. pub struct ProjectConfig { pub product: String, pub version_num: String, pub version_string: String, pub bundle_id: String, pub project_path: PathBuf, + /// Platforms and resources declared by the manifest. + pub metadata: PackageMetadata, + /// Minimum iOS version, when the manifest declares one. + pub minimum_ios: Option, } #[derive(Deserialize, Serialize)] @@ -32,19 +654,6 @@ pub struct ProjectTomlConfig { pub bundle_id: String, } -// TODO: Check platforms -#[derive(Deserialize)] -struct SwiftPackageDump { - name: String, - targets: Vec, -} - -// TODO: Resources -#[derive(Deserialize)] -struct SwiftPackageTarget { - name: String, -} - #[derive(Deserialize, Serialize)] pub enum ProjectValidation { Valid, @@ -75,12 +684,19 @@ impl ProjectConfig { let package: SwiftPackageDump = serde_json::from_slice(&raw_package.stdout) .map_err(|e| format!("Failed to parse package dump: {}", e))?; + let metadata = PackageMetadata::from_dump(&package); + Ok(ProjectConfig { product: package.name, version_num: toml_config.project.version_num, version_string: toml_config.project.version_string, bundle_id: toml_config.project.bundle_id, project_path, + minimum_ios: metadata + .minimum_ios() + .map(|platform| platform.version.clone()) + .filter(|version| !version.is_empty()), + metadata, }) } @@ -173,3 +789,141 @@ impl TomlConfig { Ok(()) } } + +#[cfg(test)] +mod metadata_tests { + use super::*; + + fn dump(json: &str) -> SwiftPackageDump { + serde_json::from_str(json).expect("manifest fixture should parse") + } + + #[test] + fn reads_string_and_enum_platform_versions() { + let package = dump( + r#"{ + "name": "App", + "targets": [], + "platforms": [ + { "platformName": "ios", "version": "17.0", "options": [] }, + { "platformName": "macos", "version": { "_0": "v14" }, "options": [] } + ] + }"#, + ); + let metadata = PackageMetadata::from_dump(&package); + assert_eq!(metadata.platforms.len(), 2); + assert_eq!(metadata.platforms[0].name, "ios"); + assert_eq!(metadata.platforms[0].version, "17.0"); + // SwiftPM's `v14` short form, with the enum wrapper flattened away. + assert_eq!(metadata.platforms[1].version, "14"); + } + + #[test] + fn a_platform_without_a_version_is_still_recorded() { + let package = dump( + r#"{"name":"App","targets":[],"platforms":[{"platformName":"ios","options":[]}]}"#, + ); + let metadata = PackageMetadata::from_dump(&package); + assert_eq!(metadata.platforms[0].version, ""); + assert!(metadata.minimum_ios().is_some()); + assert_eq!(metadata.minimum_ios().unwrap().version, ""); + } + + #[test] + fn collects_declared_resources_and_asset_catalogs() { + let package = dump( + r#"{ + "name": "App", + "platforms": [], + "targets": [ + { + "name": "App", + "path": "Sources/App", + "resources": [ + { "path": "Assets.xcassets", "rule": { "process": {} } }, + { "path": "Resources", "rule": { "copy": {} } } + ], + "settings": [] + } + ] + }"#, + ); + let metadata = PackageMetadata::from_dump(&package); + assert_eq!(metadata.asset_catalogs, vec!["Sources/App/Assets.xcassets"]); + assert_eq!(metadata.resources.len(), 2); + // asset catalogs cannot be compiled on Linux, which is worth a warning + assert!(metadata + .warnings() + .iter() + .any(|warning| warning.contains("cannot be compiled on Linux"))); + } + + #[test] + fn warns_when_ios_is_not_declared() { + let package = dump( + r#"{"name":"App","targets":[],"platforms":[{"platformName":"macos","version":"14","options":[]}]}"#, + ); + let metadata = PackageMetadata::from_dump(&package); + assert!(metadata + .warnings() + .iter() + .any(|warning| warning.contains("not iOS"))); + } + + #[test] + fn warns_about_targets_that_cannot_build_for_ios() { + let package = dump( + r#"{ + "name": "App", + "platforms": [{"platformName": "ios", "version": "17.0", "options": []}], + "targets": [ + { "name": "App", "path": "Sources/App", "resources": [], "settings": [] }, + { "name": "MacOnly", "path": "Sources/MacOnly", "resources": [], "settings": [] } + ] + }"#, + ); + let mut metadata = PackageMetadata::from_dump(&package); + // Pretend the manifest excluded `MacOnly` from iOS. + metadata.ios_targets.retain(|name| name != "MacOnly"); + let warnings = metadata.warnings(); + assert!( + warnings.iter().any(|warning| warning.contains("MacOnly")), + "expected a warning about MacOnly, got {:?}", + warnings + ); + } + + #[test] + fn says_nothing_about_a_package_without_platforms() { + let package = dump(r#"{"name":"App","targets":[],"platforms":[]}"#); + let metadata = PackageMetadata::from_dump(&package); + assert!(metadata.warnings().is_empty()); + } + + #[test] + fn tolerates_missing_fields() { + // A tools version that does not emit `path`/`resources`/`settings` yet. + let package = dump(r#"{"name":"App"}"#); + let metadata = PackageMetadata::from_dump(&package); + assert!(metadata.platforms.is_empty()); + assert!(metadata.resources.is_empty()); + } + + #[test] + fn finds_asset_catalogs_on_disk() { + let root = std::env::temp_dir().join(format!("crosscode-metadata-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&root); + std::fs::create_dir_all(root.join("Sources/App/Assets.xcassets")).unwrap(); + std::fs::create_dir_all(root.join("Sources/App/Resources/sub")).unwrap(); + std::fs::write(root.join("Sources/App/Resources/a.txt"), "a").unwrap(); + + let metadata = PackageMetadata::discover(&root, &["App".to_string()]); + assert_eq!(metadata.asset_catalogs.len(), 1); + assert!(metadata.asset_catalogs[0].ends_with("Sources/App/Assets.xcassets")); + // the nested folder is inside the reported one and must not repeat + assert_eq!(metadata.resources.len(), 1); + assert!(metadata.resources[0].ends_with("Sources/App/Resources")); + + std::fs::remove_dir_all(&root).unwrap(); + } +} diff --git a/src-tauri/src/builder/crossplatform.rs b/src-tauri/src/builder/crossplatform.rs index 34f4e26..00130a0 100644 --- a/src-tauri/src/builder/crossplatform.rs +++ b/src-tauri/src/builder/crossplatform.rs @@ -55,6 +55,44 @@ pub fn symlink(target: &str, link: &str) -> std::io::Result<()> { } } +/// Make `path` executable, going through WSL when running on Windows (the file +/// lives on the Linux filesystem there, so the Windows API cannot chmod it). +pub fn set_executable(path: &str) -> Result<(), String> { + #[cfg(not(target_os = "windows"))] + { + use std::os::unix::fs::PermissionsExt; + let metadata = fs::metadata(path) + .map_err(|e| format!("Failed to read metadata for '{}': {}", path, e))?; + let mut perms = metadata.permissions(); + perms.set_mode(perms.mode() | 0o755); + fs::set_permissions(path, perms) + .map_err(|e| format!("Failed to set permissions for '{}': {}", path, e)) + } + #[cfg(target_os = "windows")] + { + if !has_wsl() { + return Err("WSL is not available".to_string()); + } + let linux = windows_to_wsl_path(path)?; + let output = Command::new("wsl") + .arg("chmod") + .arg("+x") + .arg(&linux) + .creation_flags(CREATE_NO_WINDOW) + .output() + .map_err(|e| format!("Failed to run chmod: {}", e))?; + if output.status.success() { + Ok(()) + } else { + Err(format!( + "Failed to make '{}' executable: {}", + path, + String::from_utf8_lossy(&output.stderr).trim() + )) + } + } +} + pub fn linux_env(key: &str) -> Result { #[cfg(not(target_os = "windows"))] { diff --git a/src-tauri/src/builder/mod.rs b/src-tauri/src/builder/mod.rs index e885afc..0cb733c 100644 --- a/src-tauri/src/builder/mod.rs +++ b/src-tauri/src/builder/mod.rs @@ -2,5 +2,6 @@ pub mod config; pub mod crossplatform; pub mod icon; pub mod packer; +pub mod remote; pub mod sdk; pub mod swift; diff --git a/src-tauri/src/builder/packer.rs b/src-tauri/src/builder/packer.rs index 7cae1a2..405ad16 100644 --- a/src-tauri/src/builder/packer.rs +++ b/src-tauri/src/builder/packer.rs @@ -4,7 +4,6 @@ use std::{ path::PathBuf, }; -use dircpy::CopyBuilder; use zip::write::SimpleFileOptions; use crate::builder::config::{BuildSettings, ProjectConfig}; @@ -66,13 +65,78 @@ pub fn pack( .map_err(|e| format!("Failed to create Resources directory: {}", e))?; } - CopyBuilder::new(&resources, &app_path) - .run() - .map_err(|e| format!("Failed to copy resources: {}", e))?; + copy_directory(&resources, &app_path)?; + copy_declared_resources(project_path.clone(), config, &app_path)?; Ok(app_path) } +/// Copies the resource folders and bundles the manifest declares (or the ones +/// found next to the sources), keeping their layout relative to the project. +/// +/// SwiftPM copies declared resources next to the executable, so a `Resources` +/// folder declared by the manifest ends up in the same place as the one the +/// packer already handles; anything else is copied under `Resources/` in the +/// bundle so the app can still find it. +fn copy_declared_resources( + project_path: PathBuf, + config: &ProjectConfig, + app_path: &PathBuf, +) -> Result<(), String> { + let metadata = &config.metadata; + let mut copied = std::collections::HashSet::new(); + for declared in metadata.resources.iter().chain(metadata.asset_catalogs.iter()) { + let source = PathBuf::from(declared); + let source = if source.is_absolute() { + source + } else { + project_path.join(declared) + }; + if !source.exists() { + continue; + } + let name = match source.file_name().and_then(|name| name.to_str()) { + Some(name) => name.to_string(), + None => continue, + }; + if !copied.insert(name.clone()) { + continue; + } + let destination = app_path.join(&name); + if source.is_dir() { + copy_directory(&source, &destination)?; + } else { + fs::copy(&source, &destination) + .map_err(|e| format!("Failed to copy resource {}: {}", declared, e))?; + } + } + Ok(()) +} + +/// `fs::copy` does not recurse, so directories are walked here instead of +/// pulling in a copy crate: a declared resource folder is usually a handful of +/// files, and this keeps the error messages specific. +fn copy_directory(source: &PathBuf, destination: &PathBuf) -> Result<(), String> { + if !source.is_dir() { + return Ok(()); + } + fs::create_dir_all(destination) + .map_err(|e| format!("Failed to create {}: {}", destination.display(), e))?; + let entries = fs::read_dir(source) + .map_err(|e| format!("Failed to read {}: {}", source.display(), e))?; + for entry in entries.filter_map(Result::ok) { + let path = entry.path(); + let target = destination.join(entry.file_name()); + if path.is_dir() { + copy_directory(&path, &target)?; + } else { + fs::copy(&path, &target) + .map_err(|e| format!("Failed to copy {}: {}", path.display(), e))?; + } + } + Ok(()) +} + pub fn zip_ipa(app: PathBuf, config: &ProjectConfig) -> Result { let payload = app.parent().unwrap_or(&PathBuf::from(".")).to_path_buf(); diff --git a/src-tauri/src/builder/remote.rs b/src-tauri/src/builder/remote.rs new file mode 100644 index 0000000..c8f442d --- /dev/null +++ b/src-tauri/src/builder/remote.rs @@ -0,0 +1,345 @@ +//! Building and testing Xcode projects on a remote Mac over SSH. +//! +//! A remote command is assembled here (never by the frontend) so the profile is +//! validated once, quoted consistently and the same command is used by the +//! build, test and "test connection" commands. + +use std::process::Command; + +use serde::Deserialize; + +use crate::builder::{ + config::{ProjectInfo, ProjectKind}, + swift::pipe_command, +}; + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RemoteMacProfile { + pub enabled: bool, + pub host: String, + pub user: String, + pub port: u16, + pub project_path: String, + #[serde(default)] + pub auth: Option, + #[serde(default)] + pub identity_file: Option, + #[serde(default)] + pub run_tests: Option, + #[serde(default)] + pub result_bundle_path: Option, + #[serde(default)] + pub destination: Option, +} + +/// What to do once the project has been opened on the remote Mac. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RemoteAction { + Build, + Test, + Install, +} + +impl RemoteAction { + fn as_str(self) -> &'static str { + match self { + RemoteAction::Build => "build", + RemoteAction::Test => "test", + RemoteAction::Install => "build-for-testing", + } + } +} + +impl RemoteMacProfile { + /// Rejects anything that could escape the remote command line. + pub fn validate(&self) -> Result<(), String> { + if self.host.trim().is_empty() || self.user.trim().is_empty() { + return Err("Remote Mac host and user are required".to_string()); + } + if self.project_path.trim().is_empty() { + return Err("Remote Mac project path is required".to_string()); + } + if self.host.trim().parse::().is_err() + && !self + .host + .chars() + .all(|character| character.is_ascii_alphanumeric() || matches!(character, '.' | '-' | ':')) + { + return Err("Remote Mac host contains unsupported characters".to_string()); + } + if !self + .user + .chars() + .all(|character| character.is_ascii_alphanumeric() || matches!(character, '_' | '-' | '.')) + { + return Err("Remote Mac user contains unsupported characters".to_string()); + } + if self.port == 0 { + return Err("Remote Mac port must be between 1 and 65535".to_string()); + } + if self.uses_identity() && self.identity_path().trim().is_empty() { + return Err("Choose a private key file or switch the remote Mac to ssh-agent".to_string()); + } + Ok(()) + } + + fn uses_identity(&self) -> bool { + matches!(self.auth.as_deref(), Some("identity")) + } + + fn identity_path(&self) -> &str { + self.identity_file.as_deref().unwrap_or("").trim() + } + + /// Existence is only checked for key authentication: agent auth has no file + /// to point at, and the check must not run on a machine without the key + /// (the UI may hold a profile that belongs to another machine). + pub fn validate_identity_file(&self) -> Result<(), String> { + if !self.uses_identity() { + return Ok(()); + } + let path = self.identity_path(); + if path.is_empty() { + return Err("Choose a private key file or switch the remote Mac to ssh-agent".to_string()); + } + if !std::path::Path::new(path).is_file() { + return Err(format!("Private key not found: {}", path)); + } + Ok(()) + } + + /// The ssh command, already pointed at the right host and port. + pub fn ssh_command(&self) -> Command { + let mut command = Command::new("ssh"); + command + .arg("-o") + .arg("BatchMode=yes") + .arg("-o") + .arg("ConnectTimeout=8") + // The remote Mac is usually not in a known_hosts file. + .arg("-o") + .arg("StrictHostKeyChecking=accept-new") + .arg("-p") + .arg(self.port.to_string()); + if self.uses_identity() { + command.arg("-i").arg(self.identity_path()); + } + command.arg(format!("{}@{}", self.user, self.host)); + command + } + + /// The `xcodebuild` invocation for a project or workspace. + pub fn xcodebuild_command( + info: &ProjectInfo, + action: RemoteAction, + target: &str, + scheme: &str, + configuration: &str, + ) -> Result { + let entry = info + .entry_point + .as_ref() + .ok_or("Xcode project entry point is missing")?; + let entry_name = std::path::Path::new(entry) + .file_name() + .and_then(|name| name.to_str()) + .ok_or("Xcode project entry point has an invalid name")?; + let project_flag = match info.kind { + ProjectKind::XcodeProject => "-project", + // Anything else is a workspace; detection only calls this for the two. + _ => "-workspace", + }; + let mut arguments = vec![project_flag.to_string(), shell_quote(entry_name)]; + append_scheme_and_configuration(&mut arguments, target, scheme, configuration); + arguments.push(action.as_str().to_string()); + Ok(format!("xcodebuild {}", arguments.join(" "))) + } +} + +/// `xcodebuild` selection arguments: a scheme wins over a target, exactly like +/// the local command builder. +pub fn append_scheme_and_configuration( + arguments: &mut Vec, + target: &str, + scheme: &str, + configuration: &str, +) { + if !scheme.trim().is_empty() { + arguments.push("-scheme".to_string()); + arguments.push(shell_quote(scheme)); + } else if !target.trim().is_empty() { + arguments.push("-target".to_string()); + arguments.push(shell_quote(target)); + } + if !configuration.trim().is_empty() { + arguments.push("-configuration".to_string()); + arguments.push(shell_quote(configuration)); + } +} + +/// A single-quoted POSIX shell word — `sh -c` compatible and safe for `&&`. +pub fn shell_quote(value: &str) -> String { + format!("'{}'", value.replace('\'', "'\\\"'\\\"'")) +} + +/// Runs `command` inside the remote project directory. +pub fn remote_project_command(profile: &RemoteMacProfile, command: &str) -> String { + format!( + "cd {} && {}", + shell_quote(&profile.project_path), + command + ) +} + +/// Runs `xcodebuild -version` on the remote Mac to check the connection. +pub async fn test_connection( + window: &tauri::Window, + profile: &RemoteMacProfile, +) -> Result<(), String> { + profile.validate()?; + profile.validate_identity_file()?; + let mut command = profile.ssh_command(); + command.arg("xcodebuild -version"); + pipe_command(&mut command, window, true).await +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::builder::config::{ + project_kind_label, PackageMetadata, ProjectInfo, ProjectKind, + }; + + fn profile() -> RemoteMacProfile { + RemoteMacProfile { + enabled: true, + host: "mac.local".to_string(), + user: "dev".to_string(), + port: 22, + project_path: "/Users/dev/My App".to_string(), + auth: None, + identity_file: None, + run_tests: None, + result_bundle_path: None, + destination: None, + } + } + + fn info(kind: ProjectKind) -> ProjectInfo { + ProjectInfo { + kind, + root: "/tmp/App".to_string(), + build_root: "/tmp/App".to_string(), + entry_point: Some("/tmp/App/App.xcodeproj".to_string()), + capabilities: Vec::new(), + targets: Vec::new(), + schemes: Vec::new(), + configurations: Vec::new(), + build_type: project_kind_label(&kind), + detected_files: Vec::new(), + package_metadata: PackageMetadata::default(), + warnings: Vec::new(), + } + } + + #[test] + fn rejects_missing_fields() { + let mut broken = profile(); + broken.host = String::new(); + assert!(broken.validate().is_err()); + + let mut broken = profile(); + broken.user = "dev; rm -rf /".to_string(); + assert!(broken.validate().is_err()); + + let mut broken = profile(); + broken.port = 0; + assert!(broken.validate().is_err()); + } + + #[test] + fn identity_auth_requires_a_path() { + let mut identified = profile(); + identified.auth = Some("identity".to_string()); + assert!(identified.validate().is_err()); + + identified.identity_file = Some("/tmp/key".to_string()); + assert!(identified.validate().is_ok()); + // the file does not exist, which is a separate error message + assert!(identified.validate_identity_file().is_err()); + + let agent = profile(); + assert!(agent.validate_identity_file().is_ok()); + } + + // Long option: assert the ssh arguments rather than the whole vector. + #[test] + fn ssh_command_carries_the_port_and_key() { + let mut identified = profile(); + identified.port = 2222; + identified.auth = Some("identity".to_string()); + identified.identity_file = Some("/tmp/key".to_string()); + let command = identified.ssh_command(); + let arguments: Vec = command + .get_args() + .map(|argument| argument.to_string_lossy().to_string()) + .collect(); + assert!(arguments.contains(&"-p".to_string())); + assert!(arguments.contains(&"2222".to_string())); + assert!(arguments.contains(&"-i".to_string())); + assert!(arguments.contains(&"/tmp/key".to_string())); + assert!(arguments.contains(&"dev@mac.local".to_string())); + assert!(arguments.contains(&"StrictHostKeyChecking=accept-new".to_string())); + } + + #[test] + fn quotes_paths_with_spaces() { + let profile = profile(); + assert_eq!( + remote_project_command(&profile, "xcodebuild build"), + "cd '/Users/dev/My App' && xcodebuild build" + ); + } + + #[test] + fn quotes_embedded_single_quotes() { + assert_eq!(shell_quote("it's"), "'it'\\\"'\\\"'s'"); + } + + #[test] + fn builds_the_xcodebuild_command_for_a_project_and_a_workspace() { + let project = RemoteMacProfile::xcodebuild_command( + &info(ProjectKind::XcodeProject), + RemoteAction::Build, + "", + "MyScheme", + "Debug", + ) + .unwrap(); + assert_eq!( + project, + "xcodebuild -project 'App.xcodeproj' -scheme 'MyScheme' -configuration 'Debug' build" + ); + + let workspace = RemoteMacProfile::xcodebuild_command( + &info(ProjectKind::XcodeWorkspace), + RemoteAction::Test, + "MyTarget", + "", + "Release", + ) + .unwrap(); + assert_eq!( + workspace, + "xcodebuild -workspace 'App.xcodeproj' -target 'MyTarget' -configuration 'Release' test" + ); + } + + #[test] + fn a_scheme_wins_over_a_target() { + let mut arguments = Vec::new(); + append_scheme_and_configuration(&mut arguments, "Target", "Scheme", ""); + assert_eq!(arguments, vec!["-scheme", "'Scheme'"]); + } +} diff --git a/src-tauri/src/builder/sdk.rs b/src-tauri/src/builder/sdk.rs index fec7bf9..de67119 100644 --- a/src-tauri/src/builder/sdk.rs +++ b/src-tauri/src/builder/sdk.rs @@ -8,7 +8,9 @@ use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use tauri::{AppHandle, Manager, Window}; -use crate::builder::crossplatform::{linux_path, linux_temp_dir, remove_dir_all, symlink}; +use crate::builder::crossplatform::{ + linux_path, linux_temp_dir, remove_dir_all, set_executable, symlink, +}; use crate::builder::swift::{validate_toolchain, SwiftBin}; use crate::operation::Operation; use tauri::path::BaseDirectory; @@ -24,7 +26,137 @@ use std::os::windows::process::CommandExt; #[cfg(target_os = "windows")] const CREATE_NO_WINDOW: u32 = 0x08000000; -const DARWIN_TOOLS_VERSION: &str = "1.0.1"; +/// Toolset release from https://github.com/xtool-org/darwin-tools-linux-llvm. +/// Keep in sync with xtool's `SDKBuilder.darwinToolsVersion`. +const DARWIN_TOOLS_VERSION: &str = "1.1.0"; + +/// Release from https://github.com/xtool-org/OpenAppleMacros, which provides +/// implementations for the macros that only exist in Apple's (macOS-only) +/// toolchain (SwiftUI/Previews/FoundationModels macros). +/// Keep in sync with xtool's `SDKBuilder.oamVersion`. +const OPEN_APPLE_MACROS_VERSION: &str = "1.3.0"; + +/// Keep in sync with xtool's `SDKBuilder.oamLibraries`. +const OPEN_APPLE_MACROS_LIBRARIES: [&str; 3] = [ + "FoundationModelsMacros", + "PreviewsMacros", + "SwiftUIMacros", +]; + +/// Bump this whenever the layout/content of the generated bundle changes, so +/// tools that cache a darwin SDK by this string rebuild it. +/// Mirrors xtool's `SDKBuilder.sdkEpoch`. +const SDK_EPOCH: u32 = 2; + +/// Linux architecture of the machine that the built SDK runs on (or of WSL, +/// when running on Windows). +fn toolset_arch() -> Result<&'static str, String> { + if cfg!(target_arch = "x86_64") { + Ok("x86_64") + } else if cfg!(target_arch = "aarch64") { + Ok("aarch64") + } else { + Err("Unsupported architecture".to_string()) + } +} + +/// Value written to `darwin-sdk-version.txt`. Same shape as xtool's +/// `SDKBuilder.currentSDKVersion`. +fn darwin_sdk_version() -> String { + format!( + "epoch={},darwinTools={},oam={}", + SDK_EPOCH, DARWIN_TOOLS_VERSION, OPEN_APPLE_MACROS_VERSION + ) +} + +/// lld has no `-r` (merge object files) mode, but SPM's SwiftBuild backend uses +/// it on Darwin. We therefore install a shell trampoline as `ld64.lld` that +/// redirects `-r` invocations to `llvm-lib` and forwards everything else to the +/// real linker (`bin/orig/ld64.lld`). Taken from xtool. +/// +/// Stored line by line so the generated script never inherits the line endings +/// of the checkout. +const LD64_TRAMPOLINE: &[&str] = &[ + "#!/bin/sh", + "", + "set -eu", + "", + "case \"$0\" in", + " */*) script_path=\"$0\" ;;", + " *) script_path=\"$(command -v \"$0\")\" ;;", + "esac", + "case \"$script_path\" in", + " /*) script_dir=\"${script_path%/*}\"; [ -n \"$script_dir\" ] || script_dir=\"/\" ;;", + " */*) script_dir=\"${script_path%/*}\" ;;", + " *) script_dir=\".\" ;;", + "esac", + "bin_dir=\"$(CDPATH= cd -P \"$script_dir\" && pwd -P)\"", + "", + "find_argument_value() {", + " argument_name=\"$1\"", + " shift", + "", + " while [ \"$#\" -gt 0 ]; do", + " if [ \"$1\" = \"$argument_name\" ]; then", + " shift", + " if [ \"$#\" -gt 0 ]; then", + " argument_value=\"$1\"", + " return 0", + " fi", + " return 1", + " fi", + " shift", + " done", + "", + " return 1", + "}", + "", + "relocatable=", + "for argument do", + " if [ \"$argument\" = \"-r\" ]; then", + " relocatable=1", + " fi", + "done", + "", + "if [ -n \"$relocatable\" ]; then", + " missing_argument=", + "", + " if find_argument_value -filelist \"$@\"; then", + " filelist=\"$argument_value\"", + " else", + " missing_argument=1", + " fi", + " if find_argument_value -dependency_info \"$@\"; then", + " dependency_info=\"$argument_value\"", + " else", + " missing_argument=1", + " fi", + " if find_argument_value -o \"$@\"; then", + " output=\"$argument_value\"", + " else", + " missing_argument=1", + " fi", + "", + " if [ -n \"$missing_argument\" ]; then", + " echo \"ld64.lld trampoline could not process arguments.\" >&2", + " echo \"Please file an issue at https://github.com/nab138/CrossCode/issues\" >&2", + " echo \" Arguments: $@\" >&2", + " exit 2", + " fi", + "", + " exec \"$bin_dir/llvm-lib\" -static \\", + " -filelist \"$filelist\" \\", + " -dependency_info \"$dependency_info\" \\", + " -o \"$output\"", + "fi", + "", + "exec \"$bin_dir/orig/ld64.lld\" \"$@\"", + "", +]; + +fn ld64_trampoline() -> String { + LD64_TRAMPOLINE.join("\n") +} #[tauri::command] pub async fn install_sdk_operation( @@ -129,6 +261,13 @@ async fn install_sdk_internal( op.move_on("create_stage", "install_toolset")?; op.fail_if_err("install_toolset", install_toolset(&output_dir).await)?; op.complete("install_toolset")?; + + // Apple's macro implementations only exist in the macOS toolchain, so we + // ship xtool's OpenAppleMacros server instead (see `install_macros`). + op.start("install_macros")?; + op.fail_if_err("install_macros", install_macros(&output_dir).await)?; + op.complete("install_macros")?; + let dev = install_developer(app, &output_dir, &xcode_path, is_dir, op).await?; op.start("write_metadata")?; @@ -163,8 +302,12 @@ async fn install_sdk_internal( \"linker\": { \"path\": \"ld64.lld\" }, + \"librarian\": { + \"path\": \"llvm-lib\" + }, \"swiftCompiler\": { \"extraCLIOptions\": [ + \"-Xfrontend\", \"-enable-cross-import-overlays\", \"-use-ld=lld\" ] } @@ -175,6 +318,26 @@ async fn install_sdk_internal( |e| format!("Failed to write toolset.json: {}", e), )?; + // Same toolset, but for the SwiftBuild build system: it derives the linker + // and librarian paths itself, so it must not be given extra compiler flags. + // It needs Swift 6.4+ (6.3 has bugs resolving those paths) — this is the + // toolset flavour xtool writes as `toolset-swb.json`. + let toolset_swb = "{ + \"schemaVersion\": \"1.0\", + \"rootPath\": \"toolset/bin\", + \"linker\": { + \"path\": \"ld64.lld\" + }, + \"librarian\": { + \"path\": \"llvm-lib\" + } +}"; + op.fail_if_err_map( + "write_metadata", + fs::write(output_dir.join("toolset-swb.json"), toolset_swb), + |e| format!("Failed to write toolset-swb.json: {}", e), + )?; + let sdk_def = SDKDefinition { schema_version: "4.0".to_string(), target_triples: HashMap::from([ @@ -218,7 +381,7 @@ async fn install_sdk_internal( let sdk_version_path = output_dir.join("darwin-sdk-version.txt"); op.fail_if_err_map( "write_metadata", - fs::write(&sdk_version_path, "develop"), + fs::write(&sdk_version_path, darwin_sdk_version()), |e| format!("Failed to write darwin-sdk-version.txt: {}", e), )?; op.move_on("write_metadata", "install_sdk")?; @@ -270,13 +433,7 @@ async fn install_toolset(output_path: &PathBuf) -> Result<(), String> { fs::create_dir_all(&toolset_dir) .map_err(|e| format!("Failed to create toolset directory: {}", e))?; - let arch = if cfg!(target_arch = "x86_64") { - "x86_64" - } else if cfg!(target_arch = "aarch64") { - "aarch64" - } else { - return Err("Unsupported architecture".to_string()); - }; + let arch = toolset_arch()?; let toolset_url = format!( "https://github.com/xtool-org/darwin-tools-linux-llvm/releases/download/v{}/toolset-{}.tar.gz", DARWIN_TOOLS_VERSION, arch @@ -296,6 +453,9 @@ async fn install_toolset(output_path: &PathBuf) -> Result<(), String> { archive .unpack(&toolset_dir) .map_err(|e| format!("Failed to extract toolset: {}", e))?; + + postprocess_toolset(&toolset_dir)?; + #[cfg(target_os = "windows")] { // I'm guessing this has to be done because I'm extracting the tar from windows into the wsl file system and windows doesn't play nice with permissions, but im too lazy to do this properly @@ -314,7 +474,83 @@ async fn install_toolset(output_path: &PathBuf) -> Result<(), String> { String::from_utf8_lossy(&output.stderr) )); } + // the glob above does not cover bin/orig + set_executable( + &toolset_dir + .join("bin/orig/ld64.lld") + .to_string_lossy() + .to_string(), + )?; } + + // the trampoline is written by us, so it never gets a mode from the archive + set_executable(&ld64_path(&toolset_dir).to_string_lossy().to_string())?; + Ok(()) +} + +fn ld64_path(toolset_dir: &PathBuf) -> PathBuf { + toolset_dir.join("bin").join("ld64.lld") +} + +/// Turn a freshly extracted toolset into one that works with SwiftPM and with +/// the SwiftBuild system: +/// * expose the bundled llvm archive tool under the name SwiftBuild expects +/// (it assumes an Apple-flavored librarian on Apple platforms, but accepts +/// an explicit `llvm-lib`), +/// * replace `ld64.lld` with the `-r` trampoline (the real linker is kept as +/// `bin/orig/ld64.lld`). +fn postprocess_toolset(toolset_dir: &PathBuf) -> Result<(), String> { + let bin = toolset_dir.join("bin"); + let libtool = bin.join("libtool"); + let llvm_lib = bin.join("llvm-lib"); + if libtool.exists() { + fs::rename(&libtool, &llvm_lib) + .map_err(|e| format!("Failed to rename toolset libtool: {}", e))?; + } else if !llvm_lib.exists() { + return Err("Toolset is missing bin/libtool".to_string()); + } + + let ld64 = ld64_path(toolset_dir); + let orig_bins = bin.join("orig"); + let orig_ld64 = orig_bins.join("ld64.lld"); + fs::create_dir_all(&orig_bins) + .map_err(|e| format!("Failed to create toolset bin/orig: {}", e))?; + fs::rename(&ld64, &orig_ld64) + .map_err(|e| format!("Failed to move toolset ld64.lld: {}", e))?; + fs::write(&ld64, ld64_trampoline()) + .map_err(|e| format!("Failed to write ld64.lld trampoline: {}", e))?; + Ok(()) +} + +/// Downloads and installs xtool's OpenAppleMacros server into the bundle root. +/// It is what Apple's `*Macros` modules resolve to on Linux: per-platform +/// symlinks created in `install_developer` hand it to swiftc as the plugin +/// server. +async fn install_macros(output_path: &PathBuf) -> Result<(), String> { + let arch = toolset_arch()?; + let url = format!( + "https://github.com/xtool-org/OpenAppleMacros/releases/download/v{}/OpenAppleMacrosServer-{}", + OPEN_APPLE_MACROS_VERSION, arch + ); + + let response = reqwest::get(&url) + .await + .map_err(|e| format!("Failed to download OpenAppleMacros: {}", e))?; + if !response.status().is_success() { + return Err(format!( + "Failed to download OpenAppleMacros: {}", + response.status() + )); + } + let binary = response + .bytes() + .await + .map_err(|e| format!("Failed to read OpenAppleMacros response: {}", e))?; + + let server_path = output_path.join("OpenAppleMacrosServer"); + fs::write(&server_path, &binary) + .map_err(|e| format!("Failed to write OpenAppleMacrosServer: {}", e))?; + set_executable(&server_path.to_string_lossy().to_string())?; Ok(()) } @@ -484,6 +720,73 @@ async fn install_developer( }, )?; } + + // Point the platform's plugin server at the OpenAppleMacros server we + // installed in the bundle root, so Apple's macro modules resolve. + let platform_dir = dev.join(format!("Platforms/{}.platform", platform)); + let plugin_bin = platform_dir.join("Developer/usr/bin"); + op.fail_if_err_map("copy_files", fs::create_dir_all(&plugin_bin), |e| { + format!("Failed to create {:?}: {}", plugin_bin, e) + })?; + let plugin_server = plugin_bin.join("swift-plugin-server"); + if fs::symlink_metadata(&plugin_server).is_ok() { + op.fail_if_err_map("copy_files", fs::remove_file(&plugin_server), |e| { + format!("Failed to remove {:?}: {}", plugin_server, e) + })?; + } + op.fail_if_err_map( + "copy_files", + symlink( + "../../../../../../OpenAppleMacrosServer", + &plugin_server.to_string_lossy().to_string(), + ), + |e| format!("Failed to create {:?}: {}", plugin_server, e), + )?; + + let host_dir = platform_dir.join("Developer/usr/lib/swift/host"); + let plugins_dir = host_dir.join("plugins"); + if fs::symlink_metadata(&plugins_dir).is_ok() { + let is_symlink = fs::symlink_metadata(&plugins_dir) + .map(|m| m.file_type().is_symlink()) + .unwrap_or(false); + let removed = if is_symlink { + fs::remove_file(&plugins_dir).map_err(|e| e.to_string()) + } else { + remove_dir_all(&plugins_dir) + }; + op.fail_if_err_map("copy_files", removed, |e| { + format!("Failed to remove {:?}: {}", plugins_dir, e) + })?; + } + + if platform == "iPhoneSimulator" { + // The simulator platform ships no plugins of its own, so mirror the + // device ones. + op.fail_if_err_map("copy_files", fs::create_dir_all(&host_dir), |e| { + format!("Failed to create {:?}: {}", host_dir, e) + })?; + op.fail_if_err_map( + "copy_files", + symlink( + "../../../../../../iPhoneOS.platform/Developer/usr/lib/swift/host/plugins", + &plugins_dir.to_string_lossy().to_string(), + ), + |e| format!("Failed to create {:?}: {}", plugins_dir, e), + )?; + } else { + // Empty stubs: they only need to exist so that swiftc believes the + // modules are supported. The real implementations live in the + // macro server. + op.fail_if_err_map("copy_files", fs::create_dir_all(&plugins_dir), |e| { + format!("Failed to create {:?}: {}", plugins_dir, e) + })?; + for library in OPEN_APPLE_MACROS_LIBRARIES { + let stub = plugins_dir.join(format!("lib{}.so", library)); + op.fail_if_err_map("copy_files", fs::write(&stub, b""), |e| { + format!("Failed to create {:?}: {}", stub, e) + })?; + } + } } op.complete("copy_files")?; diff --git a/src-tauri/src/lsp_utils.rs b/src-tauri/src/lsp_utils.rs index b05e4bf..1feb10d 100644 --- a/src-tauri/src/lsp_utils.rs +++ b/src-tauri/src/lsp_utils.rs @@ -1,8 +1,13 @@ -use std::path::PathBuf; +use std::{path::PathBuf, process::Command}; use sysinfo::System; +use tauri::Emitter; -use crate::builder::config::{ProjectConfig, ProjectValidation}; +use crate::builder::{ + config::{ProjectConfig, ProjectInfo, ProjectKind, ProjectValidation}, + remote::{remote_project_command, shell_quote, RemoteAction, RemoteMacProfile}, + swift::{pipe_command, SwiftBin}, +}; #[tauri::command] pub fn has_limited_ram() -> bool { @@ -17,6 +22,278 @@ pub fn validate_project(project_path: String, toolchain_path: String) -> Project ProjectConfig::validate(PathBuf::from(project_path), &toolchain_path) } +#[tauri::command] +pub fn detect_project(project_path: String) -> Result { + ProjectInfo::detect(PathBuf::from(project_path)) +} + +#[tauri::command] +pub async fn build_project( + window: tauri::Window, + project_path: String, + toolchain_path: String, + target: String, + scheme: String, + configuration: String, + remote_mac: Option, +) -> Result<(), String> { + let root = PathBuf::from(&project_path); + let info = ProjectInfo::detect(root.clone())?; + let build_root = PathBuf::from(&info.build_root); + + if let Some(profile) = remote_mac.as_ref().filter(|profile| profile.enabled) { + let mut xcodebuild = RemoteMacProfile::xcodebuild_command( + &info, + RemoteAction::Build, + &target, + &scheme, + &configuration, + )?; + append_remote_options(profile, &mut xcodebuild); + window + .emit( + "build-output", + format!("Building on remote Mac {}@{}...", profile.user, profile.host), + ) + .map_err(|error| error.to_string())?; + return run_remote(&window, profile, &xcodebuild).await; + } + + let mut command = match info.kind { + ProjectKind::CrosscodePackage | ProjectKind::SwiftPackage => { + let swift = SwiftBin::new(&toolchain_path)?; + let mut command = swift.command(); + command.arg("build"); + if !target.trim().is_empty() { + command.arg("--target").arg(&target); + } + if configuration.eq_ignore_ascii_case("release") { + command.arg("-c").arg("release"); + } + command.current_dir(&build_root); + command + } + ProjectKind::XcodeProject => { + let entry = info.entry_point.ok_or("Xcode project entry point is missing")?; + let mut command = Command::new("xcodebuild"); + command.arg("-project").arg(&entry); + append_xcode_selection(&mut command, &target, &scheme, &configuration); + command.arg("build").current_dir(&build_root); + command + } + ProjectKind::XcodeWorkspace => { + let entry = info.entry_point.ok_or("Xcode workspace entry point is missing")?; + let mut command = Command::new("xcodebuild"); + command.arg("-workspace").arg(&entry); + append_xcode_selection(&mut command, &target, &scheme, &configuration); + command.arg("build").current_dir(root); + command + } + ProjectKind::CocoaPods => { + let mut command = Command::new("pod"); + command.args(["install"]).current_dir(&build_root); + command + } + ProjectKind::Tuist => { + let mut command = Command::new("tuist"); + command.args(["generate", "--no-open"]).current_dir(&build_root); + command + } + ProjectKind::XcodeGen => { + let mut command = Command::new("xcodegen"); + command.args(["generate"]).current_dir(&build_root); + command + } + ProjectKind::Make => { + let mut command = Command::new("make"); + command.current_dir(&build_root); + command + } + ProjectKind::Bazel => { + let mut command = Command::new("bazel"); + command.args(["build", "//..."]).current_dir(&build_root); + command + } + ProjectKind::CMake => { + let mut command = Command::new("cmake"); + command.args(["--build", "build"]).current_dir(&build_root); + command + } + ProjectKind::Fastlane => { + let mut command = Command::new("fastlane"); + command.args(["build"]).current_dir(&build_root); + command + } + ProjectKind::Unknown => { + return Err("Crosscode could not identify a supported project build system".to_string()) + } + }; + + window + .emit("build-output", format!("Building {:?} project...", info.kind)) + .map_err(|error| error.to_string())?; + pipe_command(&mut command, &window, true).await +} + +#[tauri::command] +pub async fn test_project( + window: tauri::Window, + project_path: String, + toolchain_path: String, + target: String, + scheme: String, + configuration: String, + remote_mac: Option, +) -> Result<(), String> { + let root = PathBuf::from(&project_path); + let info = ProjectInfo::detect(root.clone())?; + let build_root = PathBuf::from(&info.build_root); + + if matches!(info.kind, ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace) + && scheme.trim().is_empty() + { + return Err("Select a shared Xcode scheme before running tests".to_string()); + } + + if let Some(profile) = remote_mac.as_ref().filter(|profile| profile.enabled) { + let mut xcodebuild = RemoteMacProfile::xcodebuild_command( + &info, + RemoteAction::Test, + &target, + &scheme, + &configuration, + )?; + append_remote_options(profile, &mut xcodebuild); + window + .emit( + "build-output", + format!("Testing on remote Mac {}@{}...", profile.user, profile.host), + ) + .map_err(|error| error.to_string())?; + return run_remote(&window, profile, &xcodebuild).await; + } + + let mut command = match info.kind { + ProjectKind::CrosscodePackage | ProjectKind::SwiftPackage => { + let swift = SwiftBin::new(&toolchain_path)?; + let mut command = swift.command(); + command.arg("test"); + if configuration.eq_ignore_ascii_case("release") { + command.arg("-c").arg("release"); + } + command.current_dir(&build_root); + command + } + ProjectKind::XcodeProject | ProjectKind::XcodeWorkspace => { + let entry = info.entry_point.ok_or("Xcode project entry point is missing")?; + let mut command = Command::new("xcodebuild"); + if matches!(info.kind, ProjectKind::XcodeProject) { + command.arg("-project"); + } else { + command.arg("-workspace"); + } + command.arg(entry); + append_xcode_selection(&mut command, &target, &scheme, &configuration); + command.arg("test").current_dir(&build_root); + command + } + ProjectKind::Tuist => { + let mut command = Command::new("tuist"); + command.arg("test"); + if !scheme.trim().is_empty() { + command.arg(&scheme); + } + command.current_dir(&build_root); + command + } + ProjectKind::XcodeGen => { + return Err("XcodeGen tests require a generated Xcode project and scheme".to_string()) + } + ProjectKind::Make => { + let mut command = Command::new("make"); + command.arg("test").current_dir(&build_root); + command + } + ProjectKind::Bazel => { + let mut command = Command::new("bazel"); + command.args(["test", "//..."]).current_dir(&build_root); + command + } + ProjectKind::CMake => { + let mut command = Command::new("ctest"); + command.args(["--test-dir", "build"]).current_dir(&build_root); + command + } + ProjectKind::Fastlane => { + let mut command = Command::new("fastlane"); + command.args(["test"]).current_dir(&build_root); + command + } + ProjectKind::CocoaPods => { + return Err("CocoaPods itself has no test command. Open its generated Xcode workspace to run tests.".to_string()) + } + ProjectKind::Unknown => return Err("Crosscode could not identify a supported test system".to_string()), + }; + + window + .emit("build-output", format!("Testing {:?} project...", info.kind)) + .map_err(|error| error.to_string())?; + pipe_command(&mut command, &window, true).await +} + +fn append_xcode_selection(command: &mut Command, target: &str, scheme: &str, configuration: &str) { + if !scheme.trim().is_empty() { + command.arg("-scheme").arg(scheme); + } else if !target.trim().is_empty() { + command.arg("-target").arg(target); + } + if !configuration.trim().is_empty() { + command.arg("-configuration").arg(configuration); + } +} + + +#[tauri::command] +pub async fn test_remote_mac(window: tauri::Window, remote_mac: RemoteMacProfile) -> Result<(), String> { + window + .emit( + "build-output", + format!( + "Testing remote Mac {}@{}...", + remote_mac.user, remote_mac.host + ), + ) + .map_err(|error| error.to_string())?; + crate::builder::remote::test_connection(&window, &remote_mac).await +} + +/// Adds the destination and result bundle flags a profile may carry. +fn append_remote_options(profile: &RemoteMacProfile, command: &mut String) { + if let Some(destination) = profile.destination.as_deref() { + if !destination.trim().is_empty() { + command.push_str(&format!(" -destination {}", shell_quote(destination.trim()))); + } + } + if let Some(bundle) = profile.result_bundle_path.as_deref() { + if !bundle.trim().is_empty() { + command.push_str(&format!(" -resultBundlePath {}", shell_quote(bundle.trim()))); + } + } +} + +/// Runs a prepared `xcodebuild` invocation in the remote project directory. +async fn run_remote( + window: &tauri::Window, + profile: &RemoteMacProfile, + xcodebuild: &str, +) -> Result<(), String> { + profile.validate()?; + profile.validate_identity_file()?; + let mut command = profile.ssh_command(); + command.arg(remote_project_command(profile, xcodebuild)); + pipe_command(&mut command, window, true).await +} + // #[tauri::command] // pub fn ensure_lsp_config(project_path: String) -> Result<(), String> { // let project_path = PathBuf::from(project_path); @@ -32,7 +309,7 @@ pub fn validate_project(project_path: String, toolchain_path: String) -> Project // let config_path = project_path.join(".sourcekit-lsp").join("config.json"); // if !config_path.exists() { // fs::write(config_path, "{ -// \"$schema\": \"https://raw.githubusercontent.com/swiftlang/sourcekit-lsp/refs/heads/release/6.2/config.schema.json\", +// \"$schema\": \"https://raw.githubusercontent.com/swiftlang/sourcekit-lsp/refs/heads/release/6.4/config.schema.json\", // \"swiftPM\": { // \"swiftSDK\": \"arm64-apple-ios\" // } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 68b0347..c19d4d1 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -14,6 +14,7 @@ mod sideloader; mod sourcekit_lsp; #[macro_use] mod lsp_utils; +mod xcode; use builder::crossplatform::{linux_path, windows_path}; use builder::icon::import_icon; @@ -22,7 +23,7 @@ use builder::swift::{ build_swift, clean_swift, deploy_swift, get_swiftly_toolchains, get_toolchain_info, has_darwin_sdk, validate_toolchain, }; -use lsp_utils::{has_limited_ram, validate_project}; +use lsp_utils::{build_project, detect_project, has_limited_ram, test_project, test_remote_mac, validate_project}; use serde_json::Value; use sideloader::{ apple_commands::{ @@ -36,6 +37,7 @@ use sideloader::{ syslog::{is_streaming_syslog, start_stream_syslog, stop_stream_syslog, SyslogStream}, }; use sourcekit_lsp::{get_server_status, start_sourcekit_server, stop_sourcekit_server}; +use xcode::{apply_xcode_import, list_swift_packages}; use std::sync::Arc; use tauri::Emitter; use tauri::Manager; @@ -77,31 +79,42 @@ fn main() { Ok(matches) => { if let Some(arg) = matches.args.get("showMainWindow") { if arg.value == Value::Bool(true) { - let window = app.get_webview_window("main").unwrap(); - window.show().unwrap(); + let window = app + .get_webview_window("main") + .ok_or_else(|| "Main window is unavailable".to_string())?; + window.show().map_err(|error| error.to_string())?; + #[cfg(debug_assertions)] window.open_devtools(); } } } - Err(_) => {} + Err(error) => eprintln!("Failed to parse CLI arguments: {error}"), } - let store = app.store("preferences.json")?; - - let open_last = if store.has("general/startup") { - store.get("general/startup").unwrap().as_str().unwrap() == "open-last" - } else { - true + let store = match app.store("preferences.json") { + Ok(store) => store, + Err(error) => { + eprintln!("Failed to load preferences: {error}"); + return Ok(()); + } }; + let open_last = store + .get("general/startup") + .and_then(|value| value.as_str().map(|value| value == "open-last")) + .unwrap_or(true); + if open_last { if let Some(last_project) = store.get("last-opened-project") { if last_project.is_string() { - let path = last_project.as_str().unwrap(); - let url_str = format!("/ide/{}", path); + let path = last_project.as_str().unwrap_or_default(); + let path_json = serde_json::to_string(path) + .map_err(|error| format!("Failed to encode project path: {error}"))?; app.get_webview_window("main") - .unwrap() - .eval(&format!("window.location.replace('{}')", url_str))?; + .ok_or_else(|| "Main window is unavailable".to_string())? + .eval(&format!( + "window.location.replace('/ide/' + encodeURIComponent({path_json}))" + ))?; } } } @@ -141,6 +154,10 @@ fn main() { get_server_status, has_limited_ram, validate_project, + detect_project, + build_project, + test_project, + test_remote_mac, linux_path, windows_path, start_stream_syslog, @@ -155,6 +172,8 @@ fn main() { is_ddi_mounted, mount_ddi, take_screenshot, + apply_xcode_import, + list_swift_packages, ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); @@ -168,6 +187,17 @@ pub fn emit_error_and_return(window: &tauri::Window, msg: &str) -> Result Result<(), String> { - app.get_webview_window("main").unwrap().open_devtools(); - Ok(()) + #[cfg(debug_assertions)] + { + let window = app + .get_webview_window("main") + .ok_or_else(|| "Main window is unavailable".to_string())?; + window.open_devtools(); + Ok(()) + } + #[cfg(not(debug_assertions))] + { + let _ = app; + Err("Developer tools are disabled in production builds".to_string()) + } } diff --git a/src-tauri/src/templates.rs b/src-tauri/src/templates.rs index 8ce4149..9b34abc 100644 --- a/src-tauri/src/templates.rs +++ b/src-tauri/src/templates.rs @@ -4,6 +4,15 @@ use dircpy::CopyBuilder; use tauri::{AppHandle, Manager}; use tauri_plugin_dialog::DialogExt; +fn has_path_traversal(path: &str) -> bool { + std::path::Path::new(path).components().any(|component| { + matches!( + component, + std::path::Component::ParentDir | std::path::Component::RootDir | std::path::Component::Prefix(_) + ) + }) +} + #[tauri::command] pub async fn create_template( app: AppHandle, @@ -11,11 +20,17 @@ pub async fn create_template( name: String, parameters: HashMap, ) -> Result { + if has_path_traversal(&template) || has_path_traversal(&name) { + return Err("Template and project names must be relative names".to_string()); + } let template_dir = app .path() .resolve("templates", tauri::path::BaseDirectory::Resource) .map_err(|e| format!("Failed to resolve template directory: {}", e))?; let template_path = template_dir.join(&template); + if !template_path.starts_with(&template_dir) { + return Err("Template path escapes the bundled templates directory".to_string()); + } if !template_path.exists() { return Err(format!("Template '{}' does not exist", template)); } @@ -28,7 +43,13 @@ pub async fn create_template( return Err("No folder selected".to_string()); } let file_path = file_path.unwrap(); - let target_path = file_path.as_path().unwrap().join(&name); + let selected_path = file_path + .as_path() + .ok_or_else(|| "Selected location is not a local folder".to_string())?; + let target_path = selected_path.join(&name); + if !target_path.starts_with(selected_path) { + return Err("Project path escapes the selected folder".to_string()); + } if target_path.exists() { return Err(format!( "Target path '{}' already exists", @@ -59,6 +80,7 @@ pub async fn create_template( let mut content = std::fs::read(path) .map_err(|e| format!("Failed to read file '{}': {}", path.display(), e))?; + let mut current_path = path.to_path_buf(); let mut filename = path .file_name() .map(|s| s.to_string_lossy().to_string()) @@ -67,10 +89,11 @@ pub async fn create_template( for (key, value) in ¶meters { if filename.contains(&format!("{{{{{}}}}}", key)) { filename = filename.replace(&format!("{{{{{}}}}}", key), value); - let new_path = path.with_file_name(&filename); - std::fs::rename(path, &new_path).map_err(|e| { - format!("Failed to rename file '{}': {}", path.display(), e) + let new_path = current_path.with_file_name(&filename); + std::fs::rename(¤t_path, &new_path).map_err(|e| { + format!("Failed to rename file '{}': {}", current_path.display(), e) })?; + current_path = new_path; } } @@ -84,7 +107,7 @@ pub async fn create_template( continue; } - let final_path = path.with_file_name(&filename); + let final_path = current_path; std::fs::write(&final_path, content) .map_err(|e| format!("Failed to write file '{}': {}", path.display(), e))?; } diff --git a/src-tauri/src/xcode.rs b/src-tauri/src/xcode.rs new file mode 100644 index 0000000..16e99a9 --- /dev/null +++ b/src-tauri/src/xcode.rs @@ -0,0 +1,276 @@ +// Support code for importing Xcode projects and for browsing the Swift +// packages of a workspace. +// +// The interesting part of the import (parsing `project.pbxproj` and building +// the plan) lives in the frontend: this module only applies the resulting plan +// to disk and lists SwiftPM packages/targets. + +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::{Path, PathBuf}; +use walkdir::WalkDir; + +use crate::builder::swift::SwiftBin; + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ImportFile { + /// Package relative path, using "/" separators. + pub path: String, + pub contents: String, +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ImportCopy { + /// Absolute source path. + pub from: String, + pub to: String, +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ImportReport { + pub package_dir: String, + pub written: Vec, + pub copied: Vec, + pub skipped: Vec, +} + +/// Configuration files CrossCode owns: they are only written when the caller +/// explicitly allows replacing them. +const CONFIG_FILES: [&str; 2] = ["Package.swift", "crosscode.toml"]; + +fn join_relative(base: &Path, relative: &str) -> PathBuf { + let mut path = base.to_path_buf(); + for part in relative.split('/').filter(|part| !part.is_empty() && *part != ".") { + path.push(part); + } + path +} + +fn write_parents(path: &Path) -> Result<(), String> { + if let Some(parent) = path.parent() { + fs::create_dir_all(parent) + .map_err(|e| format!("Failed to create {}: {}", parent.display(), e))?; + } + Ok(()) +} + +/// Writes the files of an import plan and copies the resources it references. +#[tauri::command] +pub fn apply_xcode_import( + package_root: String, + files: Vec, + copies: Vec, + overwrite: bool, +) -> Result { + if package_root.trim().is_empty() { + return Err("No destination folder was selected".to_string()); + } + let package_dir = PathBuf::from(&package_root); + fs::create_dir_all(&package_dir) + .map_err(|e| format!("Failed to create {}: {}", package_dir.display(), e))?; + + if !overwrite { + let conflicts: Vec = CONFIG_FILES + .iter() + .filter(|name| package_dir.join(*name).exists()) + .map(|name| name.to_string()) + .collect(); + if !conflicts.is_empty() { + return Err(format!( + "{} already exist in {}. Enable \"overwrite\" to replace them.", + conflicts.join(" and "), + package_dir.display() + )); + } + } + + let mut written = Vec::new(); + let mut skipped = Vec::new(); + + for file in &files { + let target = join_relative(&package_dir, &file.path); + let is_config = CONFIG_FILES.iter().any(|name| *name == file.path); + if target.exists() && !is_config { + // e.g. an Info.plist the project already has: keep the user's file + skipped.push(format!("{} (already exists)", file.path)); + continue; + } + write_parents(&target)?; + fs::write(&target, &file.contents) + .map_err(|e| format!("Failed to write {}: {}", target.display(), e))?; + written.push(file.path.clone()); + } + + let mut copied = Vec::new(); + for copy in &copies { + let source = PathBuf::from(©.from); + if !source.is_file() { + skipped.push(format!("{} (not found)", copy.from)); + continue; + } + let target = join_relative(&package_dir, ©.to); + write_parents(&target)?; + fs::copy(&source, &target).map_err(|e| { + format!( + "Failed to copy {} to {}: {}", + source.display(), + target.display(), + e + ) + })?; + copied.push(copy.to.clone()); + } + + Ok(ImportReport { + package_dir: package_dir.to_string_lossy().to_string(), + written, + copied, + skipped, + }) +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PackageTargetInfo { + pub name: String, + /// "regular", "executable", "test", ... + pub kind: String, + /// Package relative directory the target's sources live in. + pub path: String, + pub is_test: bool, +} + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PackageInfo { + pub name: String, + pub path: String, + pub targets: Vec, + pub error: Option, +} + +/// SwiftPM's default source directories, used when a target does not declare a +/// custom `path`. +fn default_target_path(name: &str, kind: &str) -> String { + if kind == "test" { + format!("Tests/{}", name) + } else { + format!("Sources/{}", name) + } +} + +fn dump_package(swift: &SwiftBin, package_dir: &Path) -> Result, String> { + let output = swift + .command() + .arg("package") + .arg("dump-package") + .current_dir(package_dir) + .output() + .map_err(|e| format!("Failed to run swift: {}", e))?; + if !output.status.success() { + return Err(String::from_utf8_lossy(&output.stderr).trim().to_string()); + } + + let manifest: serde_json::Value = serde_json::from_slice(&output.stdout) + .map_err(|e| format!("Failed to parse the package manifest: {}", e))?; + let mut targets = Vec::new(); + if let Some(list) = manifest.get("targets").and_then(|value| value.as_array()) { + for target in list { + let name = target + .get("name") + .and_then(|value| value.as_str()) + .unwrap_or_default() + .to_string(); + if name.is_empty() { + continue; + } + let kind = target + .get("type") + .and_then(|value| value.as_str()) + .unwrap_or("regular") + .to_string(); + let path = target + .get("path") + .and_then(|value| value.as_str()) + .map(|value| value.to_string()) + .unwrap_or_else(|| default_target_path(&name, &kind)); + let is_test = kind == "test"; + targets.push(PackageTargetInfo { + name, + kind, + path, + is_test, + }); + } + } + Ok(targets) +} + +fn is_hidden(path: &Path) -> bool { + path.components().any(|component| { + let name = component.as_os_str().to_string_lossy(); + let name = name.as_ref(); + name == ".build" + || name == ".git" + || name == ".crosscode" + || name == "node_modules" + || name == "DerivedData" + }) +} + +/// Finds the SwiftPM packages below `root_path` and reports their targets, so +/// the UI builder can write into the package and target the user selects. +#[tauri::command] +pub fn list_swift_packages( + root_path: String, + toolchain_path: String, +) -> Result, String> { + let root = PathBuf::from(&root_path); + if !root.is_dir() { + return Err(format!("{} is not a directory", root.display())); + } + let swift = SwiftBin::new(&toolchain_path)?; + + let mut directories: Vec = Vec::new(); + for entry in WalkDir::new(&root) + .max_depth(4) + .follow_links(false) + .into_iter() + .filter_entry(|entry| !is_hidden(entry.path())) + .filter_map(|entry| entry.ok()) + { + if entry.file_type().is_file() && entry.file_name() == "Package.swift" { + if let Some(parent) = entry.path().parent() { + directories.push(parent.to_path_buf()); + } + } + if directories.len() >= 20 { + break; + } + } + directories.sort(); + directories.dedup(); + + let mut packages = Vec::new(); + for directory in directories { + let name = directory + .file_name() + .map(|name| name.to_string_lossy().to_string()) + .unwrap_or_default(); + let (targets, error) = match dump_package(&swift, &directory) { + Ok(targets) => (targets, None), + Err(message) => (Vec::new(), Some(message)), + }; + packages.push(PackageInfo { + name, + path: directory.to_string_lossy().to_string(), + targets, + error, + }); + } + + Ok(packages) +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 928d5fc..4fe4b8d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,17 +8,8 @@ "bundle": { "active": true, "targets": "all", - "resources": [ - "templates", - "cpio" - ], - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ], + "resources": ["templates", "cpio"], + "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"], "createUpdaterArtifacts": true }, "productName": "CrossCode", @@ -26,51 +17,20 @@ "version": "0.0.5", "identifier": "me.nabdev.crosscode", "plugins": { - "fs": { - "requireLiteralLeadingDot": false - }, - "cli": { - "args": [ - { - "name": "showMainWindow" - } - ] - }, + "fs": { "requireLiteralLeadingDot": false }, + "cli": { "args": [{ "name": "showMainWindow" }] }, "updater": { "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDZFOEM1NUQyOEUzNDc5MTcKUldRWGVUU08wbFdNYmg1MHM0S3p2c2x1OFZKVnN0NXNVSDMvakExMFZnMnczamxIVGdjNGY4Mm4K", - "endpoints": [ - "https://github.com/nab138/CrossCode/releases/latest/download/latest.json" - ] + "endpoints": ["https://github.com/R0GUEEE/CrossCode/releases/latest/download/latest.json"] } }, "app": { "security": { - "csp": null + "csp": "default-src 'self' ipc: http://ipc.localhost; connect-src 'self' ipc: http://ipc.localhost ws: wss:; img-src 'self' asset: http://asset.localhost data: blob:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-eval' blob:; worker-src 'self' blob:" }, "windows": [ - { - "title": "CrossCode", - "label": "main", - "width": 1000, - "height": 700, - "useHttpsScheme": true, - "visible": false, - "url": "/" - }, - { - "title": "CrossCode (Loading)", - "label": "splashscreen", - "url": "/splash.html", - "width": 200, - "height": 250, - "resizable": false, - "decorations": false, - "fullscreen": false, - "visible": true, - "center": true, - "focus": true, - "backgroundColor": "#171a1c" - } + {"title":"CrossCode","label":"main","width":1000,"height":700,"useHttpsScheme":true,"visible":false,"url":"/"}, + {"title":"CrossCode (Loading)","label":"splashscreen","url":"/splash.html","width":200,"height":250,"resizable":false,"decorations":false,"fullscreen":false,"visible":true,"center":true,"focus":true,"backgroundColor":"#171a1c"} ] } } \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/.buildSystem_debug b/src-tauri/templates/swiftui/.build/.buildSystem_debug new file mode 100644 index 0000000..c337257 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/.buildSystem_debug @@ -0,0 +1 @@ +swiftbuild \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/.lock b/src-tauri/templates/swiftui/.build/.lock new file mode 100644 index 0000000..60a7b6d --- /dev/null +++ b/src-tauri/templates/swiftui/.build/.lock @@ -0,0 +1 @@ +6564 \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/CACHEDIR.TAG b/src-tauri/templates/swiftui/.build/CACHEDIR.TAG new file mode 100644 index 0000000..b7ab0d8 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/CACHEDIR.TAG @@ -0,0 +1,4 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by (Swift Package Manager). +# For information about cache directory tags, see: +#. http://www.brynosaurus.com/cachedir/ \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/.buildSystem_debug b/src-tauri/templates/swiftui/.build/index-build/.buildSystem_debug new file mode 100644 index 0000000..9b01495 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/.buildSystem_debug @@ -0,0 +1 @@ +native \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/.lock b/src-tauri/templates/swiftui/.build/index-build/.lock new file mode 100644 index 0000000..f1c21df --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/.lock @@ -0,0 +1 @@ +8372 \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/CACHEDIR.TAG b/src-tauri/templates/swiftui/.build/index-build/CACHEDIR.TAG new file mode 100644 index 0000000..b7ab0d8 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/CACHEDIR.TAG @@ -0,0 +1,4 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by (Swift Package Manager). +# For information about cache directory tags, see: +#. http://www.brynosaurus.com/cachedir/ \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/build.db b/src-tauri/templates/swiftui/.build/index-build/build.db new file mode 100644 index 0000000..e29aabb Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/build.db differ diff --git a/src-tauri/templates/swiftui/.build/index-build/debug b/src-tauri/templates/swiftui/.build/index-build/debug new file mode 120000 index 0000000..58f4a60 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/debug @@ -0,0 +1 @@ +x86_64-unknown-windows-msvc/debug \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/debug.yaml b/src-tauri/templates/swiftui/.build/index-build/debug.yaml new file mode 100644 index 0000000..7efa66c --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/debug.yaml @@ -0,0 +1,47 @@ +client: + name: basic + file-system: device-agnostic +tools: {} +targets: + "PackageStructure": [""] + "main": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "test": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "{{projectName}}-x86_64-unknown-windows-msvc-debug.module": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] +default: "main" +nodes: + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources/": + is-directory-structure: true + content-exclusion-patterns: [".git",".build"] +commands: + "<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>": + tool: phony + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + outputs: ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module": + tool: shell + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + description: "Compiling Swift Module '__projectName__' (2 sources)" + args: ["D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe","-module-name","__projectName__","-emit-dependencies","-emit-module","-emit-module-path","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule","-output-file-map","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json","-incremental","@D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources","-I","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules","-target","x86_64-unknown-windows-msvc","-incremental","-enable-batch-mode","-serialize-diagnostics","-Onone","-enable-testing","-j8","-DSWIFT_PACKAGE","-DDEBUG","-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE","-module-cache-path","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache","-parseable-output","-Xfrontend","-entry-point-function-name","-Xfrontend","__projectName___main","-static","-swift-version","6","-Xfrontend","-experimental-lazy-typecheck","-Xfrontend","-experimental-skip-all-function-bodies","-Xfrontend","-experimental-allow-module-with-compiler-errors","-Xfrontend","-empty-abi-descriptor","-sdk","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk","-libc","MD","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-use-ld=lld","-g","-use-ld=lld","-Xcc","-D_MT","-Xcc","-D_DLL","-Xcc","-Xclang","-Xcc","--dependent-lib=msvcrt","-Xcc","-gdwarf","-package-name","swiftui"] + + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources": + tool: write-auxiliary-file + inputs: ["","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt": + tool: write-auxiliary-file + inputs: ["","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt"] + always-out-of-date: "true" + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + + "PackageStructure": + tool: package-structure-tool + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources/","D:\\crosscode\\src-tauri\\templates\\swiftui\\Package.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Package.resolved"] + outputs: [""] + description: "Planning build" + allow-missing-inputs: true + diff --git a/src-tauri/templates/swiftui/.build/index-build/plugin-tools.yaml b/src-tauri/templates/swiftui/.build/index-build/plugin-tools.yaml new file mode 100644 index 0000000..7efa66c --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/plugin-tools.yaml @@ -0,0 +1,47 @@ +client: + name: basic + file-system: device-agnostic +tools: {} +targets: + "PackageStructure": [""] + "main": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "test": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "{{projectName}}-x86_64-unknown-windows-msvc-debug.module": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] +default: "main" +nodes: + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources/": + is-directory-structure: true + content-exclusion-patterns: [".git",".build"] +commands: + "<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>": + tool: phony + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + outputs: ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module": + tool: shell + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + description: "Compiling Swift Module '__projectName__' (2 sources)" + args: ["D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe","-module-name","__projectName__","-emit-dependencies","-emit-module","-emit-module-path","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule","-output-file-map","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json","-incremental","@D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources","-I","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules","-target","x86_64-unknown-windows-msvc","-incremental","-enable-batch-mode","-serialize-diagnostics","-Onone","-enable-testing","-j8","-DSWIFT_PACKAGE","-DDEBUG","-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE","-module-cache-path","D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache","-parseable-output","-Xfrontend","-entry-point-function-name","-Xfrontend","__projectName___main","-static","-swift-version","6","-Xfrontend","-experimental-lazy-typecheck","-Xfrontend","-experimental-skip-all-function-bodies","-Xfrontend","-experimental-allow-module-with-compiler-errors","-Xfrontend","-empty-abi-descriptor","-sdk","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk","-libc","MD","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-use-ld=lld","-g","-use-ld=lld","-Xcc","-D_MT","-Xcc","-D_DLL","-Xcc","-Xclang","-Xcc","--dependent-lib=msvcrt","-Xcc","-gdwarf","-package-name","swiftui"] + + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources": + tool: write-auxiliary-file + inputs: ["","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt": + tool: write-auxiliary-file + inputs: ["","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt"] + always-out-of-date: "true" + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + + "PackageStructure": + tool: package-structure-tool + inputs: ["D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources/","D:\\crosscode\\src-tauri\\templates\\swiftui\\Package.swift","D:\\crosscode\\src-tauri\\templates\\swiftui\\Package.resolved"] + outputs: [""] + description: "Planning build" + allow-missing-inputs: true + diff --git a/src-tauri/templates/swiftui/.build/index-build/workspace-state.json b/src-tauri/templates/swiftui/.build/index-build/workspace-state.json new file mode 100644 index 0000000..7c0cb06 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/workspace-state.json @@ -0,0 +1,14 @@ +{ + "object" : { + "artifacts" : [ + + ], + "dependencies" : [ + + ], + "prebuilts" : [ + + ] + }, + "version" : 7 +} \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..366191b Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..98eff9a Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..4a36520 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..f79976e Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..67d8d09 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..dc5f995 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..ab145ae Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..406ed84 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..f69f2dd Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..0b98a02 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..68f407a Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..43ffdc9 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..da99c66 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..26d2d03 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..b2cff6d Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..c35394e Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..25e63d8 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..fc8462e Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..6d5a582 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..a248e61 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..f4a4cd9 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..2243e9c Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..08bd493 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..00c50e6 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..3fd1775 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..68a6c6c Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..9fb99d1 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/modules.timestamp b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/modules.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o new file mode 100644 index 0000000..5b973ea Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc new file mode 100644 index 0000000..9d03e71 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule new file mode 100644 index 0000000..e70d056 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo new file mode 100644 index 0000000..826a07a Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.d b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.d new file mode 100644 index 0000000..ca8a086 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.d @@ -0,0 +1 @@ +D:\crosscode\src-tauri\templates\swiftui\.build\index-build\x86_64-unknown-windows-msvc\debug\__projectName__.build\ContentView~partial.swiftmodule : D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.dia b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.dia new file mode 100644 index 0000000..90d59c2 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.dia differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.swiftdeps b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.swiftdeps new file mode 100644 index 0000000..2169f07 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView.swiftdeps differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView~partial.swiftmodule b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView~partial.swiftmodule new file mode 100644 index 0000000..e70d056 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/ContentView~partial.swiftmodule differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d new file mode 100644 index 0000000..004d370 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d @@ -0,0 +1,3 @@ +D:\crosscode\src-tauri\templates\swiftui\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftmodule : D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule +D:\crosscode\src-tauri\templates\swiftui\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftdoc : D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule +D:\crosscode\src-tauri\templates\swiftui\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftsourceinfo : D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia new file mode 100644 index 0000000..90d59c2 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json new file mode 100644 index 0000000..b7de858 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json @@ -0,0 +1,17 @@ +{ + "": { + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\primary.swiftdeps" + }, + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift": { + "dependencies": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.d", + "object": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.swift.o", + "swiftmodule": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView~partial.swiftmodule", + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.swiftdeps", + "diagnostics": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.dia" }, + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift": { + "dependencies": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.d", + "object": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.swift.o", + "swiftmodule": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}~partial.swiftmodule", + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.swiftdeps", + "diagnostics": "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.dia" } +} diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors new file mode 100644 index 0000000..4bc2fec Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources new file mode 100644 index 0000000..cc2b8ba --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources @@ -0,0 +1,2 @@ +D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift +"D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift" diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.d b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.d new file mode 100644 index 0000000..4ac1e1f --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.d @@ -0,0 +1 @@ +D:\crosscode\src-tauri\templates\swiftui\.build\index-build\x86_64-unknown-windows-msvc\debug\__projectName__.build\{{projectName}}~partial.swiftmodule : D:\crosscode\src-tauri\templates\swiftui\Sources\ContentView.swift D:\crosscode\src-tauri\templates\swiftui\Sources\{{projectName}}.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.dia b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.dia new file mode 100644 index 0000000..90d59c2 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.dia differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.swiftdeps b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.swiftdeps new file mode 100644 index 0000000..4a00344 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}.swiftdeps differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}~partial.swiftmodule b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}~partial.swiftmodule new file mode 100644 index 0000000..3afc7c6 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/{{projectName}}~partial.swiftmodule differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json new file mode 100644 index 0000000..92f50c9 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json @@ -0,0 +1,254 @@ +{ + "builtTestProducts" : [ + + ], + "copyCommands" : { + + }, + "explicitTargetDependencyImportCheckingMode" : { + "none" : { + + } + }, + "generatedSourceTargetSet" : [ + + ], + "pluginDescriptions" : [ + + ], + "swiftCommands" : { + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module" : { + "executable" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "fileList" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources", + "importPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "inputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + } + ], + "isLibrary" : false, + "moduleName" : "__projectName__", + "moduleOutputPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule", + "objects" : [ + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.swift.o", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.swift.o" + ], + "otherArguments" : [ + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "swiftui" + ], + "outputFileMapPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json", + "outputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule" + } + ], + "prepareForIndexing" : true, + "sources" : [ + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + ], + "tempsPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build", + "wholeModuleOptimization" : false + } + }, + "swiftFrontendCommands" : { + + }, + "swiftTargetScanArgs" : { + "__projectName__" : [ + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "-module-name", + "__projectName__", + "-package-name", + "swiftui", + "-c", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift", + "-I", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "swiftui", + "-driver-use-frontend-path", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + ] + }, + "targetDependencyMap" : { + "__projectName__" : [ + + ] + }, + "testDiscoveryCommands" : { + + }, + "testEntryPointCommands" : { + + }, + "traitConfiguration" : { + "default" : [ + { + + } + ] + }, + "writeCommands" : { + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" : { + "alwaysOutOfDate" : false, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + }, + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" : { + "alwaysOutOfDate" : true, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + } + } +} \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/data.mdb b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/data.mdb new file mode 100644 index 0000000..27f4901 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/data.mdb differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/lock.mdb b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/lock.mdb new file mode 100644 index 0000000..2c4642f Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--1a92f8/lock.mdb differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 new file mode 100644 index 0000000..621ff54 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J new file mode 100644 index 0000000..ea298bc Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W new file mode 100644 index 0000000..6829dd8 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J new file mode 100644 index 0000000..e782427 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/CV/{{projectName}}.swift-2J838H7WMNYCV b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/CV/{{projectName}}.swift-2J838H7WMNYCV new file mode 100644 index 0000000..813cdbf Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/CV/{{projectName}}.swift-2J838H7WMNYCV differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC new file mode 100644 index 0000000..f24a362 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH new file mode 100644 index 0000000..1311245 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH new file mode 100644 index 0000000..0b3d3ae Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM new file mode 100644 index 0000000..8e06dff Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 new file mode 100644 index 0000000..8756f7e Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG new file mode 100644 index 0000000..aa8e410 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK new file mode 100644 index 0000000..3fdbb44 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 new file mode 100644 index 0000000..8e6eccb Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY new file mode 100644 index 0000000..5cd5c25 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG new file mode 100644 index 0000000..a81ece2 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/IA/ContentView.swift-SK5XL3NORKIA b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/IA/ContentView.swift-SK5XL3NORKIA new file mode 100644 index 0000000..7515291 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/IA/ContentView.swift-SK5XL3NORKIA differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 new file mode 100644 index 0000000..173cffd Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY new file mode 100644 index 0000000..166735c Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX new file mode 100644 index 0000000..61fa672 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK new file mode 100644 index 0000000..b301695 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS new file mode 100644 index 0000000..8445081 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU new file mode 100644 index 0000000..2da66c9 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV new file mode 100644 index 0000000..51e5206 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO new file mode 100644 index 0000000..d3abb6d Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI new file mode 100644 index 0000000..7dd0612 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN new file mode 100644 index 0000000..7176adb Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 new file mode 100644 index 0000000..fff1c32 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT new file mode 100644 index 0000000..abdf53b Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV new file mode 100644 index 0000000..0fd0393 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 new file mode 100644 index 0000000..48d269f Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN new file mode 100644 index 0000000..533dc5e Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/ContentView.swift.o-1FJ80Q0LEZCBQ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/ContentView.swift.o-1FJ80Q0LEZCBQ new file mode 100644 index 0000000..13459ef Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/ContentView.swift.o-1FJ80Q0LEZCBQ differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-1H0WXNNKWDQZQ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-1H0WXNNKWDQZQ new file mode 100644 index 0000000..b5cfea3 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-1H0WXNNKWDQZQ differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY new file mode 100644 index 0000000..c66bddd Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE new file mode 100644 index 0000000..0fa579f Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V new file mode 100644 index 0000000..ee81659 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/{{projectName}}.swift.o-3MMBA3P0NXGH b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/{{projectName}}.swift.o-3MMBA3P0NXGH new file mode 100644 index 0000000..d206422 Binary files /dev/null and b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/{{projectName}}.swift.o-3MMBA3P0NXGH differ diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json new file mode 100644 index 0000000..92f50c9 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json @@ -0,0 +1,254 @@ +{ + "builtTestProducts" : [ + + ], + "copyCommands" : { + + }, + "explicitTargetDependencyImportCheckingMode" : { + "none" : { + + } + }, + "generatedSourceTargetSet" : [ + + ], + "pluginDescriptions" : [ + + ], + "swiftCommands" : { + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module" : { + "executable" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "fileList" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources", + "importPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "inputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + } + ], + "isLibrary" : false, + "moduleName" : "__projectName__", + "moduleOutputPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule", + "objects" : [ + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\ContentView.swift.o", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\{{projectName}}.swift.o" + ], + "otherArguments" : [ + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "swiftui" + ], + "outputFileMapPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json", + "outputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule" + } + ], + "prepareForIndexing" : true, + "sources" : [ + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + ], + "tempsPath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build", + "wholeModuleOptimization" : false + } + }, + "swiftFrontendCommands" : { + + }, + "swiftTargetScanArgs" : { + "__projectName__" : [ + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "-module-name", + "__projectName__", + "-package-name", + "swiftui", + "-c", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift", + "-I", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "swiftui", + "-driver-use-frontend-path", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + ] + }, + "targetDependencyMap" : { + "__projectName__" : [ + + ] + }, + "testDiscoveryCommands" : { + + }, + "testEntryPointCommands" : { + + }, + "traitConfiguration" : { + "default" : [ + { + + } + ] + }, + "writeCommands" : { + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" : { + "alwaysOutOfDate" : false, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\ContentView.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\Sources\\{{projectName}}.swift" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + }, + "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" : { + "alwaysOutOfDate" : true, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\swiftui\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + } + } +} \ No newline at end of file diff --git a/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt new file mode 100644 index 0000000..6d88140 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt @@ -0,0 +1,3 @@ +Swift version 6.4 (swift-6.4-RELEASE) +Target: x86_64-unknown-windows-msvc +Build config: +assertions diff --git a/src-tauri/templates/swiftui/.build/workspace-state.json b/src-tauri/templates/swiftui/.build/workspace-state.json new file mode 100644 index 0000000..7c0cb06 --- /dev/null +++ b/src-tauri/templates/swiftui/.build/workspace-state.json @@ -0,0 +1,14 @@ +{ + "object" : { + "artifacts" : [ + + ], + "dependencies" : [ + + ], + "prebuilts" : [ + + ] + }, + "version" : 7 +} \ No newline at end of file diff --git a/src-tauri/templates/swiftui/Package.swift b/src-tauri/templates/swiftui/Package.swift index 82c8f8f..8de6056 100644 --- a/src-tauri/templates/swiftui/Package.swift +++ b/src-tauri/templates/swiftui/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 6.2 +// swift-tools-version: 6.4 import PackageDescription diff --git a/src-tauri/templates/uikit/.build/.buildSystem_debug b/src-tauri/templates/uikit/.build/.buildSystem_debug new file mode 100644 index 0000000..c337257 --- /dev/null +++ b/src-tauri/templates/uikit/.build/.buildSystem_debug @@ -0,0 +1 @@ +swiftbuild \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/.lock b/src-tauri/templates/uikit/.build/.lock new file mode 100644 index 0000000..6685a79 --- /dev/null +++ b/src-tauri/templates/uikit/.build/.lock @@ -0,0 +1 @@ +6028 \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/CACHEDIR.TAG b/src-tauri/templates/uikit/.build/CACHEDIR.TAG new file mode 100644 index 0000000..b7ab0d8 --- /dev/null +++ b/src-tauri/templates/uikit/.build/CACHEDIR.TAG @@ -0,0 +1,4 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by (Swift Package Manager). +# For information about cache directory tags, see: +#. http://www.brynosaurus.com/cachedir/ \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/.buildSystem_debug b/src-tauri/templates/uikit/.build/index-build/.buildSystem_debug new file mode 100644 index 0000000..9b01495 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/.buildSystem_debug @@ -0,0 +1 @@ +native \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/.lock b/src-tauri/templates/uikit/.build/index-build/.lock new file mode 100644 index 0000000..c3b0611 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/.lock @@ -0,0 +1 @@ +15568 \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/CACHEDIR.TAG b/src-tauri/templates/uikit/.build/index-build/CACHEDIR.TAG new file mode 100644 index 0000000..b7ab0d8 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/CACHEDIR.TAG @@ -0,0 +1,4 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by (Swift Package Manager). +# For information about cache directory tags, see: +#. http://www.brynosaurus.com/cachedir/ \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/build.db b/src-tauri/templates/uikit/.build/index-build/build.db new file mode 100644 index 0000000..538093c Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/build.db differ diff --git a/src-tauri/templates/uikit/.build/index-build/debug b/src-tauri/templates/uikit/.build/index-build/debug new file mode 120000 index 0000000..58f4a60 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/debug @@ -0,0 +1 @@ +x86_64-unknown-windows-msvc/debug \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/debug.yaml b/src-tauri/templates/uikit/.build/index-build/debug.yaml new file mode 100644 index 0000000..4603d77 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/debug.yaml @@ -0,0 +1,47 @@ +client: + name: basic + file-system: device-agnostic +tools: {} +targets: + "PackageStructure": [""] + "main": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "test": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "{{projectName}}-x86_64-unknown-windows-msvc-debug.module": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] +default: "main" +nodes: + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources/": + is-directory-structure: true + content-exclusion-patterns: [".git",".build"] +commands: + "<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>": + tool: phony + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + outputs: ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module": + tool: shell + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + description: "Compiling Swift Module '__projectName__' (2 sources)" + args: ["D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe","-module-name","__projectName__","-emit-dependencies","-emit-module","-emit-module-path","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule","-output-file-map","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json","-incremental","@D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources","-I","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules","-target","x86_64-unknown-windows-msvc","-incremental","-enable-batch-mode","-serialize-diagnostics","-Onone","-enable-testing","-j8","-DSWIFT_PACKAGE","-DDEBUG","-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE","-module-cache-path","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache","-parseable-output","-Xfrontend","-entry-point-function-name","-Xfrontend","__projectName___main","-static","-swift-version","6","-Xfrontend","-experimental-lazy-typecheck","-Xfrontend","-experimental-skip-all-function-bodies","-Xfrontend","-experimental-allow-module-with-compiler-errors","-Xfrontend","-empty-abi-descriptor","-sdk","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk","-libc","MD","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-use-ld=lld","-g","-use-ld=lld","-Xcc","-D_MT","-Xcc","-D_DLL","-Xcc","-Xclang","-Xcc","--dependent-lib=msvcrt","-Xcc","-gdwarf","-package-name","uikit"] + + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources": + tool: write-auxiliary-file + inputs: ["","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt": + tool: write-auxiliary-file + inputs: ["","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt"] + always-out-of-date: "true" + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + + "PackageStructure": + tool: package-structure-tool + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\Sources/","D:\\crosscode\\src-tauri\\templates\\uikit\\Package.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Package.resolved"] + outputs: [""] + description: "Planning build" + allow-missing-inputs: true + diff --git a/src-tauri/templates/uikit/.build/index-build/plugin-tools.yaml b/src-tauri/templates/uikit/.build/index-build/plugin-tools.yaml new file mode 100644 index 0000000..4603d77 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/plugin-tools.yaml @@ -0,0 +1,47 @@ +client: + name: basic + file-system: device-agnostic +tools: {} +targets: + "PackageStructure": [""] + "main": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "test": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + "{{projectName}}-x86_64-unknown-windows-msvc-debug.module": ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] +default: "main" +nodes: + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources/": + is-directory-structure: true + content-exclusion-patterns: [".git",".build"] +commands: + "<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>": + tool: phony + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + outputs: ["<{{projectName}}-x86_64-unknown-windows-msvc-debug.module>"] + + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module": + tool: shell + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule"] + description: "Compiling Swift Module '__projectName__' (2 sources)" + args: ["D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe","-module-name","__projectName__","-emit-dependencies","-emit-module","-emit-module-path","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule","-output-file-map","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json","-incremental","@D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources","-I","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules","-target","x86_64-unknown-windows-msvc","-incremental","-enable-batch-mode","-serialize-diagnostics","-Onone","-enable-testing","-j8","-DSWIFT_PACKAGE","-DDEBUG","-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE","-module-cache-path","D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache","-parseable-output","-Xfrontend","-entry-point-function-name","-Xfrontend","__projectName___main","-static","-swift-version","6","-Xfrontend","-experimental-lazy-typecheck","-Xfrontend","-experimental-skip-all-function-bodies","-Xfrontend","-experimental-allow-module-with-compiler-errors","-Xfrontend","-empty-abi-descriptor","-sdk","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk","-libc","MD","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-I","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows","-L","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64","-use-ld=lld","-g","-use-ld=lld","-Xcc","-D_MT","-Xcc","-D_DLL","-Xcc","-Xclang","-Xcc","--dependent-lib=msvcrt","-Xcc","-gdwarf","-package-name","uikit"] + + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources": + tool: write-auxiliary-file + inputs: ["","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources"] + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt": + tool: write-auxiliary-file + inputs: ["","D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe"] + outputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt"] + always-out-of-date: "true" + description: "Write auxiliary file D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + + "PackageStructure": + tool: package-structure-tool + inputs: ["D:\\crosscode\\src-tauri\\templates\\uikit\\Sources/","D:\\crosscode\\src-tauri\\templates\\uikit\\Package.swift","D:\\crosscode\\src-tauri\\templates\\uikit\\Package.resolved"] + outputs: [""] + description: "Planning build" + allow-missing-inputs: true + diff --git a/src-tauri/templates/uikit/.build/index-build/workspace-state.json b/src-tauri/templates/uikit/.build/index-build/workspace-state.json new file mode 100644 index 0000000..7c0cb06 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/workspace-state.json @@ -0,0 +1,14 @@ +{ + "object" : { + "artifacts" : [ + + ], + "dependencies" : [ + + ], + "prebuilts" : [ + + ] + }, + "version" : 7 +} \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..83a6bca Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..6ff77c4 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..526b6dd Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..88fdf5c Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..b58481c Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..1bdf3e8 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..ec21e74 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..0f5ac66 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..7a8e71d Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/2BCW2FESJRD38/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..e86a313 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..0f8c732 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..6119c53 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..fdfa477 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..29735a2 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..313a246 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..e063f31 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..f282af2 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..da71537 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3B82GV9BH1X7F/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm new file mode 100644 index 0000000..070011f Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SAL-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..bb42959 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/SwiftShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..b32b81b Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_intrinsics-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm new file mode 100644 index 0000000..aa65eb7 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_Builtin_stddef-24K5ZFQ4X5VZK.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm new file mode 100644 index 0000000..df73d1b Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..22f2344 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_malloc-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..a762131 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/_stdlib-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm new file mode 100644 index 0000000..2e4cc10 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/corecrt-2DMHDX6KQUVE7.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm new file mode 100644 index 0000000..d5937d5 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/3JKRT5ZF96O6F/vcruntime-19PXDZCNLV75.pcm differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/modules.timestamp b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/ModuleCache/modules.timestamp new file mode 100644 index 0000000..e69de29 diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o new file mode 100644 index 0000000..7eaede6 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.o differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc new file mode 100644 index 0000000..9d03e71 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftdoc differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule new file mode 100644 index 0000000..738d188 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftmodule differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo new file mode 100644 index 0000000..18ffa7e Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/Modules/__projectName__.swiftsourceinfo differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.d b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.d new file mode 100644 index 0000000..21d9c45 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.d @@ -0,0 +1 @@ +D:\crosscode\src-tauri\templates\uikit\.build\index-build\x86_64-unknown-windows-msvc\debug\__projectName__.build\AppDelegate~partial.swiftmodule : D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.dia b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.dia new file mode 100644 index 0000000..3d8d1d9 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.dia differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.swiftdeps b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.swiftdeps new file mode 100644 index 0000000..fd87a1d Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate.swiftdeps differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate~partial.swiftmodule b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate~partial.swiftmodule new file mode 100644 index 0000000..5611ed8 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/AppDelegate~partial.swiftmodule differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.d b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.d new file mode 100644 index 0000000..c18535d --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.d @@ -0,0 +1 @@ +D:\crosscode\src-tauri\templates\uikit\.build\index-build\x86_64-unknown-windows-msvc\debug\__projectName__.build\RootViewController~partial.swiftmodule : D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.dia b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.dia new file mode 100644 index 0000000..3d8d1d9 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.dia differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.swiftdeps b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.swiftdeps new file mode 100644 index 0000000..937e971 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController.swiftdeps differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController~partial.swiftmodule b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController~partial.swiftmodule new file mode 100644 index 0000000..da8bf81 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/RootViewController~partial.swiftmodule differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d new file mode 100644 index 0000000..3e296aa --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.d @@ -0,0 +1,3 @@ +D:\crosscode\src-tauri\templates\uikit\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftmodule : D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule +D:\crosscode\src-tauri\templates\uikit\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftdoc : D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule +D:\crosscode\src-tauri\templates\uikit\.build\index-build\x86_64-unknown-windows-msvc\debug\Modules\__projectName__.swiftsourceinfo : D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\SwiftOnoneSupport.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_Concurrency.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.apinotes D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_StringProcessing.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule D:\Users\dilli\AppData\Local\Programs\Swift\Platforms\6.4.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\_RegexParser.swiftmodule\x86_64-unknown-windows-msvc.swiftmodule diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia new file mode 100644 index 0000000..3d8d1d9 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/__projectName__.emit-module.dia differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json new file mode 100644 index 0000000..22992d8 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/output-file-map.json @@ -0,0 +1,17 @@ +{ + "": { + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\primary.swiftdeps" + }, + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift": { + "dependencies": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.d", + "object": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.swift.o", + "swiftmodule": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate~partial.swiftmodule", + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.swiftdeps", + "diagnostics": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.dia" }, + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift": { + "dependencies": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.d", + "object": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.swift.o", + "swiftmodule": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController~partial.swiftmodule", + "swift-dependencies": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.swiftdeps", + "diagnostics": "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.dia" } +} diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors new file mode 100644 index 0000000..c06db62 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/primary.priors differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources new file mode 100644 index 0000000..fe7aa22 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/__projectName__.build/sources @@ -0,0 +1,2 @@ +D:\crosscode\src-tauri\templates\uikit\Sources\AppDelegate.swift +D:\crosscode\src-tauri\templates\uikit\Sources\RootViewController.swift diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json new file mode 100644 index 0000000..71b0063 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/description.json @@ -0,0 +1,254 @@ +{ + "builtTestProducts" : [ + + ], + "copyCommands" : { + + }, + "explicitTargetDependencyImportCheckingMode" : { + "none" : { + + } + }, + "generatedSourceTargetSet" : [ + + ], + "pluginDescriptions" : [ + + ], + "swiftCommands" : { + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module" : { + "executable" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "fileList" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources", + "importPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "inputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + } + ], + "isLibrary" : false, + "moduleName" : "__projectName__", + "moduleOutputPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule", + "objects" : [ + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.swift.o", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.swift.o" + ], + "otherArguments" : [ + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "uikit" + ], + "outputFileMapPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json", + "outputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule" + } + ], + "prepareForIndexing" : true, + "sources" : [ + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + ], + "tempsPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build", + "wholeModuleOptimization" : false + } + }, + "swiftFrontendCommands" : { + + }, + "swiftTargetScanArgs" : { + "__projectName__" : [ + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "-module-name", + "__projectName__", + "-package-name", + "uikit", + "-c", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift", + "-I", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "uikit", + "-driver-use-frontend-path", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + ] + }, + "targetDependencyMap" : { + "__projectName__" : [ + + ] + }, + "testDiscoveryCommands" : { + + }, + "testEntryPointCommands" : { + + }, + "traitConfiguration" : { + "default" : [ + { + + } + ] + }, + "writeCommands" : { + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" : { + "alwaysOutOfDate" : false, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + }, + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" : { + "alwaysOutOfDate" : true, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + } + } +} \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/data.mdb b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/data.mdb new file mode 100644 index 0000000..f366152 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/data.mdb differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/lock.mdb b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/lock.mdb new file mode 100644 index 0000000..f595e4f Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/db/v13/p23972--7283a1/lock.mdb differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 new file mode 100644 index 0000000..621ff54 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/48/x86_64-unknown-windows-msvc.swiftmodule_Math-2G54MCZXMS848 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J new file mode 100644 index 0000000..ea298bc Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/4J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Array-2ZREYJI19XA4J differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W new file mode 100644 index 0000000..6829dd8 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/5W/x86_64-unknown-windows-msvc.swiftmodule_Bool-21OC2NV9TDB5W differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J new file mode 100644 index 0000000..e782427 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7J/x86_64-unknown-windows-msvc.swiftmodule_Collection_Type-erased-2715UEBV8BF7J differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7M/AppDelegate.swift-1YJI8KMASV97M b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7M/AppDelegate.swift-1YJI8KMASV97M new file mode 100644 index 0000000..fe53258 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/7M/AppDelegate.swift-1YJI8KMASV97M differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/BO/RootViewController.swift-1Q2EBNDQDOEBO b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/BO/RootViewController.swift-1Q2EBNDQDOEBO new file mode 100644 index 0000000..06f4665 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/BO/RootViewController.swift-1Q2EBNDQDOEBO differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC new file mode 100644 index 0000000..f24a362 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DC/x86_64-unknown-windows-msvc.swiftmodule_Protocols-38RLFLR5UDCDC differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH new file mode 100644 index 0000000..1311245 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/_SwiftConcurrency.h-3TLE8ZVCLBTDH differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH new file mode 100644 index 0000000..0b3d3ae Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DH/x86_64-unknown-windows-msvc.swiftmodule_Math_Floating-1YSMZ5YEH70DH differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM new file mode 100644 index 0000000..8e06dff Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/DM/x86_64-unknown-windows-msvc.swiftmodule_Math_Integers-OS7PH024D6DM differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 new file mode 100644 index 0000000..8756f7e Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/E0/x86_64-unknown-windows-msvc.swiftmodule_Misc-39ZVTCUHH1EE0 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG new file mode 100644 index 0000000..aa8e410 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EG/x86_64-unknown-windows-msvc.swiftmodule_Result-PRXL4C5BZEEG differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK new file mode 100644 index 0000000..3fdbb44 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/EK/x86_64-unknown-windows-msvc.swiftmodule_Hashing-1SKXGLMMJC4EK differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 new file mode 100644 index 0000000..8e6eccb Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/F5/x86_64-unknown-windows-msvc.swiftmodule_Assert-1I2E2BDJC3WF5 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY new file mode 100644 index 0000000..5cd5c25 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/FY/x86_64-unknown-windows-msvc.swiftmodule_Collection-2OCY50SISZGFY differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG new file mode 100644 index 0000000..a81ece2 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/HG/x86_64-unknown-windows-msvc.swiftmodule_Playground-200G2GK961RHG differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 new file mode 100644 index 0000000..173cffd Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/J7/x86_64-unknown-windows-msvc.swiftmodule_Collection_HashedCollections-2SQ2GXV58TUJ7 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY new file mode 100644 index 0000000..166735c Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/KY/x86_64-unknown-windows-msvc.swiftmodule_C-2TBBZ981MYLKY differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX new file mode 100644 index 0000000..61fa672 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/LX/x86_64-unknown-windows-msvc.swiftmodule_Pointer-VPAKXHA1N2LX differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK new file mode 100644 index 0000000..b301695 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/MK/x86_64-unknown-windows-msvc.swiftmodule_KeyPaths-1CKFV25JB4RMK differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS new file mode 100644 index 0000000..8445081 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/NS/x86_64-unknown-windows-msvc.swiftmodule_UTF8Span-3OLVAXOHL8GNS differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU new file mode 100644 index 0000000..2da66c9 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QU/x86_64-unknown-windows-msvc.swiftmodule_UniqueArray-28EJEYRLCUOQU differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV new file mode 100644 index 0000000..51e5206 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/QV/x86_64-unknown-windows-msvc.swiftmodule_Optional-1WK69DYWEY4QV differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO new file mode 100644 index 0000000..d3abb6d Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/RO/x86_64-unknown-windows-msvc.swiftmodule-IT5O0Q3WLNRO differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI new file mode 100644 index 0000000..7dd0612 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TI/x86_64-unknown-windows-msvc.swiftmodule-WT1JM2O2PVTI differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN new file mode 100644 index 0000000..7176adb Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/TN/x86_64-unknown-windows-msvc.swiftmodule_String-3SI2FX27WFQTN differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 new file mode 100644 index 0000000..fff1c32 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/V7/x86_64-unknown-windows-msvc.swiftmodule-2BBQI1WQRHCV7 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT new file mode 100644 index 0000000..abdf53b Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VT/x86_64-unknown-windows-msvc.swiftmodule_Math_Vector-31G4FROM4Y9VT differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV new file mode 100644 index 0000000..0fd0393 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/VV/x86_64-unknown-windows-msvc.swiftmodule_Span-17KT7C1WNH8VV differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 new file mode 100644 index 0000000..48d269f Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/Z4/x86_64-unknown-windows-msvc.swiftmodule_Collection_Lazy_Views-2OMIF5UO4L8Z4 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN new file mode 100644 index 0000000..533dc5e Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/records/ZN/x86_64-unknown-windows-msvc.swiftmodule_Reflection-5NGRUT8456ZN differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/AppDelegate.swift.o-QPQJI1LBXI4G b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/AppDelegate.swift.o-QPQJI1LBXI4G new file mode 100644 index 0000000..e4c0e52 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/AppDelegate.swift.o-QPQJI1LBXI4G differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/RootViewController.swift.o-1RQPLDCMZBU90 b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/RootViewController.swift.o-1RQPLDCMZBU90 new file mode 100644 index 0000000..db21fdc Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/RootViewController.swift.o-1RQPLDCMZBU90 differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-RE4PG9R1LC6I b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-RE4PG9R1LC6I new file mode 100644 index 0000000..72b41f3 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/_SwiftConcurrencyShims-15FABOQ0CBKKC.pcm-RE4PG9R1LC6I differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY new file mode 100644 index 0000000..8a28845 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-3TLZRY7J84RHY differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE new file mode 100644 index 0000000..b9ec398 Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-4F4HKAZPBAHE differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V new file mode 100644 index 0000000..ec9275a Binary files /dev/null and b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/index/store/v5/units/x86_64-unknown-windows-msvc.swiftmodule-RIOWVUX72W8V differ diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json new file mode 100644 index 0000000..71b0063 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/plugin-tools-description.json @@ -0,0 +1,254 @@ +{ + "builtTestProducts" : [ + + ], + "copyCommands" : { + + }, + "explicitTargetDependencyImportCheckingMode" : { + "none" : { + + } + }, + "generatedSourceTargetSet" : [ + + ], + "pluginDescriptions" : [ + + ], + "swiftCommands" : { + "C.{{projectName}}-x86_64-unknown-windows-msvc-debug.module" : { + "executable" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "fileList" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources", + "importPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "inputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + } + ], + "isLibrary" : false, + "moduleName" : "__projectName__", + "moduleOutputPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule", + "objects" : [ + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\AppDelegate.swift.o", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\RootViewController.swift.o" + ], + "otherArguments" : [ + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "uikit" + ], + "outputFileMapPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\output-file-map.json", + "outputs" : [ + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules\\__projectName__.swiftmodule" + } + ], + "prepareForIndexing" : true, + "sources" : [ + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + ], + "tempsPath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build", + "wholeModuleOptimization" : false + } + }, + "swiftFrontendCommands" : { + + }, + "swiftTargetScanArgs" : { + "__projectName__" : [ + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe", + "-module-name", + "__projectName__", + "-package-name", + "uikit", + "-c", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift", + "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift", + "-I", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\Modules", + "-target", + "x86_64-unknown-windows-msvc", + "-incremental", + "-enable-batch-mode", + "-serialize-diagnostics", + "-Onone", + "-enable-testing", + "-j8", + "-DSWIFT_PACKAGE", + "-DDEBUG", + "-DSWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE", + "-module-cache-path", + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache", + "-parseable-output", + "-Xfrontend", + "-entry-point-function-name", + "-Xfrontend", + "__projectName___main", + "-static", + "-swift-version", + "6", + "-Xfrontend", + "-experimental-lazy-typecheck", + "-Xfrontend", + "-experimental-skip-all-function-bodies", + "-Xfrontend", + "-experimental-allow-module-with-compiler-errors", + "-Xfrontend", + "-empty-abi-descriptor", + "-sdk", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", + "-libc", + "MD", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\XCTest-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-I", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows", + "-L", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Platforms\\6.4.0\\Windows.platform\\Developer\\Library\\Testing-6.4.0\\usr\\lib\\swift\\windows\\x86_64", + "-use-ld=lld", + "-g", + "-use-ld=lld", + "-Xcc", + "-D_MT", + "-Xcc", + "-D_DLL", + "-Xcc", + "-Xclang", + "-Xcc", + "--dependent-lib=msvcrt", + "-Xcc", + "-gdwarf", + "-package-name", + "uikit", + "-driver-use-frontend-path", + "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + ] + }, + "targetDependencyMap" : { + "__projectName__" : [ + + ] + }, + "testDiscoveryCommands" : { + + }, + "testEntryPointCommands" : { + + }, + "traitConfiguration" : { + "default" : [ + { + + } + ] + }, + "writeCommands" : { + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" : { + "alwaysOutOfDate" : false, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\AppDelegate.swift" + }, + { + "kind" : "file", + "name" : "D:\\crosscode\\src-tauri\\templates\\uikit\\Sources\\RootViewController.swift" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\__projectName__.build\\sources" + }, + "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" : { + "alwaysOutOfDate" : true, + "inputs" : [ + { + "kind" : "virtual", + "name" : "" + }, + { + "kind" : "file", + "name" : "D:\\Users\\dilli\\AppData\\Local\\Programs\\Swift\\Toolchains\\6.4.0+Asserts\\usr\\bin\\swiftc.exe" + } + ], + "outputFilePath" : "D:\\crosscode\\src-tauri\\templates\\uikit\\.build\\index-build\\x86_64-unknown-windows-msvc\\debug\\swift-version--319CA7822A0FBD8C.txt" + } + } +} \ No newline at end of file diff --git a/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt new file mode 100644 index 0000000..6d88140 --- /dev/null +++ b/src-tauri/templates/uikit/.build/index-build/x86_64-unknown-windows-msvc/debug/swift-version--319CA7822A0FBD8C.txt @@ -0,0 +1,3 @@ +Swift version 6.4 (swift-6.4-RELEASE) +Target: x86_64-unknown-windows-msvc +Build config: +assertions diff --git a/src-tauri/templates/uikit/.build/workspace-state.json b/src-tauri/templates/uikit/.build/workspace-state.json new file mode 100644 index 0000000..7c0cb06 --- /dev/null +++ b/src-tauri/templates/uikit/.build/workspace-state.json @@ -0,0 +1,14 @@ +{ + "object" : { + "artifacts" : [ + + ], + "dependencies" : [ + + ], + "prebuilts" : [ + + ] + }, + "version" : 7 +} \ No newline at end of file diff --git a/src-tauri/templates/uikit/Package.swift b/src-tauri/templates/uikit/Package.swift index 82c8f8f..8de6056 100644 --- a/src-tauri/templates/uikit/Package.swift +++ b/src-tauri/templates/uikit/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 6.2 +// swift-tools-version: 6.4 import PackageDescription diff --git a/src/App.tsx b/src/App.tsx index fe837de..06bbb1a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,7 @@ import { IDEProvider } from "./utilities/IDEContext"; import { CommandProvider } from "./utilities/Command"; import { ToastProvider } from "react-toast-plus"; import New from "./pages/New"; +import ImportXcode from "./pages/ImportXcode"; import NewTemplate from "./pages/NewTemplate"; import "vscode/localExtensionHost"; import { UpdateProvider } from "./utilities/UpdateContext"; @@ -41,31 +42,36 @@ const theme = extendTheme({ }, }); -// Layout with IDE-related providers -const IDELayout = () => { +const IDELayoutContent = () => { const [appTheme] = useStore("appearance/theme", "dark"); return ( - - - - - - - - - - - + + + + + + + + + ); }; +// Layout with IDE-related providers. Keep the store above all consumers so a +// store failure can fall back to the app's default preferences. +const IDELayout = () => ( + + + +); + const App = () => { return ( @@ -85,6 +91,7 @@ const App = () => { } /> } /> } /> + } /> } /> } /> diff --git a/src/bun-test.d.ts b/src/bun-test.d.ts new file mode 100644 index 0000000..949fbc6 --- /dev/null +++ b/src/bun-test.d.ts @@ -0,0 +1,28 @@ +// Minimal ambient types for bun's built-in test runner. +// +// The test suites (`src/ui-builder`, `src/xcode-import`) are executed with +// `bun test src` (see the CI workflow), but the project does not depend on +// `@types/bun`, so declare the small subset of the API the tests use instead of +// pulling in another dependency. + +declare module "bun:test" { + export function describe(name: string, fn: () => void): void; + export function test(name: string, fn: () => void | Promise): void; + + interface Matchers { + toBe(expected: unknown): void; + toContain(expected: unknown): void; + toEqual(expected: unknown): void; + toBeUndefined(): void; + toBeNull(): void; + not: { + toBe(expected: unknown): void; + toContain(expected: unknown): void; + toEqual(expected: unknown): void; + toBeUndefined(): void; + toBeNull(): void; + }; + } + + export function expect(actual: unknown): Matchers; +} diff --git a/src/components/Menu/MenuBar.tsx b/src/components/Menu/MenuBar.tsx index 4881c39..82ede4c 100644 --- a/src/components/Menu/MenuBar.tsx +++ b/src/components/Menu/MenuBar.tsx @@ -1,7 +1,7 @@ import Menu from "@mui/joy/Menu"; import List from "@mui/joy/List"; import ListItem from "@mui/joy/ListItem"; -import { useCallback, useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import MenuBarButton from "./MenuBarButton"; import MenuGroup from "./MenuGroup"; import { @@ -16,6 +16,7 @@ import { Refresh, CleaningServices, CameraAlt, + Science, } from "@mui/icons-material"; import { useParams } from "react-router-dom"; import { Divider, Option, Select } from "@mui/joy"; @@ -24,6 +25,11 @@ import { useStore } from "../../utilities/StoreContext"; import { useToast } from "react-toast-plus"; import bar from "./MenuBarDefinition"; import { IStandaloneCodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneCodeEditor"; +import { + defaultRemoteMacProfile, + normalizeRemoteMacProfile, + RemoteMacProfile, +} from "../../utilities/remote-mac"; export interface MenuBarProps { callbacks: Record void>; @@ -47,6 +53,12 @@ export default function MenuBar({ callbacks, editor }: MenuBarProps) { "apple-id/anisette-server", "ani.sidestore.io" ); + const workspaceSelectionKey = `workspace/${encodeURIComponent(path ?? "")}`; + const [selectedTarget] = useStore(`${workspaceSelectionKey}/target`, ""); + const [selectedScheme] = useStore(`${workspaceSelectionKey}/scheme`, ""); + const [selectedConfiguration] = useStore(`${workspaceSelectionKey}/configuration`, "Debug"); + const [storedRemoteMac] = useStore(`${workspaceSelectionKey}/remote-mac`, defaultRemoteMacProfile); + const remoteMac = useMemo(() => normalizeRemoteMacProfile(storedRemoteMac), [storedRemoteMac]); const { addToast } = useToast(); const updateScreenshot = useCallback( @@ -265,14 +277,32 @@ export default function MenuBar({ callbacks, editor }: MenuBarProps) { /> } parameters={{ - folder: path, + projectPath: path, + toolchainPath: selectedToolchain?.path ?? "", + target: selectedTarget, + scheme: selectedScheme, + configuration: selectedConfiguration, + remoteMac, + }} + tooltip="Build selected target" + sx={{ marginRight: 0 }} + /> + } + parameters={{ + projectPath: path, toolchainPath: selectedToolchain?.path ?? "", - debug: true, + target: selectedTarget, + scheme: selectedScheme, + configuration: selectedConfiguration, + remoteMac, }} - tooltip="Build .ipa" + tooltip="Test selected workspace" sx={{ marginRight: 0 }} /> diff --git a/src/components/Menu/MenuBarDefinition.tsx b/src/components/Menu/MenuBarDefinition.tsx index 3865273..b02ca68 100644 --- a/src/components/Menu/MenuBarDefinition.tsx +++ b/src/components/Menu/MenuBarDefinition.tsx @@ -12,6 +12,11 @@ import { restartServer } from "../../utilities/lsp-client"; import { open } from "@tauri-apps/plugin-dialog"; import { useContext } from "react"; import { UpdateContext } from "../../utilities/UpdateContext"; +import { + defaultRemoteMacProfile, + normalizeRemoteMacProfile, + RemoteMacProfile, +} from "../../utilities/remote-mac"; export default [ { @@ -20,13 +25,11 @@ export default [ { label: "New", items: [ - // { - // name: "New File...", - // shortcut: "Ctrl+N", - // callback: () => { - // alert("Not implemented yet :("); - // }, - // }, + { + name: "New File...", + shortcut: "Ctrl+N", + callbackName: "newFile", + }, { name: "New Project...", callbackName: "newProject", @@ -45,6 +48,10 @@ export default [ name: "Open Folder...", callbackName: "openFolderDialog", }, + { + name: "Import Xcode Project...", + callbackName: "importXcodeProject", + }, ], }, { @@ -58,9 +65,7 @@ export default [ { name: "Save As...", shortcut: "Ctrl+Shift+S", - callback: () => { - alert("Not implemented yet :("); - }, + callbackName: "saveAs", }, ], }, @@ -175,6 +180,15 @@ export default [ }, ], }, + { + label: "Panels", + items: [ + { + name: "UI Builder", + callbackName: "toggleUIBuilder", + }, + ], + }, { label: "Debug", items: [ @@ -201,16 +215,24 @@ export default [ component: ({ shortcut }) => { const { path } = useParams<"path">(); const { selectedToolchain } = useIDE(); + const selectionKey = `workspace/${encodeURIComponent(path ?? "")}`; + const [target] = useStore(`${selectionKey}/target`, ""); + const [scheme] = useStore(`${selectionKey}/scheme`, ""); + const [configuration] = useStore(`${selectionKey}/configuration`, "Debug"); + const [remoteMac] = useStore(`${selectionKey}/remote-mac`, defaultRemoteMacProfile); return ( @@ -224,16 +246,24 @@ export default [ component: ({ shortcut }) => { const { path } = useParams<"path">(); const { selectedToolchain } = useIDE(); + const selectionKey = `workspace/${encodeURIComponent(path ?? "")}`; + const [target] = useStore(`${selectionKey}/target`, ""); + const [scheme] = useStore(`${selectionKey}/scheme`, ""); + const [configuration] = useStore(`${selectionKey}/configuration`, "Release"); + const [remoteMac] = useStore(`${selectionKey}/remote-mac`, defaultRemoteMacProfile); return ( @@ -277,6 +307,42 @@ export default [ ); }, componentId: "deployMenuBtn", + }, + { + name: "Test Selected Workspace", + shortcut: "Ctrl+U", + component: ({ shortcut }) => { + const { path } = useParams<"path">(); + const { selectedToolchain } = useIDE(); + const selectionKey = `workspace/${encodeURIComponent(path ?? "")}`; + const [target] = useStore(`${selectionKey}/target`, ""); + const [scheme] = useStore(`${selectionKey}/scheme`, ""); + const [configuration] = useStore(`${selectionKey}/configuration`, "Debug"); + const [remoteMac] = useStore(`${selectionKey}/remote-mac`, defaultRemoteMacProfile); + const profile = normalizeRemoteMacProfile(remoteMac); + // A remote Mac runs tests with the build command: the profile + // chooses `xcodebuild test` there, and the button stays in sync + // with the "run tests on the remote Mac" switch. + const remoteTests = profile.enabled && profile.runTests; + return ( + + ); + }, + componentId: "testWorkspaceMenuBtn", }, ], }, diff --git a/src/components/SDKMenu.tsx b/src/components/SDKMenu.tsx index d6cf933..487d602 100644 --- a/src/components/SDKMenu.tsx +++ b/src/components/SDKMenu.tsx @@ -7,7 +7,12 @@ import { openUrl } from "@tauri-apps/plugin-opener"; import { installSdkOperation } from "../utilities/operations"; import ErrorIcon from "@mui/icons-material/Error"; import WarningIcon from "@mui/icons-material/Warning"; -import { DARWIN_SDK_VERSION } from "../utilities/constants"; +import { + XCODE_DOWNLOAD_URL, + XCODE_VERSION, + MIN_DARWIN_SDK_VERSION, + isSupportedSDKVersion, +} from "../utilities/constants"; export default () => { const { @@ -119,12 +124,12 @@ export default () => { - {darwinSDKVersion === DARWIN_SDK_VERSION + {isSupportedSDKVersion(darwinSDKVersion) ? `Version: ${darwinSDKVersion}` - : `Unsupported SDK version (${darwinSDKVersion}). Apps may compile, but you may not be able to use newer features (like liquid glass). Please re-install with Xcode 26.`} + : `Unsupported SDK version (${darwinSDKVersion}). It is older than the minimum supported version (${MIN_DARWIN_SDK_VERSION}). Please re-install with Xcode ${XCODE_VERSION} or later.`} )} @@ -138,12 +143,10 @@ export default () => { variant="soft" onClick={(e) => { e.preventDefault(); - openUrl( - "https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_26/Xcode_26_Universal.xip" - ); + openUrl(XCODE_DOWNLOAD_URL); }} > - Download XCode 26 + Download XCode {XCODE_VERSION} + ))} + + +
+ {visible.map((problem) => ( + + ))} + {visible.length === 0 &&
No matching build problems.
} +
+ + ); +} + +export function TestsPanel({ results }: { results: TestResult[] }) { + const [filter, setFilter] = useState<"all" | TestStatus>("all"); + const visible = useMemo( + () => filter === "all" ? results : results.filter((result) => result.status === filter), + [filter, results] + ); + const passed = results.filter((result) => result.status === "passed").length; + const failed = results.filter((result) => result.status === "failed").length; + + return ( +
+
+ {passed} passed · {failed} failed + + {(["all", "passed", "failed", "skipped"] as const).map((value) => ( + + ))} + +
+
+ {visible.map((result) => ( +
+ {testIcons[result.status]} + + {result.name} + {result.suite} + + {result.duration !== undefined && {result.duration.toFixed(3)}s} +
+ ))} + {visible.length === 0 &&
No matching test results yet.
} +
+
+ ); +} diff --git a/src/components/Tiles/Editor.css b/src/components/Tiles/Editor.css index 35072e2..bc5d531 100644 --- a/src/components/Tiles/Editor.css +++ b/src/components/Tiles/Editor.css @@ -3,6 +3,63 @@ position: relative; overflow: hidden; } + +.quick-open-backdrop { + position: absolute; + inset: 0; + z-index: 20; + display: flex; + justify-content: center; + align-items: flex-start; + padding-top: 48px; + background: rgba(0, 0, 0, 0.24); +} + +.quick-open { + width: min(620px, calc(100% - 32px)); + padding: 8px; + border: 1px solid var(--joy-palette-divider); + border-radius: 8px; + background: var(--joy-palette-background-surface); + box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35); +} + +.quick-open-results { + max-height: 320px; + overflow: auto; + padding: 4px 0; +} + +.quick-open-results button { + display: flex; + flex-direction: column; + width: 100%; + gap: 2px; + padding: 8px 10px; + border: 0; + border-radius: 5px; + color: inherit; + background: transparent; + text-align: left; + cursor: pointer; +} + +.quick-open-results button:hover { + background: var(--joy-palette-neutral-100); +} + +.quick-open-results small { + opacity: 0.6; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.quick-open-hint { + padding: 6px 10px 2px; + opacity: 0.6; + font-size: 11px; +} .code-editor { width: 100%; height: 100%; @@ -12,6 +69,24 @@ /* transform: translate(0, -100%); */ } +.editor-statusbar { + display: flex; + align-items: center; + gap: 16px; + min-height: 24px; + padding: 0 10px; + border-top: 1px solid var(--joy-palette-divider); + color: var(--joy-palette-neutral-500); + font-size: 11px; +} + +.editor-statusbar span:first-child { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .tabsContainer { display: flex; padding-bottom: 1px; diff --git a/src/components/Tiles/Editor.tsx b/src/components/Tiles/Editor.tsx index b317ea3..3204af4 100644 --- a/src/components/Tiles/Editor.tsx +++ b/src/components/Tiles/Editor.tsx @@ -1,7 +1,7 @@ import { path } from "@tauri-apps/api"; import "./Editor.css"; -import { IconButton, useColorScheme } from "@mui/joy"; -import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react"; +import { IconButton, useColorScheme, Input, Typography } from "@mui/joy"; +import { Dispatch, SetStateAction, useEffect, useMemo, useRef, useState } from "react"; import CloseIcon from "@mui/icons-material/Close"; import CircleIcon from "@mui/icons-material/Circle"; import * as monaco from "monaco-editor"; @@ -17,9 +17,53 @@ import { platform } from "@tauri-apps/plugin-os"; import { TabLike } from "../TabLike"; import { useStore } from "../../utilities/StoreContext"; import { useParams } from "react-router"; -import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs"; +import { readDir, readTextFile, writeTextFile } from "@tauri-apps/plugin-fs"; +import { useIDE } from "../../utilities/IDEContext"; +import { BuildProblem, parseBuildProblems } from "../../utilities/build-results"; +import { + defaultRemoteMacProfile, + normalizeRemoteMacProfile, + RemoteMacProfile, +} from "../../utilities/remote-mac"; export type WorkerLoader = () => Worker; + +type SearchResult = { + file: string; + line: number; + column: number; + preview: string; +}; + +const searchableExtensions = new Set(["swift", "tsx", "ts", "jsx", "js", "rs", "toml", "json", "css", "md"]); +const ignoredDirectories = new Set([".git", ".build", "node_modules", "target", ".crosscode"]); + +function markerSeverity(severity: BuildProblem["severity"]): monaco.MarkerSeverity { + if (severity === "error") return monaco.MarkerSeverity.Error; + if (severity === "warning") return monaco.MarkerSeverity.Warning; + return monaco.MarkerSeverity.Info; +} + +async function collectSearchFiles(root: string, output: string[] = []): Promise { + if (output.length >= 1500) return output; + let entries; + try { + entries = await readDir(root); + } catch { + return output; + } + for (const entry of entries) { + if (output.length >= 1500) break; + const entryPath = await path.resolve(root, entry.name); + if (entry.isDirectory) { + if (!ignoredDirectories.has(entry.name)) await collectSearchFiles(entryPath, output); + continue; + } + const extension = entry.name.split(".").pop()?.toLowerCase(); + if (extension && searchableExtensions.has(extension)) output.push(entryPath); + } + return output; +} const workerLoaders: Partial> = { TextEditorWorker: () => new Worker( @@ -108,11 +152,48 @@ export default ({ [key: string]: [number, number]; }>({}); const [hoveredOnBtn, setHoveredOnBtn] = useState(null); + const [quickOpen, setQuickOpen] = useState(false); + const [quickFilter, setQuickFilter] = useState(""); + const [searchOpen, setSearchOpen] = useState(false); + const [searchQuery, setSearchQuery] = useState(""); + const [searchResults, setSearchResults] = useState([]); + const [searching, setSearching] = useState(false); + const [cursorPosition, setCursorPosition] = useState({ line: 1, column: 1 }); const [formatOnSave] = useStore("sourcekit/format", true); const { path: filePath } = useParams<"path">(); + const { consoleLines } = useIDE(); + const workspaceSelectionKey = `workspace/${encodeURIComponent(filePath ?? "")}`; + const [remoteMac] = useStore(`${workspaceSelectionKey}/remote-mac`, defaultRemoteMacProfile); + const buildProblems = useMemo( + () => parseBuildProblems(consoleLines, filePath ?? "", normalizeRemoteMacProfile(remoteMac).projectPath), + [consoleLines, filePath, remoteMac] + ); const hasAttemptedToReadOpenFiles = useRef(null); + useEffect(() => { + const openLocation = (event: Event) => { + const problem = (event as CustomEvent).detail; + if (!problem?.file) return; + const selection = { + startLineNumber: problem.line, + startColumn: problem.column, + endLineNumber: problem.line, + endColumn: problem.column + 1, + }; + if (editor && focusedFile?.replace(/\\/g, "/") === problem.file.replace(/\\/g, "/")) { + editor.setSelection(selection); + editor.revealLineNearTop(problem.line); + editor.focus(); + return; + } + selectionOverrideRef.current = { selection }; + openNewFile(problem.file); + }; + window.addEventListener("crosscode:open-location", openLocation); + return () => window.removeEventListener("crosscode:open-location", openLocation); + }, [editor, focusedFile, openNewFile]); + useEffect(() => { (async () => { if (!filePath || hasAttemptedToReadOpenFiles.current === filePath) return; @@ -309,6 +390,98 @@ export default ({ monaco.editor.setTheme(mode === "dark" ? "vs-dark" : "vs"); }, [mode, editor, initialized, openFiles]); + useEffect(() => { + const problemsByFile = new Map(); + for (const problem of buildProblems) { + const key = problem.file.replace(/\\/g, "/").toLowerCase(); + const current = problemsByFile.get(key) ?? []; + current.push(problem); + problemsByFile.set(key, current); + } + for (const model of monaco.editor.getModels()) { + const key = model.uri.fsPath.replace(/\\/g, "/").toLowerCase(); + const problems = problemsByFile.get(key) ?? []; + monaco.editor.setModelMarkers( + model, + "crosscode-build", + problems.map((problem) => ({ + severity: markerSeverity(problem.severity), + message: problem.message, + startLineNumber: problem.line, + startColumn: problem.column, + endLineNumber: problem.line, + endColumn: problem.column + 1, + source: "Build", + })) + ); + } + }, [buildProblems, editor, focused, tabs]); + + useEffect(() => { + const handleQuickOpen = (event: KeyboardEvent) => { + if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "p") { + event.preventDefault(); + setQuickOpen(true); + setQuickFilter(""); + } + if ((event.ctrlKey || event.metaKey) && event.shiftKey && event.key.toLowerCase() === "f") { + event.preventDefault(); + setSearchOpen(true); + setSearchQuery(""); + } + if (event.key === "Escape") setQuickOpen(false); + if (event.key === "Escape") setSearchOpen(false); + }; + document.addEventListener("keydown", handleQuickOpen); + return () => document.removeEventListener("keydown", handleQuickOpen); + }, []); + + useEffect(() => { + if (!searchOpen || !filePath || searchQuery.trim().length < 2) { + setSearchResults([]); + return; + } + let cancelled = false; + const timer = window.setTimeout(async () => { + setSearching(true); + const results: SearchResult[] = []; + const query = searchQuery.toLowerCase(); + const files = await collectSearchFiles(filePath); + for (const file of files) { + if (cancelled || results.length >= 200) break; + try { + const content = await readTextFile(file); + content.split(/\r?\n/).forEach((line, index) => { + if (results.length >= 200) return; + const column = line.toLowerCase().indexOf(query); + if (column >= 0) results.push({ file, line: index + 1, column: column + 1, preview: line.trim() }); + }); + } catch { + // Ignore unreadable or binary files. + } + } + if (!cancelled) { + setSearchResults(results); + setSearching(false); + } + }, 250); + return () => { + cancelled = true; + window.clearTimeout(timer); + }; + }, [filePath, searchOpen, searchQuery]); + + useEffect(() => { + if (!editor) return; + const disposable = editor.onDidChangeCursorPosition((event) => { + setCursorPosition({ + line: event.position.lineNumber, + column: event.position.column, + }); + }); + return () => disposable.dispose(); + }, [editor]); + useEffect(() => { if (!monacoEl.current || !editor) return; @@ -500,6 +673,81 @@ export default ({ return (
+ {searchOpen && ( +
setSearchOpen(false)}> +
event.stopPropagation()}> + setSearchQuery(event.target.value)} + onKeyDown={(event) => { if (event.key === "Escape") setSearchOpen(false); }} + /> +
+ {searching ? "Searching…" : `${searchResults.length} result${searchResults.length === 1 ? "" : "s"}`} · Ctrl/⌘ Shift F +
+
+ {searchResults.map((result, index) => ( + + ))} + {!searching && searchQuery.trim().length < 2 && Type at least two characters to search.} + {!searching && searchQuery.trim().length >= 2 && searchResults.length === 0 && No matches found.} +
+
+
+ )} + {quickOpen && ( +
setQuickOpen(false)}> +
event.stopPropagation()}> + setQuickFilter(event.target.value)} + onKeyDown={(event) => { + if (event.key === "Escape") setQuickOpen(false); + if (event.key === "Enter") { + const match = tabs.find((tab) => + tab.name.toLowerCase().includes(quickFilter.toLowerCase()) + ); + if (match) { + openNewFile(match.file); + setQuickOpen(false); + } + } + }} + /> +
+ {tabs + .filter((tab) => tab.name.toLowerCase().includes(quickFilter.toLowerCase())) + .map((tab) => ( + + ))} + {tabs.length === 0 && No open files} +
+
Ctrl/⌘ P to open · Esc to close
+
+
+ )}
= 1 ? {} : { display: "none" }} /> +
+ {focused !== undefined && tabs[focused] ? tabs[focused].file : "No file open"} + Ln {cursorPosition.line}, Col {cursorPosition.column} + Swift + Ctrl/⌘ P Quick Open +
); }; diff --git a/src/components/Tiles/FileExplorer.css b/src/components/Tiles/FileExplorer.css index e34a237..e21754d 100644 --- a/src/components/Tiles/FileExplorer.css +++ b/src/components/Tiles/FileExplorer.css @@ -2,3 +2,32 @@ overflow-y: auto; height: 100%; } + +.file-explorer-header { + display: flex; + align-items: center; + justify-content: space-between; + min-height: 32px; + padding: 2px 6px; + border-bottom: 1px solid var(--joy-palette-divider); +} + +.file-explorer-collapsed { + overflow: hidden; + min-width: 34px; +} + +.file-explorer-collapsed .file-explorer-header { + justify-content: center; + padding-inline: 2px; +} + +.file-explorer-rail-label { + display: flex; + align-items: flex-start; + justify-content: center; + padding-top: 12px; + font-size: 11px; + font-weight: 600; + opacity: 0.65; +} diff --git a/src/components/Tiles/FileExplorer.tsx b/src/components/Tiles/FileExplorer.tsx index 44896e0..0afedda 100644 --- a/src/components/Tiles/FileExplorer.tsx +++ b/src/components/Tiles/FileExplorer.tsx @@ -150,13 +150,17 @@ const FileItem: React.FC = ({ export interface FileExplorerProps { openFolder: string; setOpenFile: (file: string) => void; + openInUIBuilder: (file: string) => void; + collapsed?: boolean; + onToggleCollapsed?: () => void; } -export default ({ openFolder, setOpenFile }: FileExplorerProps) => { +export default ({ openFolder, setOpenFile, openInUIBuilder, collapsed = false, onToggleCollapsed }: FileExplorerProps) => { const [contextMenu, setContextMenu] = useState<{ mouseX: number; mouseY: number; filePath: string; isFolder: boolean; + canOpenInUIBuilder: boolean; } | null>(null); const { addToast } = useToast(); @@ -177,20 +181,26 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { const [deleteTarget, setDeleteTarget] = useState(null); const [deleteBasename, setDeleteBasename] = useState(""); - const handleContextMenu = (event: React.MouseEvent) => { - if (event.target instanceof HTMLButtonElement) { - const path = event.target.getAttribute("data-path"); - if (path) { + const handleContextMenu = async (event: React.MouseEvent) => { + const button = (event.target as Element).closest("button"); + if (button) { + const selectedPath = button.getAttribute("data-path"); + if (selectedPath) { event.preventDefault(); + const isFolder = button.getAttribute("data-is-folder") === "true"; + const canOpenInUIBuilder = isFolder + ? await fs.exists(await path.resolve(selectedPath, "Package.swift")) + : selectedPath.toLowerCase().endsWith(".swift"); + setContextMenu( contextMenu === null ? { mouseX: event.clientX + 2, mouseY: event.clientY - 6, - filePath: path, - isFolder: - event.target.getAttribute("data-is-folder") === "true", + filePath: selectedPath, + isFolder, + canOpenInUIBuilder, } : null ); @@ -206,7 +216,20 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { if (!renameTarget) return; const parent = await path.dirname(renameTarget); const newPath = await path.resolve(parent, renameValue); - await fs.rename(renameTarget, newPath); + if (newPath === renameTarget) { + setRenameOpen(false); + return; + } + if (await fs.exists(newPath)) { + addToast.error("A file or folder with that name already exists!"); + return; + } + try { + await fs.rename(renameTarget, newPath); + } catch (error) { + addToast.error(`Could not rename: ${error}`); + return; + } setRenameOpen(false); setRenameTarget(null); setRenameValue(""); @@ -215,7 +238,12 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { const handleDelete = async () => { if (!deleteTarget) return; - await fs.remove(deleteTarget, { recursive: true }); + try { + await fs.remove(deleteTarget, { recursive: true }); + } catch (error) { + addToast.error(`Could not delete: ${error}`); + return; + } setDeleteOpen(false); setDeleteTarget(null); setRefresh((r) => r + 1); @@ -228,7 +256,12 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { addToast.error("File already exists!"); return; } - await fs.writeTextFile(newPath, ""); + try { + await fs.writeTextFile(newPath, ""); + } catch (error) { + addToast.error(`Could not create the file: ${error}`); + return; + } setNewOpen(false); setNewTarget(null); setNewValue(""); @@ -242,7 +275,12 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { addToast.error("Folder already exists!"); return; } - await fs.mkdir(newPath); + try { + await fs.mkdir(newPath); + } catch (error) { + addToast.error(`Could not create the folder: ${error}`); + return; + } setNewFolderOpen(false); setNewFolderTarget(null); setNewFolderValue(""); @@ -250,7 +288,21 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { }; return ( -
+
+
+ {!collapsed && Project} + +
+ {collapsed ? ( +
P
+ ) : ( { openDefault={true} refresh={refresh} /> + )} + {!collapsed && <> { )} {contextMenu?.isFolder && } + {contextMenu?.canOpenInUIBuilder && ( + { + const selectedPath = contextMenu.filePath; + handleClose(); + openInUIBuilder(selectedPath); + }} + > + Open in UI Builder + + )} + {contextMenu?.canOpenInUIBuilder && } { handleClose(); @@ -349,6 +415,7 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { + } {/* New File Modal */} setNewOpen(false)}> @@ -431,33 +498,6 @@ export default ({ openFolder, setOpenFile }: FileExplorerProps) => { - {/* Rename Modal */} - setRenameOpen(false)}> - - - Rename - - setRenameValue(e.target.value)} - onKeyDown={async (e) => { - if (e.key === "Enter") { - await handleRename(); - } - }} - /> - - - - - - - {/* Delete Confirmation Modal */} setDeleteOpen(false)}> diff --git a/src/pages/IDE.css b/src/pages/IDE.css index a8ca3ff..035aba1 100644 --- a/src/pages/IDE.css +++ b/src/pages/IDE.css @@ -4,6 +4,63 @@ flex-direction: column; } +.project-kind-bar { + display: flex; + align-items: center; + gap: var(--padding-sm); + min-height: 24px; + padding: 0 var(--padding-sm); + border-bottom: 1px solid var(--joy-palette-divider); + color: var(--joy-palette-neutral-500); + font-size: 11px; +} + +.project-kind-label { + text-transform: uppercase; + letter-spacing: 0.06em; + font-weight: 600; +} + +.project-detection-badge { + padding: 1px 5px; + border: 1px solid var(--joy-palette-success-outlinedBorder); + border-radius: 4px; + color: var(--joy-palette-success-500); + font-size: 10px; +} + +.project-capabilities { + display: flex; + gap: 3px; + min-width: 0; +} + +.project-capability { + padding: 1px 4px; + border-radius: 3px; + background: var(--joy-palette-background-level2); + color: var(--joy-palette-text-tertiary); + font-size: 10px; +} + +.project-entry-point { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + opacity: 0.7; +} + +.remote-mac-row, +.remote-mac-actions { + display: flex; + gap: var(--padding-sm); +} + +.remote-mac-actions { + justify-content: flex-end; + margin-top: var(--padding-sm); +} + .file-explorer-tile { padding-right: 0.5rem; } @@ -44,3 +101,22 @@ object-fit: contain; display: block; } + +.ui-builder-tile { + padding: 0; + margin: var(--padding-md); + height: 100%; + display: flex; + flex-direction: column; + overflow: hidden; + box-sizing: border-box; + width: calc(100% - var(--padding-md) * 2); + min-width: 0; +} + +.project-capability-warn { + background: transparent; + border: 1px solid var(--joy-palette-warning-500, #f0a020); + color: var(--joy-palette-warning-500, #f0a020); + cursor: help; +} diff --git a/src/pages/IDE.tsx b/src/pages/IDE.tsx index d6f8faf..458d4b4 100644 --- a/src/pages/IDE.tsx +++ b/src/pages/IDE.tsx @@ -1,7 +1,7 @@ import Splitter, { GutterTheme, SplitDirection } from "@devbookhq/splitter"; import Tile from "../components/Tiles/Tile"; import FileExplorer from "../components/Tiles/FileExplorer"; -import { useCallback, useContext, useEffect, useState } from "react"; +import { useCallback, useContext, useEffect, useMemo, useState } from "react"; import Editor from "../components/Tiles/Editor"; import MenuBar from "../components/Menu/MenuBar"; import "./IDE.css"; @@ -13,10 +13,14 @@ import TauriFileSystemProvider from "../utilities/TauriFileSystemProvider"; import { invoke } from "@tauri-apps/api/core"; import { Button, + Checkbox, Divider, + Input, Modal, ModalClose, ModalDialog, + Option, + Select, Typography, } from "@mui/joy"; import { ErrorIcon, useToast, WarningIcon } from "react-toast-plus"; @@ -25,8 +29,27 @@ import { restartServer } from "../utilities/lsp-client"; import BottomBar from "../components/Tiles/BottomBar"; import { open as openFileDialog, save } from "@tauri-apps/plugin-dialog"; import { IStandaloneCodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneCodeEditor"; -import { DARWIN_SDK_VERSION } from "../utilities/constants"; -import { writeFile } from "@tauri-apps/plugin-fs"; +import { MIN_DARWIN_SDK_VERSION, isSupportedSDKVersion } from "../utilities/constants"; +import { exists, readTextFile, writeFile, writeTextFile } from "@tauri-apps/plugin-fs"; +import { basename, join } from "@tauri-apps/api/path"; +import { platform } from "@tauri-apps/plugin-os"; +import UIBuilder from "../ui-builder/UIBuilder"; +import { + asArray, + asString, + configurationNames, + isaOf, + loadDocument, + objectAt, + objectName, +} from "../xcode-import/pbxproj"; +import { + defaultRemoteMacProfile, + isRemoteMacUsable, + normalizeRemoteMacProfile, + suggestRemoteProjectPath, + RemoteMacProfile, +} from "../utilities/remote-mac"; export interface IDEProps {} @@ -37,12 +60,79 @@ type ProjectValidation = | "InvalidPackage" | "InvalidToolchain"; +/** Mirrors `PackageMetadata` in `src-tauri/src/builder/config.rs`. */ +type PackageMetadata = { + platforms: { name: string; version: string }[]; + assetCatalogs: string[]; + resources: string[]; + iosTargets: string[]; + supportedTargets: string[]; + /** Minimum iOS version, when the manifest declares one. */ + deploymentTarget: string | null; +}; + +type ProjectInfo = { + kind: string; + root: string; + entryPoint: string | null; + capabilities: string[]; + targets: string[]; + schemes: string[]; + configurations: string[]; + buildType: string; + detectedFiles: string[]; + packageMetadata: PackageMetadata; + warnings: string[]; +}; + +type WorkspaceTarget = { + id: string; + name: string; + productType: string; + configurations: string[]; +}; + +async function loadWorkspaceTargets(info: ProjectInfo): Promise { + if (info.kind !== "xcodeProject" || !info.entryPoint) { + return info.targets.map((name) => ({ + id: name, + name, + productType: "", + configurations: info.configurations, + })); + } + + const contents = await readTextFile(`${info.entryPoint}/project.pbxproj`); + const document = loadDocument(contents, info.entryPoint); + return asArray(document.rootObject.targets) + .map((id) => asString(id)) + .map((id) => { + const target = objectAt(document, id); + return { + id, + name: objectName(target), + productType: asString(target.productType), + configurations: configurationNames(document, asString(target.buildConfigurationList) || null), + }; + }) + .filter((target) => isaOf(objectAt(document, target.id)) === "PBXNativeTarget" && target.name.length > 0); +} + let autoStartedLsp = ""; +/** Path in the form the editor and the LSP use, from the one dialogs return. */ +async function toInternalPath(pluginPath: string): Promise { + if (platform() === "windows") { + return await invoke("linux_path", { path: pluginPath }); + } + return pluginPath; +} + export default () => { const { storeInitialized, store } = useContext(StoreContext); const [openFile, setOpenFile] = useState(null); const [openFiles, setOpenFiles] = useState([]); + const [navigatorCollapsed, setNavigatorCollapsed] = useState(false); const [saveFile, setSaveFile] = useState<(() => Promise) | null>(null); const [undo, setUndo] = useState<(() => void) | null>(null); const [redo, setRedo] = useState<(() => void) | null>(null); @@ -57,6 +147,8 @@ export default () => { darwinSDKVersion, screenshot, setScreenshot, + uiBuilderOpen, + setUIBuilderOpen, } = useIDE(); const [sourcekitStartup, setSourcekitStartup] = useStore( "sourcekit/startup", @@ -82,6 +174,19 @@ export default () => { const navigate = useNavigate(); const [projectValidation, setProjectValidation] = useState(null); + const [projectInfo, setProjectInfo] = useState(null); + const [workspaceTargets, setWorkspaceTargets] = useState([]); + const workspaceSelectionKey = `workspace/${encodeURIComponent(path)}`; + const [selectedTarget, setSelectedTarget] = useStore(`${workspaceSelectionKey}/target`, ""); + const [selectedScheme, setSelectedScheme] = useStore(`${workspaceSelectionKey}/scheme`, ""); + const [selectedConfiguration, setSelectedConfiguration] = useStore(`${workspaceSelectionKey}/configuration`, "Debug"); + const [remoteMac, setRemoteMac] = useStore( + `${workspaceSelectionKey}/remote-mac`, + defaultRemoteMacProfile + ); + // Profiles saved by an older version are missing the newer fields. + const remoteMacProfile = useMemo(() => normalizeRemoteMacProfile(remoteMac), [remoteMac]); + const [remoteMacDialogOpen, setRemoteMacDialogOpen] = useState(false); const [editor, setEditor] = useState(null); const { addToast } = useToast(); @@ -108,7 +213,9 @@ export default () => { path === undefined || path === null || selectedToolchain === null || - !initialized + !initialized || + projectInfo === null || + projectInfo.kind !== "crosscodePackage" ) return; setProjectValidation(null); @@ -124,7 +231,30 @@ export default () => { } } })(); - }, [path, selectedToolchain, initialized]); + }, [path, selectedToolchain, initialized, projectInfo]); + + useEffect(() => { + if (!path) return; + invoke("detect_project", { projectPath: path }) + .then(async (info) => { + const targets = await loadWorkspaceTargets(info).catch((error) => { + console.warn("Failed to parse workspace targets", error); + return info.targets.map((name) => ({ id: name, name, productType: "", configurations: info.configurations })); + }); + setProjectInfo(info); + setWorkspaceTargets(targets); + setSelectedTarget((current) => targets.some((target) => target.name === current) ? current : targets[0]?.name ?? ""); + setSelectedScheme((current) => info.schemes.includes(current) ? current : info.schemes[0] ?? ""); + setSelectedConfiguration((current) => { + const configurations = targets[0]?.configurations.length ? targets[0].configurations : info.configurations; + return configurations.includes(current) ? current : configurations[0] ?? "Debug"; + }); + }) + .catch((error) => console.warn("Failed to detect project type", error)); + }, [path]); + + const activeTarget = workspaceTargets.find((target) => target.name === selectedTarget) ?? null; + const configurations = activeTarget?.configurations.length ? activeTarget.configurations : projectInfo?.configurations ?? []; useEffect(() => { if (openFiles.length === 0) { @@ -191,28 +321,197 @@ export default () => { } }, [openNewFile]); + /** `File -> New -> New File...`: ask for a path inside the workspace and open it. */ + const createFile = useCallback(async () => { + const target = await save({ + title: "New File", + defaultPath: await join(path, "untitled.swift"), + }); + if (!target) return; + try { + if (await exists(target)) { + addToast.error("A file with that name already exists."); + return; + } + await writeTextFile(target, ""); + } catch (error) { + addToast.error(`Could not create the file: ${error}`); + return; + } + openNewFile(await toInternalPath(target)); + }, [path, openNewFile, addToast]); + + /** + * `File -> Save -> Save As...`: write a copy of the open file next to the + * workspace root and switch to it. The original tab keeps its contents. + */ + const saveAsFile = useCallback(async () => { + if (!editor || !openFile) { + addToast.error("Open a file in the editor before saving a copy."); + return; + } + const target = await save({ + title: "Save As", + defaultPath: await join(path, await basename(openFile)), + }); + if (!target) return; + try { + await writeTextFile(target, editor.getValue()); + } catch (error) { + addToast.error(`Could not save the file: ${error}`); + return; + } + const file = await toInternalPath(target); + if (file !== openFile) { + openNewFile(file); + } + addToast.success(`Saved a copy to ${file}`); + }, [path, editor, openFile, openNewFile, addToast]); + useEffect(() => { setCallbacks({ save: saveFile ?? (async () => {}), + saveAs: saveAsFile, + newFile: createFile, openFolderDialog, newProject: () => navigate("/new"), welcomePage: () => navigate("/"), openFile: selectFile, undo: undo ?? (() => {}), redo: redo ?? (() => {}), + toggleUIBuilder: () => setUIBuilderOpen((open) => !open), + importXcodeProject: () => navigate("/import"), }); - }, [saveFile, openFolderDialog, navigate, selectFile, undo, redo]); + }, [ + saveFile, + saveAsFile, + createFile, + openFolderDialog, + navigate, + selectFile, + undo, + redo, + setUIBuilderOpen, + ]); + + // the editor keeps most of the width; the optional panels split the rest + const paneSizes = (() => { + const editorShare = screenshot ? 50 : 80; + const builderShare = Math.round(editorShare * 0.45); + if (uiBuilderOpen && screenshot) return [20, editorShare - builderShare, builderShare, 30]; + if (uiBuilderOpen) return [20, editorShare - builderShare, builderShare]; + if (screenshot) return [20, editorShare, 30]; + return [20, editorShare]; + })(); return (
+ {projectInfo && ( +
+ Project + {projectInfo.buildType || formatProjectKind(projectInfo.kind)} + Auto-detected + + {projectInfo.capabilities + .filter((capability) => ["xcodeBuild", "swiftBuild", "test", "archive", "simulator", "remoteBuild"].includes(capability)) + .map((capability) => ( + {formatProjectKind(capability)} + ))} + + {projectInfo.packageMetadata.deploymentTarget && ( + + iOS {projectInfo.packageMetadata.deploymentTarget}+ + + )} + {projectInfo.packageMetadata.assetCatalogs.length > 0 && ( + + {projectInfo.packageMetadata.assetCatalogs.length} asset catalog + {projectInfo.packageMetadata.assetCatalogs.length === 1 ? "" : "s"} + + )} + {projectInfo.warnings.length > 0 && ( + + {projectInfo.warnings.length} warning + {projectInfo.warnings.length === 1 ? "" : "s"} + + )} + {workspaceTargets.length > 0 && ( + + )} + {projectInfo.schemes.length > 0 && ( + + )} + {configurations.length > 0 && ( + + )} + {(projectInfo.kind === "xcodeProject" || projectInfo.kind === "xcodeWorkspace") && ( + + )} + {projectInfo.entryPoint && {projectInfo.entryPoint}} +
+ )} - + setNavigatorCollapsed((value) => !value)} + openInUIBuilder={(file) => { + openNewFile(file); + setUIBuilderOpen(true); + }} + /> { /> + {uiBuilderOpen && ( +
+ setUIBuilderOpen(false)} + /> +
+ )} {screenshot && (
@@ -266,6 +575,137 @@ export default () => {
)} + setRemoteMacDialogOpen(false)}> + + + Remote Mac Build + + Build this Xcode workspace over SSH. CrossCode uses your existing SSH key or agent; the project must already exist on the Mac. + + setRemoteMac((profile) => ({ ...profile, enabled: event.target.checked }))} + /> + setRemoteMac((profile) => ({ ...profile, host: event.target.value }))} + aria-label="Remote Mac host" + /> +
+ setRemoteMac((profile) => ({ ...profile, user: event.target.value }))} + aria-label="Remote Mac user" + /> + setRemoteMac((profile) => ({ ...profile, port: Number(event.target.value) || 22 }))} + aria-label="SSH port" + sx={{ width: 100 }} + /> +
+
+ setRemoteMac((profile) => ({ ...profile, projectPath: event.target.value }))} + aria-label="Project path on Remote Mac" + sx={{ flex: 1 }} + /> + +
+ + {remoteMacProfile.auth === "identity" && ( +
+ + setRemoteMac((profile) => ({ ...profile, identityFile: event.target.value })) + } + aria-label="Private key file" + sx={{ flex: 1 }} + /> + +
+ )} + setRemoteMac((profile) => ({ ...profile, destination: event.target.value }))} + aria-label="xcodebuild destination" + /> + + setRemoteMac((profile) => ({ ...profile, resultBundlePath: event.target.value })) + } + aria-label="Result bundle path" + /> + setRemoteMac((profile) => ({ ...profile, runTests: event.target.checked }))} + /> + + { + "The sources are still built from your local workspace — keep both copies in sync (for example with git or a shared folder) before building." + } + +
+ + +
+
+
{initialized && selectedToolchain !== null && projectValidation !== null && @@ -390,7 +830,7 @@ export default () => { {initialized && selectedToolchain !== null && hasIgnoredDarwinSDK === false && - darwinSDKVersion !== DARWIN_SDK_VERSION && ( + !isSupportedSDKVersion(darwinSDKVersion) && ( { @@ -408,9 +848,9 @@ export default () => {
This version of CrossCode is designed to work with Darwin SDK{" "} - {DARWIN_SDK_VERSION}, but you have version {darwinSDKVersion}{" "} - installed. Things may still work, but you will miss out on - newer features (like liquid glass) and may run into issues. + {MIN_DARWIN_SDK_VERSION} or later, but you have version{" "} + {darwinSDKVersion} installed. Things may still work, but you + will miss out on newer features and may run into issues.
@@ -453,3 +893,7 @@ function getValidationMsg(validation: ProjectValidation): string { return ""; } } + +function formatProjectKind(kind: string): string { + return kind.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/^./, (value) => value.toUpperCase()); +} diff --git a/src/pages/ImportXcode.css b/src/pages/ImportXcode.css new file mode 100644 index 0000000..1a98335 --- /dev/null +++ b/src/pages/ImportXcode.css @@ -0,0 +1,77 @@ +.import-page { + padding-bottom: var(--padding-xl); +} + +.import-actions { + display: flex; + align-items: center; + gap: var(--padding-md); + margin-top: var(--padding-md); + flex-wrap: wrap; +} + +.import-projects { + display: flex; + gap: var(--padding-sm); + flex-wrap: wrap; + margin-top: var(--padding-sm); +} + +.import-plan { + margin-top: var(--padding-lg); + max-width: 60rem; +} + +.import-list { + margin: 0 0 var(--padding-sm) 0; + padding-left: 1.2rem; + font-size: 0.85rem; + line-height: 1.6; +} + +.import-list > li > code, +.import-plan code { + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + font-size: 0.8rem; + opacity: 0.85; +} + +.import-muted { + opacity: 0.6; +} + +.import-warnings { + color: var(--joy-palette-warning-700); +} + +.import-options { + display: flex; + flex-direction: column; + gap: var(--padding-sm); + margin-bottom: var(--padding-sm); +} + +.import-options > label { + display: flex; + flex-direction: column; + gap: 4px; + font-size: 0.8rem; +} + +.import-options input[type="text"] { + padding: 4px 8px; + font-size: 0.85rem; + font-family: inherit; + color: inherit; + background: transparent; + border: 1px solid var(--joy-palette-divider); + border-radius: 6px; + max-width: 40rem; +} + +.import-checkbox { + display: flex; + align-items: center; + gap: 8px; + font-size: 0.85rem; +} diff --git a/src/pages/ImportXcode.tsx b/src/pages/ImportXcode.tsx new file mode 100644 index 0000000..67130c6 --- /dev/null +++ b/src/pages/ImportXcode.tsx @@ -0,0 +1,281 @@ +// Import an Xcode project: pick a project, review the plan, convert it into a +// CrossCode (SwiftPM) package. + +import { useCallback, useState } from "react"; +import { useNavigate } from "react-router-dom"; +import { Button, Card, CardContent, Checkbox, Divider, Link, Typography } from "@mui/joy"; +import { invoke } from "@tauri-apps/api/core"; +import { open as openFolderDialog } from "@tauri-apps/plugin-dialog"; +import { readTextFile } from "@tauri-apps/plugin-fs"; +import { useToast } from "react-toast-plus"; +import logo from "../assets/logo.png"; +import { + ImportError, + planImport, + type ImportPlan, +} from "../xcode-import/plan"; +import { + findXcodeProjects, + joinPath, + loadProjectFiles, + normalizePath, +} from "../xcode-import/project-files"; +import { useIDE } from "../utilities/IDEContext"; +import "./Onboarding.css"; +import "./ImportXcode.css"; + +type ImportReport = { + packageDir: string; + written: string[]; + copied: string[]; + skipped: string[]; +}; + +export default () => { + const navigate = useNavigate(); + const { addToast } = useToast(); + const { selectedToolchain } = useIDE(); + + const [folder, setFolder] = useState(null); + const [projects, setProjects] = useState([]); + const [project, setProject] = useState(null); + const [plan, setPlan] = useState(null); + const [destination, setDestination] = useState(""); + const [overwrite, setOverwrite] = useState(false); + const [busy, setBusy] = useState(false); + + const pickFolder = useCallback( + async (override?: string) => { + const picked = override ?? (await openFolderDialog({ + directory: true, + multiple: false, + title: "Select the folder containing the Xcode project", + })); + if (!picked || Array.isArray(picked)) return; + + const normalized = normalizePath(picked); + setFolder(normalized); + setPlan(null); + setProjects([]); + setProject(null); + + const found = await findXcodeProjects(normalized); + setProjects(found); + if (found.length === 1) { + setProject(found[0]); + } else if (found.length === 0) { + addToast.error("No .xcodeproj found in that folder"); + } + }, + [addToast] + ); + + const buildPlan = useCallback( + async (xcodeproj: string) => { + setBusy(true); + try { + const projectDirectory = normalizePath(xcodeproj.substring(0, xcodeproj.lastIndexOf("/"))); + const pbx = await readTextFile(joinPath(xcodeproj, "project.pbxproj")); + const files = await loadProjectFiles(projectDirectory); + + const built = planImport(pbx, xcodeproj, { + packageRoot: destination.length > 0 ? normalizePath(destination) : projectDirectory, + readFile: (path) => files.plists.get(normalizePath(path)) ?? null, + listDirectory: (path) => files.listings.get(normalizePath(path)) ?? [], + }); + setPlan(built); + if (destination.length === 0) setDestination(built.packageRoot); + } catch (error) { + setPlan(null); + addToast.error( + error instanceof ImportError + ? error.message + : `Failed to read the project: ${String(error)}` + ); + } finally { + setBusy(false); + } + }, + [addToast, destination] + ); + + const runImport = useCallback(async () => { + if (!plan) return; + if (!selectedToolchain) { + addToast.error("Select a Swift toolchain first"); + return; + } + setBusy(true); + try { + const report = await invoke("apply_xcode_import", { + packageRoot: destination.length > 0 ? normalizePath(destination) : plan.packageRoot, + files: plan.files, + copies: plan.copies, + overwrite, + }); + addToast.success(`Imported into ${report.packageDir}`); + for (const name of report.skipped.slice(0, 5)) { + addToast.info(`Skipped ${name}`); + } + navigate(`/ide/${encodeURIComponent(report.packageDir)}`); + } catch (error) { + addToast.error(String(error)); + } finally { + setBusy(false); + } + }, [addToast, destination, navigate, overwrite, plan, selectedToolchain]); + + const converted = plan?.targets.filter((target) => target.swiftPackageTargetType !== null) ?? []; + const skipped = plan?.targets.filter((target) => target.swiftPackageTargetType === null) ?? []; + + return ( +
+
+ CrossCode Logo +
+ Import an Xcode project + + CrossCode generates a SwiftPM package that points at the project's existing + sources, so both tools can keep working on it. + +
+
+ +
+ + {folder && {folder}} +
+ + {projects.length > 1 && ( + + Select a project +
+ {projects.map((candidate) => ( + + ))} +
+
+ )} + + {project && !plan && ( +
+ {project} + +
+ )} + + {plan && ( + + + Import plan + + Package {plan.packageName} · iOS {plan.settings.IPHONEOS_DEPLOYMENT_TARGET ?? "17.0"} · + bundle id {plan.targets.find((target) => target.kind === "app")?.bundleId} + + + + Targets +
    + {converted.map((target) => ( +
  • + {target.name} → {target.swiftPackageTargetType} target at{" "} + {target.path} ({target.sources.length} sources) +
  • + ))} + {skipped.map((target) => ( +
  • + {target.name} — {target.skippedReason} +
  • + ))} +
+ + {plan.packages.length > 0 && ( + <> + Swift package dependencies +
    + {plan.packages.map((dependency) => ( +
  • + {dependency.identity} ({dependency.kind}) — {dependency.location} +
  • + ))} +
+ + )} + + Files +
    + {plan.files.map((file) => ( +
  • + {file.path} +
  • + ))} +
  • {plan.copies.length} resource file(s) copied into Resources/
  • +
+ + {plan.warnings.length > 0 && ( + <> + Warnings +
    + {plan.warnings.map((warning) => ( +
  • {warning}
  • + ))} +
+ + )} + + +
+ +
+ setOverwrite(event.target.checked)} + /> + Replace an existing Package.swift / crosscode.toml +
+
+ +
+ + + { + event.preventDefault(); + navigate("/"); + }} + > + Cancel + +
+
+
+ )} +
+ ); +}; diff --git a/src/pages/Onboarding.tsx b/src/pages/Onboarding.tsx index 1c298c2..7768fd1 100644 --- a/src/pages/Onboarding.tsx +++ b/src/pages/Onboarding.tsx @@ -8,13 +8,16 @@ import { useLocation, useNavigate } from "react-router"; import { openUrl } from "@tauri-apps/plugin-opener"; import SwiftMenu from "../components/SwiftMenu"; import SDKMenu from "../components/SDKMenu"; +import { + XCODE_VERSION, + SWIFT_VERSION_PREFIXES, +} from "../utilities/constants"; import ErrorIcon from "@mui/icons-material/Error"; import WarningIcon from "@mui/icons-material/Warning"; import { getVersion } from "@tauri-apps/api/app"; import { invoke } from "@tauri-apps/api/core"; import { useToast } from "react-toast-plus"; import { relaunch } from "@tauri-apps/plugin-process"; -import { SWIFT_VERSION_PREFIX } from "../utilities/constants"; export interface OnboardingProps {} @@ -36,7 +39,6 @@ export default ({}: OnboardingProps) => { const darwinSdkRef = useRef(null); useEffect(() => { - console.log(location.hash); if (location.hash === "#install-sdk" && darwinSdkRef.current) { darwinSdkRef.current.scrollIntoView({ block: "start", @@ -84,7 +86,7 @@ export default ({}: OnboardingProps) => { href="#" onClick={(e) => { e.preventDefault(); - open("https://github.com/nab138/CrossCode/issues"); + open("https://github.com/R0GUEEE/CrossCode/issues"); }} > github @@ -94,7 +96,7 @@ export default ({}: OnboardingProps) => { href="#" onClick={(e) => { e.preventDefault(); - open("https://github.com/nab138/CrossCode/wiki/Troubleshooting"); + open("https://github.com/R0GUEEE/CrossCode/wiki/Troubleshooting"); }} > troubleshooting guide @@ -118,6 +120,19 @@ export default ({}: OnboardingProps) => { +
{ Swift - You will need a Swift {SWIFT_VERSION_PREFIX} toolchain to use - CrossCode. It is recommended to install it using swiftly, but you - can also install it manually. + You will need a Swift {SWIFT_VERSION_PREFIXES.join(" or ")}{" "} + toolchain to use CrossCode. It is recommended to install it using + swiftly, but you can also install it manually. @@ -256,7 +271,7 @@ export default ({}: OnboardingProps) => { Darwin SDK CrossCode requires a special swift SDK to build apps for iOS. It can - be generated from a copy of Xcode 26 or later. To install it, + be generated from a copy of Xcode {XCODE_VERSION} or later. To install it, download Xcode.xip using the link below, click the "Install SDK" button, then select the downloaded file. Note that installing the SDK will temporarily require a lot of disk space (~11GB) and may diff --git a/src/ui-builder/UIBuilder.css b/src/ui-builder/UIBuilder.css new file mode 100644 index 0000000..ce75b91 --- /dev/null +++ b/src/ui-builder/UIBuilder.css @@ -0,0 +1,586 @@ +.uib-root { + display: flex; + flex-direction: column; + height: 100%; + min-height: 0; + width: 100%; + box-sizing: border-box; + overflow: hidden; +} + +.uib-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--padding-sm); + flex-wrap: wrap; + padding-bottom: var(--padding-xs); + border-bottom: 1px solid var(--joy-palette-divider); +} + +.uib-header-actions { + display: flex; + align-items: center; + gap: var(--padding-xs); + flex-wrap: wrap; +} + +.uib-preview-controls { + display: flex; + align-items: center; + gap: 4px; + margin-left: auto; +} + +.uib-live-indicator { + width: 7px; + height: 7px; + border-radius: 50%; + background: #35c759; + box-shadow: 0 0 0 3px rgba(53, 199, 89, 0.16); +} + +.uib-preview-status { + font-size: 11px; + color: var(--joy-palette-neutral-500); +} + +.uib-preview-status-ready { + color: #35c759; +} + +.uib-preview-status-building, +.uib-preview-status-installing { + color: #f5a623; +} + +.uib-preview-status-failed { + color: #ff453a; +} + +.uib-preview-error { + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--padding-sm); + padding: 6px 10px; + color: #ffb4ab; + background: rgba(255, 69, 58, 0.12); + border: 1px solid rgba(255, 69, 58, 0.35); + border-radius: 6px; + font-size: 12px; +} + +.uib-diagnostics { + display: flex; + flex-direction: column; + gap: 4px; + padding: 6px 0; +} + +.uib-diagnostic { + display: grid; + grid-template-columns: 52px minmax(0, 1fr) auto; + gap: 8px; + align-items: center; + width: 100%; + padding: 6px 10px; + border: 0; + border-radius: 5px; + color: inherit; + background: rgba(255, 69, 58, 0.08); + text-align: left; + cursor: pointer; + font: inherit; + font-size: 12px; +} + +.uib-diagnostic:hover { + background: rgba(255, 69, 58, 0.16); +} + +.uib-diagnostic-warning { + background: rgba(245, 166, 35, 0.08); +} + +.uib-diagnostic-warning:hover { + background: rgba(245, 166, 35, 0.16); +} + +.uib-diagnostic-severity { + text-transform: uppercase; + font-size: 10px; + font-weight: 600; + color: #ff453a; +} + +.uib-diagnostic-warning .uib-diagnostic-severity { + color: #f5a623; +} + +.uib-diagnostic-location { + opacity: 0.65; + white-space: nowrap; +} + +.uib-body { + display: flex; + flex: 1 1 0; + min-height: 0; + gap: var(--padding-xs); + padding-top: var(--padding-xs); +} + +.uib-column { + display: flex; + flex-direction: column; + width: 170px; + flex: none; + min-height: 0; + overflow: auto; + gap: var(--padding-xs); +} + +.uib-column-right { + width: 250px; +} + +.uib-group-title { + font-size: 11px; + text-transform: uppercase; + letter-spacing: 0.04em; + opacity: 0.6; + margin-bottom: 4px; +} + +/* ------------------------------------------------------------- palette -- */ + +.uib-palette { + display: flex; + flex-direction: column; + gap: var(--padding-sm); +} + +.uib-palette-item { + padding: 4px 8px; + border: 1px solid var(--joy-palette-divider); + border-radius: 6px; + font-size: 13px; + cursor: grab; + user-select: none; +} + +.uib-palette-item:hover { + border-color: var(--joy-palette-primary-500); + color: var(--joy-palette-primary-500); +} + +.uib-palette-item:active { + cursor: grabbing; +} + +/* -------------------------------------------------------------- canvas -- */ + +.uib-canvas { + position: relative; + flex: 1 1 0; + min-width: 0; + min-height: 0; + display: flex; + align-items: flex-start; + justify-content: center; + overflow: auto; + padding: var(--padding-sm); + background: + linear-gradient(45deg, rgba(128, 128, 128, 0.06) 25%, transparent 25%) -8px 0/16px 16px, + linear-gradient(-45deg, rgba(128, 128, 128, 0.06) 25%, transparent 25%) -8px 0/16px 16px, + linear-gradient(45deg, transparent 75%, rgba(128, 128, 128, 0.06) 75%) -8px 0/16px 16px, + linear-gradient(-45deg, transparent 75%, rgba(128, 128, 128, 0.06) 75%) -8px 0/16px 16px; +} + +.uib-streamed-preview { + position: absolute; + right: var(--padding-sm); + top: var(--padding-sm); + z-index: 2; + width: 180px; + padding: 6px; + border: 1px solid var(--joy-palette-divider); + border-radius: 8px; + background: var(--joy-palette-background-surface); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); +} + +.uib-streamed-preview img { + display: block; + width: 100%; + max-height: 260px; + object-fit: contain; + border-radius: 5px; +} + +.uib-device { + width: 360px; + min-height: 640px; + flex: none; + border-radius: 28px; + border: 8px solid #1b1b1f; + background: #fff; + color: #1c1c1e; + box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); + display: flex; + flex-direction: column; + overflow: hidden; +} + +.uib-device-ipad { + width: 520px; + min-height: 700px; + border-radius: 24px; +} + +.uib-device-mac { + width: 720px; + min-height: 520px; + border-radius: 12px; + border-width: 12px; +} + +.uib-device-mac .uib-homebar { + display: none; +} + +.uib-device-dark { + background: #1c1c1e; + color: #f2f2f7; +} + +.uib-device-dark .uib-screen { + background: #1c1c1e; +} + +.uib-device-landscape { + width: 640px; + min-height: 380px; +} + +.uib-device-landscape.uib-device-ipad { + width: 700px; + min-height: 500px; +} + +.uib-device-landscape.uib-device-mac { + width: 860px; + min-height: 460px; +} + +.uib-statusbar { + display: flex; + justify-content: space-between; + align-items: center; + padding: 4px 12px; + font-size: 11px; + color: #6e6e73; + background: #f7f7fa; +} + +.uib-screen { + flex: 1 1 0; + padding: 8px; + overflow: auto; + display: flex; + flex-direction: column; +} + +.uib-homebar { + height: 14px; + display: flex; + justify-content: center; + align-items: center; + background: #f7f7fa; +} + +.uib-homebar::after { + content: ""; + width: 96px; + height: 4px; + border-radius: 2px; + background: #c7c7cc; +} + +/* --------------------------------------------------------------- nodes -- */ + +.uib-node { + position: relative; + border: 1px solid transparent; + border-radius: 4px; + min-width: 0; +} + +.uib-node-container { + border-color: rgba(0, 122, 255, 0.25); + border-style: dashed; +} + +.uib-node:hover { + border-color: rgba(0, 122, 255, 0.6); +} + +.uib-node-selected { + border-color: var(--joy-palette-primary-500) !important; + border-style: solid !important; +} + +.uib-node-tag { + position: absolute; + top: -9px; + left: 2px; + font-size: 9px; + line-height: 9px; + padding: 1px 4px; + border-radius: 3px; + background: var(--joy-palette-primary-500); + color: #fff; + display: none; + pointer-events: none; + white-space: nowrap; +} + +.uib-node:hover > .uib-node-tag, +.uib-node-selected > .uib-node-tag { + display: block; +} + +/* Marker on views that carry a tap action, so the canvas shows what is wired up. */ +.uib-node-action { + position: absolute; + top: -9px; + right: 2px; + font-size: 9px; + line-height: 9px; + padding: 1px 4px; + border-radius: 3px; + background: var(--joy-palette-warning-500, #f0a020); + color: #16160f; + pointer-events: none; + white-space: nowrap; +} + +.uib-node-unknown { + padding: 4px 8px; + font-size: 11px; + color: #b00020; + border: 1px solid #b00020; + border-radius: 4px; +} + +/* ---------------------------------------------------------- inspector -- */ + +.uib-inspector, +.uib-tree-wrapper { + display: flex; + flex-direction: column; + gap: var(--padding-xs); +} + +.uib-section { + display: flex; + flex-direction: column; + gap: 6px; + border: 1px solid var(--joy-palette-divider); + border-radius: 8px; + padding: var(--padding-sm); +} + +.uib-field { + display: grid; + grid-template-columns: 1fr auto; + align-items: center; + gap: 6px; + font-size: 12px; +} + +.uib-field > label { + grid-column: 1 / -1; + opacity: 0.75; +} + +.uib-field input[type="text"], +.uib-field input[type="number"], +.uib-field select { + grid-column: 1 / -1; + width: 100%; + box-sizing: border-box; + padding: 3px 6px; + font-size: 12px; + font-family: inherit; + color: inherit; + background: transparent; + border: 1px solid var(--joy-palette-divider); + border-radius: 5px; +} + +.uib-hint { + grid-column: 1 / -1; + font-size: 10px; + opacity: 0.6; + line-height: 1.35; +} + +.uib-hint-warn { + color: var(--joy-palette-danger-500); + opacity: 1; +} + +/* Preview of the Swift the action will generate. */ +.uib-code-hint { + grid-column: 1 / -1; + font-family: ui-monospace, SFMono-Regular, Menlo, monospace; + font-size: 10px; + line-height: 1.4; + white-space: pre-wrap; + padding: 4px 6px; + border-radius: 5px; + background: rgba(127, 127, 127, 0.12); + opacity: 0.85; +} + +.uib-node-actions { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +/* ---------------------------------------------------------------- tree -- */ + +.uib-tree { + display: flex; + flex-direction: column; + border: 1px solid var(--joy-palette-divider); + border-radius: 8px; + overflow: hidden; +} + +.uib-tree-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 4px; + padding: 2px 6px; + font-size: 12px; + cursor: pointer; +} + +.uib-tree-row:hover { + background: var(--joy-palette-neutral-100); +} + +.uib-tree-row-selected { + background: var(--joy-palette-primary-100); +} + +.uib-tree-label { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.uib-tree-actions { + display: flex; + gap: 2px; + opacity: 0; +} + +.uib-tree-row:hover .uib-tree-actions, +.uib-tree-row-selected .uib-tree-actions { + opacity: 1; +} + +.uib-tree-actions > button { + border: none; + background: transparent; + color: inherit; + cursor: pointer; + font-size: 11px; + line-height: 1; + padding: 2px 3px; + border-radius: 3px; +} + +.uib-tree-actions > button:hover { + background: var(--joy-palette-neutral-200); +} + +/* ---------------------------------------------------------------- code -- */ + +.uib-code { + flex: none; + max-height: 38%; + overflow: auto; + border-top: 1px solid var(--joy-palette-divider); + padding-top: var(--padding-xs); + margin-top: var(--padding-xs); +} + +.uib-code > pre { + margin: 0; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + font-size: 12px; + line-height: 1.45; + white-space: pre; +} + +/* ------------------------------------------------------ package picker -- */ + +.uib-package-picker { + display: flex; + align-items: flex-end; + gap: var(--padding-xs); + flex-wrap: wrap; +} + +.uib-package-picker > label { + display: flex; + flex-direction: column; + gap: 2px; + font-size: 10px; + text-transform: uppercase; + letter-spacing: 0.04em; + opacity: 0.75; +} + +.uib-package-picker > label > div { + min-width: 130px; + max-width: 220px; +} + +.uib-package-error { + margin-top: var(--padding-xs); + padding: 4px 8px; + border-radius: 6px; + font-size: 11px; + color: var(--joy-palette-danger-700); + background: var(--joy-palette-danger-50); +} + +.uib-import-warning { + display: flex; + align-items: flex-start; + gap: 8px; + margin: 4px 8px 0; + padding: 6px 10px; + border-radius: 6px; + font-size: 11px; + color: var(--joy-palette-warning-800); + background: var(--joy-palette-warning-50); +} + +.uib-import-warning > span { + flex: none; +} + +.uib-import-warning ul { + margin: 0; + padding-left: 16px; + flex: 1; +} diff --git a/src/ui-builder/UIBuilder.tsx b/src/ui-builder/UIBuilder.tsx new file mode 100644 index 0000000..2c9cf87 --- /dev/null +++ b/src/ui-builder/UIBuilder.tsx @@ -0,0 +1,1437 @@ +// Visual SwiftUI builder: palette -> canvas -> inspector -> generated SwiftUI. + +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import type { ChangeEvent, DragEvent } from "react"; +import { exists, mkdir, readDir, readTextFile, writeTextFile } from "@tauri-apps/plugin-fs"; +import { Button, Checkbox, Select, Option, Typography } from "@mui/joy"; +import { invoke } from "@tauri-apps/api/core"; +import { open as openFolderDialog } from "@tauri-apps/plugin-dialog"; +import { useToast } from "react-toast-plus"; +import { + CATALOG, + CATEGORY_ORDER, + PALETTE, + boxCss, + defaultsFor, + fieldsOf, + stateNames, +} from "./catalog"; +import type { PropField } from "./catalog"; +import { + ACTION_OPTIONS, + actionStatements, + needsTarget, + needsValue, +} from "./actions"; +import type { ActionKind } from "./actions"; +import { generateSwift } from "./codegen"; +import { str, swiftIdentifier } from "./format"; +import { parseSwiftDocument } from "./parse"; +import type { SwiftImport } from "./parse"; +import { + DEFAULT_VIEW_NAME, + DOCUMENT_VERSION, + duplicateNode, + findNode, + findParent, + insertNode, + isDescendant, + makeId, + moveNode, + node, + removeNode, + replaceNode, + walk, +} from "./types"; +import type { Props, UIDocument, UINode } from "./types"; +import { joinPath, normalizePath } from "../xcode-import/project-files"; +import { useIDE } from "../utilities/IDEContext"; +import { useStore } from "../utilities/StoreContext"; +import { useCommandRunner } from "../utilities/Command"; +import "./UIBuilder.css"; + +/** One SwiftPM package of the workspace, as reported by the backend. */ +export type PackageTarget = { + name: string; + kind: string; + path: string; + isTest: boolean; +}; + +export type SwiftPackage = { + name: string; + path: string; + targets: PackageTarget[]; + error: string | null; +}; + +const PALETTE_MIME = "application/x-crosscode-ui-kind"; +const NODE_MIME = "application/x-crosscode-ui-node"; + +function bytesToBase64(bytes: number[]): string { + let binary = ""; + const chunkSize = 0x8000; + for (let index = 0; index < bytes.length; index += chunkSize) { + binary += String.fromCharCode(...bytes.slice(index, index + chunkSize)); + } + return btoa(binary); +} + +type PreviewDiagnostic = { + file: string; + line: number; + column: number; + severity: "error" | "warning"; + message: string; +}; + +function parsePreviewDiagnostics(output: string): PreviewDiagnostic[] { + const diagnostics: PreviewDiagnostic[] = []; + const pattern = /^(.+?):(\d+):(\d+):\s+(error|warning):\s+(.+)$/gm; + for (const match of output.matchAll(pattern)) { + diagnostics.push({ + file: match[1].trim(), + line: Number(match[2]), + column: Number(match[3]), + severity: match[4] as PreviewDiagnostic["severity"], + message: match[5].trim(), + }); + } + return diagnostics; +} + +export interface UIBuilderProps { + projectPath: string; + /** The file the editor currently shows; the builder follows its package. */ + focusedFile?: string | null; + openNewFile: (file: string) => void; + onClose: () => void; +} + +// -------------------------------------------------------------- document io -- + +function starterDocument(): UIDocument { + return { + version: DOCUMENT_VERSION, + name: DEFAULT_VIEW_NAME, + includePreview: true, + root: node("VStack", { alignment: "leading", spacing: "16", padding: "16" }, [ + node("Text", { text: "Hello, world!", font: ".largeTitle", weight: ".bold" }), + node("Button", { title: "Tap me", style: "borderedProminent" }), + ]), + }; +} + +function normalizeNode(raw: unknown): UINode | null { + if (!raw || typeof raw !== "object") return null; + const record = raw as Record; + if (typeof record.kind !== "string") return null; + + const props: Props = {}; + if (record.props && typeof record.props === "object") { + for (const [key, value] of Object.entries(record.props as Record)) { + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + props[key] = value; + } + } + } + + const children: UINode[] = []; + if (Array.isArray(record.children)) { + for (const child of record.children) { + const normalized = normalizeNode(child); + if (normalized) children.push(normalized); + } + } + + return { + id: typeof record.id === "string" && record.id.length > 0 ? record.id : makeId(), + kind: record.kind, + props, + children, + }; +} + +function normalizeDocument(raw: unknown): UIDocument | null { + if (!raw || typeof raw !== "object") return null; + const record = raw as Record; + const root = normalizeNode(record.root); + if (!root) return null; + return { + version: DOCUMENT_VERSION, + name: typeof record.name === "string" && record.name.length > 0 ? record.name : DEFAULT_VIEW_NAME, + includePreview: record.includePreview !== false, + root, + }; +} + +/** Compares two layouts, ignoring node ids (which are regenerated on load). */ +function sameLayout(a: UINode, b: UINode): boolean { + if (a.kind !== b.kind) return false; + const aKeys = Object.keys(a.props).sort(); + const bKeys = Object.keys(b.props).sort(); + if (aKeys.length !== bKeys.length) return false; + if (aKeys.some((key, index) => key !== bKeys[index] || a.props[key] !== b.props[key])) { + return false; + } + if (a.children.length !== b.children.length) return false; + return a.children.every((child, index) => sameLayout(child, b.children[index])); +} + +/** + * Reads a Swift file and parses it, or null when it holds no SwiftUI view. + */ +async function readSwiftView(path: string): Promise { + try { + if (!path.toLowerCase().endsWith(".swift")) return null; + const source = await readTextFile(path); + const name = path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1).replace(/\.swift$/i, ""); + return parseSwiftDocument(source, { name }); + } catch (error) { + console.warn("Failed to read Swift file", path, error); + return null; + } +} + +/** + * Where a drop lands: a container accepts children directly, dropping onto a + * leaf inserts after it in the leaf's parent. + */ +function resolveDrop(current: UIDocument, hovered: UINode): { parent: UINode; index: number } { + const spec = CATALOG[hovered.kind]; + const parent = spec?.container + ? hovered + : findParent(current.root, hovered.id) ?? current.root; + const index = spec?.container + ? parent.children.length + : parent.children.findIndex((child) => child.id === hovered.id) + 1; + return { parent, index }; +} + +// -------------------------------------------------------------- palette -- + +const Palette = ({ onAdd }: { onAdd: (kind: string) => void }) => ( +
+ {CATEGORY_ORDER.map((category) => { + const entries = PALETTE.filter((spec) => spec.category === category); + if (entries.length === 0) return null; + return ( +
+
{category}
+ {entries.map((spec) => ( +
{ + event.dataTransfer.setData(PALETTE_MIME, spec.kind); + event.dataTransfer.effectAllowed = "copy"; + }} + onClick={() => onAdd(spec.kind)} + > + {spec.label} +
+ ))} +
+ ); + })} +
+); + +// --------------------------------------------------------------- canvas -- + +interface NodeViewProps { + node: UINode; + selectedId: string | null; + onSelect: (id: string) => void; + onDropOnNode: (event: DragEvent, target: UINode) => void; +} + +const NodeView = ({ node: current, selectedId, onSelect, onDropOnNode }: NodeViewProps) => { + const spec = CATALOG[current.kind]; + const children = current.children.map((child) => ( + + )); + + if (!spec) { + return ( +
{ + event.stopPropagation(); + onSelect(current.id); + }} + onDragOver={(event) => event.preventDefault()} + > + Unknown component: {current.kind} +
+ ); + } + + return ( +
{ + event.stopPropagation(); + onSelect(current.id); + }} + onDragOver={(event) => { + event.preventDefault(); + event.stopPropagation(); + }} + onDrop={(event) => onDropOnNode(event, current)} + > + {spec.label} + {actionStatements(current).length > 0 && ( + + tap + + )} + {spec.preview(current, children)} +
+ ); +}; + +const Canvas = ({ + doc, + previewDevice, + previewScale, + streamedImage, + previewAppearance, + previewOrientation, + selectedId, + onSelect, + onDropOnNode, + onDropOnRoot, +}: { + doc: UIDocument; + previewDevice: "iphone" | "ipad" | "mac"; + previewScale: number; + streamedImage: string | null; + previewAppearance: "light" | "dark"; + previewOrientation: "portrait" | "landscape"; + selectedId: string | null; + onSelect: (id: string) => void; + onDropOnNode: (event: DragEvent, target: UINode) => void; + onDropOnRoot: (event: DragEvent) => void; +}) => ( +
onSelect(doc.root.id)}> + {streamedImage && ( +
+
Simulator stream
+ Live simulator preview +
+ )} +
event.preventDefault()} + onDrop={onDropOnRoot} + > +
+ 9:41 + CrossCode preview +
+
+ +
+
+
+
+); + +// ------------------------------------------------------------------ tree -- + +const TreeView = ({ + doc, + selectedId, + onSelect, + onDelete, + onDuplicate, + onMove, +}: { + doc: UIDocument; + selectedId: string | null; + onSelect: (id: string) => void; + onDelete: (id: string) => void; + onDuplicate: (id: string) => void; + onMove: (id: string, delta: number) => void; +}) => ( +
+ {walk(doc.root).map((item) => { + const spec = CATALOG[item.kind]; + const depth = (() => { + let level = 0; + let parent = findParent(doc.root, item.id); + while (parent) { + level += 1; + parent = findParent(doc.root, parent.id); + } + return level; + })(); + return ( +
onSelect(item.id)} + > + + {spec ? spec.label : item.kind} + {spec && !spec.container && str(item.props.text) ? `: ${str(item.props.text)}` : ""} + + + + + + {item.id !== doc.root.id && ( + + )} + +
+ ); + })} +
+); + +// ------------------------------------------------------------- inspector -- + +/** + * Editor for a node's tap action. It writes three props (`action`, + * `actionTarget`, `actionValue`) and previews the statement the generator will + * emit, so the effect of the choice is visible without regenerating the file. + */ +const ActionEditor = ({ + node: selected, + suggestions, + onPropChange, +}: { + node: UINode; + suggestions: string[]; + onPropChange: (id: string, key: string, value: string | number | boolean) => void; +}) => { + const raw = str(selected.props.action); + const kind = (ACTION_OPTIONS.some((option) => option.value === raw) ? raw : "none") as ActionKind; + const statements = actionStatements(selected); + const incomplete = statements.some((statement) => statement.startsWith("//")); + + return ( +
+ + + {needsTarget(kind) && ( + onPropChange(selected.id, "actionTarget", event.target.value)} + /> + )} + {needsValue(kind) && ( + onPropChange(selected.id, "actionValue", event.target.value)} + /> + )} + {kind !== "none" && ( +
+ {statements.join("\n")} +
+ )} + {needsTarget(kind) && ( +
+ {kind === "set" + ? "Variables are declared for you; the value may be a number, true/false or text." + : "Name of the @State variable this changes; it is declared for you."} +
+ )} + {suggestions.length > 0 && ( + + {suggestions.map((name) => ( + + )} +
+ ); +}; + +const FieldEditor = ({ + field, + value, + onChange, +}: { + field: PropField; + value: string | number | boolean | undefined; + onChange: (value: string | number | boolean) => void; +}) => { + if (field.type === "bool") { + return ( +
+ + ) => onChange(event.target.checked)} + /> +
+ ); + } + + if (field.type === "enum") { + return ( +
+ + +
+ ); + } + + const isNumber = field.type === "number"; + const isState = field.type === "state"; + const text = typeof value === "number" ? value.toString() : str(value); + const sanitized = isState ? swiftIdentifier(text) : ""; + const invalidState = isState && text.trim().length > 0 && sanitized !== text.trim(); + + return ( +
+ + onChange(event.target.value)} + /> + {isState && ( +
+ {invalidState + ? `Not a valid name — the generated variable will be "${sanitized}"` + : `Swift type: ${field.valueType}`} +
+ )} +
+ ); +}; + +const Inspector = ({ + doc, + selected, + onPropChange, + onDelete, + onDuplicate, + onMove, + onSelect, + onNameChange, + onPreviewChange, +}: { + doc: UIDocument; + selected: UINode | null; + onPropChange: (id: string, key: string, value: string | number | boolean) => void; + onDelete: (id: string) => void; + onDuplicate: (id: string) => void; + onMove: (id: string, delta: number) => void; + onSelect: (id: string) => void; + onNameChange: (name: string) => void; + onPreviewChange: (include: boolean) => void; +}) => { + const spec = selected ? CATALOG[selected.kind] : null; + const parent = selected ? findParent(doc.root, selected.id) : null; + + return ( +
+
+
Document
+
+ + onNameChange(event.target.value)} + /> +
Writes Sources/{swiftIdentifier(doc.name) || DEFAULT_VIEW_NAME}.swift
+
+
+ + ) => + onPreviewChange(event.target.checked) + } + /> +
+
+ #Preview needs a toolchain with macro support (reinstall the Darwin SDK if this fails). +
+
+ + {selected && spec ? ( +
+
{spec.label}
+
+ + + + {parent && ( + + )} + {selected.id !== doc.root.id && ( + + )} +
+ {fieldsOf(selected).map((field) => + field.type === "action" ? ( + + ) : ( + onPropChange(selected.id, field.key, value)} + /> + ) + )} +
+ ) : ( +
+ Nothing selected — click a view on the canvas or in the tree. +
+ )} +
+ ); +}; + +// ------------------------------------------------------------------- main -- + +export default ({ projectPath, focusedFile, openNewFile, onClose }: UIBuilderProps) => { + const { selectedToolchain, devices, selectedDevice, setSelectedDevice, mountDdi } = useIDE(); + const [anisetteServer] = useStore("apple-id/anisette-server", "ani.sidestore.io"); + const { runCommand, isRunningCommand } = useCommandRunner(); + const [doc, setDoc] = useState(starterDocument); + const [packages, setPackages] = useState([]); + const [packagesError, setPackagesError] = useState(null); + const [loadingPackages, setLoadingPackages] = useState(true); + const [packagePath, setPackagePath] = useState(normalizePath(projectPath)); + const [targetPath, setTargetPath] = useState(""); + const [selectedId, setSelectedId] = useState(null); + const [loaded, setLoaded] = useState(false); + const [showCode, setShowCode] = useState(true); + const [importWarnings, setImportWarnings] = useState([]); + const [undoDepth, setUndoDepth] = useState(0); + const [redoDepth, setRedoDepth] = useState(0); + const { addToast } = useToast(); + + const docRef = useRef(doc); + const historyRef = useRef([]); + const futureRef = useRef([]); + + // The load effect must not re-run when these change, so they live in refs. + const focusedFileRef = useRef(focusedFile); + const targetRef = useRef({ sourcesDirectory: "", viewName: DEFAULT_VIEW_NAME }); + + const activePackage = useMemo( + () => packages.find((candidate) => candidate.path === packagePath) ?? null, + [packagePath, packages] + ); + const targets = useMemo( + () => (activePackage ? activePackage.targets.filter((target) => !target.isTest) : []), + [activePackage] + ); + + // Per package, so switching packages switches the document too. + const documentPath = useMemo( + () => `${normalizePath(packagePath)}/.crosscode/ui-builder.json`, + [packagePath] + ); + const sourcesDirectory = useMemo(() => { + const base = normalizePath(packagePath); + const relative = targetPath.length > 0 ? targetPath.replace(/^\/+/, "") : "Sources"; + return `${base}/${relative}`; + }, [packagePath, targetPath]); + const viewName = swiftIdentifier(doc.name) || DEFAULT_VIEW_NAME; + const swiftPath = `${sourcesDirectory}/${viewName}.swift`; + const code = useMemo(() => generateSwift(doc), [doc]); + + // Latest editor/target context, read by the (rarely running) load effect. + useEffect(() => { + focusedFileRef.current = focusedFile; + }, [focusedFile]); + + useEffect(() => { + targetRef.current = { sourcesDirectory, viewName }; + }, [sourcesDirectory, viewName]); + + const commit = useCallback((updater: (current: UIDocument) => UIDocument) => { + const previous = docRef.current; + const next = updater(previous); + if (next === previous) return; + docRef.current = next; + historyRef.current.push(previous); + if (historyRef.current.length > 100) historyRef.current.shift(); + futureRef.current = []; + setUndoDepth(historyRef.current.length); + setRedoDepth(0); + setDoc(next); + }, []); + + const undo = useCallback(() => { + const previous = historyRef.current.pop(); + if (!previous) return; + futureRef.current.push(docRef.current); + docRef.current = previous; + setDoc(previous); + setUndoDepth(historyRef.current.length); + setRedoDepth(futureRef.current.length); + }, []); + + const redo = useCallback(() => { + const next = futureRef.current.pop(); + if (!next) return; + historyRef.current.push(docRef.current); + docRef.current = next; + setDoc(next); + setUndoDepth(historyRef.current.length); + setRedoDepth(futureRef.current.length); + }, []); + + const loadPackages = useCallback( + async (root: string, keepSelection: boolean) => { + setLoadingPackages(true); + try { + const found = await invoke("list_swift_packages", { + rootPath: root, + toolchainPath: selectedToolchain?.path ?? "", + }); + setPackages(found); + setPackagesError(null); + if (found.length === 0) { + setPackagesError("No Swift package found below this project."); + return; + } + setPackagePath((current) => { + if (keepSelection && found.some((candidate) => candidate.path === current)) return current; + const normalized = normalizePath(root); + return ( + found.find((candidate) => candidate.path === normalized)?.path ?? found[0].path + ); + }); + } catch (error) { + setPackages([]); + setPackagesError(String(error)); + } finally { + setLoadingPackages(false); + } + }, + [selectedToolchain] + ); + + useEffect(() => { + void loadPackages(projectPath, true); + }, [loadPackages, projectPath]); + + // the builder follows the package of the file that is open in the editor + useEffect(() => { + if (!focusedFile || packages.length === 0) return; + const file = normalizePath(focusedFile); + const owner = packages + .filter((candidate) => file.startsWith(`${candidate.path}/`)) + .sort((a, b) => b.path.length - a.path.length)[0]; + if (!owner || owner.path === packagePath) return; + setPackagePath(owner.path); + }, [focusedFile, packages, packagePath]); + + // keep the target valid for the selected package + useEffect(() => { + if (!activePackage) return; + const current = targets.find((target) => target.path === targetPath); + if (current) return; + if (focusedFile) { + const file = normalizePath(focusedFile); + const owner = targets.find( + (target) => target.path.length > 0 && file.startsWith(joinPath(activePackage.path, target.path) + "/") + ); + if (owner) { + setTargetPath(owner.path); + return; + } + } + setTargetPath(targets[0]?.path ?? "Sources"); + }, [activePackage, focusedFile, targetPath, targets]); + + // load the document that belongs to the selected package + useEffect(() => { + let cancelled = false; + setLoaded(false); + setImportWarnings([]); + + // Without a saved document the builder adopts the Swift file that is + // already in the project, so opening it on an existing view shows that view + // instead of the starter layout. + const findExistingSwiftView = async (): Promise<{ path: string; imported: SwiftImport } | null> => { + const { sourcesDirectory, viewName } = targetRef.current; + const candidates: string[] = []; + const focused = focusedFileRef.current ? normalizePath(focusedFileRef.current) : ""; + if (focused.toLowerCase().endsWith(".swift")) { + candidates.push(focused); + } + candidates.push(`${sourcesDirectory}/${viewName}.swift`); + candidates.push(`${sourcesDirectory}/${DEFAULT_VIEW_NAME}.swift`); + const collectSwiftFiles = async (directory: string, depth = 0): Promise => { + if (depth > 8 || candidates.length > 200) return; + try { + for (const entry of await readDir(directory)) { + const entryPath = `${normalizePath(directory)}/${entry.name}`; + if (entry.isFile && entry.name.toLowerCase().endsWith(".swift")) { + candidates.push(entryPath); + } else if (entry.isDirectory && ![".build", ".git", "Pods", "node_modules"].includes(entry.name)) { + await collectSwiftFiles(entryPath, depth + 1); + } + } + } catch { + // inaccessible directories are skipped + } + }; + await collectSwiftFiles(sourcesDirectory); + for (const path of [...new Set(candidates)]) { + const imported = await readSwiftView(path); + if (imported) return { path, imported }; + } + return null; + }; + + (async () => { + try { + const starter = starterDocument(); + + let saved: UIDocument | null = null; + if (await exists(documentPath)) { + saved = normalizeDocument(JSON.parse(await readTextFile(documentPath))); + } + if (cancelled) return; + + // A saved document that still matches the untouched starter layout means + // the builder was only ever opened, never edited. In that case the Swift + // file on disk wins, so opening the builder on an existing project shows + // the real view instead of "Hello, world!". + const untouched = + saved !== null && saved.name === starter.name && sameLayout(saved.root, starter.root); + + let next: UIDocument | null = saved && !untouched ? saved : null; + let imported: { path: string; imported: SwiftImport } | null = null; + if (!next) { + imported = await findExistingSwiftView(); + next = imported ? imported.imported.document : starter; + } + if (cancelled) return; + + historyRef.current = []; + futureRef.current = []; + docRef.current = next; + setDoc(next); + setSelectedId(next.root.id); + setUndoDepth(0); + setRedoDepth(0); + if (imported) { + setImportWarnings(imported.imported.warnings); + addToast.success(`Imported ${imported.path}`); + } + } catch (error) { + console.warn("Failed to load the UI builder document", error); + addToast.error("Failed to load the saved UI builder document"); + } finally { + if (!cancelled) setLoaded(true); + } + })(); + return () => { + cancelled = true; + }; + }, [documentPath, addToast, packagePath]); + + // autosave (debounced) so the layout survives a window reload + useEffect(() => { + if (!loaded) return; + const timer = setTimeout(async () => { + try { + const directory = documentPath.substring(0, documentPath.lastIndexOf("/")); + if (!(await exists(directory))) await mkdir(directory, { recursive: true }); + await writeTextFile(documentPath, JSON.stringify(doc, null, 2)); + } catch (error) { + console.warn("Failed to save the UI builder document", error); + } + }, 600); + return () => clearTimeout(timer); + }, [doc, loaded, documentPath]); + + const addNode = useCallback( + (kind: string, parentId?: string, index?: number) => { + const created = node(kind, defaultsFor(kind)); + commit((current) => ({ + ...current, + root: insertNode(current.root, parentId ?? current.root.id, created, index), + })); + setSelectedId(created.id); + }, + [commit] + ); + + const deleteNode = useCallback( + (id: string) => { + commit((current) => ({ ...current, root: removeNode(current.root, id) })); + setSelectedId((current) => (current === id ? docRef.current.root.id : current)); + }, + [commit] + ); + + const duplicate = useCallback( + (id: string) => { + const { root, newId } = duplicateNode(docRef.current.root, id); + if (newId === id) return; + commit(() => ({ ...docRef.current, root })); + setSelectedId(newId); + }, + [commit] + ); + + const move = useCallback( + (id: string, delta: number) => { + commit((current) => ({ ...current, root: moveNode(current.root, id, delta) })); + }, + [commit] + ); + + const setProp = useCallback( + (id: string, key: string, value: string | number | boolean) => { + commit((current) => ({ + ...current, + root: replaceNode(current.root, id, (item) => ({ + ...item, + props: { ...item.props, [key]: value }, + })), + })); + }, + [commit] + ); + + const handleDropOnNode = useCallback( + (event: DragEvent, hovered: UINode) => { + event.preventDefault(); + event.stopPropagation(); + const kind = event.dataTransfer.getData(PALETTE_MIME); + const movedId = event.dataTransfer.getData(NODE_MIME); + if (!kind && !movedId) return; + + const current = docRef.current; + const { parent, index } = resolveDrop(current, hovered); + if (kind) { + const created = node(kind, defaultsFor(kind)); + commit((d) => ({ ...d, root: insertNode(d.root, parent.id, created, index) })); + setSelectedId(created.id); + return; + } + const dragged = findNode(current.root, movedId); + if (!dragged || dragged.id === hovered.id) return; + if (isDescendant(dragged, parent.id)) return; + const oldParent = findParent(current.root, movedId); + const oldIndex = oldParent + ? oldParent.children.findIndex((child) => child.id === movedId) + : -1; + let target = index; + if (oldParent && oldParent.id === parent.id && oldIndex >= 0 && oldIndex < index) { + target = index - 1; + } + const without = removeNode(current.root, movedId); + commit((d) => ({ + ...d, + root: insertNode(without, parent.id, dragged, target), + })); + }, + [commit] + ); + + const handleDropOnRoot = useCallback( + (event: DragEvent) => { + event.preventDefault(); + const kind = event.dataTransfer.getData(PALETTE_MIME); + const movedId = event.dataTransfer.getData(NODE_MIME); + if (!kind && !movedId) return; + const current = docRef.current; + if (kind) { + const created = node(kind, defaultsFor(kind)); + commit((d) => ({ + ...d, + root: insertNode(d.root, d.root.id, created, d.root.children.length), + })); + setSelectedId(created.id); + return; + } + const dragged = findNode(current.root, movedId); + if (!dragged || dragged.id === current.root.id) return; + const without = removeNode(current.root, movedId); + commit((d) => ({ ...d, root: insertNode(without, without.id, dragged) })); + }, + [commit] + ); + + const saveSwift = useCallback(async () => { + try { + if (!(await exists(sourcesDirectory))) await mkdir(sourcesDirectory, { recursive: true }); + await writeTextFile(swiftPath, code); + addToast.success(`Wrote ${swiftPath}`); + return true; + } catch (error) { + addToast.error(`Failed to write ${swiftPath}: ${error}`); + return false; + } + }, [addToast, code, sourcesDirectory, swiftPath]); + + /** Replaces the current layout with the Swift file open in the editor. */ + const importFromEditor = useCallback(async () => { + const focused = focusedFileRef.current ? normalizePath(focusedFileRef.current) : ""; + if (!focused.toLowerCase().endsWith(".swift")) { + addToast.error("Open a SwiftUI view file in the editor first."); + return; + } + const imported = await readSwiftView(focused); + if (!imported) { + addToast.error(`${focused} declares no SwiftUI view.`); + return; + } + historyRef.current = []; + futureRef.current = []; + docRef.current = imported.document; + setDoc(imported.document); + setSelectedId(imported.document.root.id); + setUndoDepth(0); + setRedoDepth(0); + setImportWarnings(imported.warnings); + addToast.success(`Imported ${focused}`); + }, [addToast]); + + const selected = selectedId ? findNode(doc.root, selectedId) : null; + const [previewDevice, setPreviewDevice] = useState<"iphone" | "ipad" | "mac">("iphone"); + const [previewScale, setPreviewScale] = useState(1); + const [previewAppearance, setPreviewAppearance] = useState<"light" | "dark">("light"); + const [previewOrientation, setPreviewOrientation] = useState<"portrait" | "landscape">("portrait"); + const [streamedImage, setStreamedImage] = useState(null); + const [streaming, setStreaming] = useState(false); + const [autoBuild, setAutoBuild] = useState(false); + const [previewStatus, setPreviewStatus] = useState<"idle" | "building" | "installing" | "ready" | "failed">("idle"); + const [previewError, setPreviewError] = useState(null); + const [previewDiagnostics, setPreviewDiagnostics] = useState([]); + const lastAutoBuiltCode = useRef(null); + + const capturePreview = useCallback(async () => { + if (!selectedDevice) return; + try { + if (!(await mountDdi(false))) return; + const bytes = await invoke("take_screenshot", { device: selectedDevice }); + setStreamedImage(`data:image/png;base64,${bytesToBase64(bytes)}`); + } catch (error) { + console.error("Failed to stream simulator preview", error); + } + }, [mountDdi, selectedDevice]); + + const buildAndStream = useCallback(async () => { + if (!selectedDevice) { + addToast.error("Select a simulator or device first."); + return; + } + if (!selectedToolchain) { + addToast.error("Select a Swift toolchain first."); + return; + } + if (!(await saveSwift())) return; + if (!(await mountDdi(true))) return; + try { + setPreviewError(null); + setPreviewDiagnostics([]); + setPreviewStatus("building"); + await runCommand("deploy_swift", { + folder: projectPath, + anisetteServer, + device: selectedDevice, + toolchainPath: selectedToolchain.path, + debug: true, + }); + setPreviewStatus("installing"); + await capturePreview(); + setStreaming(true); + setPreviewStatus("ready"); + addToast.success("Built, installed, and streaming preview."); + } catch (error) { + setPreviewStatus("failed"); + setPreviewError(String(error)); + setPreviewDiagnostics(parsePreviewDiagnostics(String(error))); + setStreaming(false); + addToast.error(`Preview deployment failed: ${error}`); + } + }, [addToast, anisetteServer, capturePreview, mountDdi, projectPath, runCommand, saveSwift, selectedDevice, selectedToolchain]); + + useEffect(() => { + if (!autoBuild || !loaded || !selectedDevice || !selectedToolchain) return; + if (lastAutoBuiltCode.current === code) return; + const timer = window.setTimeout(() => { + lastAutoBuiltCode.current = code; + void buildAndStream(); + }, 800); + return () => window.clearTimeout(timer); + }, [autoBuild, buildAndStream, code, loaded, selectedDevice, selectedToolchain]); + + useEffect(() => { + if (!streaming || !selectedDevice) return; + void capturePreview(); + const timer = window.setInterval(() => void capturePreview(), 1500); + return () => window.clearInterval(timer); + }, [capturePreview, selectedDevice, streaming]); + + return ( +
+
+ UI Builder +
+
+
+ + + + +
+
+ + + + + + + + + +
+
+ + {packagesError &&
{packagesError}
} + {previewError && ( +
+ {previewError} + +
+ )} + {previewDiagnostics.length > 0 && ( +
+ {previewDiagnostics.map((diagnostic, index) => ( + + ))} +
+ )} + {importWarnings.length > 0 && ( +
+ + Imported from Swift — {importWarnings.length} thing + {importWarnings.length === 1 ? "" : "s"} could not be represented: + +
    + {importWarnings.slice(0, 6).map((warning) => ( +
  • {warning}
  • + ))} + {importWarnings.length > 6 &&
  • …
  • } +
+ +
+ )} + +
+
+ addNode(kind)} /> +
+ +
+ commit((current) => ({ ...current, name }))} + onPreviewChange={(includePreview) => + commit((current) => ({ ...current, includePreview })) + } + /> +
+
Structure
+ +
+
+
+ + {showCode && ( +
+
{code}
+
+ )} +
+ ); +}; diff --git a/src/ui-builder/actions.test.ts b/src/ui-builder/actions.test.ts new file mode 100644 index 0000000..652a670 --- /dev/null +++ b/src/ui-builder/actions.test.ts @@ -0,0 +1,117 @@ +import { describe, expect, test } from "bun:test"; +import { + DISMISS_DECLARATION, + actionStateDeclarations, + actionStatements, + needsTarget, + needsValue, + nodeAction, + parseLiteral, + tapGestureLines, + usesDismiss, +} from "./actions"; +import { node } from "./types"; + +describe("nodeAction", () => { + test("is null without an action and for the 'none' placeholder", () => { + expect(nodeAction(node("Button", {}))).toBeNull(); + expect(nodeAction(node("Button", { action: "none" }))).toBeNull(); + expect(nodeAction(node("Button", { action: "nonsense" }))).toBeNull(); + }); + + test("sanitises the target name", () => { + const action = nodeAction(node("Button", { action: "toggle", actionTarget: "is Enabled!" })); + expect(action?.kind).toBe("toggle"); + expect(action?.target).toBe("isEnabled"); + }); + + test("knows which kinds need a target or a value", () => { + expect(needsTarget("toggle")).toBe(true); + expect(needsTarget("set")).toBe(true); + expect(needsTarget("dismiss")).toBe(false); + expect(needsValue("set")).toBe(true); + expect(needsValue("toggle")).toBe(false); + }); +}); + +describe("parseLiteral", () => { + test("keeps numbers, booleans and quoted strings as Swift literals", () => { + expect(parseLiteral("42")).toEqual({ swift: "42", type: "Int" }); + expect(parseLiteral("-3")).toEqual({ swift: "-3", type: "Int" }); + expect(parseLiteral("2.5")).toEqual({ swift: "2.5", type: "Double" }); + expect(parseLiteral("true")).toEqual({ swift: "true", type: "Bool" }); + expect(parseLiteral('"Alex"')).toEqual({ swift: '"Alex"', type: "String" }); + }); + + test("quotes anything else, and escapes it", () => { + expect(parseLiteral("Alex")).toEqual({ swift: '"Alex"', type: "String" }); + expect(parseLiteral('say "hi"')).toEqual({ swift: '"say \\"hi\\""', type: "String" }); + expect(parseLiteral(" ")).toBeNull(); + }); +}); + +describe("actionStatements", () => { + test("renders each action kind", () => { + expect(actionStatements(node("Button", { action: "toggle", actionTarget: "isOn" }))).toEqual([ + "isOn.toggle()", + ]); + expect(actionStatements(node("Button", { action: "increment", actionTarget: "count" }))).toEqual([ + "count += 1", + ]); + expect(actionStatements(node("Button", { action: "decrement", actionTarget: "count" }))).toEqual([ + "count -= 1", + ]); + expect(actionStatements(node("Button", { action: "set", actionTarget: "name", actionValue: "Alex" }))).toEqual([ + 'name = "Alex"', + ]); + expect(actionStatements(node("Button", { action: "dismiss" }))).toEqual(["dismiss()"]); + }); + + test("stays valid Swift when the action is not finished", () => { + expect(actionStatements(node("Button", { action: "toggle" }))).toEqual([ + "// TODO: name the state variable this changes", + ]); + expect(actionStatements(node("Button", { action: "set", actionTarget: "name" }))).toEqual([ + "// TODO: give name a value", + ]); + expect(actionStatements(node("Button", {}))).toEqual([]); + }); +}); + +describe("action state", () => { + test("infers the type of the variable an action needs", () => { + expect(actionStateDeclarations(node("Button", { action: "toggle", actionTarget: "isOn" }))).toEqual([ + { name: "isOn", type: "Bool" }, + ]); + expect(actionStateDeclarations(node("Button", { action: "increment", actionTarget: "count" }))).toEqual([ + { name: "count", type: "Int" }, + ]); + expect( + actionStateDeclarations(node("Button", { action: "set", actionTarget: "ratio", actionValue: "0.5" })) + ).toEqual([{ name: "ratio", type: "Double" }]); + expect( + actionStateDeclarations(node("Button", { action: "set", actionTarget: "name", actionValue: "Alex" })) + ).toEqual([{ name: "name", type: "String" }]); + }); + + test("needs nothing without a target or for a dismiss", () => { + expect(actionStateDeclarations(node("Button", { action: "toggle" }))).toEqual([]); + expect(actionStateDeclarations(node("Button", { action: "dismiss" }))).toEqual([]); + expect(usesDismiss(node("Button", { action: "dismiss" }))).toBe(true); + expect(usesDismiss(node("Button", { action: "toggle", actionTarget: "x" }))).toBe(false); + expect(DISMISS_DECLARATION).toBe("@Environment(\\.dismiss) private var dismiss"); + }); +}); + +describe("tapGestureLines", () => { + test("is null when there is nothing to run", () => { + expect(tapGestureLines(node("Text", { text: "Hi" }))).toBeNull(); + }); + + test("opens a closure with the action body", () => { + expect(tapGestureLines(node("Text", { text: "Hi", action: "toggle", actionTarget: "hi" }))).toEqual({ + head: ".onTapGesture {", + body: ["hi.toggle()"], + }); + }); +}); diff --git a/src/ui-builder/actions.ts b/src/ui-builder/actions.ts new file mode 100644 index 0000000..3970a3c --- /dev/null +++ b/src/ui-builder/actions.ts @@ -0,0 +1,149 @@ +// Tap actions for the visual SwiftUI builder. +// +// A node can carry one action, stored in three primitive props so the document +// stays plain JSON: `action` (what to do), `actionTarget` (the `@State` +// variable it changes) and `actionValue` (the value to assign, for `set`). +// +// Buttons render the action in their own trailing closure; every other view +// gets an `.onTapGesture { ... }` appended to its modifier chain. The state +// variables the action needs are declared by the generator (see +// `stateDeclarations`), so making a button flip a toggle is one dropdown. +// +// Pure module: no React, no catalog import, so it is unit tested directly. + +import { str, swiftIdentifier, swiftString } from "./format"; +import type { StateValueType } from "./state"; +import type { UINode } from "./types"; + +export type ActionKind = + | "none" + | "toggle" + | "increment" + | "decrement" + | "set" + | "dismiss"; + +export const ACTION_OPTIONS: { value: ActionKind; label: string }[] = [ + { value: "none", label: "Nothing yet" }, + { value: "toggle", label: "Flip a toggle" }, + { value: "increment", label: "Add 1 to a number" }, + { value: "decrement", label: "Subtract 1 from a number" }, + { value: "set", label: "Assign a value" }, + { value: "dismiss", label: "Dismiss this view" }, +]; + +export type NodeAction = { + kind: ActionKind; + /** Sanitised name of the state variable the action changes ("" when unused). */ + target: string; + /** Raw text of the value a `set` action assigns. */ + value: string; +}; + +function isActionKind(value: string): value is ActionKind { + return ACTION_OPTIONS.some((option) => option.value === value); +} + +/** The action of a node, or null when it has none (or only an empty one). */ +export function nodeAction(node: UINode): NodeAction | null { + const kind = str(node.props.action); + if (!isActionKind(kind) || kind === "none") return null; + return { + kind, + target: swiftIdentifier(str(node.props.actionTarget)), + value: str(node.props.actionValue), + }; +} + +/** Whether the kind needs `actionTarget` filled in. */ +export function needsTarget(kind: ActionKind): boolean { + return kind === "toggle" || kind === "increment" || kind === "decrement" || kind === "set"; +} + +/** Whether the kind needs `actionValue` filled in. */ +export function needsValue(kind: ActionKind): boolean { + return kind === "set"; +} + +export type Literal = { swift: string; type: StateValueType }; + +/** + * A Swift literal for what the user typed, so the builder can ask for a value + * without asking for Swift syntax: `42` stays a number, `true` a Bool, `"a"` + * stays as written and anything else is quoted. + */ +export function parseLiteral(raw: string): Literal | null { + const text = raw.trim(); + if (text.length === 0) return null; + if (text === "true" || text === "false") return { swift: text, type: "Bool" }; + if (/^-?\d+$/.test(text)) return { swift: text, type: "Int" }; + if (/^-?\d*\.\d+$/.test(text)) return { swift: text, type: "Double" }; + if (/^".*"$/.test(text)) return { swift: text, type: "String" }; + if (text === "Date()") return { swift: text, type: "Date" }; + return { swift: swiftString(text), type: "String" }; +} + +/** + * Statements for the inside of a tap closure, not indented. An incomplete + * action still produces valid Swift: it falls back to a comment. + */ +export function actionStatements(node: UINode): string[] { + const action = nodeAction(node); + if (!action) return []; + if (action.kind === "dismiss") return ["dismiss()"]; + if (!action.target) return ["// TODO: name the state variable this changes"]; + + switch (action.kind) { + case "toggle": + return [`${action.target}.toggle()`]; + case "increment": + return [`${action.target} += 1`]; + case "decrement": + return [`${action.target} -= 1`]; + case "set": { + const literal = parseLiteral(action.value); + if (!literal) return [`// TODO: give ${action.target} a value`]; + return [`${action.target} = ${literal.swift}`]; + } + default: + return []; + } +} + +export type ActionState = { name: string; type: StateValueType }; + +/** + * The `@State` variables the action needs. `toggle` implies a Bool, the + * counters an Int and `set` whatever the literal turned out to be. + */ +export function actionStateDeclarations(node: UINode): ActionState[] { + const action = nodeAction(node); + if (!action || !action.target) return []; + if (action.kind === "toggle") return [{ name: action.target, type: "Bool" }]; + if (action.kind === "increment" || action.kind === "decrement") { + return [{ name: action.target, type: "Int" }]; + } + if (action.kind === "set") { + const literal = parseLiteral(action.value); + return [{ name: action.target, type: literal ? literal.type : "String" }]; + } + return []; +} + +/** Declaration a `dismiss` action needs (not a `@State`). */ +export const DISMISS_DECLARATION = "@Environment(\\.dismiss) private var dismiss"; + +/** Whether the node's action calls `dismiss()`. */ +export function usesDismiss(node: UINode): boolean { + return nodeAction(node)?.kind === "dismiss"; +} + +/** + * The `.onTapGesture` this node needs, or null. Buttons render their action in + * their own closure and call this only for the body. + */ +export function tapGestureLines(node: UINode): { head: string; body: string[] } | null { + const body = actionStatements(node); + if (body.length === 0) return null; + return { head: ".onTapGesture {", body }; +} diff --git a/src/ui-builder/catalog.tsx b/src/ui-builder/catalog.tsx new file mode 100644 index 0000000..0dd7222 --- /dev/null +++ b/src/ui-builder/catalog.tsx @@ -0,0 +1,1127 @@ +// Catalog of the SwiftUI views the builder can create. +// +// Every entry is one palette item, one inspector form and one code generator: +// * `swift` renders the view expression (containers return their opening line +// ending in "{" — the body and closing brace are added by the generator), +// * `preview` renders an HTML approximation for the canvas, +// * `fields` drives the inspector, and `defaults` seeds a fresh node. + +import type { CSSProperties, ReactNode } from "react"; +import { + INDENT, + appendModifier, + bool, + csv, + indentLines, + num, + parseColor, + str, + swiftColor, + swiftIdentifier, + swiftNumber, + swiftString, +} from "./format"; +import { walk } from "./types"; +import type { Props, UINode } from "./types"; +import { STATE_DEFAULTS, type StateValueType } from "./state"; +import { + DISMISS_DECLARATION, + actionStateDeclarations, + actionStatements, + usesDismiss, +} from "./actions"; + +export { STATE_DEFAULTS }; +export type { StateValueType }; + +export type Category = "Layout" | "Text" | "Controls" | "Media" | "Other"; + +export const CATEGORY_ORDER: Category[] = [ + "Layout", + "Text", + "Controls", + "Media", + "Other", +]; + +export type PropField = + | { key: string; label: string; type: "string"; placeholder?: string } + | { key: string; label: string; type: "number"; placeholder?: string } + | { key: string; label: string; type: "bool" } + | { key: string; label: string; type: "enum"; options: string[] } + | { key: string; label: string; type: "state"; valueType: StateValueType } + | { key: string; label: string; type: "action" }; + +export type Spec = { + kind: string; + label: string; + category: Category; + /** Containers render their children on the canvas and in the generated code. */ + container: boolean; + summary: string; + defaults: Props; + fields: PropField[]; + swift: (node: UINode, children: string[][]) => string[]; + preview: (node: UINode, children: ReactNode) => ReactNode; + /** + * Optional hook for containers that need to wrap or decorate their children + * for Swift reasons (e.g. `NavigationStack` + `navigationTitle`). + */ + childModifiers?: (children: string[][], node: UINode) => string[][]; + /** + * The spec renders the tap action itself (a Button puts it in its own + * trailing closure), so the generator must not add an `.onTapGesture`. + */ + ownsAction?: boolean; +}; + +// ---------------------------------------------------------------- modifiers -- + +/** + * The inspector field for a node's tap action. Buttons list it in their own + * `fields`; every other spec gets it from `fieldsOf`, because the action is + * rendered as an `.onTapGesture` on that view. + */ +export const ACTION_FIELDS: PropField[] = [ + { key: "action", label: "Tap Action", type: "action" }, +]; + +export const MODIFIER_FIELDS: PropField[] = [ + { + key: "font", + label: "Font", + type: "enum", + options: [ + "", + ".largeTitle", + ".title", + ".title2", + ".title3", + ".headline", + ".subheadline", + ".body", + ".callout", + ".footnote", + ".caption", + ".caption2", + ], + }, + { + key: "weight", + label: "Weight", + type: "enum", + options: [ + "", + ".ultraLight", + ".thin", + ".light", + ".regular", + ".medium", + ".semibold", + ".bold", + ".heavy", + ".black", + ], + }, + { + key: "foreground", + label: "Foreground", + type: "string", + placeholder: ".blue, .secondary or #FF8800", + }, + { key: "padding", label: "Padding", type: "number", placeholder: "8" }, + { key: "frameWidth", label: "Width", type: "number", placeholder: "200" }, + { key: "frameHeight", label: "Height", type: "number", placeholder: "44" }, + { + key: "background", + label: "Background", + type: "string", + placeholder: ".gray, #F2F2F7", + }, + { key: "cornerRadius", label: "Corner Radius", type: "number", placeholder: "12" }, + { key: "opacity", label: "Opacity", type: "number", placeholder: "0.5" }, +]; + +/** Swift modifier chain for a node, in a stable order. */export function modifierLines(node: UINode): string[] { + const lines: string[] = []; + const font = str(node.props.font); + if (font) lines.push(`.font(${font.startsWith(".") ? font : `.${font}`})`); + + const weight = str(node.props.weight); + if (weight) { + lines.push(`.fontWeight(${weight.startsWith(".") ? weight : `.${weight}`})`); + } + + const foreground = swiftColor(str(node.props.foreground)); + if (foreground) lines.push(`.foregroundStyle(${foreground})`); + + const padding = num(node.props.padding); + if (padding !== null) lines.push(`.padding(${swiftNumber(padding)})`); + + const width = num(node.props.frameWidth); + const height = num(node.props.frameHeight); + if (width !== null || height !== null) { + const args: string[] = []; + if (width !== null) args.push(`width: ${swiftNumber(width)}`); + if (height !== null) args.push(`height: ${swiftNumber(height)}`); + lines.push(`.frame(${args.join(", ")})`); + } + + const background = swiftColor(str(node.props.background)); + if (background) lines.push(`.background(${background})`); + + const cornerRadius = num(node.props.cornerRadius); + if (cornerRadius !== null && cornerRadius > 0) { + lines.push(`.clipShape(RoundedRectangle(cornerRadius: ${swiftNumber(cornerRadius)}))`); + } + + const opacity = num(node.props.opacity); + if (opacity !== null) lines.push(`.opacity(${swiftNumber(opacity)})`); + + return lines; +} + +/** + * Stored-property declarations required by the tree: the `@State` variables of + * every bound control, the ones the tap actions change, and the `dismiss` + * environment a "Dismiss this view" action needs. + */ +export function stateDeclarations(root: UINode): string[] { + const seen = new Map(); + let needsDismiss = false; + const visit = (node: UINode) => { + const spec = CATALOG[node.kind]; + if (spec) { + for (const field of spec.fields) { + if (field.type !== "state") continue; + const name = swiftIdentifier(str(node.props[field.key])); + if (name && !seen.has(name)) seen.set(name, field.valueType); + } + } + for (const declaration of actionStateDeclarations(node)) { + if (!seen.has(declaration.name)) seen.set(declaration.name, declaration.type); + } + if (usesDismiss(node)) needsDismiss = true; + node.children.forEach(visit); + }; + visit(root); + + const declarations = [...seen.entries()].map(([name, valueType]) => { + const value = STATE_DEFAULTS[valueType]; + const type = valueType === "Bool" ? "" : `: ${valueType}`; + return `@State private var ${name}${type} = ${value}`; + }); + if (needsDismiss) declarations.push(DISMISS_DECLARATION); + return declarations; +} + +/** Every state variable name used in the tree, for the inspector's suggestions. */ +export function stateNames(root: UINode): string[] { + const names = new Set(); + for (const node of walk(root)) { + const spec = CATALOG[node.kind]; + if (spec) { + for (const field of spec.fields) { + if (field.type !== "state") continue; + const name = swiftIdentifier(str(node.props[field.key])); + if (name) names.add(name); + } + } + for (const declaration of actionStateDeclarations(node)) names.add(declaration.name); + } + return [...names]; +} + +// ----------------------------------------------------------- preview styles -- + +const CSS_COLORS: Record = { + primary: "#1c1c1e", + secondary: "#6e6e73", + red: "#ff3b30", + orange: "#ff9500", + yellow: "#ffcc00", + green: "#34c759", + mint: "#00c7be", + teal: "#30b0c7", + cyan: "#32ade6", + blue: "#007aff", + indigo: "#5856d6", + purple: "#af52de", + pink: "#ff2d55", + brown: "#a2845e", + white: "#ffffff", + black: "#000000", + gray: "#8e8e93", + clear: "transparent", +}; + +const CSS_FONT_SIZES: Record = { + largeTitle: "34px", + title: "28px", + title2: "22px", + title3: "20px", + headline: "17px", + subheadline: "15px", + body: "17px", + callout: "16px", + footnote: "13px", + caption: "12px", + caption2: "11px", +}; + +const CSS_WEIGHTS: Record = { + ultraLight: 100, + thin: 200, + light: 300, + regular: 400, + medium: 500, + semibold: 600, + bold: 700, + heavy: 800, + black: 900, +}; + +function cssColor(value: string): string | undefined { + const parsed = parseColor(value); + if (!parsed) return undefined; + if (parsed.kind === "named") return CSS_COLORS[parsed.name]; + return `rgb(${parsed.r}, ${parsed.g}, ${parsed.b})`; +} + +/** Text-ish modifiers (font, weight, colour); specs apply these themselves. */ +export function textCss(node: UINode): CSSProperties { + const style: CSSProperties = {}; + + const font = str(node.props.font).replace(/^\./, ""); + if (font && CSS_FONT_SIZES[font]) { + style.fontSize = CSS_FONT_SIZES[font]; + style.fontWeight = font === "headline" ? 600 : undefined; + } + + const weight = CSS_WEIGHTS[str(node.props.weight).replace(/^\./, "")]; + if (weight) style.fontWeight = weight; + + const foreground = cssColor(str(node.props.foreground)); + if (foreground) style.color = foreground; + + return style; +} + +/** Box modifiers (padding, frame, background, radius, opacity): the canvas + * wrapper applies these once per node. */ +export function boxCss(node: UINode): CSSProperties { + const style: CSSProperties = {}; + + const padding = num(node.props.padding); + if (padding !== null) style.padding = `${padding}px`; + + const width = num(node.props.frameWidth); + const height = num(node.props.frameHeight); + if (width !== null) { + style.width = `${width}px`; + style.flex = "none"; + } + if (height !== null) style.height = `${height}px`; + + const background = cssColor(str(node.props.background)); + if (background) style.background = background; + + const cornerRadius = num(node.props.cornerRadius); + if (cornerRadius !== null && cornerRadius > 0) { + style.borderRadius = `${cornerRadius}px`; + style.overflow = "hidden"; + } + + const opacity = num(node.props.opacity); + if (opacity !== null) style.opacity = opacity; + + return style; +} + +function alignToCss(value: string): "flex-start" | "center" | "flex-end" | undefined { + if (value === "leading" || value === "topLeading") return "flex-start"; + if (value === "center" || value === "top" || value === "bottom") return "center"; + if (value === "trailing" || value === "bottomTrailing") return "flex-end"; + return undefined; +} + +function textStyle(node: UINode): CSSProperties { + return { fontSize: 17, color: "#1c1c1e", ...textCss(node) }; +} + +const SYMBOL_BOX: CSSProperties = { + display: "inline-flex", + alignItems: "center", + gap: 6, + padding: "4px 8px", + borderRadius: 6, + background: "#f2f2f7", + border: "1px dashed #b8b8bf", + fontSize: 11, + color: "#6e6e73", +}; + +// ----------------------------------------------------------------- catalogue -- + +const CATALOG_LIST: Spec[] = [ + // ---------------------------------------------------------------- layout -- + { + kind: "VStack", + label: "VStack", + category: "Layout", + container: true, + summary: "Vertical stack", + defaults: { alignment: "center", spacing: "8" }, + fields: [ + { + key: "alignment", + label: "Alignment", + type: "enum", + options: ["", "leading", "center", "trailing"], + }, + { key: "spacing", label: "Spacing", type: "number", placeholder: "8" }, + ], + swift: (node) => { + const args: string[] = []; + const alignment = str(node.props.alignment); + if (alignment) args.push(`alignment: .${alignment}`); + const spacing = num(node.props.spacing); + if (spacing !== null) args.push(`spacing: ${swiftNumber(spacing)}`); + return [`VStack${args.length ? `(${args.join(", ")})` : ""} {`]; + }, + preview: (node, children) => ( +
+ {children} +
+ ), + }, + { + kind: "HStack", + label: "HStack", + category: "Layout", + container: true, + summary: "Horizontal stack", + defaults: { alignment: "center", spacing: "8" }, + fields: [ + { + key: "alignment", + label: "Alignment", + type: "enum", + options: ["", "top", "center", "bottom"], + }, + { key: "spacing", label: "Spacing", type: "number", placeholder: "8" }, + ], + swift: (node) => { + const args: string[] = []; + const alignment = str(node.props.alignment); + if (alignment) args.push(`alignment: .${alignment}`); + const spacing = num(node.props.spacing); + if (spacing !== null) args.push(`spacing: ${swiftNumber(spacing)}`); + return [`HStack${args.length ? `(${args.join(", ")})` : ""} {`]; + }, + preview: (node, children) => ( +
+ {children} +
+ ), + }, + { + kind: "ZStack", + label: "ZStack", + category: "Layout", + container: true, + summary: "Layered stack", + defaults: {}, + fields: [], + swift: () => ["ZStack {"], + preview: (_node, children) => ( +
+ {Array.isArray(children) + ? children.map((child, index) => ( +
+ {child} +
+ )) + : children} +
+ ), + }, + { + kind: "ScrollView", + label: "ScrollView", + category: "Layout", + container: true, + summary: "Scrollable container", + defaults: { axis: "vertical" }, + fields: [ + { + key: "axis", + label: "Axis", + type: "enum", + options: ["vertical", "horizontal"], + }, + ], + swift: (node) => + str(node.props.axis) === "horizontal" + ? ["ScrollView(.horizontal) {"] + : ["ScrollView {"], + preview: (node, children) => ( +
+ {children} +
+ ), + }, + { + kind: "List", + label: "List", + category: "Layout", + container: true, + summary: "System list", + defaults: {}, + fields: [], + swift: () => ["List {"], + preview: (_node, children) => ( +
+ {children} +
+ ), + }, + { + kind: "Form", + label: "Form", + category: "Layout", + container: true, + summary: "Grouped settings form", + defaults: {}, + fields: [], + swift: () => ["Form {"], + preview: (_node, children) => ( +
+ {children} +
+ ), + }, + { + kind: "Group", + label: "Group", + category: "Layout", + container: true, + summary: "Applies modifiers to several views", + defaults: {}, + fields: [], + swift: () => ["Group {"], + preview: (_node, children) => ( +
{children}
+ ), + }, + { + kind: "Section", + label: "Section", + category: "Layout", + container: true, + summary: "Section inside List or Form", + defaults: { header: "Section" }, + fields: [{ key: "header", label: "Header", type: "string", placeholder: "Section" }], + swift: (node) => { + const header = str(node.props.header); + return [header ? `Section(${swiftString(header)}) {` : "Section {"]; + }, + preview: (node, children) => ( +
+
+ {str(node.props.header)} +
+ {children} +
+ ), + }, + { + kind: "NavigationStack", + label: "NavigationStack", + category: "Layout", + container: true, + summary: "Navigation container with a title", + defaults: { title: "Title" }, + fields: [{ key: "title", label: "Title", type: "string", placeholder: "Title" }], + swift: () => ["NavigationStack {"], + childModifiers: (children, node) => { + const title = str(node.props.title); + if (!title) return children; + const modifier = `.navigationTitle(${swiftString(title)})`; + if (children.length === 1) { + return [appendModifier(children[0], modifier)]; + } + // navigationTitle has to be applied to a single view, so wrap the rest + const wrapped = ["Group {", ...children.flatMap((c) => indentLines(c, 1)), "}"]; + return [appendModifier(wrapped, modifier)]; + }, + preview: (node, children) => ( +
+
+ {str(node.props.title) || "Title"} +
+ {children} +
+ ), + }, + { + kind: "Spacer", + label: "Spacer", + category: "Layout", + container: false, + summary: "Flexible space", + defaults: {}, + fields: [], + swift: () => ["Spacer()"], + preview: () => ( +
+ ), + }, + { + kind: "Divider", + label: "Divider", + category: "Layout", + container: false, + summary: "Horizontal rule", + defaults: {}, + fields: [], + swift: () => ["Divider()"], + preview: () =>
, + }, + // ------------------------------------------------------------------ text -- + { + kind: "Text", + label: "Text", + category: "Text", + container: false, + summary: "Static text", + defaults: { text: "Hello, world!" }, + fields: [{ key: "text", label: "Text", type: "string", placeholder: "Hello" }], + swift: (node) => [`Text(${swiftString(str(node.props.text))})`], + preview: (node) => {str(node.props.text)}, + }, + { + kind: "Label", + label: "Label", + category: "Text", + container: false, + summary: "Icon + title pair", + defaults: { title: "Settings", systemImage: "gearshape" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Settings" }, + { key: "systemImage", label: "SF Symbol", type: "string", placeholder: "gearshape" }, + ], + swift: (node) => [ + `Label(${swiftString(str(node.props.title))}, systemImage: ${swiftString( + str(node.props.systemImage) + )})`, + ], + preview: (node) => ( + + {str(node.props.systemImage) || "symbol"} + {str(node.props.title)} + + ), + }, + // -------------------------------------------------------------- controls -- + { + kind: "Button", + label: "Button", + category: "Controls", + container: false, + summary: "Tappable button", + ownsAction: true, + defaults: { title: "Continue", systemImage: "", style: "", action: "none" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Continue" }, + { key: "systemImage", label: "SF Symbol", type: "string", placeholder: "(optional)" }, + { + key: "style", + label: "Style", + type: "enum", + options: ["", "bordered", "borderedProminent", "plain"], + }, + ...ACTION_FIELDS, + ], + swift: (node) => { + const title = str(node.props.title) || "Button"; + const symbol = str(node.props.systemImage); + const statements = actionStatements(node); + const body = indentLines( + statements.length > 0 ? statements : ["// TODO: handle tap"], + 1 + ); + const lines = symbol + ? [ + "Button {", + ...body, + "} label: {", + `${INDENT}Label(${swiftString(title)}, systemImage: ${swiftString(symbol)})`, + "}", + ] + : [`Button(${swiftString(title)}) {`, ...body, "}"]; + const style = str(node.props.style); + // a trailing-closure block keeps its modifiers aligned with the block + return style ? appendModifier(lines, `.buttonStyle(.${style})`) : lines; + }, + preview: (node) => ( + + {str(node.props.systemImage) && ( + + {str(node.props.systemImage)} + + )} + {str(node.props.title)} + + ), + }, + { + kind: "Toggle", + label: "Toggle", + category: "Controls", + container: false, + summary: "On/off switch bound to @State", + defaults: { title: "Enabled", isOn: "isEnabled" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Enabled" }, + { key: "isOn", label: "Bound to", type: "state", valueType: "Bool" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.isOn)) || "isEnabled"; + return [`Toggle(${swiftString(str(node.props.title))}, isOn: $${name})`]; + }, + preview: (node) => ( + + {str(node.props.title)} + + + + + ), + }, + { + kind: "TextField", + label: "TextField", + category: "Controls", + container: false, + summary: "Text input bound to @State", + defaults: { placeholder: "Name", text: "name" }, + fields: [ + { key: "placeholder", label: "Placeholder", type: "string", placeholder: "Name" }, + { key: "text", label: "Bound to", type: "state", valueType: "String" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.text)) || "text"; + return [ + `TextField(${swiftString(str(node.props.placeholder))}, text: $${name})`, + `${INDENT}.textFieldStyle(.roundedBorder)`, + ]; + }, + preview: (node) => ( + + {str(node.props.placeholder)} + + ), + }, + { + kind: "SecureField", + label: "SecureField", + category: "Controls", + container: false, + summary: "Password input bound to @State", + defaults: { placeholder: "Password", text: "password" }, + fields: [ + { key: "placeholder", label: "Placeholder", type: "string", placeholder: "Password" }, + { key: "text", label: "Bound to", type: "state", valueType: "String" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.text)) || "password"; + return [`SecureField(${swiftString(str(node.props.placeholder))}, text: $${name})`]; + }, + preview: (node) => ( + + •••••••• + + ), + }, + { + kind: "Slider", + label: "Slider", + category: "Controls", + container: false, + summary: "Continuous value bound to @State", + defaults: { value: "volume", min: "0", max: "1" }, + fields: [ + { key: "value", label: "Bound to", type: "state", valueType: "Double" }, + { key: "min", label: "Minimum", type: "number", placeholder: "0" }, + { key: "max", label: "Maximum", type: "number", placeholder: "1" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.value)) || "value"; + const min = num(node.props.min); + const max = num(node.props.max); + const range = + min !== null && max !== null ? `, in: ${swiftNumber(min)}...${swiftNumber(max)}` : ""; + return [`Slider(value: $${name}${range})`]; + }, + preview: () => ( +
+
+
+
+
+
+ ), + }, + { + kind: "Stepper", + label: "Stepper", + category: "Controls", + container: false, + summary: "Increment/decrement bound to @State", + defaults: { title: "Count", value: "count" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Count" }, + { key: "value", label: "Bound to", type: "state", valueType: "Int" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.value)) || "count"; + return [`Stepper(${swiftString(str(node.props.title))}, value: $${name})`]; + }, + preview: (node) => ( + + {str(node.props.title)} + + − + + + + + + ), + }, + { + kind: "Picker", + label: "Picker", + category: "Controls", + container: false, + summary: "Choice list bound to @State", + defaults: { title: "Size", selection: "size", options: "Small, Medium, Large" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Size" }, + { key: "selection", label: "Bound to", type: "state", valueType: "String" }, + { key: "options", label: "Options", type: "string", placeholder: "A, B, C" }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.selection)) || "selection"; + const options = csv(node.props.options); + const rows = (options.length > 0 ? options : ["One"]).map( + (option) => `${INDENT}Text(${swiftString(option)}).tag(${swiftString(option)})` + ); + return [ + `Picker(${swiftString(str(node.props.title))}, selection: $${name}) {`, + ...rows, + "}", + ]; + }, + preview: (node) => ( + + {str(node.props.title)} + + {(csv(node.props.options)[0] ?? "One")} ▾ + + + ), + }, + { + kind: "DatePicker", + label: "DatePicker", + category: "Controls", + container: false, + summary: "Date selection bound to @State", + defaults: { title: "Date", selection: "date", components: "date" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "Date" }, + { key: "selection", label: "Bound to", type: "state", valueType: "Date" }, + { + key: "components", + label: "Components", + type: "enum", + options: ["date", "hourAndMinute", "dateAndTime"], + }, + ], + swift: (node) => { + const name = swiftIdentifier(str(node.props.selection)) || "date"; + const components = str(node.props.components); + const suffix = components ? `, displayedComponents: .${components}` : ""; + return [`DatePicker(${swiftString(str(node.props.title))}, selection: $${name}${suffix})`]; + }, + preview: (node) => ( + + {str(node.props.title)} + 2026-09-24 + + ), + }, + { + kind: "ProgressView", + label: "ProgressView", + category: "Controls", + container: false, + summary: "Progress indicator", + defaults: { title: "", value: "0.5" }, + fields: [ + { key: "title", label: "Title", type: "string", placeholder: "(optional)" }, + { key: "value", label: "Value (0-1)", type: "number", placeholder: "0.5" }, + ], + swift: (node) => { + const title = str(node.props.title); + const value = num(node.props.value); + const label = title ? `${swiftString(title)}, ` : ""; + if (value === null) { + return [title ? `ProgressView(${swiftString(title)})` : "ProgressView()"]; + } + return [`ProgressView(${label}value: ${swiftNumber(value)})`]; + }, + preview: (node) => ( + + {str(node.props.title) && {str(node.props.title)}} + + + + + ), + }, + // ----------------------------------------------------------------- media -- + { + kind: "Image", + label: "Image", + category: "Media", + container: false, + summary: "SF Symbol or asset image", + defaults: { source: "symbol", name: "photo", resizable: false }, + fields: [ + { key: "source", label: "Source", type: "enum", options: ["symbol", "asset"] }, + { key: "name", label: "Name", type: "string", placeholder: "photo" }, + { key: "resizable", label: "Resizable", type: "bool" }, + ], + swift: (node) => { + const name = str(node.props.name) || "photo"; + const expression = + str(node.props.source) === "asset" + ? `Image(${swiftString(name)})` + : `Image(systemName: ${swiftString(name)})`; + const lines = [expression]; + if (bool(node.props.resizable)) { + lines.push(`${INDENT}.resizable()`); + lines.push(`${INDENT}.aspectRatio(contentMode: .fit)`); + } + return lines; + }, + preview: (node) => ( + + + {str(node.props.source) === "asset" ? "asset" : "SF"}: {str(node.props.name) || "photo"} + + + ), + }, +]; + +export const CATALOG: Record = Object.fromEntries( + CATALOG_LIST.map((spec) => [spec.kind, spec]) +); + +export const PALETTE: Spec[] = CATALOG_LIST; + +export function fieldsOf(node: UINode): PropField[] { + const spec = CATALOG[node.kind]; + if (!spec) return []; + // Buttons already list ACTION_FIELDS: they render the action themselves. + const actionFields = spec.ownsAction ? [] : ACTION_FIELDS; + return [...spec.fields, ...actionFields, ...MODIFIER_FIELDS]; +} + +/** A fresh node of `kind`, including its default props. */ +export function defaultsFor(kind: string): Props { + const spec = CATALOG[kind]; + return spec ? { ...spec.defaults } : {}; +} diff --git a/src/ui-builder/codegen.test.ts b/src/ui-builder/codegen.test.ts new file mode 100644 index 0000000..a948f7e --- /dev/null +++ b/src/ui-builder/codegen.test.ts @@ -0,0 +1,232 @@ +// Code generation tests for the visual UI builder. +// +// Run with `bun test src/ui-builder` (see .github/workflows/build.yml). + +import { describe, expect, test } from "bun:test"; +import { generateSwift } from "./codegen"; +import { DEFAULT_VIEW_NAME, DOCUMENT_VERSION, node } from "./types"; +import type { UIDocument } from "./types"; + +function doc(root: UIDocument["root"], overrides: Partial = {}): UIDocument { + return { + version: DOCUMENT_VERSION, + name: DEFAULT_VIEW_NAME, + includePreview: false, + root, + ...overrides, + }; +} + +describe("generateSwift", () => { + test("renders containers, children and modifiers", () => { + const source = generateSwift( + doc( + node("VStack", { alignment: "leading", spacing: "16", padding: "16" }, [ + node("Text", { text: "Hello, world!", font: ".largeTitle", weight: ".bold" }), + node("Image", { source: "symbol", name: "star", resizable: true, frameWidth: "24" }), + ]) + ) + ); + + expect(source).toBe( + `import SwiftUI + +struct ContentView: View { + var body: some View { + VStack(alignment: .leading, spacing: 16) { + Text("Hello, world!") + .font(.largeTitle) + .fontWeight(.bold) + Image(systemName: "star") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 24) + } + .padding(16) + } +} +` + ); + }); + + test("escapes string literals", () => { + const source = generateSwift(doc(node("Text", { text: 'He said "hi"\\there' }))); + expect(source).toContain('Text("He said \\"hi\\"\\\\there")'); + }); + + test("declares @State once per bound variable and sanitises names", () => { + const source = generateSwift( + doc( + node("VStack", {}, [ + node("Toggle", { title: "On", isOn: "music playing" }), + node("Toggle", { title: "Also on", isOn: "music playing" }), + node("Slider", { value: "volume", min: "0", max: "10" }), + ]) + ) + ); + + expect(source).toContain("@State private var musicplaying = false"); + expect(source.split("@State private var musicplaying").length).toBe(2); + expect(source).toContain("@State private var volume: Double = 0"); + expect(source).toContain("Toggle(\"On\", isOn: $musicplaying)"); + expect(source).toContain("Slider(value: $volume, in: 0...10)"); + }); + + test("aligns trailing-closure modifiers with their block", () => { + const source = generateSwift( + doc( + node("VStack", {}, [ + node("Button", { title: "Continue", style: "borderedProminent", padding: "8" }), + ]) + ) + ); + + expect(source).toBe( + `import SwiftUI + +struct ContentView: View { + var body: some View { + VStack { + Button("Continue") { + // TODO: handle tap + } + .buttonStyle(.borderedProminent) + .padding(8) + } + } +} +` + ); + }); + + test("wraps multiple navigation children so navigationTitle applies", () => { + const source = generateSwift( + doc( + node("NavigationStack", { title: "Settings" }, [ + node("Text", { text: "One" }), + node("Text", { text: "Two" }), + ]) + ) + ); + + expect(source).toContain('.navigationTitle("Settings")'); + expect(source).toContain("Group {"); + }); + + test("applies navigationTitle directly to a single child", () => { + const source = generateSwift( + doc(node("NavigationStack", { title: "Home" }, [node("Text", { text: "Only" })])) + ); + + expect(source).toBe( + `import SwiftUI + +struct ContentView: View { + var body: some View { + NavigationStack { + Text("Only") + .navigationTitle("Home") + } + } +} +` + ); + }); + + test("converts hex colours and named colours", () => { + const hex = generateSwift(doc(node("Text", { text: "x", background: "#FF8800" }))); + expect(hex).toContain("Color(red: 1, green: 0.533, blue: 0)"); + const named = generateSwift(doc(node("Text", { text: "x", foreground: "secondary" }))); + expect(named).toContain(".foregroundStyle(.secondary)"); + // invalid colours are dropped rather than generating broken code + const invalid = generateSwift(doc(node("Text", { text: "x", background: "not-a-colour" }))); + expect(invalid).not.toContain(".background("); + }); + + test("adds a #Preview block only when asked", () => { + const withPreview = generateSwift(doc(node("Text", { text: "x" }), { includePreview: true })); + expect(withPreview).toContain("#Preview {\n ContentView()\n}"); + + const withoutPreview = generateSwift(doc(node("Text", { text: "x" }))); + expect(withoutPreview).not.toContain("#Preview"); + }); + + test("keeps unknown components visible as a comment", () => { + const source = generateSwift(doc(node("MapKit", { region: "x" }))); + expect(source).toContain('// Unsupported component "MapKit"'); + }); + + test("generates every catalogue component without crashing", async () => { + const { PALETTE } = await import("./catalog"); + for (const spec of PALETTE) { + const source = generateSwift(doc(node(spec.kind, { ...spec.defaults }))); + expect(source).toContain("struct ContentView: View {"); + expect(source).not.toContain("Unsupported component"); + } + }); + + test("runs a button's tap action in its own closure", () => { + const source = generateSwift( + doc(node("Button", { title: "Add", action: "increment", actionTarget: "count" })) + ); + + expect(source).toBe( + `import SwiftUI + +struct ContentView: View { + @State private var count: Int = 0 + + var body: some View { + Button("Add") { + count += 1 + } + } +} +` + ); + }); + + test("gives views that are not buttons an onTapGesture", () => { + const source = generateSwift( + doc(node("Text", { text: "Tap me", padding: "8", action: "toggle", actionTarget: "isOn" })) + ); + + expect(source).toContain( + `Text("Tap me") + .padding(8) + .onTapGesture { + isOn.toggle() + }` + ); + expect(source).toContain("@State private var isOn = false"); + }); + + test("declares the environment value a dismiss action needs", () => { + const source = generateSwift( + doc( + node("VStack", {}, [ + node("Button", { title: "Done", action: "dismiss" }), + node("Button", { title: "Rename", action: "set", actionTarget: "name", actionValue: "Alex" }), + ]) + ) + ); + + expect(source).toContain("@Environment(\\.dismiss) private var dismiss"); + expect(source).toContain('@State private var name: String = ""'); + expect(source).toContain('name = "Alex"'); + expect(source).toContain("dismiss()"); + }); + + test("declares a state variable once when a binding and an action share it", () => { + const source = generateSwift( + doc( + node("VStack", {}, [ + node("Toggle", { title: "On", isOn: "isOn" }), + node("Button", { title: "Flip", action: "toggle", actionTarget: "isOn" }), + ]) + ) + ); + + expect(source.split("@State private var isOn").length).toBe(2); + }); +}); diff --git a/src/ui-builder/codegen.ts b/src/ui-builder/codegen.ts new file mode 100644 index 0000000..eafbdab --- /dev/null +++ b/src/ui-builder/codegen.ts @@ -0,0 +1,96 @@ +// Turns a builder document into SwiftUI source. +// +// The generator is intentionally dumb: one node -> one view expression, plus a +// fixed set of modifiers applied in a stable order, so that the output is +// predictable and easy to diff. + +import { CATALOG, modifierLines, stateDeclarations } from "./catalog"; +import { tapGestureLines } from "./actions"; +import { + INDENT, + appendBlock, + appendModifier, + indentLines, + swiftIdentifier, +} from "./format"; +import type { UIDocument, UINode } from "./types"; + +export type GenerateOptions = { + /** Name of the generated struct, e.g. `ContentView`. */ + viewName: string; + includePreview: boolean; +}; + +function renderNode(node: UINode): string[] { + const spec = CATALOG[node.kind]; + if (!spec) { + return [`// Unsupported component "${node.kind}"`]; + } + + const children = node.children + .filter((c) => CATALOG[c.kind]) + .map((c) => renderNode(c)); + + // Containers return their opening line(s) ending in "{"; the body and the + // closing brace are added here so every container indents identically. + let lines = spec.swift(node, children); + if (spec.container) { + if (lines.length === 0) { + return [`// ${spec.label} produced no output`]; + } + const body = spec.childModifiers + ? spec.childModifiers(children, node) + : children; + lines = [...lines, ...body.flatMap((c) => indentLines(c, 1)), "}"]; + } + + for (const modifier of modifierLines(node)) { + lines = appendModifier(lines, modifier); + } + if (!spec.ownsAction) { + const gesture = tapGestureLines(node); + if (gesture) { + lines = appendBlock(lines, gesture.head, gesture.body); + } + } + return lines; +} + +export function generateSwift( + doc: UIDocument, + options?: Partial +): string { + const viewName = swiftIdentifier(options?.viewName ?? doc.name) || "ContentView"; + const includePreview = options?.includePreview ?? doc.includePreview; + + const states = stateDeclarations(doc.root); + const body = indentLines(renderNode(doc.root), 2); + + const lines: string[] = []; + lines.push("import SwiftUI"); + lines.push(""); + lines.push(`struct ${viewName}: View {`); + if (states.length > 0) { + for (const declaration of states) { + lines.push(`${INDENT}${declaration}`); + } + lines.push(""); + } + lines.push(`${INDENT}var body: some View {`); + if (body.length === 0) { + lines.push(`${INDENT.repeat(2)}EmptyView()`); + } else { + lines.push(...body); + } + lines.push(`${INDENT}}`); + lines.push("}"); + + if (includePreview) { + lines.push(""); + lines.push("#Preview {"); + lines.push(`${INDENT}${viewName}()`); + lines.push("}"); + } + + return `${lines.join("\n")}\n`; +} diff --git a/src/ui-builder/format.ts b/src/ui-builder/format.ts new file mode 100644 index 0000000..bd23fee --- /dev/null +++ b/src/ui-builder/format.ts @@ -0,0 +1,170 @@ +// Small pure helpers shared by the code generator and the component catalog. + +import type { Primitive } from "./types"; + +export const INDENT = " "; + +export function indentLines(lines: string[], levels: number): string[] { + const pad = INDENT.repeat(levels); + return lines.map((l) => (l.length === 0 ? l : pad + l)); +} + +/** + * Appends a modifier to a rendered view expression, following the usual Swift + * style: + * + * Text("Hi") Button("Hi") { Image("logo") + * .font(.title) ... .resizable() + * } } .frame(width: 20) + * .buttonStyle(.borderedProminent) + * + * i.e. a chain hangs one level below its base expression, while modifiers of a + * trailing-closure block line up with the start of that block. + */ +export function appendModifier(lines: string[], modifier: string): string[] { + const baseIndent = lines.length > 0 ? lines[0].length - lines[0].trimStart().length : 0; + const last = lines.length > 0 ? lines[lines.length - 1] : ""; + const lastTrimmed = last.trimStart(); + + let pad: number; + if (lastTrimmed.startsWith(".")) { + // continue an existing modifier chain + pad = last.length - lastTrimmed.length; + } else if (lines.length > 1 && lines[0].trimEnd().endsWith("{")) { + // trailing-closure block: line up with the block itself + pad = baseIndent; + } else { + pad = baseIndent + INDENT.length; + } + + return [...lines, `${" ".repeat(pad)}${modifier}`]; +} + +/** + * Appends a block modifier — `head` is a modifier opening a closure + * (`.onTapGesture {`) and `body` its statements, which are indented one level + * deeper than the head: + * + * Text("Hi") + * .onTapGesture { + * isTapped.toggle() + * } + */ +export function appendBlock(lines: string[], head: string, body: string[]): string[] { + const withHead = appendModifier(lines, head); + const last = withHead[withHead.length - 1]; + const indent = last.length - last.trimStart().length; + return [ + ...withHead, + ...body.map((line) => (line.length === 0 ? line : " ".repeat(indent + INDENT.length) + line)), + `${" ".repeat(indent)}}`, + ]; +} + +/** Escape a Swift string literal body. */export function swiftString(value: string): string { + const escaped = value + .replace(/\\/g, "\\\\") + .replace(/"/g, '\\"') + .replace(/\r?\n/g, "\\n") + .replace(/\t/g, "\\t"); + return `"${escaped}"`; +} + +const NAMED_COLORS = [ + "primary", + "secondary", + "red", + "orange", + "yellow", + "green", + "mint", + "teal", + "cyan", + "blue", + "indigo", + "purple", + "pink", + "brown", + "white", + "black", + "gray", + "clear", +]; + +export type ColorValue = { kind: "named"; name: string } | { kind: "rgb"; r: number; g: number; b: number }; + +/** Parses ".blue", "blue" or "#FF8800" into a colour value. */ +export function parseColor(value: string): ColorValue | null { + const trimmed = value.trim(); + if (trimmed.length === 0) return null; + const named = /^\.?([a-zA-Z]+)$/.exec(trimmed); + if (named && NAMED_COLORS.includes(named[1].toLowerCase())) { + return { kind: "named", name: named[1].toLowerCase() }; + } + const hex = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(trimmed); + if (!hex) return null; + let digits = hex[1]; + if (digits.length === 3) { + digits = digits + .split("") + .map((c) => c + c) + .join(""); + } + return { + kind: "rgb", + r: parseInt(digits.slice(0, 2), 16), + g: parseInt(digits.slice(2, 4), 16), + b: parseInt(digits.slice(4, 6), 16), + }; +} + +/** + * `#RRGGBB` / `#RGB` / colour name to a `Color(...)` expression, so the builder + * can offer hex colours without requiring a helper extension in the generated + * project. + */ +export function swiftColor(value: string): string | null { + const parsed = parseColor(value); + if (!parsed) return null; + if (parsed.kind === "named") return `.${parsed.name}`; + const fmt = (v: number) => Number((v / 255).toFixed(3)).toString(); + return `Color(red: ${fmt(parsed.r)}, green: ${fmt(parsed.g)}, blue: ${fmt(parsed.b)})`; +} + +/** Sanitised Swift identifier, or "" when nothing usable is left. */ +export function swiftIdentifier(raw: string): string { + const cleaned = raw.trim().replace(/[^A-Za-z0-9_]/g, ""); + if (cleaned.length === 0) return ""; + return /^[0-9]/.test(cleaned) ? `v${cleaned}` : cleaned; +} + +export function str(value: Primitive | undefined): string { + return typeof value === "string" ? value : ""; +} + +export function bool(value: Primitive | undefined): boolean { + return value === true || value === "true"; +} + +/** Parses a numeric prop; empty string / garbage means "not set". */ +export function num(value: Primitive | undefined): number | null { + if (typeof value === "number") return Number.isFinite(value) ? value : null; + if (typeof value !== "string") return null; + const trimmed = value.trim(); + if (trimmed.length === 0) return null; + const parsed = Number(trimmed); + return Number.isFinite(parsed) ? parsed : null; +} + +/** `"a, b,c"` -> `["a", "b", "c"]`, dropping empty entries. */ +export function csv(value: Primitive | undefined): string[] { + return str(value) + .split(",") + .map((part) => part.trim()) + .filter((part) => part.length > 0); +} + +/** Swift number literal: keeps integers integral, e.g. 2 -> "2", 2.5 -> "2.5". */ +export function swiftNumber(value: number): string { + return Number.isInteger(value) ? value.toString() : value.toString(); +} diff --git a/src/ui-builder/parse.test.ts b/src/ui-builder/parse.test.ts new file mode 100644 index 0000000..e8095a1 --- /dev/null +++ b/src/ui-builder/parse.test.ts @@ -0,0 +1,135 @@ +// Tests for reading an existing SwiftUI file back into a builder document. +// +// Run with `bun test src/ui-builder` (see .github/workflows/build.yml). + +import { describe, expect, test } from "bun:test"; +import { generateSwift } from "./codegen"; +import { parseSwiftDocument } from "./parse"; +import { DEFAULT_VIEW_NAME, DOCUMENT_VERSION, node } from "./types"; +import type { UIDocument } from "./types"; + +function doc(root: UIDocument["root"], overrides: Partial = {}): UIDocument { + return { + version: DOCUMENT_VERSION, + name: DEFAULT_VIEW_NAME, + includePreview: false, + root, + ...overrides, + }; +} + +const SCREENSHOT_SOURCE = `import SwiftUI + +struct ContentView: View { + var body: some View { + VStack(alignment: .leading, spacing: 16) { + Text("Hello, world!") + .font(.largeTitle) + .fontWeight(.bold) + Button("Tap me") { + // TODO: handle tap + } + .buttonStyle(.borderedProminent) + } + .padding(16) + } +} + +#Preview { + ContentView() +} +`; + +describe("parseSwiftDocument", () => { + test("reads a view file that the generator produced", () => { + const parsed = parseSwiftDocument(SCREENSHOT_SOURCE); + expect(parsed).not.toBeNull(); + + const { document, warnings } = parsed!; + expect(warnings).toEqual([]); + expect(document.name).toBe("ContentView"); + expect(document.includePreview).toBe(true); + + expect(document.root.kind).toBe("VStack"); + expect(document.root.props).toEqual({ alignment: "leading", spacing: "16", padding: "16" }); + + expect(document.root.children.map((child) => child.kind)).toEqual(["Text", "Button"]); + expect(document.root.children[0].props).toEqual({ + text: "Hello, world!", + font: ".largeTitle", + weight: ".bold", + }); + expect(document.root.children[1].props).toEqual({ + title: "Tap me", + style: "borderedProminent", + }); + }); + + test("ignores files that are not SwiftUI views", () => { + expect(parseSwiftDocument("@main struct MyApp: App { var body: some Scene { WindowGroup { } } }")) + .toBeNull(); + expect(parseSwiftDocument("struct Model { let id = 1 }")).toBeNull(); + }); + + test("reports components and modifiers it cannot represent", () => { + const parsed = parseSwiftDocument( + `struct V: View { + var body: some View { + VStack { + MapView() + Text("hi").tracking(2) + } + } + }` + ); + expect(parsed).not.toBeNull(); + expect(parsed!.warnings.length).toBe(2); + expect(parsed!.document.root.children[0].kind).toBe("MapView"); + }); + + test("round-trips generated code for every supported component", () => { + const original = doc( + node("VStack", { alignment: "leading", spacing: "16", padding: "16" }, [ + node("Text", { text: "Title", font: ".title", weight: ".semibold", foreground: ".blue" }), + node("Label", { title: "Settings", systemImage: "gearshape" }), + node("Image", { + source: "symbol", + name: "star", + resizable: true, + frameWidth: "24", + frameHeight: "24", + background: ".gray", + cornerRadius: "8", + opacity: "0.5", + }), + node("HStack", { spacing: "12" }, [ + node("Toggle", { title: "Enabled", isOn: "isEnabled" }), + node("TextField", { placeholder: "Name", text: "name" }), + node("SecureField", { placeholder: "Password", text: "password" }), + ]), + node("Button", { title: "Go", systemImage: "play", style: "borderedProminent" }), + node("Picker", { title: "Size", selection: "size", options: "Small, Medium" }), + node("Slider", { value: "volume", min: "0", max: "1" }), + node("Stepper", { title: "Count", value: "count" }), + node("DatePicker", { title: "Date", selection: "date", components: "date" }), + node("ProgressView", { title: "Loading", value: "0.5" }), + node("Spacer"), + node("Divider"), + node("Section", { header: "More" }, [node("Text", { text: "row" })]), + node("NavigationStack", { title: "Home" }, [node("Text", { text: "Hello" })]), + node("ScrollView", { axis: "horizontal" }, [node("Text", { text: "x" })]), + node("List", {}, [node("Text", { text: "row" })]), + node("Form", {}, [node("Text", { text: "row" })]), + node("ZStack", {}, [node("Text", { text: "z" })]), + node("Group", {}, [node("Text", { text: "g" })]), + ]), + { includePreview: true } + ); + + const source = generateSwift(original); + const parsed = parseSwiftDocument(source, { name: "ContentView" }); + expect(parsed).not.toBeNull(); + expect(parsed!.warnings).toEqual([]); + expect(generateSwift(parsed!.document)).toBe(source); + }); +}); diff --git a/src/ui-builder/parse.ts b/src/ui-builder/parse.ts new file mode 100644 index 0000000..c7bd6a7 --- /dev/null +++ b/src/ui-builder/parse.ts @@ -0,0 +1,676 @@ +// Reads an existing SwiftUI view file back into a builder document. +// +// `codegen.ts` deliberately emits a small subset of SwiftUI, so the reader only +// has to understand that same subset: one view expression per node, a fixed set +// of modifiers and `@State` bindings. Anything outside that subset is reported +// as a warning instead of being silently dropped. + +import { CATALOG } from "./catalog"; +import { parseColor } from "./format"; +import { DEFAULT_VIEW_NAME, DOCUMENT_VERSION, node } from "./types"; +import type { Props, UIDocument, UINode } from "./types"; + +export type SwiftImport = { + document: UIDocument; + /** Notes about constructs the builder cannot represent. */ + warnings: string[]; +}; + +type Closure = { label: string; body: string }; +type Modifier = { name: string; args: string }; +type Call = { name: string; args: string; closures: Closure[]; modifiers: Modifier[] }; +type Arg = { label: string; value: string }; +type Cursor = { text: string; index: number }; + +const FONT_NAMES = new Set([ + "largeTitle", + "title", + "title2", + "title3", + "headline", + "subheadline", + "body", + "callout", + "footnote", + "caption", + "caption2", +]); + +const WEIGHT_NAMES = new Set([ + "ultraLight", + "thin", + "light", + "regular", + "medium", + "semibold", + "bold", + "heavy", + "black", +]); + +const BUTTON_STYLES = new Set(["bordered", "borderedProminent", "plain"]); + +const CONTROL_FLOW = new Set([ + "if", + "else", + "for", + "while", + "switch", + "guard", + "let", + "var", + "return", +]); + +/** Modifiers the generator emits that carry no builder state. */ +const IGNORED_MODIFIERS = new Set(["aspectRatio", "textFieldStyle", "tag", "navigationTitle"]); + +// ------------------------------------------------------------------- scanner -- + +/** Drops line and block comments, leaving string literals untouched. */ +function stripComments(source: string): string { + let out = ""; + let index = 0; + while (index < source.length) { + const ch = source[index]; + if (ch === '"') { + out += ch; + index += 1; + while (index < source.length) { + const inner = source[index]; + if (inner === "\\") { + out += inner + (source[index + 1] ?? ""); + index += 2; + continue; + } + out += inner; + index += 1; + if (inner === '"') break; + } + continue; + } + if (ch === "/" && source[index + 1] === "/") { + while (index < source.length && source[index] !== "\n") index += 1; + continue; + } + if (ch === "/" && source[index + 1] === "*") { + index += 2; + while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) { + index += 1; + } + index += 2; + continue; + } + out += ch; + index += 1; + } + return out; +} + +function skipWhitespace(cursor: Cursor) { + while (cursor.index < cursor.text.length && /\s/.test(cursor.text[cursor.index])) { + cursor.index += 1; + } +} + +function readIdentifier(cursor: Cursor): string { + const match = /^[A-Za-z_][A-Za-z0-9_]*/.exec(cursor.text.slice(cursor.index)); + if (!match) return ""; + cursor.index += match[0].length; + return match[0]; +} + +/** Returns the text between a balanced `open`/`close` pair, strings included. */ +function readGroup(cursor: Cursor, open: string, close: string): string { + const { text } = cursor; + if (text[cursor.index] !== open) return ""; + cursor.index += 1; + const start = cursor.index; + let depth = 1; + while (cursor.index < text.length) { + const ch = text[cursor.index]; + if (ch === '"') { + cursor.index += 1; + while (cursor.index < text.length) { + const inner = text[cursor.index]; + if (inner === "\\") { + cursor.index += 2; + continue; + } + cursor.index += 1; + if (inner === '"') break; + } + continue; + } + if (ch === open) depth += 1; + else if (ch === close) { + depth -= 1; + if (depth === 0) { + const inner = text.slice(start, cursor.index); + cursor.index += 1; + return inner; + } + } + cursor.index += 1; + } + return text.slice(start); +} + +/** One `Name(args) { … }` expression followed by its `.modifier(…)` chain. */ +function parseCall(cursor: Cursor): Call | null { + skipWhitespace(cursor); + const name = readIdentifier(cursor); + if (!name) return null; + + const call: Call = { name, args: "", closures: [], modifiers: [] }; + skipWhitespace(cursor); + if (cursor.text[cursor.index] === "(") call.args = readGroup(cursor, "(", ")"); + + for (;;) { + skipWhitespace(cursor); + if (cursor.text[cursor.index] === "{") { + call.closures.push({ label: "", body: readGroup(cursor, "{", "}") }); + continue; + } + // Labelled trailing closure, e.g. `Button { … } label: { … }`. + const save = cursor.index; + const label = readIdentifier(cursor); + if (label) { + skipWhitespace(cursor); + if (cursor.text[cursor.index] === ":" && cursor.text[cursor.index + 1] !== ":") { + cursor.index += 1; + skipWhitespace(cursor); + if (cursor.text[cursor.index] === "{") { + call.closures.push({ label, body: readGroup(cursor, "{", "}") }); + continue; + } + } + } + cursor.index = save; + break; + } + + for (;;) { + skipWhitespace(cursor); + if (cursor.text[cursor.index] !== ".") break; + const save = cursor.index; + cursor.index += 1; + const modifierName = readIdentifier(cursor); + if (!modifierName) { + cursor.index = save; + break; + } + let args = ""; + skipWhitespace(cursor); + if (cursor.text[cursor.index] === "(") args = readGroup(cursor, "(", ")"); + call.modifiers.push({ name: modifierName, args }); + } + + return call; +} + +/** Every view expression at the top level of a `ViewBuilder` body. */ +function parseViewList(source: string, warnings: string[]): Call[] { + const cursor: Cursor = { text: source, index: 0 }; + const calls: Call[] = []; + while (cursor.index < cursor.text.length) { + skipWhitespace(cursor); + if (cursor.index >= cursor.text.length) break; + const ch = cursor.text[cursor.index]; + if (ch === "}" || ch === ")") break; + + const call = parseCall(cursor); + if (!call) { + cursor.index += 1; + continue; + } + + if (CONTROL_FLOW.has(call.name)) { + // `if`/`for`/… have no builder equivalent; consume the block and note it. + warnings.push(`"${call.name}" blocks are not supported by the builder.`); + while (cursor.index < cursor.text.length && cursor.text[cursor.index] !== "{") { + cursor.index += 1; + } + if (cursor.text[cursor.index] === "{") readGroup(cursor, "{", "}"); + continue; + } + + calls.push(call); + } + return calls; +} + +// -------------------------------------------------------------------- helpers -- + +/** Splits on top-level commas, ignoring nesting and string literals. */ +function splitTopLevel(raw: string): string[] { + const parts: string[] = []; + let depth = 0; + let inString = false; + let start = 0; + for (let i = 0; i < raw.length; i += 1) { + const ch = raw[i]; + if (inString) { + if (ch === "\\") { + i += 1; + continue; + } + if (ch === '"') inString = false; + continue; + } + if (ch === '"') { + inString = true; + continue; + } + if (ch === "(" || ch === "[" || ch === "{") depth += 1; + else if (ch === ")" || ch === "]" || ch === "}") depth -= 1; + else if (ch === "," && depth === 0) { + parts.push(raw.slice(start, i)); + start = i + 1; + } + } + parts.push(raw.slice(start)); + return parts.map((part) => part.trim()).filter((part) => part.length > 0); +} + +function argList(raw: string): Arg[] { + return splitTopLevel(raw).map((part) => { + let depth = 0; + let inString = false; + for (let i = 0; i < part.length; i += 1) { + const ch = part[i]; + if (inString) { + if (ch === "\\") { + i += 1; + continue; + } + if (ch === '"') inString = false; + continue; + } + if (ch === '"') inString = true; + else if (ch === "(" || ch === "[" || ch === "{") depth += 1; + else if (ch === ")" || ch === "]" || ch === "}") depth -= 1; + else if (ch === ":" && depth === 0) { + return { label: part.slice(0, i).trim(), value: part.slice(i + 1).trim() }; + } + } + return { label: "", value: part.trim() }; + }); +} + +function argValue(args: Arg[], label: string): string { + return args.find((arg) => arg.label === label)?.value ?? ""; +} + +/** First unlabelled argument, e.g. the `"Hello"` in `Text("Hello")`. */ +function positional(args: Arg[]): string { + return argValue(args, ""); +} + +function unquote(value: string, warnings?: string[]): string | null { + const trimmed = value.trim(); + if (trimmed.length < 2 || trimmed[0] !== '"' || trimmed[trimmed.length - 1] !== '"') { + return null; + } + const inner = trimmed.slice(1, -1); + if (inner.includes("\\(")) { + warnings?.push( + "String interpolation is not supported by the builder; the text is kept literally." + ); + } + return inner.replace(/\\(.)/g, (_match: string, ch: string) => + ch === "n" ? "\n" : ch === "t" ? "\t" : ch + ); +} + +/** `.leading` / `leading` -> `leading`. */ +function unDot(value: string): string { + return value.trim().replace(/^\./, ""); +} + +/** `$isEnabled` -> `isEnabled`, but only for plain identifiers. */ +function binding(value: string): string { + const name = value.trim().replace(/^\$/, "").trim(); + return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) ? name : ""; +} + +function isNumber(value: string): boolean { + return /^-?\d+(\.\d+)?$/.test(value.trim()); +} + +/** `.blue`, `#FF8800` or `Color(red:…)` to a value the XML inspector accepts. */ +function colorValue(value: string): string | null { + const trimmed = value.trim(); + const rgb = /^Color\(\s*red:\s*([\d.]+)\s*,\s*green:\s*([\d.]+)\s*,\s*blue:\s*([\d.]+)/.exec( + trimmed + ); + if (rgb) { + const hex = (part: string) => + Math.max(0, Math.min(255, Math.round(Number(part) * 255))) + .toString(16) + .padStart(2, "0"); + return `#${hex(rgb[1])}${hex(rgb[2])}${hex(rgb[3])}`; + } + const parsed = parseColor(trimmed); + if (!parsed) return null; + return parsed.kind === "named" ? `.${parsed.name}` : trimmed.replace(/^#?/, "#"); +} + +function stringLiteral(value: string, warnings: string[], what: string): string | null { + const parsed = unquote(value, warnings); + if (parsed === null && value.trim().length > 0) { + warnings.push(`${what} is not a plain string literal and was ignored.`); + } + return parsed; +} + +// ---------------------------------------------------------------- modifiers -- + +function applyModifiers(props: Props, modifiers: Modifier[], warnings: string[]) { + for (const modifier of modifiers) { + const args = modifier.args.trim(); + switch (modifier.name) { + case "font": { + const name = unDot(args); + if (FONT_NAMES.has(name)) props.font = `.${name}`; + else warnings.push(`Font "${args || "(none)"}" is not supported by the builder.`); + break; + } + case "fontWeight": { + const name = unDot(args); + if (WEIGHT_NAMES.has(name)) props.weight = `.${name}`; + else warnings.push(`Font weight "${args || "(none)"}" is not supported by the builder.`); + break; + } + case "foregroundStyle": + case "foregroundColor": { + const color = colorValue(args); + if (color) props.foreground = color; + else warnings.push(`Foreground colour "${args || "(none)"}" is not supported.`); + break; + } + case "padding": { + if (args.length === 0) props.padding = "8"; + else if (isNumber(args)) props.padding = args; + else warnings.push(`Padding "${args}" is not supported; only a single value is.`); + break; + } + case "frame": { + const width = /width:\s*([\d.]+)/.exec(args); + const height = /height:\s*([\d.]+)/.exec(args); + if (width) props.frameWidth = width[1]; + if (height) props.frameHeight = height[1]; + break; + } + case "background": { + const color = colorValue(args); + if (color) props.background = color; + else warnings.push(`Background "${args || "(none)"}" is not supported.`); + break; + } + case "clipShape": { + const radius = /RoundedRectangle\(cornerRadius:\s*([\d.]+)/.exec(args); + if (radius) props.cornerRadius = radius[1]; + else warnings.push(`Clip shape "${args}" is not supported; only rounded rectangles are.`); + break; + } + case "opacity": { + if (isNumber(args)) props.opacity = args; + else warnings.push(`Opacity "${args || "(none)"}" is not supported.`); + break; + } + case "buttonStyle": { + const name = unDot(args); + if (BUTTON_STYLES.has(name)) props.style = name; + else warnings.push(`Button style "${args || "(none)"}" is not supported.`); + break; + } + case "resizable": { + props.resizable = true; + break; + } + default: { + if (!IGNORED_MODIFIERS.has(modifier.name)) { + warnings.push(`Modifier ".${modifier.name}" is not supported by the builder.`); + } + } + } + } +} + +// ------------------------------------------------------------------- mapping -- + +function childrenOf(call: Call, warnings: string[]): UINode[] { + const closure = call.closures.find((candidate) => candidate.label === ""); + if (!closure) return []; + return parseViewList(closure.body, warnings).map((child) => toNode(child, warnings)); +} + +/** + * `navigationTitle` is generated on the (possibly Group-wrapped) child of a + * `NavigationStack`, not on the stack itself, so it has to be collected from + * there when reading a file back. + */ +function findNavigationTitle(calls: Call[], warnings: string[]): string | null { + for (const child of calls) { + const direct = child.modifiers.find((modifier) => modifier.name === "navigationTitle"); + if (direct) return stringLiteral(direct.args, warnings, "A navigation title"); + if (child.name === "Group") { + const closure = child.closures.find((candidate) => candidate.label === ""); + if (closure) { + const nested = findNavigationTitle(parseViewList(closure.body, warnings), warnings); + if (nested !== null) return nested; + } + } + } + return null; +} + +function toNode(call: Call, warnings: string[]): UINode { + const spec = CATALOG[call.name]; + if (!spec) { + warnings.push( + `"${call.name}" has no builder component; it is shown as a placeholder and will not be regenerated.` + ); + return node(call.name, {}, []); + } + + const args = argList(call.args); + const props: Props = {}; + applyModifiers(props, call.modifiers, warnings); + + switch (call.name) { + case "VStack": + case "HStack": { + const alignment = unDot(argValue(args, "alignment")); + if (alignment) props.alignment = alignment; + const spacing = argValue(args, "spacing"); + if (isNumber(spacing)) props.spacing = spacing.trim(); + break; + } + case "ScrollView": { + props.axis = unDot(positional(args)) === "horizontal" ? "horizontal" : "vertical"; + break; + } + case "Section": { + const header = stringLiteral(positional(args), warnings, "A Section header"); + if (header !== null) props.header = header; + break; + } + case "NavigationStack": { + const title = call.modifiers.find((modifier) => modifier.name === "navigationTitle"); + const own = title ? stringLiteral(title.args, warnings, "A navigation title") : null; + if (own !== null) { + props.title = own; + } else { + const closure = call.closures.find((candidate) => candidate.label === ""); + const childCalls = closure ? parseViewList(closure.body, warnings) : []; + const inherited = findNavigationTitle(childCalls, warnings); + if (inherited !== null) props.title = inherited; + } + break; + } + case "Text": { + const text = stringLiteral(positional(args), warnings, "Text content"); + props.text = text ?? ""; + break; + } + case "Label": { + const title = stringLiteral(positional(args), warnings, "A Label title"); + if (title !== null) props.title = title; + const symbol = stringLiteral(argValue(args, "systemImage"), warnings, "A Label symbol"); + if (symbol !== null) props.systemImage = symbol; + break; + } + case "Button": { + const title = stringLiteral(positional(args), warnings, "A Button title"); + if (title !== null) props.title = title; + const label = call.closures.find((candidate) => candidate.label === "label"); + if (label) { + const inner = parseViewList(label.body, warnings)[0]; + if (inner && (inner.name === "Label" || inner.name === "Text")) { + const innerArgs = argList(inner.args); + const innerTitle = stringLiteral(positional(innerArgs), warnings, "A Button title"); + if (innerTitle !== null) props.title = innerTitle; + if (inner.name === "Label") { + const symbol = stringLiteral( + argValue(innerArgs, "systemImage"), + warnings, + "A Button symbol" + ); + if (symbol !== null) props.systemImage = symbol; + } + // Modifiers on the label view (font, padding, …) belong to the node. + applyModifiers(props, inner.modifiers, warnings); + } + } + break; + } + case "Toggle": { + const title = stringLiteral(positional(args), warnings, "A Toggle title"); + if (title !== null) props.title = title; + const isOn = binding(argValue(args, "isOn")); + if (isOn) props.isOn = isOn; + break; + } + case "TextField": + case "SecureField": { + const placeholder = stringLiteral(positional(args), warnings, "A placeholder"); + if (placeholder !== null) props.placeholder = placeholder; + const text = binding(argValue(args, "text")); + if (text) props.text = text; + break; + } + case "Slider": { + const value = binding(argValue(args, "value")); + if (value) props.value = value; + const range = /^(-?[\d.]+)\s*\.\.\.\s*(-?[\d.]+)$/.exec(argValue(args, "in").trim()); + if (range) { + props.min = range[1]; + props.max = range[2]; + } + break; + } + case "Stepper": { + const title = stringLiteral(positional(args), warnings, "A Stepper title"); + if (title !== null) props.title = title; + const value = binding(argValue(args, "value")); + if (value) props.value = value; + break; + } + case "Picker": { + const title = stringLiteral(positional(args), warnings, "A Picker title"); + if (title !== null) props.title = title; + const selection = binding(argValue(args, "selection")); + if (selection) props.selection = selection; + const closure = call.closures.find((candidate) => candidate.label === ""); + if (closure) { + const options = parseViewList(closure.body, []) + .filter((child) => child.name === "Text") + .map((child) => unquote(positional(argList(child.args)), []) ?? "") + .filter((option) => option.length > 0); + if (options.length > 0) props.options = options.join(", "); + } + break; + } + case "DatePicker": { + const title = stringLiteral(positional(args), warnings, "A DatePicker title"); + if (title !== null) props.title = title; + const selection = binding(argValue(args, "selection")); + if (selection) props.selection = selection; + const components = unDot(argValue(args, "displayedComponents")); + if (components) props.components = components; + break; + } + case "ProgressView": { + const title = stringLiteral(positional(args), warnings, "A ProgressView title"); + if (title !== null) props.title = title; + const value = argValue(args, "value"); + if (isNumber(value)) props.value = value.trim(); + break; + } + case "Image": { + const symbol = stringLiteral(argValue(args, "systemName"), warnings, "An SF Symbol name"); + const asset = stringLiteral(positional(args), warnings, "An asset name"); + if (symbol !== null) { + props.source = "symbol"; + props.name = symbol; + } else if (asset !== null) { + props.source = "asset"; + props.name = asset; + } + break; + } + default: + break; + } + + return node(call.name, props, spec.container ? childrenOf(call, warnings) : []); +} + +// -------------------------------------------------------------------- entry -- + +/** The name and `var body` of a SwiftUI view declaration, if there is one. */ +function extractBody(source: string): { name: string; body: string } | null { + const bodyMatch = /var\s+body\s*:\s*some\s+View\s*\{/.exec(source); + if (!bodyMatch) return null; + const cursor: Cursor = { text: source, index: bodyMatch.index + bodyMatch[0].length - 1 }; + const body = readGroup(cursor, "{", "}"); + const structMatch = /struct\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*View\b/.exec(source); + return { name: structMatch?.[1] ?? "", body }; +} + +/** + * Parses SwiftUI source into a builder document, or null when the file holds no + * `var body: some View` (an `App`, a model, a helper, …). + */ +export function parseSwiftDocument( + source: string, + options: { name?: string; includePreview?: boolean } = {} +): SwiftImport | null { + const clean = stripComments(source); + const extracted = extractBody(clean); + if (!extracted) return null; + + const warnings: string[] = []; + const roots = parseViewList(extracted.body, warnings).map((call) => toNode(call, warnings)); + if (roots.length === 0) return null; + + const viewName = + extracted.name || + (options.name ? options.name.replace(/[^A-Za-z0-9_]/g, "") : "") || + DEFAULT_VIEW_NAME; + + const document: UIDocument = { + version: DOCUMENT_VERSION, + name: viewName, + includePreview: options.includePreview ?? /#Preview\b/.test(clean), + root: roots.length === 1 ? roots[0] : node("VStack", {}, roots), + }; + + return { document, warnings: dedupe(warnings) }; +} + +function dedupe(values: string[]): string[] { + return [...new Set(values)]; +} diff --git a/src/ui-builder/state.ts b/src/ui-builder/state.ts new file mode 100644 index 0000000..ee5a344 --- /dev/null +++ b/src/ui-builder/state.ts @@ -0,0 +1,15 @@ +// The Swift types a builder control can bind to. +// +// Lives on its own (no JSX, no catalog) so the action helpers can use it +// without pulling the component catalog in. + +export type StateValueType = "Bool" | "String" | "Double" | "Int" | "Date"; + +/** Initial value of a freshly declared `@State` variable. */ +export const STATE_DEFAULTS: Record = { + Bool: "false", + String: '""', + Double: "0", + Int: "0", + Date: "Date()", +}; diff --git a/src/ui-builder/types.ts b/src/ui-builder/types.ts new file mode 100644 index 0000000..336582e --- /dev/null +++ b/src/ui-builder/types.ts @@ -0,0 +1,142 @@ +// Data model of the visual SwiftUI builder. +// +// A document is a tree of nodes; every node maps to exactly one SwiftUI view +// (`kind`) plus a flat bag of props. Props are primitives so that a document +// can be persisted as JSON and edited by simple form fields. + +export type Primitive = string | number | boolean; + +export type Props = Record; + +export type UINode = { + id: string; + kind: string; + props: Props; + children: UINode[]; +}; + +export type UIDocument = { + version: number; + /** Name of the generated Swift `struct`, e.g. `ContentView`. */ + name: string; + /** Emit a `#Preview` block (needs a macro-capable toolchain). */ + includePreview: boolean; + root: UINode; +}; + +export const DOCUMENT_VERSION = 1; + +export const DEFAULT_VIEW_NAME = "ContentView"; + +let nextId = 0; + +export function makeId(): string { + nextId += 1; + return `n${nextId.toString(36)}${Math.random().toString(36).slice(2, 7)}`; +} + +export function node(kind: string, props: Props = {}, children: UINode[] = []): UINode { + return { id: makeId(), kind, props, children }; +} + +/** Every node in the document, parents before children. */ +export function walk(rootNode: UINode): UINode[] { + const all: UINode[] = []; + const visit = (n: UINode) => { + all.push(n); + n.children.forEach(visit); + }; + visit(rootNode); + return all; +} + +export function findNode(rootNode: UINode, id: string): UINode | null { + return walk(rootNode).find((n) => n.id === id) ?? null; +} + +/** The node that contains `id`, or null for the root. */ +export function findParent(rootNode: UINode, id: string): UINode | null { + for (const n of walk(rootNode)) { + if (n.children.some((c) => c.id === id)) return n; + } + return null; +} + +export function isDescendant(ancestor: UINode, id: string): boolean { + return walk(ancestor).some((n) => n.id === id); +} + +/** + * Immutably replace the node with `id`. `fn` returns the new node (or null to + * delete it, which is only allowed for non-root nodes). + */ +export function replaceNode( + rootNode: UINode, + id: string, + fn: (n: UINode) => UINode | null +): UINode { + const visit = (n: UINode): UINode | null => { + if (n.id === id) return fn(n); + const children: UINode[] = []; + for (const child of n.children) { + const result = visit(child); + if (result !== null) children.push(result); + } + return { ...n, children }; + }; + // fn returning null deletes a node; the root is not deletable + return visit(rootNode) ?? rootNode; +} + +export function insertNode( + rootNode: UINode, + parentId: string, + newNode: UINode, + index?: number +): UINode { + return replaceNode(rootNode, parentId, (parent) => { + const children = [...parent.children]; + const at = index === undefined ? children.length : Math.max(0, Math.min(index, children.length)); + children.splice(at, 0, newNode); + return { ...parent, children }; + }); +} + +export function removeNode(rootNode: UINode, id: string): UINode { + const parent = findParent(rootNode, id); + if (!parent) return rootNode; + return replaceNode(rootNode, parent.id, (p) => ({ + ...p, + children: p.children.filter((c) => c.id !== id), + })); +} + +export function moveNode(rootNode: UINode, id: string, delta: number): UINode { + const parent = findParent(rootNode, id); + if (!parent) return rootNode; + const index = parent.children.findIndex((c) => c.id === id); + const target = index + delta; + if (index < 0 || target < 0 || target >= parent.children.length) return rootNode; + return replaceNode(rootNode, parent.id, (p) => { + const children = [...p.children]; + const [moved] = children.splice(index, 1); + children.splice(target, 0, moved); + return { ...p, children }; + }); +} + +export function duplicateNode(rootNode: UINode, id: string): { root: UINode; newId: string } { + const source = findNode(rootNode, id); + if (!source) return { root: rootNode, newId: id }; + const copyOf = (n: UINode): UINode => ({ + ...n, + id: makeId(), + props: { ...n.props }, + children: n.children.map(copyOf), + }); + const copy = copyOf(source); + const parent = findParent(rootNode, id); + const parentId = parent ? parent.id : rootNode.id; + const index = parent ? parent.children.findIndex((c) => c.id === id) + 1 : 1; + return { root: insertNode(rootNode, parentId, copy, index), newId: copy.id }; +} diff --git a/src/utilities/IDEContext.tsx b/src/utilities/IDEContext.tsx index b6ecdd3..f5fae9c 100644 --- a/src/utilities/IDEContext.tsx +++ b/src/utilities/IDEContext.tsx @@ -31,6 +31,19 @@ import { isCompatable } from "../components/SwiftMenu"; let isMainWindow = getCurrentWindow().label === "main"; +const STARTUP_PROBE_TIMEOUT_MS = 10000; + +const withStartupTimeout = (promise: Promise, name: string) => + Promise.race([ + promise, + new Promise((_, reject) => { + window.setTimeout( + () => reject(new Error(`${name} timed out during startup`)), + STARTUP_PROBE_TIMEOUT_MS + ); + }), + ]); + export interface IDEContextType { initialized: boolean; ready: boolean | null; @@ -60,6 +73,8 @@ export interface IDEContextType { mountDdi: (ask: boolean) => Promise; setScreenshot: React.Dispatch>; screenshot: string | null; + uiBuilderOpen: boolean; + setUIBuilderOpen: React.Dispatch>; } export type DeviceInfo = { @@ -120,6 +135,7 @@ export const IDEProvider: React.FC<{ const [ddiOpen, setDdiOpen] = useState(false); const [ddiProgress, setDdiProgress] = useState(0); const [screenshot, setScreenshot] = useState(null); + const [uiBuilderOpen, setUIBuilderOpen] = useState(false); const { checkForUpdates } = useContext(UpdateContext); const { store, storeInitialized } = useContext(StoreContext); @@ -177,16 +193,20 @@ export const IDEProvider: React.FC<{ } }, [selectedToolchain]); - const scanToolchains = useCallback(() => { - return new Promise(async (resolve) => { - let response = await invoke( + const scanToolchains = useCallback(async () => { + try { + const response = await invoke( "get_swiftly_toolchains" ); - if (response) { - setToolchains(response); - resolve(); - } - }); + setToolchains(response); + } catch (error) { + console.error("Failed to scan Swift toolchains:", error); + setToolchains({ + swiftlyInstalled: false, + swiftlyVersion: null, + toolchains: [], + }); + } }, []); const locateToolchain = useCallback(async () => { @@ -259,50 +279,70 @@ export const IDEProvider: React.FC<{ if (startedInitializing.current) return; startedInitializing.current = true; let initPromises: Promise[] = []; - initPromises.push(scanToolchains()); initPromises.push( - invoke("has_wsl").then((response) => { - setHasWSL(response as boolean); - }) + withStartupTimeout(scanToolchains(), "Swift toolchain scan") ); initPromises.push( - invoke("is_windows").then((response) => { - setIsWindows(response as boolean); - }) + withStartupTimeout(invoke("has_wsl"), "WSL detection").then( + (response) => { + setHasWSL(response as boolean); + } + ) + ); + initPromises.push( + withStartupTimeout(invoke("is_windows"), "Windows detection").then( + (response) => { + setIsWindows(response as boolean); + } + ) ); initPromises.push( - invoke("has_darwin_sdk", { - toolchainPath: selectedToolchain?.path ?? "", - }).then((response) => { + withStartupTimeout( + invoke("has_darwin_sdk", { + toolchainPath: selectedToolchain?.path ?? "", + }), + "Darwin SDK detection" + ).then((response) => { setHasDarwinSDK(response != "none"); setDarwinSDKVersion(response); }) ); initPromises.push( - invoke("has_limited_ram").then((response) => { - setHasLimitedRam(response as boolean); - }) + withStartupTimeout(invoke("has_limited_ram"), "RAM detection").then( + (response) => { + setHasLimitedRam(response as boolean); + } + ) ); - Promise.all(initPromises) - .then(() => { - setInitialized(true); - }) - .catch((error) => { - console.error("Error initializing IDE context: ", error); - alert("An error occurred while initializing the IDE context: " + error); + Promise.allSettled(initPromises).then((results) => { + results.forEach((result) => { + if (result.status === "rejected") { + console.error("Error initializing IDE context: ", result.reason); + } }); + setInitialized(true); + }); }, []); useEffect(() => { if (!initialized) return; let changeWindows = async () => { - let splash = await Window.getByLabel("splashscreen"); - let main = await Window.getByLabel("main"); - if (splash && main) { - splash.close(); - await main.show(); - main.setFocus(); + try { + const splash = await Window.getByLabel("splashscreen"); + const main = await Window.getByLabel("main"); + if (main) { + // Show the main window first so a close failure cannot leave the + // user with only the splash screen. + await main.show(); + await main.setFocus(); + } + if (splash) await splash.close(); + } catch (error) { + console.error( + "Failed to switch from splash screen to main window:", + error + ); } }; changeWindows(); @@ -320,15 +360,14 @@ export const IDEProvider: React.FC<{ return; hasCheckedForUpdates = true; - checkForUpdates(); + void checkForUpdates().catch((error) => { + console.error("Failed to check for updates:", error); + }); }; check(); }, [initialized, checkForUpdates, store, storeInitialized]); - const listenerAdded = useRef(false); - const listener2Added = useRef(false); - const listener3Added = useRef(false); const unlisten = useRef<() => void>(() => {}); const unlisten2fa = useRef<() => void>(() => {}); const unlistenAppleid = useRef<() => void>(() => {}); @@ -341,8 +380,9 @@ export const IDEProvider: React.FC<{ const saveCredentials = useRef(null); useEffect(() => { - if (!listenerAdded.current) { - (async () => { + let cancelled = false; + (async () => { + try { const unlistenFn = await listen("idevices", (event) => { let devices = event.payload as DeviceInfo[]; setDevices(devices); @@ -350,18 +390,22 @@ export const IDEProvider: React.FC<{ addToast.info("No devices found"); } }); - unlisten.current = unlistenFn; - })(); - listenerAdded.current = true; - } + if (cancelled) unlistenFn(); + else unlisten.current = unlistenFn; + } catch (error) { + console.error("Failed to listen for device updates:", error); + } + })(); return () => { + cancelled = true; unlisten.current(); }; }, []); useEffect(() => { - if (!listener2Added.current) { - (async () => { + let cancelled = false; + (async () => { + try { const unlistenFn = await listen("2fa-required", async () => { if (isMainWindow) { setTfaOpen(true); @@ -369,18 +413,22 @@ export const IDEProvider: React.FC<{ addToast.info("Please complete 2FA in the main window."); } }); - unlisten2fa.current = unlistenFn; - })(); - listener2Added.current = true; - } + if (cancelled) unlistenFn(); + else unlisten2fa.current = unlistenFn; + } catch (error) { + console.error("Failed to listen for 2FA requests:", error); + } + })(); return () => { + cancelled = true; unlisten2fa.current(); }; }, []); useEffect(() => { - if (!listener3Added.current) { - (async () => { + let cancelled = false; + (async () => { + try { const unlistenFn = await listen("apple-id-required", () => { if (isMainWindow) { setAppleIdOpen(true); @@ -388,30 +436,36 @@ export const IDEProvider: React.FC<{ addToast.info("Please login to your Apple ID in the main window."); } }); - unlistenAppleid.current = unlistenFn; - })(); - listener3Added.current = true; - } + if (cancelled) unlistenFn(); + else unlistenAppleid.current = unlistenFn; + } catch (error) { + console.error("Failed to listen for Apple ID requests:", error); + } + })(); return () => { + cancelled = true; unlistenAppleid.current(); }; }, []); - const ddiListenerAdded = useRef(false); const ddiUnlisten = useRef<() => void>(() => {}); useEffect(() => { - if (!ddiListenerAdded.current) { - (async () => { + let cancelled = false; + (async () => { + try { const unlistenFn = await listen("ddi-mount-progress", (event) => { const progress = event.payload as number; setDdiProgress(progress); }); - ddiUnlisten.current = unlistenFn; - })(); - ddiListenerAdded.current = true; - } + if (cancelled) unlistenFn(); + else ddiUnlisten.current = unlistenFn; + } catch (error) { + console.error("Failed to listen for DDI progress:", error); + } + })(); return () => { + cancelled = true; ddiUnlisten.current(); }; }, [setDdiProgress]); @@ -515,6 +569,8 @@ export const IDEProvider: React.FC<{ darwinSDKVersion, screenshot, setScreenshot, + uiBuilderOpen, + setUIBuilderOpen, }), [ isWindows, @@ -540,6 +596,8 @@ export const IDEProvider: React.FC<{ darwinSDKVersion, screenshot, setScreenshot, + uiBuilderOpen, + setUIBuilderOpen, ] ); diff --git a/src/utilities/StoreContext.tsx b/src/utilities/StoreContext.tsx index c903b38..791388b 100644 --- a/src/utilities/StoreContext.tsx +++ b/src/utilities/StoreContext.tsx @@ -33,23 +33,34 @@ export const StoreProvider: React.FC<{ children: React.ReactNode }> = ({ useEffect(() => { const initializeStore = async () => { - const storeInstance = await load("preferences.json"); - setStore(storeInstance); - - let theme = await storeInstance.get("appearance/theme"); - if (theme === undefined) theme = "dark"; - await setTheme(theme as "light" | "dark"); - setMode(theme as "light" | "dark"); - - storeInstance.set("isCrossCodePrefs", true); - - const keys = await storeInstance.keys(); - const values: { [key: string]: any } = {}; - for (const key of keys) { - values[key] = await storeInstance.get(key); + try { + const storeInstance = await load("preferences.json"); + setStore(storeInstance); + + let theme = await storeInstance.get("appearance/theme"); + if (theme === undefined) theme = "dark"; + try { + await setTheme(theme as "light" | "dark"); + setMode(theme as "light" | "dark"); + } catch (error) { + console.error("Failed to apply saved theme:", error); + } + + await storeInstance.set("isCrossCodePrefs", true); + + const keys = await storeInstance.keys(); + const values: { [key: string]: any } = {}; + for (const key of keys) { + values[key] = await storeInstance.get(key); + } + setStoreValues(values); + } catch (error) { + console.error("Failed to initialize preferences store:", error); + } finally { + // A corrupt or unavailable preferences file must not keep the splash + // screen visible forever. The app can operate with default values. + setStoreInitialized(true); } - setStoreValues(values); - setStoreInitialized(true); }; initializeStore(); @@ -94,7 +105,7 @@ export const StoreProvider: React.FC<{ children: React.ReactNode }> = ({ [storeValues, setStoreValue, store] ); - if (!store || !storeInitialized) { + if (!storeInitialized) { return null; } diff --git a/src/utilities/TauriFileSystemProvider.ts b/src/utilities/TauriFileSystemProvider.ts index 1033244..9abbd75 100644 --- a/src/utilities/TauriFileSystemProvider.ts +++ b/src/utilities/TauriFileSystemProvider.ts @@ -6,6 +6,8 @@ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { FileChangeType, FileSystemProviderCapabilities, + FileSystemProviderError, + FileSystemProviderErrorCode, FileType, IFileChange, IFileDeleteOptions, @@ -22,23 +24,72 @@ import { import * as fs from "@tauri-apps/plugin-fs"; import { invoke } from "@tauri-apps/api/core"; import { platform } from "@tauri-apps/plugin-os"; +import { + classifyWatchEvent, + isExcludedPath, + providerErrorCodeFor, + ProviderErrorCodeName, + WatchChangeKind, +} from "./fs-provider-helpers"; + +const errorCodes: Record = { + FileExists: FileSystemProviderErrorCode.FileExists, + FileNotFound: FileSystemProviderErrorCode.FileNotFound, + FileNotADirectory: FileSystemProviderErrorCode.FileNotADirectory, + FileIsADirectory: FileSystemProviderErrorCode.FileIsADirectory, + NoPermissions: FileSystemProviderErrorCode.NoPermissions, + FileExceedsStorageQuota: FileSystemProviderErrorCode.FileExceedsStorageQuota, + FileTooLarge: FileSystemProviderErrorCode.FileTooLarge, + Unknown: FileSystemProviderErrorCode.Unknown, +}; + +const changeTypes: Record = { + added: FileChangeType.ADDED, + updated: FileChangeType.UPDATED, + deleted: FileChangeType.DELETED, +}; + +/** + * The fs plugin rejects with a plain string (and occasionally an `Error`), while + * the file service wants an error carrying a `FileSystemProviderErrorCode` — the + * code decides the message the user sees and how the operation is treated. + */ +function toProviderError(error: unknown): Error { + if (error instanceof FileSystemProviderError) return error; + const message = error instanceof Error ? error.message : String(error); + return FileSystemProviderError.create( + message, + errorCodes[providerErrorCodeFor(message)] + ); +} + +function toFileType(entry: fs.DirEntry): FileType { + let type = FileType.Unknown; + if (entry.isFile) type |= FileType.File; + if (entry.isDirectory) type |= FileType.Directory; + if (entry.isSymlink) type |= FileType.SymbolicLink; + return type; +} export default class TauriFileSystemProvider extends Disposable implements IFileSystemProviderWithFileReadWriteCapability { private _onDidChangeFile: Emitter; + private _onDidWatchError: Emitter; capabilities: FileSystemProviderCapabilities; onDidChangeCapabilities: Event; onDidChangeFile: Event; - onDidWatchError?: Event | undefined; + onDidWatchError: Event; constructor(readonly: boolean) { super(); this.onDidChangeCapabilities = Event.None; this._onDidChangeFile = new Emitter(); this.onDidChangeFile = this._onDidChangeFile.event; + this._onDidWatchError = new Emitter(); + this.onDidWatchError = this._onDidWatchError.event; this.capabilities = FileSystemProviderCapabilities.FileReadWrite | FileSystemProviderCapabilities.PathCaseSensitive; @@ -46,101 +97,195 @@ export default class TauriFileSystemProvider this.capabilities |= FileSystemProviderCapabilities.Readonly; } } + + override dispose(): void { + this._onDidChangeFile.dispose(); + this._onDidWatchError.dispose(); + super.dispose(); + } + async readFile(resource: URI): Promise { - return await fs.readFile(await this.path(resource)); + return await this.withPath(resource, (path) => fs.readFile(path)); } + async writeFile(resource: URI, content: Uint8Array, opts: IFileWriteOptions) { - await fs.writeFile(await this.path(resource), content, { - create: opts.create, - createNew: !opts.overwrite, - }); + const existed = await this.withPath(resource, (path) => fs.exists(path)); + if (!opts.overwrite && existed) { + throw FileSystemProviderError.create( + `Unable to write file '${resource.toString()}' (File exists)`, + FileSystemProviderErrorCode.FileExists + ); + } + if (!opts.create && !existed) { + throw FileSystemProviderError.create( + `Unable to write file '${resource.toString()}' (File not found)`, + FileSystemProviderErrorCode.FileNotFound + ); + } + await this.withPath(resource, (path) => + fs.writeFile(path, content, { create: true }) + ); this._onDidChangeFile.fire([ { - type: opts.create ? FileChangeType.ADDED : FileChangeType.UPDATED, + type: existed ? FileChangeType.UPDATED : FileChangeType.ADDED, resource, }, ]); } async stat(resource: URI): Promise { - let stat = await fs.stat(await this.path(resource)); - let type = stat.isFile ? FileType.File : FileType.Directory; - if (stat.isSymlink) { - type = FileType.SymbolicLink; - } - let ctime = stat.birthtime?.getMilliseconds() || 0; - let mtime = stat.mtime?.getMilliseconds() || 0; + const stat = await this.withPath(resource, (path) => fs.stat(path)); + // `FileType` is a bitfield: a symlink to a folder is both. + let type = FileType.Unknown; + if (stat.isFile) type |= FileType.File; + if (stat.isDirectory) type |= FileType.Directory; + if (stat.isSymlink) type |= FileType.SymbolicLink; + // The file service expects milliseconds since the epoch — not the + // millisecond *component* of the date, which is what this used to report. + const mtime = stat.mtime ? stat.mtime.getTime() : 0; + const birthtime = stat.birthtime ? stat.birthtime.getTime() : 0; return { type, - ctime, - mtime, + ctime: Number.isFinite(birthtime) && birthtime > 0 ? birthtime : mtime, + mtime: Number.isFinite(mtime) ? mtime : 0, size: stat.size, }; } + async readdir(resource: URI): Promise<[string, FileType][]> { + const entries = await this.withPath(resource, (path) => fs.readDir(path)); + return entries.map((entry) => [entry.name, toFileType(entry)]); + } + + async mkdir(resource: URI): Promise { + // The file service creates the parents itself (`mkdirp`), so `recursive` + // only makes this tolerant of a folder that appeared in the meantime. + await this.withPath(resource, (path) => fs.mkdir(path, { recursive: true })); + this._onDidChangeFile.fire([{ type: FileChangeType.ADDED, resource }]); + } + + async delete(resource: URI, opts: IFileDeleteOptions): Promise { + await this.withPath(resource, (path) => + fs.remove(path, { recursive: opts.recursive }) + ); + this._onDidChangeFile.fire([{ type: FileChangeType.DELETED, resource }]); + } + + async rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise { + const exists = await this.withPath(to, (path) => fs.exists(path)); + if (!opts.overwrite && exists) { + throw FileSystemProviderError.create( + `Unable to rename '${from.toString()}' to '${to.toString()}' (File exists)`, + FileSystemProviderErrorCode.FileExists + ); + } + const source = await this.path(from); + const target = await this.path(to); + try { + await fs.rename(source, target); + } catch (error) { + throw toProviderError(error); + } + this._onDidChangeFile.fire([ + { type: FileChangeType.DELETED, resource: from }, + { type: FileChangeType.ADDED, resource: to }, + ]); + } + watch(resource: URI, opts: IWatchOptions): IDisposable { let disposed = false; + let unwatch: fs.UnwatchFn | undefined; + + const fire = (changes: IFileChange[]) => { + if (!disposed && changes.length) { + this._onDidChangeFile.fire(changes); + } + }; + (async () => { - fs.watchImmediate( - await this.path(resource), - () => { - if (!disposed) { - // TODO: Exclude files based on opts.excludes and look into how recursive watch actually works - this._onDidChangeFile.fire([ - { - type: FileChangeType.UPDATED, - resource, - }, - ]); - } - }, - { - recursive: opts.recursive, - } - ).then((unwatch) => { + try { + const watchedPath = await this.path(resource); + const stop = await fs.watchImmediate( + watchedPath, + (event) => { + const kind = classifyWatchEvent(event.type); + if (!kind) return; + const paths = (event.paths ?? []).filter( + (path) => !isExcludedPath(path, watchedPath, opts.excludes) + ); + // Some backends report an event without the path it belongs to; + // fall back to the watched resource so the change is not lost. + if (paths.length === 0) { + fire([{ type: changeTypes[kind], resource }]); + return; + } + void (async () => { + const changes: IFileChange[] = []; + for (const path of paths) { + changes.push({ + type: changeTypes[kind], + resource: await this.uriFor(path), + }); + } + fire(changes); + })(); + }, + { recursive: opts.recursive } + ); if (disposed) { - unwatch(); + stop(); + } else { + unwatch = stop; } - (disposable as any)._unwatch = unwatch; - }); + } catch (error) { + this._onDidWatchError.fire( + `Unable to watch ${resource.toString()}: ${ + error instanceof Error ? error.message : String(error) + }` + ); + } })(); - const disposable: IDisposable = { + return { dispose: () => { disposed = true; - if ((disposable as any)._unwatch) { - (disposable as any)._unwatch(); - } + unwatch?.(); + unwatch = undefined; }, }; - return disposable; } - // TODO: Implement remaining methods - // @ts-ignore - mkdir(resource: URI): Promise { - throw new Error("Mkdir not implemented."); - } - - // @ts-ignore - readdir(resource: URI): Promise<[string, FileType][]> { - throw new Error("Readdir not implemented."); - } - - // @ts-ignore - delete(resource: URI, opts: IFileDeleteOptions): Promise { - throw new Error("Delete not implemented."); - } - - // @ts-ignore - rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise { - throw new Error("Rename not implemented."); + /** Runs `operation` against the plugin's path form of `resource`. */ + private async withPath( + resource: URI, + operation: (path: string) => Promise + ): Promise { + try { + return await operation(await this.path(resource)); + } catch (error) { + throw toProviderError(error); + } } + /** + * Path of a resource in the form the fs plugin understands: the internal + * (Linux/WSL) path, converted when running on Windows. + */ private async path(resource: URI): Promise { if (platform() === "windows") { return await invoke("windows_path", { path: resource.path }); } return resource.fsPath; } + + /** + * Inverse of {@link path}: watcher events come back in the plugin's own path + * form, so convert before building a resource out of them. + */ + private async uriFor(path: string): Promise { + if (platform() === "windows") { + return URI.file(await invoke("linux_path", { path })); + } + return URI.file(path); + } } diff --git a/src/utilities/UpdateContext.tsx b/src/utilities/UpdateContext.tsx index ef9e466..d6a437e 100644 --- a/src/utilities/UpdateContext.tsx +++ b/src/utilities/UpdateContext.tsx @@ -1,5 +1,4 @@ -import { createContext, useCallback, useContext } from "react"; -import { StoreContext } from "./StoreContext"; +import { createContext, useCallback } from "react"; import { check } from "@tauri-apps/plugin-updater"; import { getVersion } from "@tauri-apps/api/app"; import { relaunch } from "@tauri-apps/plugin-process"; @@ -17,12 +16,12 @@ export const UpdateContext = createContext({ export const UpdateProvider: React.FC<{ children: React.ReactNode }> = ({ children, }) => { - const { store, storeInitialized } = useContext(StoreContext); const { addToast } = useToast(); const checkForUpdates = useCallback(async () => { - const update = await check(); - if (!update) return; + try { + const update = await check(); + if (!update) return; let shouldUpdate = await dialog.ask( "A new update (" + @@ -62,10 +61,16 @@ export const UpdateProvider: React.FC<{ children: React.ReactNode }> = ({ } ); - if (shouldRelaunch) { - await relaunch(); + if (shouldRelaunch) { + await relaunch(); + } + } catch (error) { + console.error("Update failed:", error); + addToast.error( + error instanceof Error ? error.message : "Failed to check for or install updates" + ); } - }, [store, storeInitialized, addToast]); + }, [addToast]); return ( diff --git a/src/utilities/build-results.test.ts b/src/utilities/build-results.test.ts new file mode 100644 index 0000000..82d76c5 --- /dev/null +++ b/src/utilities/build-results.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, test } from "bun:test"; +import { parseBuildProblems, parseTestResults, resolveBuildPath } from "./build-results"; + +describe("build result parsing", () => { + test("parses and deduplicates Swift diagnostics", () => { + const lines = [ + "Sources/App.swift:12:7: error: cannot find 'thing' in scope", + "Sources/App.swift:12:7: error: cannot find 'thing' in scope", + "Sources/App.swift:9:1: warning: immutable value was never used", + ]; + const problems = parseBuildProblems(lines, "/work/App"); + expect(problems.length).toBe(2); + expect(problems[0].file).toBe("/work/App/Sources/App.swift"); + expect(problems[0].severity).toBe("error"); + }); + + test("maps remote Mac paths into the local workspace", () => { + expect(resolveBuildPath( + "/Users/dev/App/Sources/View.swift", + "D:/Code/App", + "/Users/dev/App" + )).toBe("D:/Code/App/Sources/View.swift"); + }); + + test("parses XCTest and Swift Testing results", () => { + const results = parseTestResults([ + "Test Case '-[AppTests.LoginTests testValidLogin]' passed (0.042 seconds).", + "✔ Test “Creates a profile” passed after 0.003 seconds.", + ]); + expect(results.length).toBe(2); + expect(results[0].status).toBe("passed"); + expect(results[1].name).toBe("Creates a profile"); + }); +}); diff --git a/src/utilities/build-results.ts b/src/utilities/build-results.ts new file mode 100644 index 0000000..9574d2d --- /dev/null +++ b/src/utilities/build-results.ts @@ -0,0 +1,102 @@ +export type ProblemSeverity = "error" | "warning" | "note"; + +export type BuildProblem = { + id: string; + file: string; + line: number; + column: number; + severity: ProblemSeverity; + message: string; +}; + +export type TestStatus = "passed" | "failed" | "skipped"; + +export type TestResult = { + id: string; + suite: string; + name: string; + status: TestStatus; + duration?: number; +}; + +const problemPattern = /^(.*\.(?:swift|m|mm|h|hpp|c|cc|cpp)):(\d+):(\d+):\s*(error|warning|note):\s*(.+)$/i; +const xctestPattern = /^Test Case ['"]-?\[?([^\]']+?)[ .]([^\]']+?)\]?['"] (passed|failed|skipped)(?: \(([\d.]+) seconds\))?\.?$/i; +const swiftTestPattern = /^[✔✘]\s+Test\s+["“](.+?)["”]\s+(passed|failed|skipped)(?: after ([\d.]+) seconds?)?/i; + +function slash(value: string): string { + return value.replace(/\\/g, "/").replace(/\/$/, ""); +} + +export function resolveBuildPath(rawFile: string, projectRoot: string, remoteRoot = ""): string { + const file = slash(rawFile.trim()); + const local = slash(projectRoot); + const remote = slash(remoteRoot); + + if (remote && (file === remote || file.startsWith(`${remote}/`))) { + return `${local}${file.slice(remote.length)}`; + } + if (file.startsWith("/") || /^[A-Za-z]:\//.test(file)) return file; + return local ? `${local}/${file.replace(/^\.\//, "")}` : file; +} + +export function parseBuildProblems( + lines: string[], + projectRoot: string, + remoteRoot = "" +): BuildProblem[] { + const unique = new Map(); + for (const rawLine of lines) { + const line = rawLine.replace(/\x1b\[[0-9;]*m/g, "").trim(); + const match = line.match(problemPattern); + if (!match) continue; + const problem: BuildProblem = { + id: `${match[1]}:${match[2]}:${match[3]}:${match[4]}:${match[5]}`, + file: resolveBuildPath(match[1], projectRoot, remoteRoot), + line: Number(match[2]), + column: Number(match[3]), + severity: match[4].toLowerCase() as ProblemSeverity, + message: match[5].trim(), + }; + unique.set(problem.id, problem); + } + return [...unique.values()]; +} + +export function parseTestResults(lines: string[]): TestResult[] { + const results = new Map(); + for (const rawLine of lines) { + const line = rawLine.replace(/\x1b\[[0-9;]*m/g, "").trim(); + const xctest = line.match(xctestPattern); + if (xctest) { + const suite = xctest[1].trim(); + const name = xctest[2].trim(); + const id = `${suite}.${name}`; + results.set(id, { + id, + suite, + name, + status: xctest[3].toLowerCase() as TestStatus, + duration: xctest[4] ? Number(xctest[4]) : undefined, + }); + continue; + } + const swiftTest = line.match(swiftTestPattern); + if (swiftTest) { + const name = swiftTest[1].trim(); + results.set(name, { + id: name, + suite: "Swift Testing", + name, + status: swiftTest[2].toLowerCase() as TestStatus, + duration: swiftTest[3] ? Number(swiftTest[3]) : undefined, + }); + } + } + return [...results.values()]; +} + +export function openBuildLocation(problem: Pick) { + window.dispatchEvent( + new CustomEvent("crosscode:open-location", { detail: problem }) + ); +} diff --git a/src/utilities/constants.ts b/src/utilities/constants.ts index 752e37d..35c8305 100644 --- a/src/utilities/constants.ts +++ b/src/utilities/constants.ts @@ -1,2 +1,63 @@ -export const SWIFT_VERSION_PREFIX = "6.2"; -export const DARWIN_SDK_VERSION = "26.0"; +// Supported Swift toolchain lines. 6.4.x is the latest stable line (Swift 6.4.0 +// ships with the latest stable Xcode 27.0); 6.5 is included to support the +// in-development main-branch snapshots. Toolchains are matched by prefix, so +// e.g. 6.4.0 / 6.4.1 qualify for "6.4", and the 6.5 dev snapshots — including +// the "6.5-dev" string reported by `swift --version` — qualify for "6.5". +export const SWIFT_VERSION_PREFIXES = ["6.4", "6.5"]; + +// Recommended Swift version shown in the "swiftly install ..." hint and other +// onboarding copy. Stays on the latest STABLE line so beta toolchains +// are opt-in rather than the default advice. +export const SWIFT_VERSION_PREFIX = "6.4"; + +// The in-development toolchain line, offered as the "next release" option. +export const SWIFT_VERSION_SNAPSHOT_PREFIX = SWIFT_VERSION_PREFIXES[1]; + +// True when the given Swift version string belongs to a supported line. +// Handles stable versions ("6.4.0"), purely-numeric dev snapshots +// ("6.5.0.33.1"), the "6.5-dev" string from `swift --version`, and swiftly's +// snapshot directory naming ("swift-6.4.x-DEVELOPMENT-SNAPSHOT-..."). +export function isSupportedSwiftVersion(version: string): boolean { + return SWIFT_VERSION_PREFIXES.some((prefix) => { + return version.startsWith(prefix) || version.includes(`swift-${prefix}`); + }); +} + +// Minimum Darwin SDK version this build of CrossCode is tested/supported with. +// iOS SDK 27.0 ships with the latest stable Xcode 27.0. The app deliberately +// accepts ANY SDK >= this value so newer Xcode betas (27.1, 27.2, ...) do not +// get falsely flagged as unsupported. +export const MIN_DARWIN_SDK_VERSION = "27.0"; + +// Latest stable Xcode for the Download link + install guidance. +export const XCODE_VERSION = "27.0"; + +// Download link for the Xcode above. Apple names the .0 releases after the +// major version only ("Xcode_27/Xcode_27.xip") and everything else after the +// full version plus a "_Universal" suffix +// ("Xcode_26.6/Xcode_26.6_Universal.xip"), so derive it the same way. +const XCODE_MAJOR_VERSION = XCODE_VERSION.split(".")[0]; +const XCODE_IS_MAJOR_RELEASE = XCODE_VERSION.endsWith(".0"); +const XCODE_DIRECTORY = XCODE_IS_MAJOR_RELEASE + ? `Xcode_${XCODE_MAJOR_VERSION}` + : `Xcode_${XCODE_VERSION}`; +const XCODE_FILE = XCODE_IS_MAJOR_RELEASE + ? XCODE_DIRECTORY + : `${XCODE_DIRECTORY}_Universal`; + +export const XCODE_DOWNLOAD_URL = `https://developer.apple.com/services-account/download?path=/Developer_Tools/${XCODE_DIRECTORY}/${XCODE_FILE}.xip`; + +// True when the installed Darwin SDK is at or above the minimum supported. +// i.e. an SDK is "supported" unless it is older than MIN_DARWIN_SDK_VERSION. +export function isSupportedSDKVersion(installed: string): boolean { + const minParts = MIN_DARWIN_SDK_VERSION.split(".").map(Number); + const instParts = installed.split(".").map(Number); + for (let i = 0; i < Math.max(minParts.length, instParts.length); i++) { + const a = minParts[i] ?? 0; + const b = instParts[i] ?? 0; + if (b > a) return true; + if (b < a) return false; + } + // Installed == minimum + return true; +} diff --git a/src/utilities/fs-provider-helpers.test.ts b/src/utilities/fs-provider-helpers.test.ts new file mode 100644 index 0000000..a36363c --- /dev/null +++ b/src/utilities/fs-provider-helpers.test.ts @@ -0,0 +1,85 @@ +import { describe, expect, test } from "bun:test"; +import { + classifyWatchEvent, + isExcludedPath, + providerErrorCodeFor, +} from "./fs-provider-helpers"; + +describe("classifyWatchEvent", () => { + test("maps create/remove/modify to added/deleted/updated", () => { + expect(classifyWatchEvent({ create: { kind: "file" } })).toBe("added"); + expect(classifyWatchEvent({ create: { kind: "folder" } })).toBe("added"); + expect(classifyWatchEvent({ remove: { kind: "file" } })).toBe("deleted"); + expect(classifyWatchEvent({ modify: { kind: "data", mode: "content" } })).toBe( + "updated" + ); + }); + + test("splits renames into a delete and an add", () => { + expect(classifyWatchEvent({ modify: { kind: "rename", mode: "from" } })).toBe( + "deleted" + ); + expect(classifyWatchEvent({ modify: { kind: "rename", mode: "to" } })).toBe( + "added" + ); + expect(classifyWatchEvent({ modify: { kind: "rename", mode: "both" } })).toBe( + "updated" + ); + }); + + test("ignores events that must not invalidate cached models", () => { + // Reading a file (or touching its metadata) must not reload the editor. + expect(classifyWatchEvent({ access: { kind: "open", mode: "read" } })).toBeNull(); + expect(classifyWatchEvent({ access: { kind: "close", mode: "write" } })).toBeNull(); + expect(classifyWatchEvent("other")).toBeNull(); + expect(classifyWatchEvent(undefined)).toBeNull(); + }); + + test("treats a bare 'any' as a write", () => { + expect(classifyWatchEvent("any")).toBe("updated"); + }); +}); + +describe("isExcludedPath", () => { + test("matches patterns relative to the watched folder", () => { + expect(isExcludedPath("/work/App/.git/index", "/work/App", [".git"])).toBe(true); + expect(isExcludedPath("/work/App/.git/objects/ab", "/work/App", [".git"])).toBe(true); + expect(isExcludedPath("/work/App/Sources/App.swift", "/work/App", [".git"])).toBe(false); + }); + + test("supports globs", () => { + expect(isExcludedPath("/work/App/.build/a/b.o", "/work/App", [".build/**"])).toBe(true); + expect(isExcludedPath("/work/App/notes.txt", "/work/App", ["**/*.txt"])).toBe(true); + expect(isExcludedPath("/work/App/Sources/App.swift", "/work/App", ["**/*.txt"])).toBe(false); + expect(isExcludedPath("/work/App/Sources/App.swift", "/work/App", ["Sources/?.swift"])).toBe(false); + expect(isExcludedPath("/work/App/Sources/A.swift", "/work/App", ["Sources/?.swift"])).toBe(true); + expect(isExcludedPath("/work/App/App.swift", "/work/App", ["**/App.swift"])).toBe(true); + }); + + test("handles absolute patterns and Windows separators", () => { + expect(isExcludedPath("C:\\work\\App\\.build\\x", "C:\\work\\App", ["C:/work/App/.build"])).toBe(true); + expect(isExcludedPath("C:\\work\\App\\src\\a.swift", "C:\\work\\App", ["C:/other"])).toBe(false); + }); + + test("ignores paths outside the watched folder and empty exclude lists", () => { + expect(isExcludedPath("/elsewhere/a.swift", "/work/App", ["Sources"])).toBe(false); + expect(isExcludedPath("/work/App/Sources/a.swift", "/work/App", [])).toBe(false); + expect(isExcludedPath("/work/App/Sources/a.swift", "/work/App", undefined)).toBe(false); + }); +}); + +describe("providerErrorCodeFor", () => { + test("recognises the fs plugin's error strings", () => { + expect(providerErrorCodeFor("No such file or directory (os error 2)")).toBe("FileNotFound"); + expect(providerErrorCodeFor("path `x` already exists")).toBe("FileExists"); + expect(providerErrorCodeFor("forbidden path: /etc/passwd")).toBe("NoPermissions"); + expect(providerErrorCodeFor("Not a directory (os error 20)")).toBe("FileNotADirectory"); + expect(providerErrorCodeFor("Is a directory (os error 21)")).toBe("FileIsADirectory"); + expect(providerErrorCodeFor("something odd happened")).toBe("Unknown"); + }); + + test("prefers FileNotFound over the 'directory' patterns", () => { + expect(providerErrorCodeFor("Error: ENOENT: no such file or directory")).toBe("FileNotFound"); + expect(providerErrorCodeFor("target does not exist")).toBe("FileNotFound"); + }); +}); diff --git a/src/utilities/fs-provider-helpers.ts b/src/utilities/fs-provider-helpers.ts new file mode 100644 index 0000000..feed7b9 --- /dev/null +++ b/src/utilities/fs-provider-helpers.ts @@ -0,0 +1,158 @@ +// Pure helpers for `TauriFileSystemProvider`. +// +// The provider itself imports the Monaco/VSCode file service, which makes it +// awkward to unit test; everything that can be decided without touching the +// filesystem lives here instead so `bun test src` can cover it. + +/** The subset of VSCode's `FileChangeType` the watcher ever reports. */ +export type WatchChangeKind = "added" | "updated" | "deleted"; + +/** + * Maps a `@tauri-apps/plugin-fs` `WatchEvent["type"]` to the change kind the + * file service understands. + * + * `null` means "do not report this event". `access` notifications fire whenever + * a file is merely *read*, and turning those into `updated` events makes the + * editor invalidate and reload the model it just wrote, which in turn triggers + * another watch event — a feedback loop. `other` is notify's unclassified + * bucket (metadata churn) and is ignored for the same reason. + */ +export function classifyWatchEvent(type: unknown): WatchChangeKind | null { + // Watching a single file usually reports a plain `any`; that is a write. + if (type === "any") return "updated"; + // `other` is notify's unclassified bucket and carries no change kind. + if (typeof type !== "object" || type === null) return null; + + const record = type as Record; + if ("create" in record) return "added"; + if ("remove" in record) return "deleted"; + if ("modify" in record) { + // A rename arrives as a modify with a `from`/`to` mode; the old path is + // gone and the new one appeared, so they are a delete plus an add. + const modify = record.modify; + if (modify && typeof modify === "object") { + const details = modify as Record; + if (details.kind === "rename") { + if (details.mode === "from") return "deleted"; + if (details.mode === "to") return "added"; + } + } + return "updated"; + } + return null; +} + +/** + * Decides whether a path reported by the filesystem watcher should be ignored. + * + * `excludes` comes straight from the file service and holds absolute paths, + * paths relative to the watched folder and simple glob patterns — the subset of + * `fast-glob` that is cheap to evaluate here. Supported wildcards: `*` (within a + * segment), `**` (across segments) and `?` (a single character). + */ +export function isExcludedPath( + changedPath: string, + watchedPath: string, + excludes: readonly string[] | undefined +): boolean { + if (!excludes || excludes.length === 0) return false; + + const changed = normalise(changedPath); + const root = normalise(watchedPath).replace(/\/+$/, ""); + + for (const exclude of excludes) { + if (!exclude) continue; + const pattern = normalise(exclude).replace(/^\.\//, ""); + const isAbsolute = pattern.startsWith("/") || /^[a-z]:\//i.test(pattern); + + // Where the pattern is matched from: the whole path for absolute patterns, + // the part below the watched folder otherwise. + let candidate: string | null = null; + if (isAbsolute) { + candidate = changed; + } else if (changed === root) { + candidate = ""; + } else if (changed.startsWith(`${root}/`)) { + candidate = changed.slice(root.length + 1); + } + if (candidate === null) continue; + + if (!/[*?]/.test(pattern)) { + // A plain path excludes the entry itself and everything below it. + const prefix = isAbsolute ? pattern.replace(/\/+$/, "") : pattern.replace(/\/+$/, ""); + if (candidate === prefix) return true; + if (candidate.startsWith(`${prefix}/`)) return true; + continue; + } + + if (globToRegExp(pattern).test(candidate)) return true; + } + + return false; +} + +/** Translates one glob pattern to the `RegExp` used by {@link isExcludedPath}. */ +function globToRegExp(pattern: string): RegExp { + let source = ""; + for (let index = 0; index < pattern.length; index += 1) { + const character = pattern[index]; + if (character === "*") { + // `**/` also matches zero segments, like it does in fast-glob. + if (pattern[index + 1] === "*") { + if (pattern[index + 2] === "/") { + source += "(?:[^/]+/)*"; + index += 2; + } else { + source += ".*"; + index += 1; + } + } else { + source += "[^/]*"; + } + continue; + } + if (character === "?") { + source += "[^/]"; + continue; + } + source += character.replace(/[.+^${}()|[\]\\]/g, "\\$&"); + } + return new RegExp(`^${source}$`); +} + +function normalise(path: string): string { + return path.replace(/\\/g, "/"); +} + +/** `FileSystemProviderErrorCode` member names, so this module stays pure. */ +export type ProviderErrorCodeName = + | "FileExists" + | "FileNotFound" + | "FileNotADirectory" + | "FileIsADirectory" + | "NoPermissions" + | "FileExceedsStorageQuota" + | "FileTooLarge" + | "Unknown"; + +/** + * Guesses the right `FileSystemProviderErrorCode` for a message coming out of + * the Tauri fs plugin, which rejects with a plain (OS-flavoured) string. The + * order matters: "No such file or directory (os error 2)" must be + * `FileNotFound`, not `FileIsADirectory`. + */ +export function providerErrorCodeFor(message: unknown): ProviderErrorCodeName { + const text = typeof message === "string" ? message : ""; + if (/no such file|not found|does not exist|enoent|os error 2\b/i.test(text)) { + return "FileNotFound"; + } + if (/not a directory|enotdir/i.test(text)) return "FileNotADirectory"; + if (/\bis a directory|eisdir/i.test(text)) return "FileIsADirectory"; + if (/already exists|eexist|\bexists\b/i.test(text)) return "FileExists"; + if (/permission|denied|eacces|eperm|forbidden/i.test(text)) { + return "NoPermissions"; + } + if (/quota/i.test(text)) return "FileExceedsStorageQuota"; + if (/too large|too big|etoolarge/i.test(text)) return "FileTooLarge"; + return "Unknown"; +} diff --git a/src/utilities/operations.ts b/src/utilities/operations.ts index 3dc43d5..cddc0c0 100644 --- a/src/utilities/operations.ts +++ b/src/utilities/operations.ts @@ -44,6 +44,10 @@ export const installSdkOperation: Operation = { id: "install_toolset", title: "Download & Install toolset", }, + { + id: "install_macros", + title: "Download & Install macros", + }, { id: "extract_xip", title: "Extract Xcode.xip", diff --git a/src/utilities/remote-mac.test.ts b/src/utilities/remote-mac.test.ts new file mode 100644 index 0000000..3dc4bd0 --- /dev/null +++ b/src/utilities/remote-mac.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, test } from "bun:test"; +import { + defaultRemoteMacProfile, + isRemoteMacUsable, + mapRemoteToLocalPath, + normalizeRemoteMacProfile, + suggestRemoteProjectPath, +} from "./remote-mac"; + +describe("normalizeRemoteMacProfile", () => { + test("fills the fields a profile stored by an older version lacks", () => { + const legacy = { + enabled: true, + host: "mac.local", + user: "dev", + port: 22, + projectPath: "/Users/dev/App", + }; + expect(normalizeRemoteMacProfile(legacy)).toEqual({ + ...defaultRemoteMacProfile, + ...legacy, + }); + }); + + test("coerces unknown or missing values", () => { + expect(normalizeRemoteMacProfile(null).auth).toBe("agent"); + expect(normalizeRemoteMacProfile({ auth: "password" as never }).auth).toBe("agent"); + expect(normalizeRemoteMacProfile({ auth: "identity" }).auth).toBe("identity"); + expect(normalizeRemoteMacProfile({ port: 0 }).port).toBe(22); + expect(normalizeRemoteMacProfile({ port: 2222 }).port).toBe(2222); + expect(normalizeRemoteMacProfile({ runTests: 1 as never }).runTests).toBe(false); + }); +}); + +describe("isRemoteMacUsable", () => { + test("requires the host, user, project path and the switch", () => { + const base = { ...defaultRemoteMacProfile, host: "mac.local", user: "dev", projectPath: "/Users/dev/App" }; + expect(isRemoteMacUsable({ ...base, enabled: true })).toBe(true); + expect(isRemoteMacUsable({ ...base, enabled: false })).toBe(false); + expect(isRemoteMacUsable({ ...base, enabled: true, host: " " })).toBe(false); + expect(isRemoteMacUsable({ ...base, enabled: true, user: "" })).toBe(false); + expect(isRemoteMacUsable({ ...base, enabled: true, projectPath: "" })).toBe(false); + }); +}); + +describe("mapRemoteToLocalPath", () => { + test("maps build problems back into the workspace", () => { + expect( + mapRemoteToLocalPath("/Users/dev/App/App/View.swift", "/Users/dev/App", "D:/Code/App") + ).toBe("D:/Code/App/App/View.swift"); + expect(mapRemoteToLocalPath("/Users/dev/App", "/Users/dev/App", "D:/Code/App")).toBe("D:/Code/App"); + }); + + test("leaves paths outside the remote project alone", () => { + expect( + mapRemoteToLocalPath("/Applications/Xcode.app/x.swift", "/Users/dev/App", "D:/Code/App") + ).toBe("/Applications/Xcode.app/x.swift"); + expect(mapRemoteToLocalPath("/Users/dev/Other/a.swift", "/Users/dev/App", "D:/Code/App")).toBe( + "/Users/dev/Other/a.swift" + ); + }); + + test("tolerates missing roots and Windows separators", () => { + expect(mapRemoteToLocalPath("/Users/dev/App/a.swift", "", "D:/Code/App")).toBe( + "/Users/dev/App/a.swift" + ); + expect( + mapRemoteToLocalPath("\\Users\\dev\\App\\a.swift", "/Users/dev/App/", "D:\\Code\\App\\") + ).toBe("D:/Code/App/a.swift"); + }); +}); + +describe("suggestRemoteProjectPath", () => { + test("keeps the folder name under the user's home", () => { + expect(suggestRemoteProjectPath("/home/dev/Code/MyApp", "dev")).toBe("/Users/dev/MyApp"); + expect(suggestRemoteProjectPath("C:\\Code\\MyApp", "dev")).toBe("/Users/dev/MyApp"); + }); + + test("gives up without a folder name or user", () => { + expect(suggestRemoteProjectPath("/", "dev")).toBe(""); + expect(suggestRemoteProjectPath("/home/dev/MyApp", "")).toBe(""); + }); +}); diff --git a/src/utilities/remote-mac.ts b/src/utilities/remote-mac.ts new file mode 100644 index 0000000..45f7ba2 --- /dev/null +++ b/src/utilities/remote-mac.ts @@ -0,0 +1,88 @@ +export type RemoteMacAuth = "agent" | "identity"; + +export type RemoteMacProfile = { + enabled: boolean; + host: string; + user: string; + port: number; + projectPath: string; + /** `agent` uses ssh-agent / the default key, `identity` an explicit key file. */ + auth: RemoteMacAuth; + /** Private key path, only for `auth: "identity"`. */ + identityFile: string; + /** Run `xcodebuild test` instead of `build` for Xcode projects. */ + runTests: boolean; + /** Build result bundle destination on the remote Mac (optional). */ + resultBundlePath: string; + /** Limit the build to a destination, e.g. `generic/platform=iOS`. */ + destination: string; +}; + +export const defaultRemoteMacProfile: RemoteMacProfile = { + enabled: false, + host: "", + user: "", + port: 22, + projectPath: "", + auth: "agent", + identityFile: "", + runTests: false, + resultBundlePath: "", + destination: "", +}; + +/** + * Fills in the fields a profile stored by an older version of CrossCode does + * not have, so a saved workspace keeps working after an update. + */ +export function normalizeRemoteMacProfile( + profile: Partial | null | undefined +): RemoteMacProfile { + return { + ...defaultRemoteMacProfile, + ...(profile ?? {}), + auth: profile?.auth === "identity" ? "identity" : "agent", + port: typeof profile?.port === "number" && profile.port > 0 ? profile.port : 22, + runTests: profile?.runTests === true, + }; +} + +/** Whether the profile has everything a remote command needs. */ +export function isRemoteMacUsable(profile: RemoteMacProfile): boolean { + return ( + profile.enabled && + profile.host.trim().length > 0 && + profile.user.trim().length > 0 && + profile.projectPath.trim().length > 0 + ); +} + +/** + * Maps a path printed by the remote Mac back into the local workspace using the + * remote project path and the local one, so a build problem opens the right + * file. Anything outside the remote project path is returned unchanged. + */ +export function mapRemoteToLocalPath( + remoteFile: string, + remoteRoot: string, + localRoot: string +): string { + const file = remoteFile.replace(/\\/g, "/"); + const remote = (remoteRoot || "").replace(/\\/g, "/").replace(/\/+$/, ""); + const local = (localRoot || "").replace(/\\/g, "/").replace(/\/+$/, ""); + if (!remote || !local) return file; + if (file === remote) return local; + if (file.startsWith(`${remote}/`)) return `${local}${file.slice(remote.length)}`; + return file; +} + +/** + * Best guess at the remote project directory from a local one: the folder name + * is kept and placed under `~/` unless the user set something else. Used to + * prefill the dialog, never to override what the user typed. + */ +export function suggestRemoteProjectPath(localPath: string, username: string): string { + const name = (localPath || "").replace(/\\/g, "/").replace(/\/+$/, "").split("/").pop() ?? ""; + if (!name) return ""; + return username ? `/Users/${username}/${name}` : ""; +} diff --git a/src/xcode-import/fixture.ts b/src/xcode-import/fixture.ts new file mode 100644 index 0000000..518f56c --- /dev/null +++ b/src/xcode-import/fixture.ts @@ -0,0 +1,396 @@ +// A small but representative `project.pbxproj`, in the format Xcode writes. +// +// It covers the shapes the importer has to handle: an app target, a framework +// target with a nested group path, a shared file compiled by both, a local +// Swift package added as a folder reference, a localised resource, an asset +// catalog, a test target and the usual configuration lists. + +export const FIXTURE_PBX = String.raw`// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 1A0000000000000000000001 /* AppMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000001 /* AppMain.swift */; }; + 1A0000000000000000000002 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000002 /* ContentView.swift */; }; + 1A0000000000000000000003 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000003 /* Shared.swift */; }; + 1A0000000000000000000004 /* Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000003 /* Shared.swift */; }; + 1A0000000000000000000005 /* Kit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000004 /* Kit.swift */; }; + 1A0000000000000000000006 /* en in Resources */ = {isa = PBXBuildFile; fileRef = 2B000000000000000000000A /* en */; }; + 1A0000000000000000000007 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000005 /* Assets.xcassets */; }; + 1A0000000000000000000008 /* LocalKit in Frameworks */ = {isa = PBXBuildFile; productRef = 3C0000000000000000000001 /* LocalKit */; }; + 1A0000000000000000000009 /* AppMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0000000000000000000001 /* AppMain.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 4D0000000000000000000001 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5E0000000000000000000001 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6F0000000000000000000002; + remoteInfo = MyKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2B0000000000000000000001 /* AppMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppMain.swift; sourceTree = ""; }; + 2B0000000000000000000002 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 2B0000000000000000000003 /* Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shared.swift; sourceTree = ""; }; + 2B0000000000000000000004 /* Kit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Kit.swift; sourceTree = ""; }; + 2B0000000000000000000005 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2B0000000000000000000006 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B0000000000000000000007 /* LocalKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = LocalKit; sourceTree = ""; }; + 2B0000000000000000000008 /* My App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B0000000000000000000009 /* MyAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyAppTests.swift; sourceTree = ""; }; + 2B000000000000000000000A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 2B000000000000000000000B /* Notes.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = Notes.bin; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7A0000000000000000000001 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A0000000000000000000008 /* LocalKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8B0000000000000000000001 = { + isa = PBXGroup; + children = ( + 8B0000000000000000000002 /* App */, + 8B0000000000000000000003 /* Framework */, + 2B0000000000000000000007 /* LocalKit */, + 8B0000000000000000000004 /* Products */, + 8B0000000000000000000005 /* Tests */, + ); + sourceTree = ""; + }; + 8B0000000000000000000002 /* App */ = { + isa = PBXGroup; + children = ( + 2B0000000000000000000001 /* AppMain.swift */, + 2B0000000000000000000002 /* ContentView.swift */, + 2B0000000000000000000003 /* Shared.swift */, + 2B0000000000000000000005 /* Assets.xcassets */, + 9C0000000000000000000001 /* Localizable.strings */, + 2B0000000000000000000006 /* Info.plist */, + 2B000000000000000000000B /* Notes.bin */, + ); + path = App; + sourceTree = ""; + }; + 8B0000000000000000000003 /* Framework */ = { + isa = PBXGroup; + children = ( + 2B0000000000000000000004 /* Kit.swift */, + ); + path = Framework/Sources; + sourceTree = ""; + }; + 8B0000000000000000000004 /* Products */ = { + isa = PBXGroup; + children = ( + 2B0000000000000000000008 /* My App.app */, + ); + name = Products; + sourceTree = ""; + }; + 8B0000000000000000000005 /* Tests */ = { + isa = PBXGroup; + children = ( + 2B0000000000000000000009 /* MyAppTests.swift */, + ); + path = Tests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6F0000000000000000000001 /* My App */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0D0000000000000000000002 /* Build configuration list for PBXNativeTarget "My App" */; + buildPhases = ( + AB0000000000000000000001 /* Sources */, + 7A0000000000000000000001 /* Frameworks */, + AC0000000000000000000001 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + AD0000000000000000000001 /* PBXTargetDependency */, + ); + name = "My App"; + packageProductDependencies = ( + 3C0000000000000000000001 /* LocalKit */, + ); + productName = "My App"; + productReference = 2B0000000000000000000008 /* My App.app */; + productType = "com.apple.product-type.application"; + }; + 6F0000000000000000000002 /* MyKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0D0000000000000000000003 /* Build configuration list for PBXNativeTarget "MyKit" */; + buildPhases = ( + AB0000000000000000000002 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MyKit; + productName = MyKit; + productReference = 2B000000000000000000000C /* MyKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 6F0000000000000000000003 /* MyAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0D0000000000000000000004 /* Build configuration list for PBXNativeTarget "MyAppTests" */; + buildPhases = ( + AB0000000000000000000003 /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MyAppTests; + productName = MyAppTests; + productReference = 2B000000000000000000000D /* MyAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5E0000000000000000000001 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1500; + TargetAttributes = { + 6F0000000000000000000001 = { + CreatedOnToolsVersion = 15.0; + }; + }; + }; + buildConfigurationList = 0D0000000000000000000001 /* Build configuration list for PBXProject "MyApp" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 8B0000000000000000000001; + productRefGroup = 8B0000000000000000000004 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6F0000000000000000000001 /* My App */, + 6F0000000000000000000002 /* MyKit */, + 6F0000000000000000000003 /* MyAppTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + AC0000000000000000000001 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A0000000000000000000007 /* Assets.xcassets in Resources */, + 1A0000000000000000000006 /* en in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + AB0000000000000000000001 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A0000000000000000000001 /* AppMain.swift in Sources */, + 1A0000000000000000000002 /* ContentView.swift in Sources */, + 1A0000000000000000000003 /* Shared.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + AB0000000000000000000002 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A0000000000000000000005 /* Kit.swift in Sources */, + 1A0000000000000000000004 /* Shared.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + AB0000000000000000000003 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A0000000000000000000009 /* AppMain.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + AD0000000000000000000001 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6F0000000000000000000002 /* MyKit */; + targetProxy = 4D0000000000000000000001 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 9C0000000000000000000001 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 2B000000000000000000000A /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCSwiftPackageProductDependency section */ + 3C0000000000000000000001 /* LocalKit */ = { + isa = XCSwiftPackageProductDependency; + productName = LocalKit; + }; +/* End XCSwiftPackageProductDependency section */ + +/* Begin XCBuildConfiguration section */ + 0E0000000000000000000001 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 0E0000000000000000000002 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 0E0000000000000000000003 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "App/Info.plist"; + MARKETING_VERSION = 2.1; + CURRENT_PROJECT_VERSION = 42; + PRODUCT_BUNDLE_IDENTIFIER = com.example.myapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 0E0000000000000000000004 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "App/Info.plist"; + MARKETING_VERSION = 2.1; + CURRENT_PROJECT_VERSION = 42; + PRODUCT_BUNDLE_IDENTIFIER = com.example.myapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 0E0000000000000000000005 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_BUNDLE_IDENTIFIER = "com.example.myapp.MyKit"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + }; + name = Release; + }; + 0E0000000000000000000006 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_BUNDLE_IDENTIFIER = "com.example.myapp.MyAppTests"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0D0000000000000000000001 /* Build configuration list for PBXProject "MyApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0E0000000000000000000001 /* Debug */, + 0E0000000000000000000002 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0D0000000000000000000002 /* Build configuration list for PBXNativeTarget "My App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0E0000000000000000000003 /* Debug */, + 0E0000000000000000000004 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0D0000000000000000000003 /* Build configuration list for PBXNativeTarget "MyKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0E0000000000000000000005 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0D0000000000000000000004 /* Build configuration list for PBXNativeTarget "MyAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0E0000000000000000000006 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5E0000000000000000000001 /* Project object */; +} +`; + +/** An Xcode style Info.plist with variables, used by the conversion test. */ +export const FIXTURE_INFO_PLIST = ` + + + + CFBundleName + $(PRODUCT_NAME) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + UILaunchScreen + + + +`; + +/** A filesystem listing that matches `FIXTURE_PBX`. */ +export function fixtureDirectory(absolutePath: string): string[] { + const entries: Record = { + "/work/MyApp.xcodeproj": [], + "/work/App/en.lproj": ["/work/App/en.lproj/Localizable.strings"], + "/work/Framework/Sources": ["/work/Framework/Sources/Kit.swift"], + "/work/LocalKit": ["/work/LocalKit/Package.swift", "/work/LocalKit/Sources"], + "/work/Tests": ["/work/Tests/MyAppTests.swift"], + }; + return entries[absolutePath] ?? []; +} diff --git a/src/xcode-import/pbxproj.ts b/src/xcode-import/pbxproj.ts new file mode 100644 index 0000000..bb20ea2 --- /dev/null +++ b/src/xcode-import/pbxproj.ts @@ -0,0 +1,307 @@ +// Parser for Xcode's `project.pbxproj` files. +// +// The file is an OpenStep property list: dictionaries, arrays, quoted strings +// and bare tokens, with `/* ... */` comments everywhere. Xcode writes the same +// syntax for every project version, so a small hand-written parser is enough — +// no dependency, and it keeps the importer working on all platforms. + +export type PbxValue = string | PbxValue[] | { [key: string]: PbxValue }; +export type PbxDict = { [key: string]: PbxValue }; +export type PbxArray = PbxValue[]; + +export class PbxParseError extends Error {} + +type Parser = { + text: string; + pos: number; +}; + +function skipTrivia(parser: Parser): void { + const { text } = parser; + while (parser.pos < text.length) { + const char = text[parser.pos]; + if (char === " " || char === "\t" || char === "\n" || char === "\r") { + parser.pos += 1; + continue; + } + if (char === "/" && text[parser.pos + 1] === "/") { + const end = text.indexOf("\n", parser.pos); + parser.pos = end === -1 ? text.length : end + 1; + continue; + } + if (char === "/" && text[parser.pos + 1] === "*") { + const end = text.indexOf("*/", parser.pos + 2); + parser.pos = end === -1 ? text.length : end + 2; + continue; + } + return; + } +} + +function isBareTerminator(char: string): boolean { + return ( + char === " " || + char === "\t" || + char === "\n" || + char === "\r" || + char === "{" || + char === "}" || + char === "(" || + char === ")" || + char === "=" || + char === ";" || + char === "," + ); +} + +function parseQuotedString(parser: Parser): string { + const { text } = parser; + parser.pos += 1; // opening quote + let result = ""; + while (parser.pos < text.length) { + const char = text[parser.pos]; + if (char === "\\") { + const next = text[parser.pos + 1]; + if (next === "n") result += "\n"; + else if (next === "t") result += "\t"; + else if (next === "r") result += "\r"; + else if (next === "u") { + const hex = text.slice(parser.pos + 2, parser.pos + 6); + const code = parseInt(hex, 16); + if (!Number.isNaN(code)) { + result += String.fromCharCode(code); + parser.pos += 6; + continue; + } + result += next; + } else if (next === undefined) { + result += "\\"; + } else { + result += next; + } + parser.pos += 2; + continue; + } + if (char === '"') { + parser.pos += 1; + return result; + } + result += char; + parser.pos += 1; + } + throw new PbxParseError("unterminated string"); +} + +function parseBareToken(parser: Parser): string { + const { text } = parser; + const start = parser.pos; + while (parser.pos < text.length) { + const char = text[parser.pos]; + if (isBareTerminator(char)) break; + // a slash only ends a token when it starts a comment: paths stay intact + if (char === "/" && (text[parser.pos + 1] === "/" || text[parser.pos + 1] === "*")) break; + parser.pos += 1; + } + return text.slice(start, parser.pos); +} + +/** `<0a1b2c>` data values are kept verbatim. */ +function parseData(parser: Parser): string { + const { text } = parser; + const start = parser.pos; + while (parser.pos < text.length && text[parser.pos] !== ">") { + parser.pos += 1; + } + parser.pos += 1; + return text.slice(start, parser.pos); +} + +function parseValue(parser: Parser): PbxValue { + skipTrivia(parser); + const char = parser.text[parser.pos]; + if (char === "{") return parseDictionary(parser); + if (char === "(") return parseArray(parser); + if (char === '"') return parseQuotedString(parser); + if (char === "<") return parseData(parser); + return parseBareToken(parser); +} + +function parseDictionary(parser: Parser): PbxDict { + parser.pos += 1; // { + const result: PbxDict = {}; + for (;;) { + skipTrivia(parser); + if (parser.pos >= parser.text.length) { + throw new PbxParseError("unterminated dictionary"); + } + if (parser.text[parser.pos] === "}") { + parser.pos += 1; + return result; + } + const key = + parser.text[parser.pos] === '"' + ? parseQuotedString(parser) + : parseBareToken(parser); + if (key.length === 0) { + throw new PbxParseError( + `unexpected character '${parser.text[parser.pos]}' near ${JSON.stringify( + parser.text.slice(Math.max(0, parser.pos - 40), parser.pos + 40) + )}` + ); + } + skipTrivia(parser); + if (parser.text[parser.pos] !== "=") { + throw new PbxParseError(`expected '=' after key '${key}'`); + } + parser.pos += 1; + result[key] = parseValue(parser); + skipTrivia(parser); + if (parser.text[parser.pos] === ";") parser.pos += 1; + } +} + +function parseArray(parser: Parser): PbxArray { + parser.pos += 1; // ( + const result: PbxArray = []; + for (;;) { + skipTrivia(parser); + if (parser.pos >= parser.text.length) { + throw new PbxParseError("unterminated array"); + } + if (parser.text[parser.pos] === ")") { + parser.pos += 1; + return result; + } + result.push(parseValue(parser)); + skipTrivia(parser); + if (parser.text[parser.pos] === ",") parser.pos += 1; + } +} + +/** Parses a whole pbxproj (or a standalone plist) into plain JS values. */ +export function parsePbx(text: string): PbxDict { + const parser: Parser = { text, pos: 0 }; + const value = parseValue(parser); + if (typeof value !== "object" || Array.isArray(value)) { + throw new PbxParseError("expected a dictionary at the top level"); + } + return value; +} + +// ------------------------------------------------------------------ access -- + +export function asDict(value: PbxValue | undefined): PbxDict { + return value && typeof value === "object" && !Array.isArray(value) ? value : {}; +} + +export function asArray(value: PbxValue | undefined): PbxArray { + return Array.isArray(value) ? value : []; +} + +export function asString(value: PbxValue | undefined): string { + if (typeof value === "string") return value; + if (typeof value === "number") return String(value); + return ""; +} + +export type PbxObjects = Record; + +export interface PbxDocument { + objects: PbxObjects; + rootObjectId: string; + rootObject: PbxDict; + /** Absolute path of the directory containing the `.xcodeproj`. */ + projectDirectory: string; +} + +export function loadDocument(text: string, projectDirectory: string): PbxDocument { + const root = parsePbx(text); + const objects = asDict(root.objects) as PbxObjects; + const rootObjectId = asString(root.rootObject); + const rootObject = asDict(objects[rootObjectId]); + if (Object.keys(objects).length === 0 || Object.keys(rootObject).length === 0) { + throw new PbxParseError("project.pbxproj has no objects/rootObject"); + } + return { objects, rootObjectId, rootObject, projectDirectory }; +} + +export function objectAt(document: PbxDocument, id: string): PbxDict { + return asDict(document.objects[id]); +} + +export function isaOf(object: PbxDict): string { + return asString(object.isa); +} + +/** `name` is the display name; group entries may only carry `path`. */ +export function objectName(object: PbxDict): string { + return asString(object.name) || asString(object.path); +} + +/** + * Files a build phase compiles/copies, resolved through `PBXBuildFile` entries. + * Variant groups (localised resources) are flattened into their children. + */ +export function buildPhaseFiles( + document: PbxDocument, + phaseId: string +): { fileRefId: string; name: string }[] { + const phase = objectAt(document, phaseId); + const result: { fileRefId: string; name: string }[] = []; + for (const entry of asArray(phase.files)) { + const buildFile = objectAt(document, asString(entry)); + const fileRefId = asString(buildFile.fileRef); + if (!fileRefId) continue; + const fileRef = objectAt(document, fileRefId); + if (isaOf(fileRef) === "PBXVariantGroup") { + for (const child of asArray(fileRef.children)) { + const childId = asString(child); + result.push({ fileRefId: childId, name: objectName(objectAt(document, childId)) }); + } + continue; + } + result.push({ fileRefId, name: objectName(fileRef) }); + } + return result; +} + +/** Phases declared by a target, keyed by isa. */ +export function targetBuildPhases(document: PbxDocument, targetId: string): PbxDict[] { + return asArray(objectAt(document, targetId).buildPhases).map((id) => objectAt(document, asString(id))); +} + +export function configurationNames(document: PbxDocument, listId: string | null): string[] { + if (!listId) return []; + const list = objectAt(document, listId); + return asArray(list.buildConfigurations).map((id) => + asString(objectAt(document, asString(id)).name) + ); +} + +/** + * Build settings of one configuration, merged onto `base` so project level + * settings can be overridden by a target. + */ +export function resolveBuildSettings( + document: PbxDocument, + listId: string | null, + configurationName: string, + base: Record = {} +): Record { + const merged: Record = { ...base }; + if (!listId) return merged; + const list = objectAt(document, listId); + const ids = asArray(list.buildConfigurations).map((id) => asString(id)); + const preferred = + ids.find((id) => asString(objectAt(document, id).name) === configurationName) ?? ids[0]; + if (!preferred) return merged; + + const settings = asDict(objectAt(document, preferred).buildSettings); + for (const [key, value] of Object.entries(settings)) { + // list settings (OTHER_SWIFT_FLAGS, ...) are joined the way Xcode renders them + merged[key] = Array.isArray(value) + ? value.map((entry) => asString(entry)).join(" ") + : asString(value); + } + return merged; +} diff --git a/src/xcode-import/plan.test.ts b/src/xcode-import/plan.test.ts new file mode 100644 index 0000000..2f0288d --- /dev/null +++ b/src/xcode-import/plan.test.ts @@ -0,0 +1,207 @@ +// Tests for the Xcode project importer: the pbxproj parser and the plan that +// turns a project into a CrossCode (SwiftPM) package. +// +// Run with `bun test src/xcode-import`. + +import { describe, expect, test } from "bun:test"; +import { FIXTURE_INFO_PLIST, FIXTURE_PBX, fixtureDirectory } from "./fixture"; +import { ImportError, convertInfoPlist, indexFilePaths, planImport, swiftIdentifier } from "./plan"; +import { asDict, asString, loadDocument, parsePbx } from "./pbxproj"; + +const XCODEPROJ = "/work/MyApp.xcodeproj"; + +function importFixture(readInfoPlist = true) { + return planImport(FIXTURE_PBX, XCODEPROJ, { + packageRoot: "/work", + readFile: (path) => (readInfoPlist && path === "/work/App/Info.plist" ? FIXTURE_INFO_PLIST : null), + listDirectory: fixtureDirectory, + }); +} + +describe("parsePbx", () => { + test("parses the fixture into objects and a root object", () => { + const root = parsePbx(FIXTURE_PBX); + const objects = asDict(root.objects); + expect(asString(root.rootObject)).toBe("5E0000000000000000000001"); + expect(Object.keys(objects).length > 40).toBe(true); + expect(asString(asDict(objects["8B0000000000000000000002"]).path)).toBe("App"); + }); + + test("keeps slashes inside bare values (regression)", () => { + const root = parsePbx(`{ + objects = { + 1 /* en */ = {isa = PBXFileReference; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + }; +}`); + const objects = asDict(root.objects); + expect(asString(asDict(objects["1"]).path)).toBe("en.lproj/Localizable.strings"); + }); + + test("handles comments, arrays, nested dictionaries and data values", () => { + const root = parsePbx(`{ + /* a block comment */ + // a line comment + list = ( + "quoted value", + bare, + ); + data = <0a1b>; + nested = { + empty = { + }; + }; +}`); + expect(asString(root.data)).toBe("<0a1b>"); + expect((root.list as unknown[]).length).toBe(2); + expect(Object.keys(asDict(root.nested)).length).toBe(1); + }); + + test("supports escaped quotes", () => { + const root = parsePbx(`{ message = "say \\"hi\\" please"; }`); + expect(asString(root.message)).toBe('say "hi" please'); + }); + + test("rejects a project without objects", () => { + let failed = false; + try { + loadDocument("{ objectVersion = 56; }", "/work"); + } catch { + failed = true; + } + expect(failed).toBe(true); + }); +}); + +describe("group paths", () => { + test("resolves nested group paths and ignores group display names", () => { + const document = loadDocument(FIXTURE_PBX, "/work"); + const index = indexFilePaths(document, asString(document.rootObject.mainGroup)); + // path = "Framework/Sources" on a nested group + expect(index.get("2B0000000000000000000004")?.path).toBe("/work/Framework/Sources/Kit.swift"); + // the "Products" group only has a display name: no path component + expect(index.get("2B0000000000000000000008")?.path).toBeUndefined(); + // a variant group adds no path component of its own + expect(index.get("2B000000000000000000000A")?.path).toBe("/work/App/en.lproj/Localizable.strings"); + }); +}); + +describe("planImport", () => { + test("generates a package manifest and configuration", () => { + const plan = importFixture(); + expect(plan.packageName).toBe("MyApp"); + expect(plan.productName).toBe("MyApp"); + + const manifest = plan.files.find((file) => file.path === "Package.swift")!.contents; + expect(manifest).toContain('name: "MyApp"'); + expect(manifest).toContain('platforms: [.iOS("17.0")]'); + expect(manifest).toContain('.executable(name: "MyApp", targets: ["MyApp"])'); + expect(manifest).toContain('.package(path: "LocalKit")'); + expect(manifest).toContain('.product(name: "LocalKit", package: "LocalKit")'); + expect(manifest).toContain('.target(name: "MyKit")'); + + const toml = plan.files.find((file) => file.path === "crosscode.toml")!.contents; + expect(toml).toContain('bundle_id = "com.example.myapp"'); + expect(toml).toContain('version_string = "2.1"'); + expect(toml).toContain('version_num = "42"'); + }); + + test("maps targets, paths and exclusions", () => { + const plan = importFixture(); + const app = plan.targets.find((target) => target.name === "My App")!; + const kit = plan.targets.find((target) => target.name === "MyKit")!; + const tests = plan.targets.find((target) => target.name === "MyAppTests")!; + + expect(app.swiftPackageTargetType).toBe("executable"); + // the app compiles App/ only + expect(app.path).toBe("App"); + expect(app.sources).toContain("App/AppMain.swift"); + expect(app.excludes).toContain("Info.plist"); + expect(app.excludes).toContain("Assets.xcassets"); + + expect(kit.swiftPackageTargetType).toBe("regular"); + // the shared file pulls the framework target up to the package root + expect(kit.path).toBe("."); + expect(kit.excludes).toContain("App"); + + expect(tests.swiftPackageTargetType).toBeNull(); + expect(tests.skippedReason).toContain("Test targets"); + }); + + test("assigns files shared by two converted targets to the app", () => { + const plan = importFixture(); + const app = plan.targets.find((target) => target.name === "My App")!; + const kit = plan.targets.find((target) => target.name === "MyKit")!; + + expect(app.sources).toContain("App/Shared.swift"); + expect(kit.sources).toContain("App/Shared.swift"); + // only one target may compile it — here the whole App directory is excluded + expect(kit.excludes).toContain("App"); + expect(kit.excludes).not.toContain("App/Shared.swift"); + expect(plan.warnings.some((warning) => warning.includes("shared"))).toBe(true); + }); + + test("copies resources and keeps localisations in place", () => { + const plan = importFixture(); + expect(plan.copies.map((copy) => copy.to)).toContain("Resources/en.lproj/Localizable.strings"); + expect(plan.warnings.some((warning) => warning.includes("Assets.xcassets"))).toBe(true); + }); + + test("converts the Info.plist", () => { + const plan = importFixture(); + const info = plan.files.find((file) => file.path === "Info.plist")!.contents; + expect(plan.infoPlistSource).toBe("/work/App/Info.plist"); + expect(info).toContain("[[product]]"); + expect(info).toContain("[[bundle_id]]"); + expect(info).toContain("[[version_string]]"); + expect(info).not.toContain("$(PRODUCT_NAME)"); + expect(info).toContain("UILaunchScreen"); + }); + + test("falls back to a generated Info.plist", () => { + const plan = importFixture(false); + const info = plan.files.find((file) => file.path === "Info.plist")!.contents; + expect(info).toContain("CFBundleIdentifier"); + expect(plan.infoPlistSource).toBeNull(); + expect(plan.warnings.some((warning) => warning.includes("default Info.plist"))).toBe(true); + }); + + test("keeps a macOS project's platform and warns", () => { + // the setting lives in both the Debug and the Release configuration + const macOS = FIXTURE_PBX.split("IPHONEOS_DEPLOYMENT_TARGET = 17.0;").join( + "SDKROOT = macosx;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 14.4;" + ); + const plan = planImport(macOS, XCODEPROJ, { packageRoot: "/work", listDirectory: fixtureDirectory }); + const manifest = plan.files.find((file) => file.path === "Package.swift")!.contents; + expect(manifest).toContain('platforms: [.macOS("14.4")]'); + expect(plan.warnings.some((warning) => warning.includes("targets macOS"))).toBe(true); + }); + + test("rejects projects without an application target", () => { + const onlyTests = FIXTURE_PBX.replace( + 'productType = "com.apple.product-type.application";', + 'productType = "com.apple.product-type.framework";' + ); + let message = ""; + try { + planImport(onlyTests, XCODEPROJ, { packageRoot: "/work", listDirectory: fixtureDirectory }); + } catch (error) { + message = error instanceof ImportError ? error.message : String(error); + } + expect(message).toContain("buildable app target"); + }); +}); + +describe("helpers", () => { + test("sanitises Swift identifiers", () => { + expect(swiftIdentifier("Food Truck")).toBe("FoodTruck"); + expect(swiftIdentifier("2 Fast")).toBe("_2Fast"); + expect(swiftIdentifier("!!!")).toBe("Package"); + }); + + test("expands build setting variables in an Info.plist", () => { + const converted = convertInfoPlist("CFBundleDisplayName\n$(PRODUCT_NAME)", { + PRODUCT_NAME: "My App", + }); + expect(converted).toContain("My App"); + }); +}); diff --git a/src/xcode-import/plan.ts b/src/xcode-import/plan.ts new file mode 100644 index 0000000..7e7d4c9 --- /dev/null +++ b/src/xcode-import/plan.ts @@ -0,0 +1,1200 @@ +// Turns an Xcode project into a CrossCode (SwiftPM) package. +// +// The import is "in place": sources stay where they are and the generated +// `Package.swift` points at them with `path:`/`exclude:`, so the project can +// keep being edited in Xcode. Only the CrossCode specific files are added +// (`Package.swift`, `crosscode.toml`, an Info.plist when missing), plus copies +// of plain resources, because CrossCode packages `/Resources` into the +// .app. +// +// The planner is pure: every filesystem read goes through the optional +// `readFile` / `listDirectory` callbacks, which keeps it unit testable. + +import { + asArray, + asDict, + asString, + buildPhaseFiles, + isaOf, + loadDocument, + objectAt, + objectName, + resolveBuildSettings, + type PbxDict, + type PbxDocument, +} from "./pbxproj"; + +export type ImportTargetKind = "app" | "framework" | "extension" | "test" | "other"; + +export interface ImportTarget { + id: string; + /** Xcode target name. */ + name: string; + /** Sanitised name used as the SwiftPM target. */ + swiftName: string; + productType: string; + kind: ImportTargetKind; + swiftPackageTargetType: "executable" | "regular" | null; + productName: string; + /** Package relative directory holding the sources, if they could be located. */ + sourceDirectory: string | null; + /** SwiftPM `path:` (equals sourceDirectory for converted targets). */ + path: string | null; + excludes: string[]; + /** Package relative source files that were discovered. */ + sources: string[]; + /** Package relative resources copied into `Resources/`. */ + resources: string[]; + /** Names of the other targets of this project it depends on. */ + dependencies: string[]; + /** `XCSwiftPackageProductDependency` entries: product name plus package identity. */ + packageProducts: { productName: string; package: string | null }[]; + bundleId: string; + deploymentTarget: string; + settings: Record; + skippedReason: string | null; +} + +export interface ImportPackageDependency { + /** Package identity (the directory name for local packages). */ + identity: string; + kind: "local" | "remote"; + /** Relative path (local) or repository URL (remote). */ + location: string; + /** Recognised version requirement for remote packages. */ + requirement: string | null; +} + +export interface ImportPlan { + /** Directory that receives Package.swift (the xcodeproj's parent). */ + packageRoot: string; + packageName: string; + productName: string; + targets: ImportTarget[]; + warnings: string[]; + /** Files to create, keyed by package relative path. */ + files: { path: string; contents: string }[]; + /** Resource copies: absolute source -> package relative destination. */ + copies: { from: string; to: string }[]; + packages: ImportPackageDependency[]; + /** Build settings of the configuration the plan was derived from. */ + settings: Record; + configuration: string; + infoPlistSource: string | null; +} + +export interface PlanOptions { + /** Configuration read from the project (defaults to Release). */ + configuration?: string; + /** Directory the generated files go into (defaults to the xcodeproj's parent). */ + packageRoot?: string; + /** Name of the generated package (defaults to the xcodeproj name). */ + packageName?: string; + readFile?: (absolutePath: string) => string | null; + /** Returns the absolute paths of a directory's entries. */ + listDirectory?: (absolutePath: string) => string[]; +} + +export class ImportError extends Error {} + +// ----------------------------------------------------------------- helpers -- + +/** Assets/storyboards need Xcode's compilers, which do not exist on Linux. */ +const UNSUPPORTED_EXTENSIONS = new Set([ + "xcassets", + "storyboard", + "xib", + "xcdatamodeld", + "xcmappingmodel", + "intentdefinition", + "metal", +]); + +const RESOURCE_EXTENSIONS = new Set([ + "strings", + "stringsdict", + "plist", + "json", + "png", + "jpg", + "jpeg", + "gif", + "pdf", + "heic", + "webp", + "mp3", + "m4a", + "caf", + "wav", + "mov", + "mp4", + "txt", + "html", + "css", + "js", + "ttf", + "otf", + "csv", + "xml", + "geojson", + "usdz", + "scn", +]); + +const SOURCE_EXTENSIONS = new Set(["swift", "m", "mm", "c", "cc", "cpp", "h", "hpp", "s", "metal"]); + +function normalize(path: string): string { + return path.replace(/\\/g, "/").replace(/\/+$/, ""); +} + +function segments(path: string): string[] { + return normalize(path).split("/").filter((part) => part.length > 0); +} + +function isAbsolutePath(path: string): boolean { + return path.startsWith("/") || /^[A-Za-z]:\//.test(normalize(path)); +} + +/** Joins a path without dropping a leading "/" or "C:/". */ +function joinPath(base: string, child: string): string { + const normalizedBase = normalize(base); + if (child.length === 0) return normalizedBase; + if (isAbsolutePath(child)) return normalize(child); + if (normalizedBase.length === 0) return child; + return `${normalizedBase}/${child}`; +} + +function dirOf(path: string): string { + const normalized = normalize(path); + const index = normalized.lastIndexOf("/"); + if (index < 0) return "/"; + const directory = normalized.slice(0, index); + if (directory.length === 0) return "/"; + if (/^[A-Za-z]:$/.test(directory)) return `${directory}/`; + return directory; +} + +function baseName(path: string): string { + return path.split("/").pop() ?? path; +} + +function extensionOf(path: string): string { + const name = baseName(path); + const dot = name.lastIndexOf("."); + return dot === -1 ? "" : name.slice(dot + 1).toLowerCase(); +} + +/** Drops excludes that are already covered by an excluded parent directory. */ +export function pruneExcludes(excludes: string[]): string[] { + const sorted = [...new Set(excludes)].sort( + (a, b) => segments(a).length - segments(b).length || a.localeCompare(b) + ); + const kept: string[] = []; + for (const candidate of sorted) { + if (kept.some((parent) => candidate.startsWith(`${parent}/`))) continue; + kept.push(candidate); + } + return kept.sort(); +} + +function isUnder(directory: string, path: string): boolean { + if (directory === "" || directory === ".") return true; + return path === directory || path.startsWith(`${directory}/`); +} + +function relativeTo(root: string, path: string): string | null { + const rootParts = segments(root); + const pathParts = segments(path); + if (pathParts.length < rootParts.length) return null; + for (let index = 0; index < rootParts.length; index += 1) { + if (rootParts[index].toLowerCase() !== pathParts[index].toLowerCase()) return null; + } + return pathParts.slice(rootParts.length).join("/"); +} + +/** "Food Truck" -> "FoodTruck"; used for package, product and target names. */ +export function swiftIdentifier(raw: string): string { + const words = raw.split(/[^A-Za-z0-9_]+/).filter((word) => word.length > 0); + if (words.length === 0) return "Package"; + const joined = words.join(""); + return /^[0-9]/.test(joined) ? `_${joined}` : joined; +} + +function commonDirectory(paths: string[]): string { + if (paths.length === 0) return ""; + let prefix = segments(dirOf(paths[0])); + for (const path of paths.slice(1)) { + const parts = segments(dirOf(path)); + let length = 0; + while ( + length < prefix.length && + length < parts.length && + prefix[length].toLowerCase() === parts[length].toLowerCase() + ) { + length += 1; + } + prefix = prefix.slice(0, length); + } + return prefix.join("/"); +} + +function expandVariables( + value: string, + settings: Record, + projectDirectory: string +): string { + return value + .replace(/\$\((SRCROOT|PROJECT_DIR)\)/g, projectDirectory) + .replace(/\$\{(SRCROOT|PROJECT_DIR)\}/g, projectDirectory) + .replace(/\$\(([A-Za-z0-9_]+)(:[a-zA-Z0-9]+)?\)/g, (match, name: string) => + settings[name] && settings[name].length > 0 ? settings[name] : match + ) + .replace(/\$\{([A-Za-z0-9_]+)(:[a-zA-Z0-9]+)?\}/g, (match, name: string) => + settings[name] && settings[name].length > 0 ? settings[name] : match + ); +} + +/** Resolves a path-valued build setting (INFOPLIST_FILE, ...) to an absolute path. */ +function settingPath( + settings: Record, + key: string, + projectDirectory: string +): string | null { + const raw = settings[key]; + if (!raw || raw.length === 0) return null; + const expanded = normalize(expandVariables(raw, settings, projectDirectory)); + return isAbsolutePath(expanded) ? expanded : joinPath(projectDirectory, expanded); +} + +// ---------------------------------------------------------- package deps -- + +interface PackageCollection { + list: ImportPackageDependency[]; + /** Maps an `XCRemoteSwiftPackageReference`/`XCLocalSwiftPackageReference` id to an identity. */ + byReference: Map; + /** + * Xcode can add a local package without any package reference object: the + * folder shows up as a `PBXFileReference` (a "wrapper") and the target links + * its product. Resolves that product name to a package identity. + */ + registerFolderPackage: ( + productName: string, + index: Map + ) => string | null; +} + +function describeRequirement(requirement: PbxDict): string | null { + const kind = asString(requirement.kind); + const version = asString(requirement.minimumVersion) || asString(requirement.version); + switch (kind) { + case "upToNextMajorVersion": + return version.length > 0 ? `from: ${JSON.stringify(version)}` : null; + case "upToNextMinorVersion": + return version.length > 0 ? `from: ${JSON.stringify(version)}` : null; + case "exactVersion": + return version.length > 0 ? `exact: ${JSON.stringify(version)}` : null; + case "branch": { + const branch = asString(requirement.branch); + return branch.length > 0 ? `branch: ${JSON.stringify(branch)}` : null; + } + case "revision": { + const revision = asString(requirement.revision); + return revision.length > 0 ? `revision: ${JSON.stringify(revision)}` : null; + } + default: + return null; + } +} + +/** + * Swift package dependencies of the project: local folders are referenced by + * path, remote ones by URL (SwiftPM resolves those when building). + */ +function collectPackages( + document: PbxDocument, + projectDirectory: string, + packageRoot: string, + warnings: string[], + listDirectory: PlanOptions["listDirectory"] +): PackageCollection { + const list: ImportPackageDependency[] = []; + const byReference = new Map(); + const seen = new Set(); + const folderPackages = new Map(); + const warnedProducts = new Set(); + + for (const referenceId of asArray(document.rootObject.packageReferences).map((id) => asString(id))) { + const reference = objectAt(document, referenceId); + const isa = isaOf(reference); + + if (isa === "XCLocalSwiftPackageReference") { + const relativePath = asString(reference.relativePath); + if (relativePath.length === 0) continue; + const identity = swiftIdentifier(baseName(relativePath)); + byReference.set(referenceId, identity); + const absolute = isAbsolutePath(relativePath) + ? normalize(relativePath) + : joinPath(projectDirectory, relativePath); + const relative = relativeTo(packageRoot, absolute); + if (relative === null) { + warnings.push( + `Local package "${relativePath}" is outside the project folder and was not added to Package.swift.` + ); + continue; + } + if (seen.has(identity)) continue; + seen.add(identity); + list.push({ identity, kind: "local", location: relative, requirement: null }); + continue; + } + + if (isa === "XCRemoteSwiftPackageReference") { + const url = asString(reference.repositoryURL); + if (url.length === 0) continue; + const identity = swiftIdentifier(baseName(url).replace(/\.git$/, "")); + byReference.set(referenceId, identity); + if (seen.has(identity)) continue; + seen.add(identity); + list.push({ + identity, + kind: "remote", + location: url, + requirement: describeRequirement(asDict(reference.requirement)), + }); + warnings.push( + `Remote package "${identity}" is declared in Package.swift; SwiftPM downloads it when the project is built.` + ); + } + } + + const registerFolderPackage = ( + productName: string, + index: Map + ): string | null => { + if (productName.length === 0) return null; + const identity = swiftIdentifier(productName); + if (seen.has(identity) || folderPackages.has(productName)) { + return folderPackages.get(productName) ?? identity; + } + + // find the folder reference with this name + let folderPath: string | null = null; + for (const [id, object] of Object.entries(document.objects)) { + if (isaOf(object) !== "PBXFileReference") continue; + const path = asString(object.path) || asString(object.name); + if (baseName(path) !== productName) continue; + if (asString(object.lastKnownFileType) !== "wrapper") continue; + folderPath = index.get(id)?.path ?? null; + if (folderPath) break; + } + if (!folderPath) { + if (!warnedProducts.has(productName)) { + warnedProducts.add(productName); + warnings.push( + `Package product "${productName}" has no matching folder in the project; add it to Package.swift manually.` + ); + } + return null; + } + + const relative = relativeTo(packageRoot, folderPath); + if (relative === null || relative.length === 0) { + warnings.push( + `Local package "${productName}" is outside the project folder; add it to Package.swift manually.` + ); + return null; + } + + let isPackage = true; + if (listDirectory) { + try { + const entries = listDirectory(folderPath).map((entry) => baseName(normalize(entry))); + isPackage = entries.includes("Package.swift"); + } catch { + isPackage = true; + } + } + if (!isPackage) { + if (!warnedProducts.has(productName)) { + warnedProducts.add(productName); + warnings.push( + `"${productName}" was referenced as a package but contains no Package.swift; add the dependency manually.` + ); + } + return null; + } + + list.push({ identity, kind: "local", location: relative, requirement: null }); + seen.add(identity); + folderPackages.set(productName, identity); + return identity; + }; + + return { list, byReference, registerFolderPackage }; +} + +// ---------------------------------------------------------- file path index -- + +interface FileIndexEntry { + /** Absolute path for groups and file references. */ + path: string; + isFile: boolean; + sourceTree: string; +} + +/** + * Maps group ids and file reference ids to absolute paths, following the + * `sourceTree` rules Xcode uses. Products and SDK roots are skipped: they never + * contain user sources. + */ +export function indexFilePaths( + document: PbxDocument, + mainGroupId: string | null +): Map { + const index = new Map(); + const skippedTrees = new Set(["BUILT_PRODUCTS_DIR", "SDKROOT", "DEVELOPER_DIR"]); + + const resolveGroupBase = (sourceTree: string, ownPath: string, parent: string): string | null => { + if (skippedTrees.has(sourceTree)) return null; + if (sourceTree === "SOURCE_ROOT" || sourceTree === "") { + return isAbsolutePath(ownPath) ? normalize(ownPath) : joinPath(document.projectDirectory, ownPath); + } + if (ownPath.length === 0) return parent; + return isAbsolutePath(ownPath) ? normalize(ownPath) : joinPath(parent, ownPath); + }; + + const visit = (id: string, parent: string) => { + const object = objectAt(document, id); + const isa = isaOf(object); + const sourceTree = asString(object.sourceTree); + // a group's `name` is only a label; a file reference's `name` is its file name + const ownPath = + isa === "PBXFileReference" + ? asString(object.path) || asString(object.name) + : asString(object.path); + + if (isa === "PBXFileReference") { + if (skippedTrees.has(sourceTree)) return; + const path = isAbsolutePath(ownPath) ? normalize(ownPath) : joinPath(parent, ownPath); + index.set(id, { path, isFile: true, sourceTree }); + return; + } + + const base = resolveGroupBase(sourceTree, ownPath, parent); + if (base === null) return; + index.set(id, { path: base, isFile: false, sourceTree }); + + for (const childId of [...asArray(object.children), ...asArray(object.files)]) { + visit(asString(childId), base); + } + }; + + if (mainGroupId) { + const group = objectAt(document, mainGroupId); + const base = resolveGroupBase( + asString(group.sourceTree), + asString(group.path), + document.projectDirectory + ); + if (base !== null) { + index.set(mainGroupId, { path: base, isFile: false, sourceTree: asString(group.sourceTree) }); + for (const childId of [...asArray(group.children), ...asArray(group.files)]) { + visit(asString(childId), base); + } + } + } + + return index; +} + +// -------------------------------------------------------------- generators -- + +const DEFAULT_INFO_PLIST = ` + + + + CFBundleName + [[product]] + CFBundleExecutable + [[product]] + CFBundleIdentifier + [[bundle_id]] + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleShortVersionString + [[version_string]] + CFBundleVersion + [[version_num]] + CFBundleSupportedPlatforms + + iPhoneOS + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + +`; + +/** + * Rewrites an Xcode Info.plist so CrossCode controls the bundle id and the + * versions: those four fields become `[[...]]` placeholders, and every other + * `$(SETTING)` is expanded with the project's build settings. + */ +export function convertInfoPlist(text: string, settings: Record, projectDirectory = ""): string { + const placeholders: Record = { + CFBundleIdentifier: "[[bundle_id]]", + CFBundleName: "[[product]]", + CFBundleExecutable: "[[product]]", + CFBundleVersion: "[[version_num]]", + CFBundleShortVersionString: "[[version_string]]", + }; + + let result = text; + for (const [key, placeholder] of Object.entries(placeholders)) { + const pattern = new RegExp(`(${key}\\s*)([\\s\\S]*?)()`, "g"); + result = result.replace(pattern, (_match, before: string, _value: string, after: string) => { + return `${before}${placeholder}${after}`; + }); + } + + return expandVariables(result, settings, projectDirectory); +} + +/** Values Xcode substitutes in an Info.plist that are not settings themselves. */ +function withPlistDefaults(settings: Record): Record { + return { + EXECUTABLE_NAME: settings.PRODUCT_NAME ?? "", + PRODUCT_MODULE_NAME: swiftIdentifier(settings.PRODUCT_NAME ?? ""), + ...settings, + }; +} + +export function generatePackageSwift( + packageName: string, + targets: ImportTarget[], + platform: { name: string; version: string } | null, + packages: ImportPackageDependency[] = [] +): string { + const converted = targets.filter((target) => target.swiftPackageTargetType !== null); + const appTarget = converted.find((target) => target.kind === "app") ?? null; + + const lines: string[] = []; + lines.push("// swift-tools-version: 6.4"); + lines.push("// Generated by CrossCode from an Xcode project."); + lines.push(""); + lines.push("import PackageDescription"); + lines.push(""); + lines.push("let package = Package("); + lines.push(` name: ${JSON.stringify(packageName)},`); + if (platform) { + // the string overload accepts any x.y[.z] deployment target + lines.push(` platforms: [.${platform.name}(${JSON.stringify(platform.version)})],`); + } + if (appTarget) { + lines.push(" products: ["); + lines.push( + ` .executable(name: ${JSON.stringify(packageName)}, targets: [${JSON.stringify( + appTarget.swiftName + )}]),` + ); + lines.push(" ],"); + } + if (packages.length > 0) { + lines.push(" dependencies: ["); + for (const dependency of packages) { + if (dependency.kind === "local") { + lines.push(` .package(path: ${JSON.stringify(dependency.location)}),`); + } else { + const requirement = dependency.requirement ?? "from: \"0.0.0\""; + lines.push( + ` .package(url: ${JSON.stringify(dependency.location)}, ${requirement}),` + ); + } + } + lines.push(" ],"); + } + lines.push(" targets: ["); + + for (const target of converted) { + const dependencies = target.dependencies + .map((name) => converted.find((candidate) => candidate.name === name)) + .filter((dependency): dependency is ImportTarget => Boolean(dependency)) + .filter((dependency) => dependency.id !== target.id) + .map((dependency) => dependency.swiftName); + + lines.push( + target.swiftPackageTargetType === "executable" ? " .executableTarget(" : " .target(" + ); + lines.push(` name: ${JSON.stringify(target.swiftName)},`); + const productDependencies = target.packageProducts.filter((product) => product.package); + if (dependencies.length > 0 || productDependencies.length > 0) { + lines.push(" dependencies: ["); + for (const dependency of dependencies) { + lines.push(` .target(name: ${JSON.stringify(dependency)}),`); + } + for (const product of productDependencies) { + lines.push( + ` .product(name: ${JSON.stringify(product.productName)}, package: ${JSON.stringify( + product.package + )}),` + ); + } + lines.push(" ],"); + } + lines.push(` path: ${JSON.stringify(target.path ?? ".")},`); + if (target.excludes.length > 0) { + lines.push(" exclude: ["); + for (const exclude of target.excludes) { + lines.push(` ${JSON.stringify(exclude)},`); + } + lines.push(" ],"); + } + lines.push(" ),"); + } + + lines.push(" ]"); + lines.push(")"); + lines.push(""); + return lines.join("\n"); +} + +export function generateCrosscodeToml( + bundleId: string, + versionNum: string, + versionString: string +): string { + return `format_version = 1 + +[project] +version_num = ${JSON.stringify(versionNum)} +version_string = ${JSON.stringify(versionString)} +bundle_id = ${JSON.stringify(bundleId)} +`; +} + +// ------------------------------------------------------------------- plan -- + +interface RawTarget { + id: string; + name: string; + packageProducts: { productName: string; package: string | null }[]; + kind: ImportTargetKind; + productType: string; + settings: Record; + sources: string[]; + resources: string[]; + synchronizedDirectories: string[]; + dependencies: string[]; +} + +function collectTargetFiles( + document: PbxDocument, + index: Map, + target: PbxDict, + listDirectory: PlanOptions["listDirectory"], + warnings: string[] +): { sources: string[]; resources: string[]; synchronous: string[] } { + const sources: string[] = []; + const resources: string[] = []; + const synchronous: string[] = []; + + for (const phaseId of asArray(target.buildPhases).map((id) => asString(id))) { + const phase = objectAt(document, phaseId); + const isa = isaOf(phase); + if (isa !== "PBXSourcesBuildPhase" && isa !== "PBXResourcesBuildPhase") continue; + for (const file of buildPhaseFiles(document, phaseId)) { + const entry = index.get(file.fileRefId); + if (!entry) continue; + if (isa === "PBXSourcesBuildPhase") { + if (isSourceFile(entry.path)) sources.push(entry.path); + else warnings.push(`"${baseName(entry.path)}" is not a compilable source and was skipped.`); + } else { + resources.push(entry.path); + } + } + } + + // Xcode 16+ "synchronized" groups describe a directory instead of listing its + // files, so the directory has to be walked. + for (const groupId of asArray(target.fileSystemSynchronizedGroups).map((id) => asString(id))) { + const entry = index.get(groupId); + if (!entry) continue; + synchronous.push(entry.path); + if (!listDirectory) continue; + walk(entry.path, listDirectory, sources, resources, 0, warnings); + } + + return { + sources: [...new Set(sources)], + resources: [...new Set(resources)], + synchronous, + }; +} + +function isSourceFile(path: string): boolean { + return SOURCE_EXTENSIONS.has(extensionOf(path)); +} + +function walk( + directory: string, + listDirectory: (absolutePath: string) => string[], + sources: string[], + resources: string[], + depth: number, + warnings: string[] +): void { + if (depth > 12) return; + let entries: string[] = []; + try { + entries = listDirectory(directory); + } catch { + warnings.push(`Could not read ${directory}.`); + return; + } + for (const rawEntry of entries) { + const entry = normalize(rawEntry); + const name = baseName(entry); + if (name === ".DS_Store" || name.endsWith(".xcodeproj") || name === "DerivedData") continue; + const extension = extensionOf(entry); + if (extension.length === 0) { + // directory (or no extension): descend, but not into asset catalogs + walk(entry, listDirectory, sources, resources, depth + 1, warnings); + continue; + } + if (SOURCE_EXTENSIONS.has(extension)) sources.push(entry); + else if (RESOURCE_EXTENSIONS.has(extension)) resources.push(entry); + } +} + +/** + * Reads an Xcode project and produces everything needed to write a CrossCode + * package: the SwiftPM manifest, `crosscode.toml`, an Info.plist, and the list + * of resources to copy. + */ +export function planImport( + pbxText: string, + xcodeprojPath: string, + options: PlanOptions = {} +): ImportPlan { + const configuration = options.configuration ?? "Release"; + const normalizedProject = normalize(xcodeprojPath); + const projectDirectory = dirOf(normalizedProject); + const document = loadDocument(pbxText, projectDirectory); + const warnings: string[] = []; + + const projectName = + options.packageName ?? + (baseName(normalizedProject).replace(/\.xcodeproj$/i, "") || "ImportedProject"); + const packageName = swiftIdentifier(projectName); + const packageRoot = normalize(options.packageRoot ?? projectDirectory); + + const projectListId = asString(document.rootObject.buildConfigurationList); + const projectSettings = resolveBuildSettings(document, projectListId, configuration); + const fileIndex = indexFilePaths(document, asString(document.rootObject.mainGroup)); + + const usedNames = new Set(); + const rawTargets: RawTarget[] = []; + const packages = collectPackages( + document, + projectDirectory, + packageRoot, + warnings, + options.listDirectory + ); + + for (const targetId of asArray(document.rootObject.targets).map((id) => asString(id))) { + const object = objectAt(document, targetId); + if (isaOf(object) !== "PBXNativeTarget") { + warnings.push(`Skipped "${objectName(object)}": not a native target.`); + continue; + } + const name = asString(object.name) || objectName(object); + const productType = asString(object.productType); + const settings = resolveBuildSettings( + document, + asString(object.buildConfigurationList), + configuration, + projectSettings + ); + settings.TARGET_NAME = name; + + const collected = collectTargetFiles(document, fileIndex, object, options.listDirectory, warnings); + + const packageProducts = asArray(object.packageProductDependencies) + .map((productId) => objectAt(document, asString(productId))) + .map((product) => { + const referenceId = asString(product.package); + if (referenceId.length > 0) { + return { + productName: asString(product.productName), + package: packages.byReference.get(referenceId) ?? null, + }; + } + // Xcode also records local packages as a folder reference plus a bare + // product dependency, without any package reference object. + const productName = asString(product.productName); + return { + productName, + package: packages.registerFolderPackage(productName, fileIndex), + }; + }) + .filter((product) => product.productName.length > 0); + + rawTargets.push({ + id: targetId, + name, + packageProducts, + kind: mapProductType(productType), + productType, + settings, + sources: collected.sources, + resources: collected.resources, + synchronizedDirectories: collected.synchronous, + dependencies: asArray(object.dependencies) + .map((dependencyId) => asString(objectAt(document, asString(dependencyId)).target)) + .filter((value) => value.length > 0), + }); + } + + // SwiftPM cannot have two targets compiling the same files, and Xcode + // projects often ship several app targets (a "Lite" variant, a "All" + // variant, ...). Import the one matching the project name. + const appCandidates = rawTargets.filter((raw) => raw.kind === "app"); + const chosenApp = + appCandidates.find((raw) => swiftIdentifier(raw.name) === packageName) ?? appCandidates[0] ?? null; + + const targets: ImportTarget[] = []; + const directoriesByTarget = new Map(); + + for (const raw of rawTargets) { + const relativeSources = raw.sources + .map((absolute) => relativeTo(packageRoot, absolute)) + .filter((path): path is string => path !== null); + const missing = raw.sources.filter((absolute) => relativeTo(packageRoot, absolute) === null); + + let swiftName = swiftIdentifier(raw.name); + while (usedNames.has(swiftName)) swiftName = `${swiftName}_`; + usedNames.add(swiftName); + + const sourceDirectory = + relativeSources.length > 0 ? commonDirectory(relativeSources) || "." : null; + directoriesByTarget.set(raw.id, sourceDirectory); + + const hasSynchronizedGroups = raw.synchronizedDirectories.length > 0; + let skippedReason: string | null = null; + if (raw.kind === "app" && chosenApp && raw.id !== chosenApp.id) { + skippedReason = `Only one app target is imported ("${chosenApp.name}").`; + } else if (raw.kind === "test") { + skippedReason = "Test targets are not converted."; + } else if (raw.kind === "extension") { + skippedReason = "App extensions cannot be embedded by CrossCode yet."; + } else if (raw.kind === "other") { + skippedReason = `Unsupported product type (${raw.productType}).`; + } else if (relativeSources.length === 0) { + skippedReason = hasSynchronizedGroups + ? "Its sources could not be listed (synchronized Xcode groups)." + : "No sources were found for this target."; + } else if (missing.length > 0) { + skippedReason = "Some sources live outside the project directory."; + } + + const bundleIdCandidate = raw.settings.PRODUCT_BUNDLE_IDENTIFIER ?? ""; + targets.push({ + id: raw.id, + name: raw.name, + swiftName, + productType: raw.productType, + kind: raw.kind, + swiftPackageTargetType: + skippedReason !== null ? null : raw.kind === "app" ? "executable" : "regular", + productName: raw.settings.PRODUCT_NAME || raw.name, + sourceDirectory, + path: skippedReason !== null ? null : sourceDirectory, + excludes: [], + sources: relativeSources, + resources: raw.resources + .map((absolute) => relativeTo(packageRoot, absolute)) + .filter((path): path is string => path !== null), + dependencies: raw.dependencies.map((id) => asString(objectAt(document, id).name)), + packageProducts: raw.packageProducts, + bundleId: + bundleIdCandidate.length > 0 && !bundleIdCandidate.includes("$(") + ? bundleIdCandidate + : `com.example.${packageName.toLowerCase()}`, + deploymentTarget: raw.settings.IPHONEOS_DEPLOYMENT_TARGET ?? "", + settings: raw.settings, + skippedReason, + }); + } + + const app = targets.find((target) => target.kind === "app" && target.skippedReason === null); + if (!app) { + const reason = + targets.find((target) => target.kind === "app")?.skippedReason ?? + "the project has no application target"; + throw new ImportError(`CrossCode can only import projects with a buildable app target (${reason}).`); + } + + // Every file that must not be compiled as part of a target gets excluded. + // Files shared between targets stay in all of them (SwiftPM cannot share + // sources between targets, but a file may be compiled into several modules). + const xcodeprojName = baseName(normalizedProject); + const packagePaths = packages.list + .filter((dependency) => dependency.kind === "local") + .map((dependency) => dependency.location); + + // A file compiled by several *converted* targets is a SwiftPM error, so such + // files go to the app target only (that is the one CrossCode builds). + const sharedWithApp = new Map(); + for (const target of targets) { + if (target.id === app.id || target.swiftPackageTargetType === null) continue; + const shared = target.sources.filter((source) => app.sources.includes(source)); + if (shared.length > 0) sharedWithApp.set(target.id, shared); + } + for (const [targetId, shared] of sharedWithApp) { + const target = targets.find((candidate) => candidate.id === targetId); + if (!target) continue; + target.excludes = pruneExcludes([...target.excludes, ...shared]); + warnings.push( + `${shared.length} file(s) are shared with the app target and were assigned to it (${target.name} will not compile them).` + ); + } + + for (const target of targets) { + if (!target.path || target.swiftPackageTargetType === null) continue; + const base = target.path; + const excludes = new Set(); + const add = (path: string) => { + if (path.length === 0 || path === base) return; + const relative = base === "." ? path : isUnder(base, path) ? path.slice(base.length + 1) : null; + if (relative && relative.length > 0 && !relative.startsWith("..")) excludes.add(relative); + }; + + for (const junk of [ + "Info.plist", + "crosscode.toml", + "Package.swift", + "Resources", + ".crosscode", + ".build", + "DerivedData", + xcodeprojName, + ...packagePaths, + ]) { + add(junk); + } + + for (const other of targets) { + if (other.id === target.id || other.sources.length === 0) continue; + const shared = other.sources.filter((source) => target.sources.includes(source)); + const foreign = other.sources.filter( + (source) => !target.sources.includes(source) && isUnder(base, source) + ); + if (foreign.length === 0) continue; + if (shared.length === 0 && other.sourceDirectory && other.sourceDirectory !== base) { + add(other.sourceDirectory); + } else { + for (const source of foreign) add(source); + } + } + + // resources are copied into the package's Resources folder: keep the target + // from reporting them as unhandled files + for (const resource of target.resources) add(resource); + + target.excludes = pruneExcludes([...excludes]); + } + + // plain resources are copied so CrossCode can put them into the .app + const copies: { from: string; to: string }[] = []; + const warnedUnsupported = new Set(); + const copiedSources = new Set(); + const usedResourceNames = new Set(); + for (const target of targets) { + // only converted targets are built, so only their resources are needed + if (target.swiftPackageTargetType === null) continue; + const absoluteResources = rawTargets.find((raw) => raw.id === target.id)?.resources ?? []; + for (const resource of absoluteResources) { + if (copiedSources.has(resource)) continue; + const extension = extensionOf(resource); + if (UNSUPPORTED_EXTENSIONS.has(extension)) { + if (!warnedUnsupported.has(extension)) { + warnedUnsupported.add(extension); + warnings.push( + `"${baseName(resource)}" needs Xcode's compilers (${extension}) and will not be available on the device.` + ); + } + continue; + } + if (!RESOURCE_EXTENSIONS.has(extension)) continue; + copiedSources.add(resource); + + // localised resources keep their .lproj placement in the app bundle + const parts = resource.split("/"); + const localeIndex = parts.findIndex((part) => part.endsWith(".lproj")); + const fileName = parts[parts.length - 1]; + let destination = + localeIndex >= 0 ? `Resources/${parts[localeIndex]}/${fileName}` : `Resources/${fileName}`; + let counter = 2; + while (usedResourceNames.has(destination)) { + destination = + localeIndex >= 0 + ? `Resources/${parts[localeIndex]}/${fileName.replace(/(\.[^.]+)$/, `-${counter}$1`)}` + : `Resources/${fileName.replace(/(\.[^.]+)$/, `-${counter}$1`)}`; + counter += 1; + } + usedResourceNames.add(destination); + copies.push({ from: resource, to: destination }); + } + } + + // Info.plist + const infoPlistSetting = settingPath(app.settings, "INFOPLIST_FILE", projectDirectory); + let infoPlistText: string | null = null; + let infoPlistSource: string | null = null; + if (infoPlistSetting && infoPlistSetting.toLowerCase().endsWith(".plist")) { + const contents = options.readFile ? options.readFile(infoPlistSetting) : null; + if (contents !== null && contents !== undefined) { + infoPlistText = convertInfoPlist( + contents, + withPlistDefaults({ ...projectSettings, ...app.settings }), + projectDirectory + ); + infoPlistSource = infoPlistSetting; + } else { + warnings.push(`Could not read ${infoPlistSetting}; a default Info.plist was generated instead.`); + } + } else if (app.settings.GENERATE_INFOPLIST_FILE === "YES") { + warnings.push("The project generates its Info.plist at build time; a default one was generated."); + } + if (infoPlistText === null) { + infoPlistText = convertInfoPlist( + DEFAULT_INFO_PLIST, + withPlistDefaults({ ...projectSettings, ...app.settings }), + projectDirectory + ); + } + + // the Info.plist usually lives inside the app target's directory + if (infoPlistSource && app.path) { + const packageRelative = relativeTo(packageRoot, infoPlistSource); + if (packageRelative) { + const relative = + app.path === "." + ? packageRelative + : isUnder(app.path, packageRelative) + ? packageRelative.slice(app.path.length + 1) + : null; + if (relative && relative.length > 0) { + app.excludes = pruneExcludes([...app.excludes, relative]); + } + } + } + + // CrossCode builds iOS apps: detect what the project targets and say so. + const sdkRoot = (app.settings.SDKROOT || "").toLowerCase(); + const supported = (app.settings.SUPPORTED_PLATFORMS || "").toLowerCase(); + const isMacOS = sdkRoot.includes("macosx") || supported.includes("macosx"); + const isIOS = + sdkRoot.includes("iphoneos") || + sdkRoot.includes("iphonesimulator") || + supported.includes("iphoneos") || + (!isMacOS && (app.settings.IPHONEOS_DEPLOYMENT_TARGET ?? "").length > 0); + + const deploymentTarget = isMacOS + ? app.settings.MACOSX_DEPLOYMENT_TARGET || "14.0" + : app.deploymentTarget || projectSettings.IPHONEOS_DEPLOYMENT_TARGET || "17.0"; + const platformVersion = /^[0-9]+(\.[0-9]+){1,2}$/.test(deploymentTarget) + ? deploymentTarget + : isMacOS + ? "14.0" + : "17.0"; + const platform = { + name: isMacOS ? "macOS" : "iOS", + version: platformVersion, + }; + if (isMacOS) { + warnings.push( + "This project targets macOS; CrossCode builds and installs iOS apps, so the imported package is a starting point rather than a buildable app." + ); + } else if (!isIOS) { + warnings.push( + "The project does not declare an iOS deployment target; iOS 17.0 was assumed." + ); + } + + const extensions = targets.filter((target) => target.kind === "extension"); + if (extensions.length > 0) { + warnings.push( + `Skipped ${extensions.length} app extension target(s) (${extensions + .map((target) => target.name) + .join(", ")}): CrossCode can build and install the app, but not embed extensions yet.` + ); + } + return { + packageRoot, + packageName, + productName: packageName, + targets, + warnings, + packages: packages.list, + files: [ + { + path: "Package.swift", + contents: generatePackageSwift(packageName, targets, platform, packages.list), + }, + { + path: "crosscode.toml", + contents: generateCrosscodeToml( + app.bundleId, + app.settings.CURRENT_PROJECT_VERSION || "1", + app.settings.MARKETING_VERSION || "1.0.0" + ), + }, + { path: "Info.plist", contents: infoPlistText }, + ], + copies, + settings: { ...projectSettings, ...app.settings }, + configuration, + infoPlistSource, + }; +} + +function mapProductType(productType: string): ImportTargetKind { + switch (productType) { + case "com.apple.product-type.application": + return "app"; + case "com.apple.product-type.framework": + case "com.apple.product-type.library.dynamic": + case "com.apple.product-type.library.static": + case "com.apple.product-type.bundle": + return "framework"; + case "com.apple.product-type.app-extension": + case "com.apple.product-type.extensionkit-extension": + case "com.apple.product-type.watchkit2-extension": + case "com.apple.product-type.widgetkit-extension": + return "extension"; + case "com.apple.product-type.bundle.unit-test": + case "com.apple.product-type.bundle.ui-testing": + return "test"; + default: + return "other"; + } +} diff --git a/src/xcode-import/project-files.ts b/src/xcode-import/project-files.ts new file mode 100644 index 0000000..5dc7601 --- /dev/null +++ b/src/xcode-import/project-files.ts @@ -0,0 +1,128 @@ +// Filesystem helpers for the Xcode project importer. +// +// The importer needs to read `project.pbxproj` and, while planning, a handful +// of files and directory listings. Those are loaded up-front into a cache so +// the planner itself can stay synchronous (and therefore unit testable). + +import { readDir, readTextFile } from "@tauri-apps/plugin-fs"; + +export type ProjectFiles = { + /** directory -> absolute paths of its entries */ + listings: Map; + /** absolute path -> file contents (plists only) */ + plists: Map; +}; + +const SKIPPED_DIRECTORIES = new Set([ + ".git", + ".build", + ".crosscode", + "DerivedData", + "node_modules", + "Pods", + "Carthage", +]); + +/** Normalises to "/" separators so paths compare consistently across platforms. */ +export function normalizePath(path: string): string { + return path.replace(/\\/g, "/").replace(/\/+$/, ""); +} + +export function joinPath(base: string, child: string): string { + return `${normalizePath(base)}/${child}`; +} + +/** + * Walks a project directory collecting directory listings and Info.plist style + * files. The walk is bounded: huge trees only need the parts the planner reads. + */ +export async function loadProjectFiles( + root: string, + options: { maxDirectories?: number; maxPlistBytes?: number } = {} +): Promise { + const maxDirectories = options.maxDirectories ?? 4000; + const maxPlistBytes = options.maxPlistBytes ?? 512 * 1024; + + const listings = new Map(); + const plists = new Map(); + const queue: string[] = [normalizePath(root)]; + let visited = 0; + + while (queue.length > 0 && visited < maxDirectories) { + const directory = queue.shift() as string; + if (listings.has(directory)) continue; + + let entries; + try { + entries = await readDir(directory); + } catch { + listings.set(directory, []); + visited += 1; + continue; + } + + const paths: string[] = []; + for (const entry of entries) { + const path = joinPath(directory, entry.name); + paths.push(path); + if (entry.isDirectory) { + if (!SKIPPED_DIRECTORIES.has(entry.name)) queue.push(path); + continue; + } + if (!entry.name.toLowerCase().endsWith(".plist")) continue; + try { + const contents = await readTextFile(path); + if (contents.length <= maxPlistBytes) plists.set(path, contents); + } catch { + // unreadable plists simply fall back to the generated default + } + } + listings.set(directory, paths); + visited += 1; + } + + return { listings, plists }; +} + +/** The `.xcodeproj` bundles inside a directory. */ +export async function findXcodeProjects(directory: string): Promise { + try { + const entries = await readDir(normalizePath(directory)); + return entries + .filter((entry) => entry.name.toLowerCase().endsWith(".xcodeproj")) + .map((entry) => joinPath(normalizePath(directory), entry.name)); + } catch { + return []; + } +} + +/** The SwiftPM packages below a directory (folders containing Package.swift). */ +export async function findSwiftPackages( + root: string, + options: { maxDepth?: number } = {} +): Promise { + const maxDepth = options.maxDepth ?? 3; + const found: string[] = []; + const queue: { directory: string; depth: number }[] = [{ directory: normalizePath(root), depth: 0 }]; + + while (queue.length > 0) { + const { directory, depth } = queue.shift() as { directory: string; depth: number }; + let entries; + try { + entries = await readDir(directory); + } catch { + continue; + } + if (entries.some((entry) => entry.isFile && entry.name === "Package.swift")) { + found.push(directory); + continue; // nested packages are not part of this one + } + if (depth >= maxDepth) continue; + for (const entry of entries) { + if (!entry.isDirectory || SKIPPED_DIRECTORIES.has(entry.name)) continue; + queue.push({ directory: joinPath(directory, entry.name), depth: depth + 1 }); + } + } + + return found.sort(); +}