Files
RedLintu16andClaude Opus 5.5 babba1905c Run on Linux too: iPhone apps with xtool 2.0, Android with Gradle
One codebase; on the Mac nothing changes (rl16build --dry-run --for ios
android gives the same output before and after). On Linux:

- ios builds each app's XcodeGen .xcodeproj with `xtool dev build
  --configuration release --scheme <s> --ipa [--sign]`, run in
  ~/.cache/rl16build/xtool/<folder> with an xtool.yml pointing at the
  project, so nothing of xtool's lands in the app's repo. The build number
  goes into the generated project, since xtool takes no build settings.
- macos and watchos are not available on Linux (xtool): no watchOS SDK, and
  Mac apps xtool can't sign.
- What xtool can't build there is skipped, with the reason on the app's
  line and in the summary: an asset catalog, storyboard, xib, Metal, string
  catalog, Core Data or Core ML model, intent definition (Apple's tools,
  which Linux doesn't have), or a watch app inside. What it builds without
  is said on the line: App Intents metadata (xtool skips it on Linux),
  ExtensionKit extensions.
- The .ipa files are never uploaded: xtool signs for development under
  XTL-… bundle IDs, so they aren't the Mac's builds. --upload-only on Linux
  checks each .ipa and sends only the app's own bundle ID with Ad Hoc.
- Upload keys through secret-tool (the same service and account names),
  else $IPA_UPLOAD_KEY/$APK_UPLOAD_KEY, else asked; --key-file keeps one in
  ~/.config/rl16build/<site>.key (600) instead.
- Android: JDK from JAVA_HOME, /usr/lib/jvm/java-17/21-openjdk or
  archlinux-java; SDK from ANDROID_HOME, ~/Android/Sdk or /opt/android-sdk;
  a local.properties naming the Mac's SDK is pointed at this one.
- --extract-watch is macOS-only.

Both systems: no Keystores folder at all stops the Android builds before
anything is built (copy it from the Mac, or --new-keys); RL16BUILD_SWIFT_ROOT,
RL16BUILD_KOTLIN_ROOT and RL16BUILD_OUTPUT_ROOT move the folders; a test
target (swift test, macOS and Linux) covers the logic. README: a Linux
(xtool) section with the Arch setup.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ug8WAdn5H4r3oi1q2LdYaY
2026-11-23 19:47:26 -08:00

298 lines
12 KiB
Swift

import Foundation
/// A small project.pbxproj in XcodeGen's shape: an iPhone app (Demo) with an
/// asset catalog, a widget whose code imports AppIntents and an embedded
/// watch app; a plain iPhone app (Plain); a Mac app; a local package.
enum Fixture {
static let pbxproj = """
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {
/* Begin PBXBuildFile section */
BF000000000000000000APPS /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR00000000000000000APPS /* App.swift */; };
BF000000000000000000ASSE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FR00000000000000000ASSE /* Assets.xcassets */; };
BF000000000000000000WIDS /* Widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR00000000000000000WIDS /* Widget.swift */; };
BF000000000000000000PLNS /* Plain.swift in Sources */ = {isa = PBXBuildFile; fileRef = FR00000000000000000PLNS /* Plain.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
FR00000000000000000APPS /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
FR00000000000000000ASSE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
FR00000000000000000WIDS /* Widget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Widget.swift; sourceTree = "<group>"; };
FR00000000000000000PLNS /* Plain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Plain/Plain.swift; sourceTree = SOURCE_ROOT; };
PR0000000000000000DEMO /* Demo.app */ = {isa = PBXFileReference; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
PR0000000000000000WIDG /* DemoWidget.appex */ = {isa = PBXFileReference; includeInIndex = 0; path = DemoWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
PR0000000000000000WTCH /* DemoWatch.app */ = {isa = PBXFileReference; includeInIndex = 0; path = DemoWatch.app; sourceTree = BUILT_PRODUCTS_DIR; };
PR0000000000000000MACA /* DemoMac.app */ = {isa = PBXFileReference; includeInIndex = 0; path = DemoMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
PR0000000000000000PLAI /* Plain.app */ = {isa = PBXFileReference; includeInIndex = 0; path = Plain.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
GR0000000000000000MAIN = {
isa = PBXGroup;
children = (
GR0000000000000000DEMO /* Demo */,
);
sourceTree = "<group>";
};
GR0000000000000000DEMO /* Demo */ = {
isa = PBXGroup;
children = (
FR00000000000000000APPS /* App.swift */,
FR00000000000000000ASSE /* Assets.xcassets */,
GR0000000000000000WIDG /* Widget */,
);
path = Demo;
sourceTree = "<group>";
};
GR0000000000000000WIDG /* Widget */ = {
isa = PBXGroup;
children = (
FR00000000000000000WIDS /* Widget.swift */,
);
path = Widget;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
TG0000000000000000DEMO /* Demo */ = {
isa = PBXNativeTarget;
buildConfigurationList = CL0000000000000000DEMO;
buildPhases = (
PH0000000000000000DSRC /* Sources */,
PH0000000000000000DRES /* Resources */,
);
dependencies = (
TD0000000000000000WIDG /* PBXTargetDependency */,
TD0000000000000000WTCH /* PBXTargetDependency */,
);
name = Demo;
productName = Demo;
productReference = PR0000000000000000DEMO /* Demo.app */;
productType = "com.apple.product-type.application";
};
TG0000000000000000WIDG /* DemoWidget */ = {
isa = PBXNativeTarget;
buildConfigurationList = CL0000000000000000WIDG;
buildPhases = (
PH0000000000000000WSRC /* Sources */,
);
dependencies = (
);
name = DemoWidget;
productReference = PR0000000000000000WIDG /* DemoWidget.appex */;
productType = "com.apple.product-type.app-extension";
};
TG0000000000000000WTCH /* DemoWatch */ = {
isa = PBXNativeTarget;
buildConfigurationList = CL0000000000000000WTCH;
buildPhases = (
);
dependencies = (
);
name = DemoWatch;
productReference = PR0000000000000000WTCH /* DemoWatch.app */;
productType = "com.apple.product-type.application";
};
TG0000000000000000MACA /* DemoMac */ = {
isa = PBXNativeTarget;
buildConfigurationList = CL0000000000000000MACA;
buildPhases = (
);
dependencies = (
);
name = DemoMac;
productReference = PR0000000000000000MACA /* DemoMac.app */;
productType = "com.apple.product-type.application";
};
TG0000000000000000PLAI /* Plain */ = {
isa = PBXNativeTarget;
buildConfigurationList = CL0000000000000000PLAI;
buildPhases = (
PH0000000000000000PSRC /* Sources */,
);
dependencies = (
);
name = Plain;
productReference = PR0000000000000000PLAI /* Plain.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
PJ0000000000000000ROOT /* Project object */ = {
isa = PBXProject;
buildConfigurationList = CL0000000000000000PROJ;
mainGroup = GR0000000000000000MAIN;
packageReferences = (
LP0000000000000000KIT0 /* XCLocalSwiftPackageReference "Packages/Kit" */,
);
projectDirPath = "";
projectRoot = "";
targets = (
TG0000000000000000DEMO /* Demo */,
TG0000000000000000WIDG /* DemoWidget */,
TG0000000000000000WTCH /* DemoWatch */,
TG0000000000000000MACA /* DemoMac */,
TG0000000000000000PLAI /* Plain */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
PH0000000000000000DRES /* Resources */ = {
isa = PBXResourcesBuildPhase;
files = (
BF000000000000000000ASSE /* Assets.xcassets in Resources */,
);
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
PH0000000000000000DSRC /* Sources */ = {
isa = PBXSourcesBuildPhase;
files = (
BF000000000000000000APPS /* App.swift in Sources */,
);
};
PH0000000000000000WSRC /* Sources */ = {
isa = PBXSourcesBuildPhase;
files = (
BF000000000000000000WIDS /* Widget.swift in Sources */,
);
};
PH0000000000000000PSRC /* Sources */ = {
isa = PBXSourcesBuildPhase;
files = (
BF000000000000000000PLNS /* Plain.swift in Sources */,
);
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
TD0000000000000000WIDG /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = TG0000000000000000WIDG /* DemoWidget */;
};
TD0000000000000000WTCH /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = TG0000000000000000WTCH /* DemoWatch */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
BC0000000000000000PROJ /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 1;
SWIFT_VERSION = 5.0;
};
name = Release;
};
BC0000000000000000DEMO /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 7;
PRODUCT_BUNDLE_IDENTIFIER = fi.example.Demo;
SDKROOT = iphoneos;
};
name = Release;
};
BC0000000000000000WIDG /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
SDKROOT = iphoneos;
};
name = Release;
};
BC0000000000000000WTCH /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
SDKROOT = watchos;
SKIP_INSTALL = YES;
};
name = Release;
};
BC0000000000000000MACA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
SDKROOT = macosx;
};
name = Release;
};
BC0000000000000000PLAI /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CL0000000000000000PROJ = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000PROJ /* Release */,); defaultConfigurationName = Release; };
CL0000000000000000DEMO = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000DEMO /* Release */,); defaultConfigurationName = Release; };
CL0000000000000000WIDG = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000WIDG /* Release */,); defaultConfigurationName = Release; };
CL0000000000000000WTCH = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000WTCH /* Release */,); defaultConfigurationName = Release; };
CL0000000000000000MACA = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000MACA /* Release */,); defaultConfigurationName = Release; };
CL0000000000000000PLAI = {isa = XCConfigurationList; buildConfigurations = (BC0000000000000000PLAI /* Release */,); defaultConfigurationName = Release; };
/* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
LP0000000000000000KIT0 /* XCLocalSwiftPackageReference "Packages/Kit" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = Packages/Kit;
};
/* End XCLocalSwiftPackageReference section */
};
rootObject = PJ0000000000000000ROOT /* Project object */;
}
"""
/// A scheme as Schemes.addMissing writes one: builds and runs [id].
static func scheme(running id: String, alsoBuilding other: String? = nil, runnable: Bool = true) -> String {
func entry(_ id: String) -> String {
"""
<BuildActionEntry buildForTesting="YES" buildForRunning="YES" buildForProfiling="YES" buildForArchiving="YES" buildForAnalyzing="YES">
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="\(id)" BuildableName="X.app" BlueprintName="X" ReferencedContainer="container:Demo.xcodeproj"/>
</BuildActionEntry>
"""
}
return """
<?xml version="1.0" encoding="UTF-8"?>
<Scheme LastUpgradeVersion="1600" version="1.7">
<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
<BuildActionEntries>
\(entry(id))
\(other.map(entry) ?? "")
</BuildActionEntries>
</BuildAction>
<LaunchAction buildConfiguration="Debug" launchStyle="0">
\(runnable ? """
<BuildableProductRunnable runnableDebuggingMode="0">
<BuildableReference BuildableIdentifier="primary" BlueprintIdentifier="\(id)" BuildableName="X.app" BlueprintName="X" ReferencedContainer="container:Demo.xcodeproj"/>
</BuildableProductRunnable>
""" : "")
</LaunchAction>
<ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/>
</Scheme>
"""
}
/// A fresh folder for a test, removed by the caller.
static func folder() -> String {
let dir = NSTemporaryDirectory() + "rl16build-tests-\(UUID().uuidString)"
try? FileManager.default.createDirectory(atPath: dir, withIntermediateDirectories: true)
return dir
}
}