Skip to content

Conversation

@cbracken
Copy link
Member

@cbracken cbracken commented Feb 7, 2017

No description provided.

Copy link
Contributor

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. There is no sense in doing this is in non-release modes. It will just add to the time it takes to launch the application for development/debugging. Also, I would write it in Dart instead of shell.

When building against frameworks that are distributed as
multi-architecture fat binaries, we want to strip the frameworks we
distribute down to only the architectures specified in $ARCHS.

This patch adds:
* The ability to specify commands to xcode_backend.sh (if none is
  specified, run BuildApp for backward compatibility).
* A 'thin' command that invokes lipo to thin down the distributed as
  described above.
Invokes xcode_backend.sh thin on the build application.
Flutter does not yet support armv7 iOS devices. Limit the $ARCHS build
variable to arm64 until then.
@cbracken
Copy link
Member Author

cbracken commented Feb 7, 2017

Rewritten from scratch with some additional error checking and lipo -info output in the case where an architecture isn't present.

There is no sense in doing this is in non-release modes.

Is there a foolproof way of detecting release vs non-release builds? CONFIGURATION won't be safe since developers can rename them at will. It'd be relatively simple to rule it out for simulator builds with a check against CURRENT_PLATFORM == iphonesimulator but that doesn't cover device debug builds. There are probably a few other heuristics we could use (like whether debug symbols are enabled), but given that it takes ~0.4s to run this (with just the Flutter framework), I wonder if the additional complexity is worth it.

@cbracken
Copy link
Member Author

cbracken commented Feb 7, 2017

Fixes #7908.

@chinmaygarde
Copy link
Contributor

lgtm. I guess if it is fast enough, it doesn't matter.

@cbracken
Copy link
Member Author

cbracken commented Feb 7, 2017

sgtm. I've got a followup that rewrites all the thin command in Dart. Will get the build code and tests done and send as a followup patch.

That work still needs a bit of performance tuning; the runtime is ~1.2s vs 0.4s for the shell version. Will take a look at whether snapshotting helps significantly and if so, we can do what we do with the flutter tool.

@cbracken cbracken merged commit 1926d11 into flutter:master Feb 7, 2017
@cbracken cbracken deleted the xcodebuild-thin branch February 7, 2017 20:04
@xster
Copy link
Member

xster commented Feb 7, 2017

I may be reading incorrectly but wouldn't this cause issues with armv7 users if we declare support for standard architectures but stripped out armv7 from libraries?

@cbracken
Copy link
Member Author

cbracken commented Feb 7, 2017

Part of this patch was to change the ARCHS setting from 'Standard architectures' to arm64. We don't update VALID_ARCHS, but given that Xcode only builds the intersection of VALID_ARCHS and ARCHS, we should be okay. (Personally I'd like to get armv7 builds working and revert 388280f.

@xster
Copy link
Member

xster commented Feb 7, 2017

Ah, understood

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants