Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Allow xctool to build with Buck #518

Merged
merged 6 commits into from May 29, 2015
Merged

Allow xctool to build with Buck #518

merged 6 commits into from May 29, 2015

Conversation

bhamiltoncx
Copy link
Contributor

This doesn't yet build the mobile-installation-helper.app, but that's next.

I'm thinking about how we might want to run xctool tests via Buck. Maybe directly with xctest?

I tested this with:

% buck build :xctool-zip
% unzip -l buck-out/gen/xctool.zip
Archive:  buck-out/gen/xctool.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  05-27-15 21:28   bin/
   690468  05-27-15 21:28   bin/xctool
        0  05-27-15 21:28   lib/
    59004  05-27-15 21:28   lib/otest-query-lib-ios.dylib
    62868  05-27-15 21:28   lib/otest-query-lib-osx.dylib
   102496  05-27-15 21:28   lib/otest-shim-ios.dylib
   106360  05-27-15 21:28   lib/otest-shim-osx.dylib
    39668  05-27-15 21:28   lib/sim-shim.dylib
        0  05-27-15 21:28   libexec/
        0  05-27-15 21:28   libexec/mobile-installation-helper.app/
    24896  05-27-15 21:28   libexec/otest-query-ios
    63020  05-27-15 21:28   libexec/otest-query-osx
        0  05-27-15 21:28   reporters/
    35600  05-27-15 21:28   reporters/json-compilation-database
    25292  05-27-15 21:28   reporters/json-stream
    43844  05-27-15 21:28   reporters/junit
    35804  05-27-15 21:28   reporters/phabricator
    83356  05-27-15 21:28   reporters/plain
    83356  05-27-15 21:28   reporters/pretty
    39392  05-27-15 21:28   reporters/teamcity
    31088  05-27-15 21:28   reporters/user-notifications
 --------                   -------
  1526512                   21 files

I also ran the compiled xctool by hand to run a few tests for iOS, it worked fine.

This doesn't yet build the mobile-installation-helper.app, but that's next.
@grp
Copy link
Contributor

grp commented May 28, 2015

Can Buck support the concept of host/target platforms, so you can avoid some of the genrule()'s and hardcoding #macosx-x86_64?

Can you avoid the lipo genrules and assume that when that support is needed, Buck will handle fat binaries natively?

@bhamiltoncx
Copy link
Contributor Author

Can Buck support the concept of host/target platforms, so you can avoid some of the genrule()'s and hardcoding #macosx-x86_64?

Can you avoid the lipo genrules and assume that when that support is needed, Buck will handle fat binaries natively?

These are all awesome questions. Since Buck was written and designed to build Java, it doesn't have the concept of host/target platforms yet. I've been thinking about how to integrate those.

@LegNeato
Copy link
Contributor

🎉

bhamiltoncx added a commit that referenced this pull request May 29, 2015
Allow xctool to build with Buck
@bhamiltoncx bhamiltoncx merged commit 3229558 into master May 29, 2015
@bhamiltoncx bhamiltoncx deleted the beng/buck branch May 29, 2015 23:41
sdwilsh pushed a commit to facebook/buck that referenced this pull request Jun 3, 2015
Summary:
Currently, Buck `apple_test` rules use the open-source
`xctool` utility, which either has to exist in the repository
as a compiled binary, or called via a wrapper script which uses
Xcode to build the utility.

Building `xctool` with Xcode takes about 45 seconds and gives
no visible output to the user.

@k21 mentioned it'd make more sense to build xctool from
source, and I agree.

As an alternative, this builds on this pull request I sent in:

facebookarchive/xctool#518

to allow building xctool from source with Buck itself. This will
allow us to cache it in the HTTP cache, etc.

Because `xctool` is sensitive to the layout of its files, we have to
invoke a `genrule` which lays out the binary, its supporting
utilities, and supporting libraries in the correct directory
structure, then zips the result. We unzip it before running the tests.

Test Plan:
Updated `xctool` to commit 2978953f5b3dff49da0e57ad60497054f9023072
in Apple repo.

Added to `.buckconfig.local`:

  [apple]
    xctool_zip_dep = //path/to:xctool-zip

Ran `buck test //path/to:apple_test`, confirmed it built xctool and ran
test successfully.

If we like this approach, I can deprecate the support for running
`xctool` directly and remove the copy of the binary we have checked
in to the `test` directory.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants