Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

More renaming and regrouping

Kabir Oberai7245b34f4f20
diff --git a/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift b/Sources/XKit/GrandSlam/Anisette/ADIDataProvider.swift
index 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] = [:]
diff --git a/Sources/XKit/Utilities/ProvisioningIdentifiers.swift b/Sources/XKit/Utilities/ProvisioningIdentifiers.swift
index 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 "
diff --git a/Sources/XTool/Documentation.docc/Control.md b/Sources/XTool/Documentation.docc/Control.md
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-1b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-1b.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-2a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-2a.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-2b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-2b.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-3a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-3a.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-3b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-3b.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-4a.sh b/Sources/XTool/Documentation.docc/First-app-code/template-4a.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app-code/template-4b.sh b/Sources/XTool/Documentation.docc/First-app-code/template-4b.sh
index 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
diff --git a/Sources/XTool/Documentation.docc/First-app.tutorial b/Sources/XTool/Documentation.docc/First-app.tutorial
index 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") {}
}
diff --git a/Sources/XTool/Documentation.docc/Installation-Linux.md b/Sources/XTool/Documentation.docc/Installation-Linux.md
index 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:
diff --git a/Sources/XToolSupport/AuthCommand.swift b/Sources/XToolSupport/AuthCommand.swift
index 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,
diff --git a/Sources/XToolSupport/AuthToken.swift b/Sources/XToolSupport/AuthToken.swift
index 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 {
diff --git a/Sources/XToolSupport/DevCommands/DevCommand.swift b/Sources/XToolSupport/DevCommand.swift
similarity index 71%
rename from Sources/XToolSupport/DevCommands/DevCommand.swift
rename to Sources/XToolSupport/DevCommand.swift
index 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,
diff --git a/Sources/XToolSupport/RunCommand.swift b/Sources/XToolSupport/LaunchCommand.swift
similarity index 90%
rename from Sources/XToolSupport/RunCommand.swift
rename to Sources/XToolSupport/LaunchCommand.swift
index 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(
diff --git a/Sources/XToolSupport/DevCommands/DevNewCommand.swift b/Sources/XToolSupport/NewCommand.swift
similarity index 96%
rename from Sources/XToolSupport/DevCommands/DevNewCommand.swift
rename to Sources/XToolSupport/NewCommand.swift
index 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)
diff --git a/Sources/XToolSupport/DevCommands/SDKBuilder.swift b/Sources/XToolSupport/SDKBuilder.swift
similarity index 100%
rename from Sources/XToolSupport/DevCommands/SDKBuilder.swift
rename to Sources/XToolSupport/SDKBuilder.swift
diff --git a/Sources/XToolSupport/DevCommands/DevSDKCommand.swift b/Sources/XToolSupport/SDKCommand.swift
similarity index 99%
rename from Sources/XToolSupport/DevCommands/DevSDKCommand.swift
rename to Sources/XToolSupport/SDKCommand.swift
index 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",
diff --git a/Sources/XToolSupport/SetupCommand.swift b/Sources/XToolSupport/SetupCommand.swift
new file mode 100644
index 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()
+ }
+ }
+}
diff --git a/Sources/XToolSupport/XToolCommand.swift b/Sources/XToolSupport/XToolCommand.swift
index 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,
+ ]
+ )
]
)
}