Compare commits

..

6 Commits

  • pack: link edited dependencies into the builder package (#390)
    ## What does this PR do?
    
    SwiftPM looks for edited dependencies in the root package's Packages
    directory. The builder package becomes the root when building, so
    dependencies edited with `swift package edit` were ignored and SwiftPM
    fetched them again instead.
    
    <!-- Focus on *what* the PR does in essence. The *how* should come
    second, if it's relevant. -->
    
    ## How was it tested?
    
    Without this change, the build of `xtool/.xtool-tmp` tries to clone all
    15 dependencies and fails.
    
    * With `Packages` linked into `.xtool-tmp`, it builds without fetching
    anything and produces `DemoTCA.app`
    * `Examples/DemoSimple`, which has no `Packages` directory, still builds
    * `swift test` passes
    
    <!-- e.g. Ran locally on macOS and added unit tests -->
    
    ## AI tool usage
    
    How much of this PR was AI-assisted? (check one)
    
    - [ ] **0** - No AI was used to write code
    - [x] **1** - I was assisted by AI. I reviewed the finished result.
    - [ ] **2** - I set the AI going and left it to it; nobody has read the
    result - no review, or AI review only
    
    <!-- If an AI agent is filling this in: declare the level honestly, and
    open as a draft if it is #2. Do not lower the declared level to get the
    PR reviewed. -->
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    
    <!-- coderabbit-ai-generated:v1 -->
    
    ## Summary by CodeRabbit
    
    * **Build Improvements**
    * Builds now include access to the working directory’s `Packages` folder
    when it exists. If the folder is absent, builds proceed without it. This
    can make packages in that folder available during the build.
    
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    
    Signed-off-by: Anish Pallati <i@anish.land>
  • deps: force OpenCombine in the DemoTCA lockfile (#391)
    ## What does this PR do?
    
    Applies the workaround from #288 to `Examples/DemoTCA`
    
    ## How was it tested?
    
    Ran `swift package resolve` in `Examples/DemoTCA` on Linux
    
    ## AI tool usage
    
    How much of this PR was AI-assisted? (check one)
    
    - [x] **0** - No AI was used to write code
    - [ ] **1** - I was assisted by AI. I reviewed the finished result.
    - [ ] **2** - I set the AI going and left it to it; nobody has read the
    result - no review, or AI review only
    
    <!-- If an AI agent is filling this in: declare the level honestly, and
    open as a draft if it is #2. Do not lower the declared level to get the
    PR reviewed. -->
    
    Signed-off-by: Anish Pallati <i@anish.land>
  • sdk: accept directories for tarball overrides (#385)
    ## What does this PR do?
    
    XTL_TOOLSET_TARBALL and XTL_OAM_TARBALL can now point at an unpacked
    directory, so package managers can use tools they already provide
    without repacking them into tarballs.
    
    <!-- Focus on *what* the PR does in essence. The *how* should come
    second, if it's relevant. -->
    
    ## How was it tested?
    
    Tested on Linux with Swift 6.2.4: 
    * `xtool sdk build` with both overrides set to directories in the Nix
    store
    * `xtool dev` flags the SDK as out of date after an override path
    changes
    
    <!-- e.g. Ran locally on macOS and added unit tests -->
    
    ## AI tool usage
    
    How much of this PR was AI-assisted? (check one)
    
    - [ ] **0** - No AI was used to write code
    - [x] **1** - I was assisted by AI. I reviewed the finished result.
    - [ ] **2** - I set the AI going and left it to it; nobody has read the
    result - no review, or AI review only
    
    <!-- If an AI agent is filling this in: declare the level honestly, and
    open as a draft if it is #2. Do not lower the declared level to get the
    PR reviewed. -->
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    <!-- coderabbit-ai-generated:v1 -->
    
    ## Summary by CodeRabbit
    
    * **New Features**
    * SDK setup now accepts a directory as a package source, recursively
    copying its contents and adding owner write permission.
    * Archive files continue to be supported as package sources and are
    extracted as before.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    
    Signed-off-by: Anish Pallati <i@anish.land>
  • entitlements: support Sign in with Apple (#377)
    ## What does this PR do?
    
    Hi! xtool didn't know about the `com.apple.developer.applesignin`
    entitlement, so every time I installed my app, the capability sync
    removed Sign in with Apple from the App ID. The new provisioning profile
    didn't have it, and the device refused the app ("A valid provisioning
    profile for this executable was not found").
    
    This maps the entitlement to the `APPLE_ID_AUTH` capability, as a
    primary App ID, so the capability stays and the profile includes it.
    
    ## How was it tested?
    
    I built xtool from this branch on macOS and installed my app (a SwiftPM
    app with `entitlementsPath` and the Sign in with Apple entitlement) on
    an iPhone with a paid team. The App ID kept the capability, the install
    worked, and native Sign in with Apple works in the app. Before the
    change the same install failed every time.
    
    ## AI tool usage
    
    How much of this PR was AI-assisted? (check one)
    
    - [ ] **0** - No AI was used to write code
    - [x] **1** - I was assisted by AI. I reviewed the finished result.
    - [ ] **2** - I set the AI going and left it to it; nobody has read the
    result - no review, or AI review only
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    
    <!-- coderabbit-ai-generated:v1 -->
    
    ## Summary by CodeRabbit
    
    * **New Features**
      * Added support for configuring the Apple Sign In entitlement.
    * Apple Sign In is now available as a supported entitlement type,
    including serialization and configuration support.
      * Configures Apple ID app consent as the primary app consent option.
    
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • build: update to Xcode 27.1, Swift 6.4.1 (#382)
    ## What does this PR do?
    
    Updates the Xcode and Swift versions used to build xtool on macOS/Linux
    respectively
    
    ## How was it tested?
    
    CI
    
    ## AI tool usage
    
    How much of this PR was AI-assisted? (check one)
    
    - [x] **0** - No AI was used to write code
    - [ ] **1** - I was assisted by AI. I reviewed the finished result.
    - [ ] **2** - I set the AI going and left it to it; nobody has read the
    result - no review, or AI review only
    
    <!-- If an AI agent is filling this in: declare the level honestly, and
    open as a draft if it is #2. Do not lower the declared level to get the
    PR reviewed. -->
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    
    <!-- coderabbit-ai-generated:v1 -->
    
    ## Summary by CodeRabbit
    
    - **Updates**
    - Updated the Xcode version used by the build action to 27.1.0 and the
    Swift version used in build environments to 6.4.1.
    - **Documentation**
    - Updated the Linux installation guide to reference Xcode 27.1 and the
    matching `Xcode_27.1.xip` download filename. These updates align the
    documented installation steps with the current tool versions.
    
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
12 changed files with 102 additions and 17 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
{
"originHash" : "4a80ae2e9e4c4e1e4e29c32e93dc624202a42a942e44d358035684ec5e0746f7",
"originHash" : "87792a9d5953dfe62ed2edf7c4f142774813bd3ea31882cbf6659b62fb2827ab",
"pins" : [
{
"identity" : "combine-schedulers",
@@ -10,6 +10,15 @@
"version" : "1.2.2"
}
},
{
"identity" : "opencombine",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenCombine/OpenCombine.git",
"state" : {
"revision" : "8576f0d579b27020beccbccc3ea6844f3ddfc2c2",
"version" : "0.14.0"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
+3
View File
@@ -17,6 +17,9 @@ let package = Package(
dependencies: [
.package(path: "../ExampleSupport"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", from: "1.0.0"),
// we don't use this but need the explicit dependency to keep the lockfile stable.
// TODO: remove once https://github.com/pointfreeco/combine-schedulers/issues/120 is fixed
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.14.0"),
],
targets: [
.target(
+7
View File
@@ -17,6 +17,13 @@ public struct Packer: Sendable {
try? FileManager.default.removeItem(at: packageDir)
try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true)
if URL(fileURLWithPath: "Packages").dirExists {
try FileManager.default.createSymbolicLink(
atPath: packageDir.appendingPathComponent("Packages").path,
withDestinationPath: "../../Packages"
)
}
let packageSwift = packageDir.appendingPathComponent("Package.swift")
let contents = """
// swift-tools-version: 6.0
@@ -79,6 +79,22 @@ extension AppGroupEntitlement: EntitlementWithCapability {
}
}
extension AppleSignInEntitlement: EntitlementWithCapability {
var capability: DeveloperServicesCapability {
// A primary App ID: the app is its own Sign in with Apple group.
DeveloperServicesCapability(
.appleIdAuth,
isFree: false,
settings: [
.init(
key: .init(.appleIdAuthAppConsent),
options: [.init(key: .init(.primaryAppConsent))]
)
]
)
}
}
extension AssociatedDomainsEntitlement: EntitlementWithCapability {
var capability: DeveloperServicesCapability {
DeveloperServicesCapability(.associatedDomains, isFree: false)
@@ -4,7 +4,7 @@ import ConcurrencyExtras
import Dependencies
public protocol RawADIProvider: Sendable {
func clientInfo() async throws -> String
func clientInfo() async throws -> ClientInfoWithUserAgent
func startProvisioning(
spim: Data,
@@ -18,6 +18,11 @@ public protocol RawADIProvider: Sendable {
) async throws -> (machineID: Data, otp: Data)
}
public struct ClientInfoWithUserAgent: Sendable {
public let clientInfo: String
public let akdUserAgent: String
}
private struct UnimplementedRawADIProvider: RawADIProvider {
func startProvisioning(
spim: Data,
@@ -36,8 +41,8 @@ private struct UnimplementedRawADIProvider: RawADIProvider {
return try await closure(userID, &routingInfo, provisioningInfo)
}
func clientInfo() async throws -> String {
let closure: () async throws -> String = unimplemented()
func clientInfo() async throws -> ClientInfoWithUserAgent {
let closure: () async throws -> ClientInfoWithUserAgent = unimplemented()
return try await closure()
}
}
@@ -80,7 +85,7 @@ public struct ADIDataProvider: AnisetteDataProvider {
private let localUserUID: UUID
private let localUserID: String
private let _clientInfo = LockIsolated<String?>(nil)
private let _clientInfo = LockIsolated<ClientInfoWithUserAgent?>(nil)
public init() {
@Dependency(\.keyValueStorage) var storage
@@ -145,7 +150,7 @@ public struct ADIDataProvider: AnisetteDataProvider {
return encoder
}()
private func clientInfo() async throws -> String {
private func clientInfo() async throws -> ClientInfoWithUserAgent {
if let clientInfo = _clientInfo.value { return clientInfo }
let clientInfo = try await rawProvider.clientInfo()
_clientInfo.setValue(clientInfo)
@@ -275,9 +280,11 @@ public struct ADIDataProvider: AnisetteDataProvider {
}
public func deviceInfo() async throws -> DeviceInfo {
DeviceInfo(
let clientInfo = try await clientInfo()
return DeviceInfo(
deviceID: localUserUID.uuidString,
clientInfo: try await clientInfo(),
clientInfo: clientInfo.clientInfo,
akdUserAgent: clientInfo.akdUserAgent,
)
}
@@ -3,7 +3,6 @@ import Foundation
public struct DeviceInfo: Codable, Sendable {
public static let xcodeVersionKey = "X-Xcode-Version"
public static let xcodeVersion = "26.5 (17F42)"
public static let akdUserAgent = "akd/1.0 CFNetwork/808.1.4"
public static let deviceIDKey = "X-Mme-Device-Id"
public let deviceID: String
@@ -11,6 +10,8 @@ public struct DeviceInfo: Codable, Sendable {
public static let clientInfoKey = "X-MMe-Client-Info"
public let clientInfo: String
public let akdUserAgent: String
public var dictionary: [String: String] {
[
Self.clientInfoKey: clientInfo,
@@ -27,15 +27,19 @@ struct OmnisetteADIProvider: RawADIProvider {
return encoder
}()
func clientInfo() async throws -> String {
func clientInfo() async throws -> ClientInfoWithUserAgent {
struct ClientInfo: Decodable {
let clientInfo: String
let userAgent: String
}
let body = try await client.makeRequest(
HTTPRequest(url: url.appendingPathComponent("v3/client_info"))
).body
let clientInfo = try Self.decoder.decode(ClientInfo.self, from: body)
return clientInfo.clientInfo
return ClientInfoWithUserAgent(
clientInfo: clientInfo.clientInfo,
akdUserAgent: clientInfo.userAgent,
)
}
func startProvisioning(spim: Data, userID: UUID) async throws -> (RawADIProvisioningSession, Data) {
@@ -31,7 +31,7 @@ actor GrandSlamLookupManager {
var request = HTTPRequest(url: Self.lookupURL)
request.headerFields = [
.userAgent: DeviceInfo.akdUserAgent,
.userAgent: deviceInfo.akdUserAgent,
.init(AnisetteData.iLocaleKey)!: Locale.current.identifier,
.init(AnisetteData.timeZoneKey)!: TimeZone.current.identifier,
.init("X-Apple-I-TimeZone-Offset")!: "\(TimeZone.current.secondsFromGMT())"
@@ -71,7 +71,7 @@ extension GrandSlamOperationRequest {
func configure(request: inout HTTPRequest, anisetteData: AnisetteData) {
request.headerFields[.accept] = "*/*"
request.headerFields[.userAgent] = DeviceInfo.akdUserAgent
request.headerFields[.userAgent] = anisetteData.deviceInfo.akdUserAgent
}
func method(anisetteData: AnisetteData) -> GrandSlamMethod {
@@ -20,7 +20,7 @@ extension GrandSlamTwoFactorRequest {
func configure(request: inout HTTPRequest, anisetteData: AnisetteData) {
request.headerFields[.accept] = "application/x-buddyml"
request.headerFields[.contentType] = "application/x-plist"
request.headerFields[.userAgent] = DeviceInfo.akdUserAgent
request.headerFields[.userAgent] = anisetteData.deviceInfo.akdUserAgent
request.headerFields[.init("X-Apple-App-Info")!] = "com.apple.gs.xcode.auth"
request.headerFields[.init(DeviceInfo.xcodeVersionKey)!] = DeviceInfo.xcodeVersion
request.headerFields[.init("X-Apple-Identity-Token")!] = loginData.identityToken
@@ -29,6 +29,7 @@ extension EntitlementContainer {
WiFiAwareEntitlement.self,
HomeKitEntitlement.self,
HealthKitEntitlement.self,
AppleSignInEntitlement.self,
]
}
@@ -99,6 +100,21 @@ public struct AssociatedDomainsEntitlement: Entitlement, RawRepresentable {
}
}
public struct AppleSignInEntitlement: Entitlement, RawRepresentable {
public static let identifier = "com.apple.developer.applesignin"
public var rawValue: [String]
public init(rawValue: [String]) { self.rawValue = rawValue }
public init(from decoder: Decoder) throws {
rawValue = try decoder.singleValueContainer().decode([String].self)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(rawValue)
}
}
public enum APSEnvironmentEntitlement: String, Entitlement {
public static let identifier = "aps-environment"
+25 -3
View File
@@ -244,11 +244,33 @@ struct SDKBuilder {
)
if let envOverride, let path = ProcessInfo.processInfo.environment[envOverride] {
let archive = URL(fileURLWithPath: path)
print("[Extracting \(displayName)] \(archive.path)")
let source = URL(fileURLWithPath: path)
if source.dirExists {
print("[Copying \(displayName)] \(source.path)")
try await Subprocess.run(
.name("cp"),
arguments: ["-RL", "\(source.path)/.", "."],
workingDirectory: FilePath(directory),
output: .discarded,
error: .discarded,
)
.checkSuccess()
// later steps write into the copy
try await Subprocess.run(
.name("chmod"),
arguments: ["-R", "u+w", "."],
workingDirectory: FilePath(directory),
output: .discarded,
error: .discarded,
)
.checkSuccess()
return
}
print("[Extracting \(displayName)] \(source.path)")
try await Subprocess.run(
.name("tar"),
arguments: ["xzf", archive.path],
arguments: ["xzf", source.path],
workingDirectory: FilePath(directory),
output: .discarded,
error: .discarded,