Repository navigation
0.0.14
Fixed
-
injectEntitlementwrote a file Xcode never read. The op set the key inios/Runner/Runner.entitlementsand stopped, so unless somebody had already opened Xcode and added the capability by hand,CODE_SIGN_ENTITLEMENTSwas unset and the entitlement was inert. The op now also points the application target at that file. Concretely this is what made an installer-driven iOS push setup impossible: the plist was correct and the build ignored it. -
A
project.pbxprojthe reader declined to touch aborted the whole plugin install, half-applied.XcodeProjectEditorrefuses to write a project it cannot re-emit byte for byte, and that refusal arrived atInstallTransaction's dispatcher catch as anError, so the install stopped. Stopping undid nothing: the entitlements plist and every earlier helper-backed write (pubspec.yaml, the gradle files,Info.plist,.env) had already landed and none of them roll back, so the operator was left holding a partial install and an exception string. The trigger is ordinary rather than exotic. Xcode escapes non-ASCII in that file as\Uxxxx, the parser resolves an escape it does not model to the bare character, and the re-emission then differs, so a project whosePRODUCT_NAMEis"Caf\U00e9"was enough to reach it. The refusal is now a warning beside the two cases that were already non-fatal (no.xcodeprojat all, and a target already signing with a different entitlements file): it names the value to set on the application target and says thatRunner/Runner.entitlementsstays inert until the setting carries it. Aproject.pbxprojthat is not a valid project file at all still aborts the install, because that is not the editor declining to write a project it read and it is not answered by editing a build setting by hand. The round-trip guard itself is unchanged; refusing to write a file it cannot reproduce exactly is what makes the editor safe to point at a real project. -
PlistWriterandPodfileEditorrefused to edit a file that did not exist yet, which is every Flutter project's entitlements file until somebody opens Xcode, and every Swift Package Manager project's Podfile always. Both now create the file first.PlistWritercreates ONLY an.entitlementspath: an absentInfo.pliststill throws, because that means the caller has the wrong path and inventing one would hide it. -
A created Podfile is now shaped for the platform it is created for.
PodfileEditor's creation path is reached fromsetPlatformVersion,addPostInstallHookandaddPodLine, and all three accept macOS, so the first cut wrote one iOS-shaped file for both:platform :ios, '12.0'andflutter_install_all_ios_pods. On a macOS project with no Podfile that produced a file nothing could build.setPlatformVersion(path, 'macos', v)matchesplatform :osx, missed the:iosline the creation had just written, and took its prepend branch, so the file ended up carrying TWOplatformdeclarations; andflutter_install_all_ios_podsis not defined by the macOS half of Flutter'spodhelper.rb, sopod installfailed with an undefined method. Creation now takes the platform from the caller and emitsplatform :osxwithflutter_install_all_macos_podsfor macOS, which is also what makes the followingsetPlatformVersionREPLACE that line instead of adding a second one. The mapping lives in one place now, so the created file and the regex that later edits it cannot disagree again. Worth stating plainly, because it is a regression this branch introduced and not an old bug: before create-if-absent, that same call threw and wrote nothing. This is a helper-backed write path the installer does not roll back, so a wrong file has no undo. -
A created Podfile called four Flutter helper functions and defined none of them, so
pod installfailed on both platforms. The file saidflutter_install_all_ios_pods(or the macOS one) and stopped there. Those are Ruby methods from Flutter'spackages/flutter_tools/bin/podhelper.rb, and a Podfile only has them after it requires that file, which it can only do once it knows where the Flutter SDK is. So the whole preamble Flutter'stemplates/cocoapods/Podfile-*carry is load-bearing rather than decoration: aflutter_rootfunction that readsFLUTTER_ROOTout of the generated xcconfig (ios/Flutter/Generated.xcconfigon iOS,macos/Flutter/ephemeral/Flutter-Generated.xcconfigon macOS, each raising a named error when it is absent becauseflutter pub gethas not run), therequireofpodhelperrelative to it, and theflutter_ios_podfile_setup/flutter_macos_podfile_setupcall. The created file now carries all of it, generated from Flutter 3.47's own two templates, along with the analytics opt-out, theproject 'Runner'build-configuration map and apost_installblock calling the platform'sflutter_additional_*_build_settings. It diverges from the templates in exactly two places, both deliberate: the iOSplatformline is written uncommented, becausesetPlatformVersionedits that line and a commented one would make the bump inert, and the nestedtarget 'RunnerTests'block is omitted, because CocoaPods aborts on a target name itsRunner.xcodeprojdoes not carry and a project without a Podfile need not have a test target. Worth stating plainly: before this, the created file could notpod installon EITHER platform. The macOS fix above corrected which helper was named; it was still a name nothing defined. -
addPodLineandaddPostInstallHookrefuse to create a Podfile when the caller does not name a platform. Both gained an optionalplatform:argument; without it an absent file throwsFileSystemExceptionexactly as it did before this branch. Neither method can infer the platform from its own arguments, and a Podfile is platform-shaped down to the podhelper function it calls, so guessing produces the broken file described above. Refusing to create one is the recoverable failure.setPlatformVersionalready takes the platform and creates as before. -
InjectPodfileLinecreates an absent Podfile again. The refusal above cost the op the capability it was given earlier on this branch:InstallTransactioncalledaddPodLinewithoutplatform:, so on a project whoseios/ormacos/directory holds no Podfile (every Swift Package Manager project, always) the op stopped withPodfile not foundinstead of writing one. It carriesop.platformand now forwards it, so both platforms get a file of the right shape. It is the onlyPodfileEditorcall site inlib/that mutates a file; the other reference,ConflictDetector, only computes the path. -
A created Podfile no longer declares a deployment target three major versions below the project's own. It said
platform :ios, '12.0', a constant with nothing behind it; the created file now declares iOS15.0and macOS12.0, the values Flutter 3.47's ownflutter createtemplates carry (templates/cocoapods/Podfile-iosandPodfile-macos), and iOS15.0is also theIPHONEOS_DEPLOYMENT_TARGETof the consumer this work was driven by. Reading the project's real target would beat any constant, but it lives inRunner.xcodeproj/project.pbxprojand the helper is handed a Podfile path only. Under-declaring is the harmful direction: CocoaPods then resolves pod versions older than the project can use.
Added
XcodeProjectEditor.setEntitlementsPath(), a trivia-preserving OpenStep-plist reader and writer for.pbxproj, with one public setter and no general mutation API. Three properties are load-bearing rather than incidental. It scopes the write to thePBXNativeTargetwhoseproductTypeiscom.apple.product-type.application, reached through itsbuildConfigurationList: a stock Flutter project holds nineXCBuildConfigurationblocks and only three are the app's, so a naive sweep would put a signing entitlement on the test bundle and the project defaults. It parses, re-emits and compares byte for byte before touching disk, and refuses rather than writing a partially-edited project, because a truncated.pbxprojcannot be opened and the installer's helper-backed ops do not roll back. And it never REPOINTS a configuration that already names a different entitlements file: every macOS Flutter project carriesRunner/DebugProfile.entitlementsandRunner/Release.entitlements, and silently overwriting those would drop the sandbox grants they hold.
Documentation
- The installer DSL page described the smaller half of what
injectEntitlementdoes. Its table said the op sets a key inRunner.entitlementsand said nothing about theCODE_SIGN_ENTITLEMENTSwrite into<platform>/Runner.xcodeproj/project.pbxproj, a second file the transaction cannot roll back, nor about the three cases that warn and skip it (no.xcodeproj, a target already signing with another entitlements file, which is every macOS project, and a project the.pbxprojreader refuses). A plugin author reading that page would stage the op without knowing which files it touches, which is the same under-reporting the dry-run preview exists to prevent. - The caret constraint quoted by
doc/getting-started/installation.md,doc/commands/install.mdanddoc/plugins/authoring.mdnow tracks this release. One of them still said^0.0.4, which tells a reader the package never moved.