Modern Apps git

← xtool.git

More renaming and regrouping

Commit
7245b34f4f206dd87f8721d50ba2d70794150c82
Author
Kabir Oberai <[email protected]>
When
2025-05-06 07:01 UTC (1 year ago)
Parents
1790ecb

Diff

Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift
diff --git a/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift b/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swiftindex d3f0ad2..a939efe 100644--- a/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift+++ b/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift@@ -112,9 +112,9 @@ public struct ADIDataProvider: AnisetteDataProvider {             .joined()     } -    private static let localUserUIDKey = "SUPLocalUserUID"-    private static let provisioningKey = "SUPProvisioningInfo"-    private static let routingInfoKey = "SUPRoutingInfo"+    private static let localUserUIDKey = "XTLLocalUserUID"+    private static let provisioningKey = "XTLProvisioningInfo"+    private static let routingInfoKey = "XTLRoutingInfo"      private struct GSARequest<T: Encodable>: Encodable {         let header: [String: String] = [:]
Sources/XKit/Utilities/ProvisioningIdentifiers.swift
diff --git a/Sources/XKit/Utilities/ProvisioningIdentifiers.swift b/Sources/XKit/Utilities/ProvisioningIdentifiers.swiftindex b06e013..f956c5d 100644--- a/Sources/XKit/Utilities/ProvisioningIdentifiers.swift+++ b/Sources/XKit/Utilities/ProvisioningIdentifiers.swift@@ -12,7 +12,7 @@ enum ProvisioningIdentifiers {}  extension ProvisioningIdentifiers { -    static let idPrefix = "SC-"+    static let idPrefix = "XTL-"     static let groupPrefix = "group."     static let namePrefix = "XTool " 
Sources/XTool/Documentation.docc/Control.md
diff --git a/Sources/XTool/Documentation.docc/Control.md b/Sources/XTool/Documentation.docc/Control.mdindex 4fe302c..e348490 100644--- a/Sources/XTool/Documentation.docc/Control.md+++ b/Sources/XTool/Documentation.docc/Control.md@@ -6,7 +6,7 @@ Add resources, modify your `Info.plist`, and more.  When building your app, xtool provides many knobs to add resources and modify files in its `.app` bundle. This article explains how to perform some common tasks along these lines. -Many of the tasks here involve modifying the `xtool.yml` file. The default `xtool dev new` template should generate this file for you. If you don't have it, make sure you create one first.+Many of the tasks here involve modifying the `xtool.yml` file. The default `xtool new` template should generate this file for you. If you don't have it, make sure you create one first.  ```bash cat > xtool.yml << EOF
Sources/XTool/Documentation.docc/First-app-code/template-1b.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-1b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-1b.shindex ea41ca6..87fdcbf 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-1b.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-1b.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-2a.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-2a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-2a.shindex 0ced4a4..9cecda4 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-2a.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-2a.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-2b.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-2b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-2b.shindex 5387254..d138eef 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-2b.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-2b.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-3a.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-3a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-3a.shindex c5ab172..225d90b 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-3a.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-3a.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-3b.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-3b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-3b.shindex a0b836c..e8c9c6b 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-3b.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-3b.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-4a.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-4a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-4a.shindex a111259..1cb630e 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-4a.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-4a.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app-code/template-4b.sh
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-4b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-4b.shindex dd917f3..4f7dd50 100644--- a/Sources/XTool/Documentation.docc/First-app-code/template-4b.sh+++ b/Sources/XTool/Documentation.docc/First-app-code/template-4b.sh@@ -1,4 +1,4 @@-Developer$ xtool dev new Hello+Developer$ xtool new Hello Creating package: Hello Creating Package.swift Creating xtool.yml
Sources/XTool/Documentation.docc/First-app.tutorial
diff --git a/Sources/XTool/Documentation.docc/First-app.tutorial b/Sources/XTool/Documentation.docc/First-app.tutorialindex 78c80dd..0078586 100644--- a/Sources/XTool/Documentation.docc/First-app.tutorial+++ b/Sources/XTool/Documentation.docc/First-app.tutorial@@ -8,7 +8,7 @@                  @Steps {             @Step {-                xtool comes with a template for iOS-capable Swift Packages. Run `xtool dev new` to create a new package.+                xtool comes with a template for iOS-capable Swift Packages. Run `xtool new` to create a new package.                                  @Code(name: "Terminal", file: "template-1b.sh", previousFile: "template-1a.sh") {}             }
Sources/XTool/Documentation.docc/Installation-Linux.md
diff --git a/Sources/XTool/Documentation.docc/Installation-Linux.md b/Sources/XTool/Documentation.docc/Installation-Linux.mdindex 3a428ec..88d51aa 100644--- a/Sources/XTool/Documentation.docc/Installation-Linux.md+++ b/Sources/XTool/Documentation.docc/Installation-Linux.md@@ -85,7 +85,7 @@ xtool --help Perform one-time setup with  ```bash-xtool dev setup+xtool setup ```  You'll first be asked to log in:
Sources/XToolSupport/AuthCommand.swift
diff --git a/Sources/XToolSupport/AuthCommand.swift b/Sources/XToolSupport/AuthCommand.swiftindex c968a27..3b2a33e 100644--- a/Sources/XToolSupport/AuthCommand.swift+++ b/Sources/XToolSupport/AuthCommand.swift@@ -195,7 +195,7 @@ struct AuthStatusCommand: AsyncParsableCommand { struct AuthCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(         commandName: "auth",-        abstract: "Authenticate with Apple Developer Services",+        abstract: "Manage Apple Developer Services authentication",         subcommands: [             AuthLoginCommand.self,             AuthLogoutCommand.self,
Sources/XToolSupport/AuthToken.swift
diff --git a/Sources/XToolSupport/AuthToken.swift b/Sources/XToolSupport/AuthToken.swiftindex a23a049..82e7b0f 100644--- a/Sources/XToolSupport/AuthToken.swift+++ b/Sources/XToolSupport/AuthToken.swift@@ -48,19 +48,19 @@ extension AuthToken {     private static let decoder = JSONDecoder()      static func saved() throws -> Self {-        guard let data = try storage.data(forKey: "SUPAuthToken") else {+        guard let data = try storage.data(forKey: "XTLAuthToken") else {             throw Console.Error("Please log in with `xtool auth` before running this command.")         }         return try decoder.decode(AuthToken.self, from: data)     }      static func clear() throws {-        try Self.storage.setData(nil, forKey: "SUPAuthToken")+        try Self.storage.setData(nil, forKey: "XTLAuthToken")     }      func save() throws {         let data = try Self.encoder.encode(self)-        try Self.storage.setData(data, forKey: "SUPAuthToken")+        try Self.storage.setData(data, forKey: "XTLAuthToken")     }      func authData() throws -> DeveloperAPIAuthData {
Sources/XToolSupport/DevCommand.swift
diff --git a/Sources/XToolSupport/DevCommands/DevCommand.swift b/Sources/XToolSupport/DevCommand.swiftsimilarity index 71%rename from Sources/XToolSupport/DevCommands/DevCommand.swiftrename to Sources/XToolSupport/DevCommand.swiftindex 1a866b2..221c396 100644--- a/Sources/XToolSupport/DevCommands/DevCommand.swift+++ b/Sources/XToolSupport/DevCommand.swift@@ -3,55 +3,6 @@ import ArgumentParser import PackLib import XKit -struct DevSetupCommand: AsyncParsableCommand {-    static let configuration = CommandConfiguration(-        commandName: "setup",-        abstract: "Set up xtool for iOS development",-        discussion: """-        Authenticates with Apple if needed, then adds the iOS SDK to SwiftPM.--        Equivalent to running `xtool auth && xtool dev sdk`-        """-    )--    func run() async throws {-        try await DevSetupOperation().run()-    }-}--struct DevSetupOperation {-    var quiet = false--    func run() async throws {-        try await AuthOperation(logoutFromExisting: false, quiet: quiet).run()--        switch try DarwinSDK.current()?.isUpToDate() {-        case true?:-            if !quiet {-                print("Darwin SDK is up to date.")-            }-        case false?:-            if !quiet {-                print("Darwin SDK is outdated.")-            }-            fallthrough-        case nil:-            let path = try await Console.prompt("""-            Now generating the Darwin SDK.-            -            Please download Xcode from http://developer.apple.com/download/all/?q=Xcode-            and enter the path to the downloaded Xcode.xip.-            -            Path to Xcode.xip: -            """)--            let expanded = (path as NSString).expandingTildeInPath--            try await InstallSDKOperation(path: expanded).run()-        }-    }-}- struct PackOperation {     struct BuildOptions: ParsableArguments {         @Option(@@ -178,11 +129,8 @@ struct DevRunCommand: AsyncParsableCommand { struct DevCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(         commandName: "dev",-        abstract: "Develop iOS apps with SwiftPM",+        abstract: "Build and run an xtool SwiftPM project",         subcommands: [-            DevSetupCommand.self,-            DevNewCommand.self,-            DevSDKCommand.self,             DevXcodeCommand.self,             DevBuildCommand.self,             DevRunCommand.self,
Sources/XToolSupport/LaunchCommand.swift
diff --git a/Sources/XToolSupport/RunCommand.swift b/Sources/XToolSupport/LaunchCommand.swiftsimilarity index 90%rename from Sources/XToolSupport/RunCommand.swiftrename to Sources/XToolSupport/LaunchCommand.swiftindex 9c28524..1cc49a8 100644--- a/Sources/XToolSupport/RunCommand.swift+++ b/Sources/XToolSupport/LaunchCommand.swift@@ -3,16 +3,16 @@ import XKit import SwiftyMobileDevice import ArgumentParser -struct RunCommand: AsyncParsableCommand {+struct LaunchCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(-        commandName: "run",-        abstract: "Run an installed app"+        commandName: "launch",+        abstract: "Launch an installed app"     )          @OptionGroup var connectionOptions: ConnectionOptions      @Argument(-        help: "The app to run"+        help: "The app to launch"     ) var bundleID: String      @Argument(
Sources/XToolSupport/NewCommand.swift
diff --git a/Sources/XToolSupport/DevCommands/DevNewCommand.swift b/Sources/XToolSupport/NewCommand.swiftsimilarity index 96%rename from Sources/XToolSupport/DevCommands/DevNewCommand.swiftrename to Sources/XToolSupport/NewCommand.swiftindex 504486d..4a5fda8 100644--- a/Sources/XToolSupport/DevCommands/DevNewCommand.swift+++ b/Sources/XToolSupport/NewCommand.swift@@ -2,10 +2,10 @@ import ArgumentParser import Foundation import PackLib -struct DevNewCommand: AsyncParsableCommand {+struct NewCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(         commandName: "new",-        abstract: "Create a new project"+        abstract: "Create a new xtool SwiftPM project"     )      @Argument var name: String?@@ -14,7 +14,7 @@ struct DevNewCommand: AsyncParsableCommand {         help: ArgumentHelp(             "Skip setup steps. (default: false)",             discussion: """-            By default, this command first invokes `xtool dev setup` to complete \+            By default, this command first invokes `xtool setup` to complete \             any missing setup steps, like authenticating and installing the SDK. Use \             this flag to always skip setup.             """@@ -24,7 +24,7 @@ struct DevNewCommand: AsyncParsableCommand {     func run() async throws {         if !skipSetup {             // perform any remaining setup steps first-            try await DevSetupOperation(quiet: true).run()+            try await SetupOperation(quiet: true).run()         }          let name = try await Console.promptRequired("Package name: ", existing: self.name)
Sources/XToolSupport/SDKBuilder.swift
diff --git a/Sources/XToolSupport/DevCommands/SDKBuilder.swift b/Sources/XToolSupport/SDKBuilder.swiftsimilarity index 100%rename from Sources/XToolSupport/DevCommands/SDKBuilder.swiftrename to Sources/XToolSupport/SDKBuilder.swift
Sources/XToolSupport/SDKCommand.swift
diff --git a/Sources/XToolSupport/DevCommands/DevSDKCommand.swift b/Sources/XToolSupport/SDKCommand.swiftsimilarity index 99%rename from Sources/XToolSupport/DevCommands/DevSDKCommand.swiftrename to Sources/XToolSupport/SDKCommand.swiftindex 7f5c9b6..464fa96 100644--- a/Sources/XToolSupport/DevCommands/DevSDKCommand.swift+++ b/Sources/XToolSupport/SDKCommand.swift@@ -5,7 +5,7 @@ import ArgumentParser import Dependencies import PackLib -struct DevSDKCommand: AsyncParsableCommand {+struct SDKCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(         commandName: "sdk",         abstract: "Manage the Darwin Swift SDK",
Sources/XToolSupport/SetupCommand.swift
diff --git a/Sources/XToolSupport/SetupCommand.swift b/Sources/XToolSupport/SetupCommand.swiftnew file mode 100644index 0000000..d4514ee--- /dev/null+++ b/Sources/XToolSupport/SetupCommand.swift@@ -0,0 +1,52 @@+import ArgumentParser+import Foundation+import XKit++struct SetupCommand: AsyncParsableCommand {+    static let configuration = CommandConfiguration(+        commandName: "setup",+        abstract: "Set up xtool for iOS development",+        discussion: """+        Authenticates with Apple if needed, then adds the iOS SDK to SwiftPM.++        Equivalent to running `xtool auth && xtool sdk`+        """+    )++    func run() async throws {+        try await SetupOperation().run()+    }+}++struct SetupOperation {+    var quiet = false++    func run() async throws {+        try await AuthOperation(logoutFromExisting: false, quiet: quiet).run()++        switch try DarwinSDK.current()?.isUpToDate() {+        case true?:+            if !quiet {+                print("Darwin SDK is up to date.")+            }+        case false?:+            if !quiet {+                print("Darwin SDK is outdated.")+            }+            fallthrough+        case nil:+            let path = try await Console.prompt("""+            Now generating the Darwin SDK.+            +            Please download Xcode from http://developer.apple.com/download/all/?q=Xcode+            and enter the path to the downloaded Xcode.xip.+            +            Path to Xcode.xip: +            """)++            let expanded = (path as NSString).expandingTildeInPath++            try await InstallSDKOperation(path: expanded).run()+        }+    }+}
Sources/XToolSupport/XToolCommand.swift
diff --git a/Sources/XToolSupport/XToolCommand.swift b/Sources/XToolSupport/XToolCommand.swiftindex d2f0581..81c606c 100644--- a/Sources/XToolSupport/XToolCommand.swift+++ b/Sources/XToolSupport/XToolCommand.swift@@ -12,14 +12,32 @@ struct XToolCommand: AsyncParsableCommand {     static let configuration = CommandConfiguration(         commandName: "xtool",         abstract: "The xtool command line interface",-        subcommands: [-            AuthCommand.self,-            DSCommand.self,-            DevicesCommand.self,-            InstallCommand.self,-            UninstallCommand.self,-            DevCommand.self,-            RunCommand.self,+        groupedSubcommands: [+            CommandGroup(+                name: "Configuration",+                subcommands: [+                    SetupCommand.self,+                    AuthCommand.self,+                    SDKCommand.self,+                ]+            ),+            CommandGroup(+                name: "Development",+                subcommands: [+                    NewCommand.self,+                    DevCommand.self,+                    DSCommand.self,+                ]+            ),+            CommandGroup(+                name: "Device",+                subcommands: [+                    DevicesCommand.self,+                    InstallCommand.self,+                    UninstallCommand.self,+                    LaunchCommand.self,+                ]+            )         ]     ) }