XcodeProjectEditor class final
Xcode project (project.pbxproj) build-setting writer for the installer.
A .pbxproj is an OpenStep plist, not XML, so none of the XML-backed
helpers can touch it. This editor exists for exactly one job: pointing the
application target at an entitlements file. Writing Runner.entitlements
to disk is not enough on its own, because Xcode only reads that file when
the target's CODE_SIGN_ENTITLEMENTS build setting names it.
Three invariants make it safe to run against a real project:
- Round-trip proof before any write. The file is parsed into a
trivia-preserving tree and re-emitted; unless the re-emission matches
the original byte for byte, the editor throws and writes nothing. A
project it cannot reproduce exactly is a project it must not edit,
because a corrupt
.pbxprojmakes the project unopenable and the installer does not roll helper-backed writes back. - Application-target scoping. A stock Flutter project holds nine
XCBuildConfigurationblocks: three for the app, three for the test bundle and three project-level defaults. Only the three reachable from thePBXNativeTargetwhoseproductTypeiscom.apple.product-type.applicationare touched. Signing entitlements on a test bundle is a build failure, not a harmless extra. - No repointing. A project already signing with a different entitlements file keeps it, and the paths that blocked the write come back to the caller. Overwriting would unsign whatever that file grants, which the macOS Flutter template relies on.
The operation is idempotent: a second call with the same path leaves the file byte-identical and performs no write at all.
Usage
XcodeProjectEditor.setEntitlementsPath(
'ios/Runner.xcodeproj/project.pbxproj',
'Runner/Runner.entitlements',
);
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
setEntitlementsPath(
String pbxprojPath, String entitlementsPath) → Set< String> -
Point every build configuration of the application target in
pbxprojPathatentitlementsPath.