Giter Club home page Giter Club logo

bucksample's People

Contributors

andre-alves-ifood avatar bachand avatar bogo avatar dependabot[bot] avatar dfed avatar fdiaz avatar gsabran avatar lcsmarcal avatar lostatseajoshua avatar mgrebenets avatar qyang-nj avatar rockbruno avatar rz-robsn avatar shepting avatar stephengroat avatar thexande avatar xianwen avatar zayhero avatar zayhero-zz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bucksample's Issues

[Feature] Add bitcode support

It would be great to have bitcode support added to the sample.

From the research I had earlier, it's the -fembed-bitcode flag that has to be added to compiler and linker flags.
I tried it before, but I think I may have missed couple options, like Swift compiler flags or maybe even ldflags (?).

Ideally, the bitcode option should be an on/off option in .buckconfig, which could then be controlled from command line.

The reason: to be able to build different projects in monorepo with and without bitcode.
We actually have a setup, where one app can enable bitcode but another one cannot (due to 3-rd party pre-built binary missing bitcode).

I think building with/without bitcode, would mean that different cache directory should be used.

Or, what I tried as well, everything that can be built with bitcode, should be built with bitcode, but then when, say a library, is used in an app that doesn't support bitcode, the bitcode can be stripped out of the binary. That, or each library can generate two artifacts, one with bitcode, one stripped, so then the apps/target products can pick the one fitting their needs.

Exception when running `buck build`

$ buck build src/ImportObjC
[-] PROCESSING BUCK FILES...FINISHED 0.0s 🏖  Watchman reported no changes
[-] DOWNLOADING... (0.00 B/S AVG, TOTAL: 0.00 B, 0 Artifacts)
[-] BUILDING...FINISHED 0.0s
[2017-08-20 13:00:48.450][error][command:null][tid:313][com.facebook.buck.cli.Main] Uncaught exception at top level
java.lang.StackOverflowError
	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
	at java.util.TimSort.sort(TimSort.java:220)
	at java.util.Arrays.sort(Arrays.java:1512)
	at com.google.common.collect.ImmutableSortedSet.construct(ImmutableSortedSet.java:369)
	at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:298)
	at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:321)
	at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:235)
	at com.facebook.buck.rules.TargetNodeFactory.create(TargetNodeFactory.java:124)
	at com.facebook.buck.rules.TargetNodeFactory.copyNodeWithFlavors(TargetNodeFactory.java:188)
	at com.facebook.buck.rules.TargetNode.copyWithFlavors(TargetNode.java:202)
	at com.facebook.buck.rules.TargetGraph.getInternal(TargetGraph.java:68)
	at com.facebook.buck.rules.TargetGraph.get(TargetGraph.java:78)
	at com.facebook.buck.rules.BuildRuleResolver.requireRule(BuildRuleResolver.java:132)
	at com.facebook.buck.rules.BuildRuleResolver.requireAllRules(BuildRuleResolver.java:158)
	at com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer.transform(DefaultTargetNodeToBuildRuleTransformer.java:39)
	at com.facebook.buck.rules.BuildRuleResolver.requireRule(BuildRuleResolver.java:133)

The stack trace is hundreds of lines long, and consists of the last three lines repeated.

Import Realm pod

Hi, thanks for this great sample app! I've tried to use if with Realm:

# Podfile
pod 'RealmSwift'
# Pods/BUCK

apple_pod_lib(
    name = "Realm",
    visibility = ["PUBLIC"],
    exported_headers = glob([
        "Realm/**/*.h",
        "Realm/**/*.hpp",
    ]),
    srcs = glob([
        "Realm/**/*.m",
        "Realm/**/*.mm",
        "Realm/**/*.cpp",
    ]),
)

apple_pod_lib(
    name = "RealmSwift",
    visibility = ["PUBLIC"],
    swift_version = "4.2",
    srcs = glob([
        "RealmSwift/**/*.swift",
    ]),
    deps = [
        "//Pods:Realm"
    ],
)

But then when building my project I get the error:

In target '//Pods:Realm', 'Realm/history.hpp' maps to the following header files:
- .../BuckSample/Pods/Realm/include/core/realm/sync/history.hpp
- .../BuckSample/Pods/Realm/include/core/realm/history.hpp

Please rename one of them or export one of them to a different path.

What is the best way to deal with this?

`apple_test_all` won't run when pre-compiled libraries are included

This is a bit of a non-intuitive thing about Buck in general where pre-compiled libraries aren't auto-embedded, so it might be worth including as an example. Makes sense since you have to add the Copy Files phase in Xcode, but it feels like Buck would do that for you but doesn't (there are issues logged around this in the Buck repo).

Biggest consequence of that is you have to redefine those dependencies to get apple_test_all to work and not crash at runtime, which it doesn't have the flexibility to do.

Thinking redefining it as:

def apple_test_all(
        libraries = [],
        additional_tests = [],
        additional_deps = [],
        **kwargs):
    ci_test_libraries = []
    for library in libraries:
        ci_test_libraries.append(ci_test_name(test_name(library)))

    apple_test_lib(
        deps = ci_test_libraries + additional_tests + additional_deps,
        bundle_for_ci = False,
        **kwargs
    )

should work fine.

Issues with importing *-Swift.h in an apple_binary()

I'm trying to create an apple_binary() that contains swift code which will be called by Obj-C. It seems that I can't get the header to resolve. For background, I'm trying to convert a xcodeproj into a BUCK project. The xcode project has the following options defined:

  • Defines Module = Yes
  • Project Module Name = foo

So we have some Obj-C files that have the import

#import "foo-Swift.h"

But when building with buck, we are unable to resolve this header. Although this is similar to #5, its not totally the same as we are not building a library and ideally would rather not have the swift header prefix be the same as the target, since we have multiple targets which depend on the same objc file that makes this import.

Created a fork with commit: davidxiasc@c811b95 to demonstrate the issue.

Command run:

buck build //Libraries/SwiftAndObjc:SwiftAndObjcBinary

So far, I've tried adding the following swift compiler flags:

-emit-module -module-name foo

as this is what was generated by the output of xcodebuild when building the swift files. However, -module-name foo produces an additional error:

<unknown>:0: error: unknown argument: '-module-name foo'

Any guidance on how to resolve this would be much appreciated! 🙂

Tests take 15 seconds to run, if run individually

I did:

git clone https://github.com/airbnb/BuckSample.git
cd BuckSample
make install_buck
tools/buck test //Libraries/ASwiftModule:ASwiftModuleTests

The result of executing those commands is as follows:

Starting new Buck daemon...
Parsing buck files: finished in 0.5 sec
Building: finished in 3.8 sec (100%) 11/11 jobs, 11 updated
  Total time: 4.6 sec
Testing: finished in 17.3 sec (1 PASS/0 FAIL)
RESULTS FOR //Libraries/ASwiftModule:ASwiftModuleTests
PASS     15.0s  1 Passed   0 Skipped   0 Failed   SomeASwiftModuleTests
TESTS PASSED

The test executes properly (it passes/fails properly), but takes 15 exact seconds to finish.
Any idea whats going on?

Thanks!

Add example of App Clip

When we can support Xcode 12 in CI let's add an example of multiple App Clips, so we can learn how that will work.

Cannot Import *-Swift.h generated header file from Obj-c

Hi,
thanks so much for providing this information. it really helped me starting out with Buck.

I'm trying to setup a simple project with Objc and Swift inter-op.
I can successfully use Objc from Swift using the bridging header, however I cannot use Swift from Objc code.

When trying to #import "App-Swift.h" (App is the module name) from the obj m file and try to build using Buck, I get the following error:
stderr: App/App.m:3:9: fatal error: 'App-Swift.h' file not found

Any hints?
I am using the latest version of buck which I've installed from the original repo. I know you are using a custom version of it but I am not really sure how to try this out.

Any hints would be extremely helpful. thanks!

Running `make test` fails with Xcode 10.2

I updated my machine to Xcode 10.2 today, and now I can't run make test locally. Here's the error I'm getting:

$ make test
tools/buck test //App:ExampleAppCITests --test-runner-env FOO=BAR
Building: finished in 15.6 sec (100%) 159/159 jobs, 49 updated
  Total time: 15.7 sec
Testing: finished in 6.7 sec
RESULTS FOR //App:ExampleAppCITests //App:UnitTests //App:UnitTestsWithHostApp //App:XCUITests
FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle: 
stdout:

stderr:
This copy of libswiftCore.dylib requires an OS version prior to 12.2.0.
Child process terminated with signal 6: Abort trap

FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle: 
stdout:

stderr:
This copy of libswiftCore.dylib requires an OS version prior to 12.2.0.
Child process terminated with signal 6: Abort trap

FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle: 
stdout:

stderr:
This copy of libswiftCore.dylib requires an OS version prior to 12.2.0.
Child process terminated with signal 6: Abort trap

====TEST STATUS MESSAGES====
[2019-04-08 16:32:17.473][INFO] Collecting info for testables...
[2019-04-08 16:32:17.473][INFO] Collecting info for testables...
[2019-04-08 16:32:18.656][INFO] Collecting info for testables...
[2019-04-08 16:32:18.706][INFO] Collecting info for testables...
[2019-04-08 16:32:21.348][INFO] Collecting info for testables...
[2019-04-08 16:32:22.926][INFO] Collecting info for testables...
TESTS FAILED: 3 FAILURES
Failed target: //App:ExampleAppCITests
FAIL Internal error from test runner
Failed target: //App:UnitTests
FAIL Internal error from test runner
Failed target: //App:UnitTestsWithHostApp
FAIL Internal error from test runner
make: *** [test] Error 32

Modify Swift method implementation shouldn't cause rebuilding its dependents

First, we make sure SecondSwiftModule is already up to date, and we check the md5sum of its dependency module YetAnotherSwiftModule.swiftmodule:

➜  BuckSample git:(master) ✗ tools/buck build //Libraries/SecondSwiftModule -v 3
PARSING BUCK FILES: FINISHED IN 0.0s
CREATING ACTION GRAPH: FINISHED IN 0.0s
FOUND 1/1 JOBS 0.0s //Libraries/SecondSwiftModule:SecondSwiftModule#iphonesimulator-x86_64,static
DOWNLOADED 0 ARTIFACTS, 0.00 BYTES, 0.0% CACHE MISS
BUILDING: FINISHED IN 0.0s (100%) 1/1 JOBS, 0 UPDATED
BUILD SUCCEEDED

➜  BuckSample git:(master) ✗ md5sum /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule\#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule
f3845ab1513135544bb1cf881fd870c3  /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule

And then, we modify a Swift method implementation in YetAnotherSwiftModule like the following:

image

Now we try to compile SecondSwiftModule again, the expected behavior is that SecondSwiftModule should not be rebuilt, but the reality is the SecondSwiftModule is indeed being rebuilt:

➜  BuckSample git:(master) ✗ tools/buck build //Libraries/SecondSwiftModule -v 3
PARSING BUCK FILES: FINISHED IN 0.0s
CREATING ACTION GRAPH: FINISHED IN 0.0s
FOUND 1/6 JOBS 0.0s //Libraries/YetAnotherSwiftModule:YetAnotherSwiftModule
FOUND 2/6 JOBS 0.0s //Libraries/YetAnotherSwiftModule:YetAnotherSwiftModule#header-mode-symlink-tree-with-modulemap,headers,iphonesimulator-x86_64
FOUND 3/6 JOBS 0.0s //Libraries/YetAnotherSwiftModule:YetAnotherSwiftModule#apple-swift-objc-generated-header,iphonesimulator-x86_64
mkdir -p buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64
swift-filelist
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -frontend -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -target x86_64-apple-ios11.0 -c -enable-objc-interop -parse-as-library -serialize-debugging-options -module-name YetAnotherSwiftModule -emit-module -emit-module-path buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule -emit-objc-header-path buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule-Swift.h -o buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.o -swift-version 5 -DBUCK -whole-module-optimization -Onone -DDEBUG -enable-testing -g -warnings-as-errors -filelist /Users/xianwen/work/BuckSample/buck-out/bin/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64__filelist.txt
[/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc, -frontend, -sdk, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk, -target, x86_64-apple-ios11.0, -c, -enable-objc-interop, -parse-as-library, -serialize-debugging-options, -module-name, YetAnotherSwiftModule, -emit-module, -emit-module-path, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule, -emit-objc-header-path, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule-Swift.h, -o, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.o, -swift-version, 5, -DBUCK, -whole-module-optimization, -Onone, -DDEBUG, -enable-testing, -g, -warnings-as-errors, -filelist, /Users/xianwen/work/BuckSample/buck-out/bin/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64__filelist.txt]
mkdir -p buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64
swift-filelist
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -frontend -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -target x86_64-apple-ios11.0 -Xcc -I -Xcc buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-objc-generated-header,iphonesimulator-x86_64.hmap -Xcc -I -Xcc buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#header-mode-symlink-tree-with-modulemap,headers,iphonesimulator-x86_64 -Xcc -I -Xcc buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64 -Xcc -I -Xcc buck-out -I /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64 -c -enable-objc-interop -parse-as-library -serialize-debugging-options -module-name SecondSwiftModule -emit-module -emit-module-path buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule.swiftmodule -emit-objc-header-path buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule-Swift.h -o buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule.o -swift-version 5 -DBUCK -whole-module-optimization -Onone -DDEBUG -enable-testing -g -warnings-as-errors -filelist /Users/xianwen/work/BuckSample/buck-out/bin/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64__filelist.txt
BUILT 4/6 JOBS 0.1s //Libraries/YetAnotherSwiftModule:YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64
[/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc, -frontend, -sdk, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk, -target, x86_64-apple-ios11.0, -Xcc, -I, -Xcc, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-objc-generated-header,iphonesimulator-x86_64.hmap, -Xcc, -I, -Xcc, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#header-mode-symlink-tree-with-modulemap,headers,iphonesimulator-x86_64, -Xcc, -I, -Xcc, buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64, -Xcc, -I, -Xcc, buck-out, -I, /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64, -c, -enable-objc-interop, -parse-as-library, -serialize-debugging-options, -module-name, SecondSwiftModule, -emit-module, -emit-module-path, buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule.swiftmodule, -emit-objc-header-path, buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule-Swift.h, -o, buck-out/gen/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64/SecondSwiftModule.o, -swift-version, 5, -DBUCK, -whole-module-optimization, -Onone, -DDEBUG, -enable-testing, -g, -warnings-as-errors, -filelist, /Users/xianwen/work/BuckSample/buck-out/bin/Libraries/SecondSwiftModule/SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64__filelist.txt]
FOUND 5/6 JOBS 0.0s //Libraries/SecondSwiftModule:SecondSwiftModule#iphonesimulator-x86_64,static
BUILT 6/6 JOBS 0.2s //Libraries/SecondSwiftModule:SecondSwiftModule#apple-swift-compile,iphonesimulator-x86_64
DOWNLOADED 0 ARTIFACTS, 0.00 BYTES, 100.0% CACHE MISS
BUILDING: FINISHED IN 0.3s (100%) 6/6 JOBS, 2 UPDATED
BUILD SUCCEEDED

However, when we review the md5sum of YetAnotherSwiftModule.swiftmodule, it remains the same:

➜  BuckSample git:(master) ✗ md5sum /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule\#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule
f3845ab1513135544bb1cf881fd870c3  /Users/xianwen/work/BuckSample/buck-out/gen/Libraries/YetAnotherSwiftModule/YetAnotherSwiftModule#apple-swift-compile,iphonesimulator-x86_64/YetAnotherSwiftModule.swiftmodule

Question about Embedded Binaries (Carthage frameworks) in generated Xcode workspace

all prebuilt_apple_framework in generated via buck Xcode workspace goes as Embedded Binaries and also in Copy Files in Build Phase, for example FirebaseAnalytics.

So it leads to some building/running issues and bad developer experience while working with generated project.

Is there any chance to exclude this frameworks from generated Copy Files?

Update CI to Xcode 10

I cannot merge my Siri Shortcut PR (#86) until we update CI to Xcode 10 since Siri Shortcuts are a feature of Xcode 10.

Is it supported on Linux?

I'm looking for a tool like this for our Azure VMSS build box, as Microsoft does not support Mac OS hosts. Both Buck and Swift should be compatible with Linux, but I know Apple's walled garden might still get in the way.

Add instructions to README.md on how to run the watch app via Buck CLI

I spent a few minutes on this and I can't figure it out.

I ran make debug, and then tried opening a Watch simulator via the "Hardware" menu of the simulator, but it wasn't paired.

I then tried running xcrun simctl list to see if I could specify a paired iPhone + Watch simulator, but I wasn't sure how to specify one on the command line.

Ideally there would be a command to do this in the Makefile if that's possible.

[Feature Request] Extend sample with support for Release and Debug configurations

Currently the sample is built in what seems to be Debug configuration.
Having support for Release vs Debug would be of great help.

E.g. Release is build with optimizations like -O (speed) or -Osize and -whole-module-optimization.
While Debug is built with SWIFT_COMPILATION_MODE=singlefile (no -whole-module-optimization flag).

Release should be built with DEBUG_INFORMATION_FORMAT = dwarf-with-dsym, which I think means removing -g flag.
No -enable-testing, maybe -DNS_BLOCK_ASSERTIONS=1 if the intention is to turn assertions off for release. No -D DEBUG I guess, etc.

If possible, having a script that packages xcarchive from buck output would be super helpful too. We've got this https://gist.github.com/mgrebenets/8fe4289603aaec0dfeae5eacfae203d6 so far, but it can be improved further and maybe wrapped into/replaced with buck genrule?

[Feature Request] Basic build caching on CI

CircleCI has some cache support that should let us cache the artifacts to some extent. It's pretty easy to add in, but it depends on the flow you want to use:

  1. Cache artifacts on the master branch always with a key

or

  1. Use the master cache, then cache artifacts on each branch after a PR is made and built under a separate key

As long as CircleCI is running tests on the "default" branch each time 1 isn't too bad alone and should give most of the benefits

Running `make test` fails with Xcode 11.1

I cloned the BuckSample to study and I can't run make test.

I made these steps:

  • make install_buck
  • make update_cocoapods
  • make project
  • make test

In the Xcode everything goes well, but in the terminal I receive this:

$ make test
tools/buck test //App:ExampleAppCITests --test-runner-env XCTOOL_TEST_ENV_LLVM_PROFILE_FILE="/Users/renatomendes/Developer/Personal/BuckSample/buck-out/tmp/code-%p.profraw%15x" \
		--config custom.other_cflags="\$(config custom.code_coverage_cflags)" \
		--config custom.other_cxxflags="\$(config custom.code_coverage_cxxflags)" \
		--config custom.other_ldflags="\$(config custom.code_coverage_ldflags)" \
		--config custom.other_swift_compiler_flags="\$(config custom.code_coverage_swift_compiler_flags)"
Building: finished in 0.0 sec (100%) 62/62 jobs, 0 updated
  Total time: 0.4 sec
Testing: finished in 1.9 sec
RESULTS FOR //App:ExampleAppCITests //App:UnitTests //App:UnitTestsWithHostApp
FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle:
stdout:

stderr:
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=165):
Invalid device state

FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle:
stdout:

stderr:
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=165):
Invalid device state

FAIL    <100ms  0 Passed   0 Skipped   1 Failed   Internal error from test runner
FAILURE Internal error from test runner main: Failed to query the list of test cases in the test bundle:
stdout:

stderr:
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=165):
Invalid device state

====TEST STATUS MESSAGES====
[2019-10-23 16:57:56.712][INFO] Collecting info for testables...
[2019-10-23 16:57:56.712][INFO] Collecting info for testables...
[2019-10-23 16:57:56.846][INFO] Collecting info for testables...
[2019-10-23 16:57:56.846][INFO] Collecting info for testables...
[2019-10-23 16:57:57.627][INFO] Collecting info for testables...
[2019-10-23 16:57:57.763][INFO] Collecting info for testables...
TESTS FAILED: 3 FAILURES
Failed target: //App:UnitTestsWithHostApp
FAIL Internal error from test runner
Failed target: //App:UnitTests
FAIL Internal error from test runner
Failed target: //App:ExampleAppCITests
FAIL Internal error from test runner
make: *** [test] Error 32

I'm doing something wrong?

[Feature Request] Support for Codegen tasks

Hi.

This feature request is about adding support for code generation tasks.
Code generation (codegen) tasks are quite common these days.
Once such example is using https://github.com/SwiftGen/SwiftGen to generate Swift code for images, assets or storyboards used in the app.

The thing with codegen tasks, is that they run before the actual build.
In case of Xcode, codegen tasks would be added as custom build phases to be ran before "Compile Sources" build phase.

The feature request / question is how should codegen be done when it comes to Buck?

AFAIK, but rules don't ever write things back to the repo itself (unless ugly workarounds are used). We are using such ugly workaround where genrule is running a shell script and that shell script writes directly into ROOT_REPO/... path(s) where ROOT_REPO is another ugly thing we did as REPO_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))).

Moving towards Starlark, we can't do things like __file__ and such.

Unable to run `ExampleWatchApp` from Buck-generated Xcode project

Steps

  1. make project.
  2. Create a scheme for ExampleWatchApp#watchsimulator-i386.
  3. Build and run.

Result

Both the iPhone and Watch simulators open. The app is not installed on the watch.

Other attempts

  • I tried explicitly installing ExampleWatchApp via the Watch app on the iPhone simulator.
  • I tried creating a scheme for ExampleWatchAppExtension#watchsimulator-i386 instead and then building and running.

Neither of these worked.

Precompiled Library Issue (no such module)

I'm trying to get a build of a precompiled library (https://cocoapods.org/pods/AdobeMobileSDK). It compiles normally but when I try to import on my Swift project I'm getting stuck on no such module 'AdobeMobileSDK'.

prebuilt_cxx_library(
  name = 'AdobeMobileSDK',
  visibility = ["PUBLIC"],
  static_lib = 'AdobeMobileSDK/AdobeMobileLibrary/libAdobeMobile.a',
  exported_headers = glob([
    'Target Support Files/AdobeMobileSDK/*.h',
    'AdobeMobileSDK/AdobeMobileLibrary/*.h',
  ])
)

I'm wondering me if somebody is familiar with this issue

linker flags error in cxx_library and "-I $(location //targets:myrule)" preprocessor flags

Hi guys, I have 2 issues in buck_local project generation.

1. cxx_library rule is not included in linker flags BuckLocal/BUCK. This mapping caused compiler error (missing symbol) when I used cxx_library rule.

Current

cxx_library() not included in linker flags BuckLocal/BUCK

Expected

library gets linked in BuckLocal/BUCK
Screen Shot 2021-03-25 at 13 43 44

2. Some of my rules are using preprocessor_flag = ["-I $(location //targets:myrule)"]. Somehow this gets filtered in the query and included in linker flags.

Current

Screen Shot 2021-03-25 at 13 39 28

Caused by
Screen Shot 2021-03-25 at 13 41 47

Expected

string "-lct#iphonesimulator-x86_64,private-headers.hm" not included in linker flags

Issue with @testable import test

I am currently having an issue, in my tests, I am using @testable import to access the API code I want to test.

Here my BUCK:

buck test :chatApp

apple_asset_catalog(
  name = 'Assets',
  app_icon = 'AppIcon',
  dirs = ['app/Assets.xcassets'],
)

apple_resource(
  name = 'appResources',
  files = glob(['app/*.png', 'app/**/*.storyboard']),
)

apple_bundle(
  name = 'app',
  binary = ':appBinary',
  extension = 'app',
  info_plist = 'app/Info.plist',
  tests = [':appTests']
)

apple_binary(
  name = 'appBinary',
  deps = [':appResources', ':Assets'],
  srcs = glob([
    'app/**/*.swift'
  ]),
  frameworks = [
    '$SDKROOT/System/Library/Frameworks/UIKit.framework',
    '$SDKROOT/System/Library/Frameworks/Foundation.framework',
  ]
)

apple_package(
  name = 'appPackage',
  bundle = ':app'
)

apple_test(
  name = 'appTests',
  test_host_app = ':app',
  run_test_separately = True,
  info_plist = 'appTests/Info.plist',
  srcs = glob([
    'appTests/**/*.swift'
  ]),
  frameworks = [
    '$SDKROOT/System/Library/Frameworks/Foundation.framework',
    '$SDKROOT/System/Library/Frameworks/UIKit.framework',
    '$PLATFORM_DIR/Developer/Library/Frameworks/XCTest.framework',
  ]
)

I am having a runtime crash.
Is it possible to have the @testable import?
If not what is the other alternative to test my code?

Here the error :

Building... 0.4 sec
[2017-12-18 16:21:26.111][error][command:null][tid:465][com.facebook.buck.cli.Main] Uncaught exception at top level
java.lang.NullPointerException
	at java.util.Objects.requireNonNull(Objects.java:203)
	at java.util.Optional.<init>(Optional.java:96)
	at java.util.Optional.of(Optional.java:108)
	at com.facebook.buck.apple.AppleTestDescription.createTestHostInfo(AppleTestDescription.java:496)
	at com.facebook.buck.apple.AppleTestDescription.createBuildRule(AppleTestDescription.java:233)
	at com.facebook.buck.apple.AppleTestDescription.createBuildRule(AppleTestDescription.java:84)
	at com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer.transform(DefaultTargetNodeToBuildRuleTransformer.java:88)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.lambda$requireRule$0(SingleThreadedBuildRuleResolver.java:111)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.computeIfAbsent(SingleThreadedBuildRuleResolver.java:84)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.requireRule(SingleThreadedBuildRuleResolver.java:107)
	at com.facebook.buck.swift.SwiftLibraryDescription.createCompanionBuildRule(SwiftLibraryDescription.java:391)
	at com.facebook.buck.apple.AppleLibraryDescription.lambda$requireSingleArchUnstrippedBuildRule$8(AppleLibraryDescription.java:587)
	at java.util.Optional.flatMap(Optional.java:241)
	at com.facebook.buck.apple.AppleLibraryDescription.requireSingleArchUnstrippedBuildRule(AppleLibraryDescription.java:585)
	at com.facebook.buck.apple.AppleLibraryDescription.requireUnstrippedBuildRule(AppleLibraryDescription.java:546)
	at com.facebook.buck.apple.AppleLibraryDescription.createLibraryBuildRule(AppleLibraryDescription.java:441)
	at com.facebook.buck.apple.AppleTestDescription.createTestLibraryRule(AppleTestDescription.java:411)
	at com.facebook.buck.apple.AppleTestDescription.createBuildRule(AppleTestDescription.java:251)
	at com.facebook.buck.apple.AppleTestDescription.createBuildRule(AppleTestDescription.java:84)
	at com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer.transform(DefaultTargetNodeToBuildRuleTransformer.java:88)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.lambda$requireRule$0(SingleThreadedBuildRuleResolver.java:111)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.computeIfAbsent(SingleThreadedBuildRuleResolver.java:84)
	at com.facebook.buck.rules.SingleThreadedBuildRuleResolver.requireRule(SingleThreadedBuildRuleResolver.java:107)
	at com.facebook.buck.rules.ActionGraphCache$2.visit(ActionGraphCache.java:330)
	at com.facebook.buck.rules.ActionGraphCache$2.visit(ActionGraphCache.java:327)
	at com.facebook.buck.graph.AbstractBottomUpTraversal.traverse(AbstractBottomUpTraversal.java:36)
	at com.facebook.buck.rules.ActionGraphCache.createActionGraphSerially(ActionGraphCache.java:332)
	at com.facebook.buck.rules.ActionGraphCache.createActionGraph(ActionGraphCache.java:264)
	at com.facebook.buck.rules.ActionGraphCache.getActionGraph(ActionGraphCache.java:167)
	at com.facebook.buck.rules.ActionGraphCache.getActionGraph(ActionGraphCache.java:68)
	at com.facebook.buck.cli.TestCommand.runWithoutHelp(TestCommand.java:549)
	at com.facebook.buck.cli.AbstractCommand.run(AbstractCommand.java:232)
	at com.facebook.buck.cli.AbstractContainerCommand.run(AbstractContainerCommand.java:79)
	at com.facebook.buck.cli.BuckCommand.run(BuckCommand.java:82)
	at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:1101)
	at com.facebook.buck.cli.Main.runMainThenExit(Main.java:395)
	at com.facebook.buck.cli.Main.nailMain(Main.java:1855)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:329)

Running Buck on 32bit simulators

Both in the sample and my real app, Buck apps fails to run in iOS 10 when installing in the simulator: (the sample's target is iOS 11, but I've reduced it to test this out)

An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "com.airbnb.ExampleApp" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: Unspecified.
Underlying error (domain=FBSOpenApplicationErrorDomain, code=1):
	The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.)
BUILD FAILED: Cannot launch //App:ExampleApp#dwarf-and-dsym,no-include-frameworks (failed to launch bundle ID com.airbnb.ExampleApp)

The app itself gets installed after this, but trying to run it results in a crash at the splash screen. I was unable to retrieve a log for the sample app, but in my real app this crash happens inside UIKit: [UIView(AdditionalLayoutSupport) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:onBehalfOfLayoutGuide:]

Is this something that you guys have dealt with before in your production app?

.ipa path

Hi everybody,
I am trying to export ipa file.

Here is .buckconfig
`[cxx]
default_platform = iphonesimulator-x86_64
cflags = -g -fmodules -fobjc-arc -D BUCK -w
combined_preprocess_and_compile = true

[swift]
version = 3.2
compiler_flags = -DBUCK -whole-module-optimization -enable-testing -suppress-warnings
`

And BUCK file

`apple_resource(
name = 'AppResources',
dirs = [],
files = glob(['/*.xib','/*.storyboard']),
)

apple_asset_catalog(
name = 'AppAsset',
dirs = ['SampleApp/Assets.xcassets'],
)

apple_binary(
name = 'AppBinary',
srcs = glob([
'SampleApp/*.swift',
]),
deps = [':AppResources', ':AppAsset'],
frameworks = [
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
],
)

apple_bundle(
name = 'TheApp',
binary = ':AppBinary',
extension = 'app',
info_plist = 'SampleApp/Info.plist',
info_plist_substitutions = {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.some.bundleID',
'CURRENT_PROJECT_VERSION': '1',
'DEVELOPMENT_LANGUAGE': 'Base',
},
)

apple_package(
name = 'SampleAppPackage',
bundle = ':TheApp',
)
`

I don't know what to pass to apple_package() or apple_bundle() functions.
In configuration file I couldn't find .ipa export or archive path.

I would really appreciate if you could help me.
Thank you.

Issues when running make test command

While running make test command I get errors like this:

ERROR: /Users/grebenma/dev/oss/buck-samples/airbnb/BuckSample/tools/buck:2:3: invalid character: '�'
ERROR: /Users/grebenma/dev/oss/buck-samples/airbnb/BuckSample/tools/buck:2:4: invalid character: '�'
ERROR: /Users/grebenma/dev/oss/buck-samples/airbnb/BuckSample/tools/buck:2:5: invalid character: '�'

Looks like it tries to treat the whole tools/buck executable as a huge string.
I used this command to capture output make test 2>&1 | tee build.log

Running tools/buck test //App/Tests:Tests --all --exclude ui --test-runner-env FOO=BAR directly from command line causes same issue.

Running ./tools/buck build //App:ExampleAppBundle, however, works just fine, as well as make build.
tools/buck build //App/Tests:Tests also works fine.

@testable import ExampleAppBinary doesn't work

I've mentioned this issue on Slack channel, and wanted to try it with AirBnB's custom fork of buck.

Still no luck though.

Adding @testable import ExampleAppBinary to any of the tests, e.g. to BuckSampleTests.swift or BuckSampleUITests.swift causes this error:

Command failed with exit code 1.
stderr: App/UITests/BuckSampleUITests.swift:10:18: error: no such module 'ExampleAppBinary'
@testable import ExampleAppBinary
                 ^

While I can definitely find the ExampleAppBinary module with find buck-out -name "*ExampleApp*"

buck-out/gen/App/ExampleAppBinary#iphonesimulator-x86_64,swift-compile
buck-out/gen/App/ExampleAppBinary#iphonesimulator-x86_64,swift-compile/ExampleAppBinary.swiftmodule
buck-out/gen/App/ExampleAppBinary#iphonesimulator-x86_64,swift-compile/ExampleAppBinary-Swift.h
buck-out/gen/App/ExampleAppBinary#iphonesimulator-x86_64,swift-compile/ExampleAppBinary.o

I can't use it in Unit or UI tests though.

The original issue is here: facebook/buck#2074

P.S.
I know it's open source and all that, but I don't have the time and code base knowledge to locate the change that removed this functionality and revert just the bits that make app module imports work again.

Since this is the only up-to-date buck demo of mix-n-match project there is (🥇), I thought raising it here would draw some attention to it.

Also, I though most of AirBnB's changes made it to master already... At least I was able to use import statements in our mix-n-match project with modular=True flag using current master.

Error build on Xcode `make project`

Reproduce Method

  1. Clone git.
  2. Run command make project
  3. Xcode opened, then run cmd + B or build.
  4. Build failed.
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "SwiftAndObjc.h"
        ^
/<your env dir>/_p/1YWHeOsVjJ-pub/SwiftAndObjc/SwiftAndObjc.h:2:9: error: 'SwiftAndObjc/SwiftAndObjc-Swift.h' file not found
#import <SwiftAndObjc/SwiftAndObjc-Swift.h>
        ^
<unknown>:0: error: could not build Objective-C module 'SwiftAndObjc'

Xcode Version

10.1

[Question] How to know when a test result is cached?

Hello:

I am using buck and also bazel to run the same set of tests (in here). When running them with bazel, the output is as follows:

INFO: Analyzed 31 targets (0 packages loaded, 0 targets configured).
INFO: Found 25 targets and 6 test targets...
INFO: Elapsed time: 0.151s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
//Libraries/ObjcModule:ObjcModuleTests                          (cached) PASSED in 21.2s
//Libraries/SwiftApp:SwiftAppAppTests                           (cached) PASSED in 26.7s
//Libraries/SwiftApp:SwiftAppTests                              (cached) PASSED in 16.7s
//Libraries/SwiftModule:SwiftModuleAppTests                     (cached) PASSED in 27.9s
//Libraries/SwiftModule:SwiftModuleTests                        (cached) PASSED in 21.1s
//Libraries/SwiftModuleWithPrebuiltDependency:SwiftModuleWithPrebuiltDependencyTests (cached) PASSED in 18.2s

As you can see, it clearly indicates which of the test results were cached and which of them did run.

With buck I get the following output:

Not using buckd because watchman isn't installed.
Parsing buck files: finished in 0.5 sec
Building: finished in 0.8 sec (100%) 40/40 jobs, 0 updated
  Total time: 1.5 sec
Testing: finished in 12.2 sec (8 PASS/0 FAIL)
RESULTS FOR //Libraries/ObjcModule:ObjcModuleObjcTests //Libraries/ObjcModule:ObjcModuleTests //Libraries/SwiftApp:SwiftAppAppTests //Libraries/SwiftApp:SwiftAppTests //Libraries/SwiftModule:SwiftModuleAppTests //Libraries/SwiftModule:SwiftModuleTests //Libraries/SwiftModuleWithPrebuiltDependency:SwiftModuleWithPrebuiltDependencyTests
PASS    <100ms  1 Passed   0 Skipped   0 Failed   Tests
PASS    <100ms  2 Passed   0 Skipped   0 Failed   Tests
PASS    <100ms  2 Passed   0 Skipped   0 Failed   Tests
PASS    <100ms  1 Passed   0 Skipped   0 Failed   Tests
PASS    <100ms  1 Passed   0 Skipped   0 Failed   Tests
PASS    <100ms  1 Passed   0 Skipped   0 Failed   Tests
TESTS PASSED

How can I see which of those test results were cached, and which of them did actually run?

Thanks!

Running on iPhone X or higher (arm64e)

Hi,

I'm unable to run my project on iPhone X or higher (physical device).

I'm using the following command: ./buck install App#iphoneos-arm64 -d -r --verbose 8.

Log:

[2019-07-22 14:54:18.136][warn ][command:9306a98a-4de0-44bb-ad84-1e8b9ef986d6][tid:13][com.facebook.buck.util.Console] Build failure: Failed to install //App:MyApp#dwarf-and-dsym,iphoneos-arm64,no-include-frameworks to device DEVICE_UUID (Matheus | Booted | iPhone X | iOS 12.3.1 | arm64)

BUILD FAILED: Failed to install //App#dwarf-and-dsym,iphoneos-arm64,no-include-frameworks to device DEVICE_UUID (Matheus | Booted | iPhone X | iOS 12.3.1 | arm64)
INSTALLING: FINISHED IN 11,3s
[2019-07-22 14:54:18.138][info ][command:9306a98a-4de0-44bb-ad84-1e8b9ef986d6][tid:412][com.facebook.buck.event.listener.CriticalPathEventListener] Received command finished event for command : install

[2019-07-22 14:54:18.139][debug][command:9306a98a-4de0-44bb-ad84-1e8b9ef986d6][tid:411][com.facebook.buck.util.perf.ProcessTracker] shutDown

make: *** [debug_device] Error 6

fbsimctl tells my device is arm64e, but #iphoneos-arm64e flavor doesn't seem to exist.

Have you guys faced any similar issue? Thanks in advance :)

Exception when running `make debug`

When running make debug buck raises the following exception:

$ make debug                                                                                                                                                                                                                                                                 ()
buck  install //App:ExampleAppBundle --run
Building: finished in 0.0 sec (100%) 1/1 jobs, 0 updated
  Total time: 0.0 sec
Installing... 1.1 sec
BUILD FAILED: Cannot install //App:ExampleAppBundle#dwarf-and-dsym,no-include-frameworks (no appropriate simulator found)
make: *** [debug] Error 6

Can't build project after installing Java JDK

I cloned the project, ran make install_buck, and then ran make build.

tools/buck build //App:ExampleAppBundle
Not using buckd because watchman isn't installed.
No Java runtime present, requesting install.
Cannot verify that installed Java version at '/usr/bin/java' is correct.
make: *** [build] Error 1

I also got this popup.
Screen Shot 2019-03-21 at 12 41 40 AM

I clicked "More Info..." and was redirected here.

I downloaded and installed the JDK linked to from that page.

I then closed my shell and ran make build again. The same text was printed to the console and the popup appeared again.

XCode 11 issues with `UICollectionViewDiffableDataSourceCellProvider`

More just a placeholder for later

Command failed with exit code 1.
stderr: <unknown>:0: error: imported declaration 'UITableViewDiffableDataSourceCellProvider' could not be mapped to 'UITableViewDiffableDataSourceReference.CellProvider'
<unknown>:0: error: imported declaration 'UICollectionViewDiffableDataSourceCellProvider' could not be mapped to 'UICollectionViewDiffableDataSourceReference.CellProvider'

Siri does not read or display response text for Siri Shortcut

This issue is related to #86 (which is unmerged due to #102).

That PR gets a Siri Shortcut working with ExampleApp. Siri displays the custom Siri Shortcut UI but fails to display or read out the response text.

The response text for the .success case should be Here is a wild buck.

As I wrote #86, I built the same example Siri Shortcut in a manually managed Xcode project. In that project, the response text is displayed and read out as you would expect. I have tried diff'ing the resulting .app files and can't the culprit. The code for the manually managed example project is here: XcodeExampleApp.zip.

Here are the .app files and dSYMs for the working manually managed Xcode project and the broken Buck-generated project: 01 ExampleApp - correct.zip and 02 ExampleApp - no Siri phrase.zip.

Response text successfully read out in manually managed Xcode project No response text in Buck-generated Xcode project
Recording Recording

I have looked through the console logs of both the working and not working apps using Console.app (filtering for the term "example"). Sometimes (but not always) the broken Buck-built app will print out errors like this:

error	13:16:13.862344 -0700	assistant_service	-[AAPIntentsInfoSyncHandler getChangeAfterAnchor:changeInfo:] com.apple.siri.applications: No intents are supported by Intents extensions for com.airbnb.ExampleApp: (
    "<LSPlugInKitProxy: 0x7fbb55c4b160> pluginID=com.airbnb.ExampleApp.IntentExtension UUID=FFC456C5-061C-4B6E-B629-26DDA91FF66E version=1.0"
)

I tried changing the bundle identifier for the extensions to be com.airbnb.ExampleApp.ExampleIntentExtension and com.airbnb.ExampleApp.ExampleIntentUIExtension instead of com.airbnb.ExampleApp.IntentExtension and com.airbnb.ExampleApp.IntentUIExtension, respectively. I was curious if the issue was that the last component didn't match the bundle names for each extension. That did not resolve the issue. The full log output for a run of the Buck-built app that printed out that error message is here: sample_console_log_for_02_ExampleApp.txt. In this case the app was built with a Buck-generated Xcode project.

Other potentially useful information:

  • I have verified that Siri retrieves the response text from the .intentdefinition file in the root of the .app.
  • The issue occurs identically when building with Buck CLI or a Buck-generated Xcode project.
  • Code in both the Intent and IntentUI extensions is executing.
  • I have filed a Radar with Apple including artifacts from both the working manually managed Xcode project and the broken buck-generated Xcode project.

Run script phase when running make install

Would it be possible to include an example on your sample project that runs make install and it executes a build phase run script?

I am trying to figure out the best way to execute a run script during make install or make build, but I don’t seem to find anytjing good out there.

[Question] How to deal with resources/localization keys?

Hi:

In order to get compile time checks on the resources and localization files used in my app, I do the following:
1- I create a standalone library called Resources.
2- I use SwiftGen to populate that library with a binary representation of the resources of the app App1.
3- At this point I use Resources as a dependency of other libraries to safely retrieve resources or localized strings.

The folder structure + dependency graph is as follows:

- App1
  * Depends on: //OtherLibraries/OtherLibrary1
  |
  |- Resources

- OtherLibraries
  |
  |- OtherLibrary1
     * Depends on: //App1/Resources

The problem comes when adding a second app to the repository:

- App1
  * Depends on: //OtherLibraries/OtherLibrary1
  |
  |- Resources

- App2
  * Depends on: //OtherLibraries/OtherLibrary1 <-- Here the Resources library that is being used is the one under App1, and this is wrong: it should be the one under App2
  |
  |- Resources

- OtherLibraries
  |
  |- OtherLibrary1
     * Depends on: //App1/Resources

The way this is done in Xcode is by using implicit dependencies inside the Xcode projects that get resolved when that project is inside a workspace (yonaskolb/XcodeGen#224 (comment)).

Is there any way to work around this problem in Buck? For example:

  • By somehow inject the location of the Resources dependency to OtherLibrary1?
  • By not fully specifying the location of the Resources library in OtherLibrary1, and letting App1 and App2 rules control it?
  • By having a unique Resources library that depends on a genrule in charge of generating the code from the resources? But, in this case, how to tell the genrule which app resources to use during code generation?
  • Any other completely different way that enables compile time safety on resources and lozalization files?

Thanks!

PD: I tried joining the slack channel in order to post this question, but I couldn't because it's limited to employees of specific companies, so I decided to open this issue.

Example with c++ module

Hi!

I've done a few tries to reference a c++ module directly from a swift module but I could not get it to work. I've seen that you've implemented an apple_cxx_lib macro. Would you have an example of how to use it with first party code?

ui_test are failing

make ui_test fails for me. Should they be part of the ci ?

make ui_test
/usr/local/Cellar/buck/2018.10.29.01/bin/buck test //App/UITests:UITests
FAILURE BuckSampleUITests -[BuckSampleUITests testExample]: <unknown>:0: failed: caught "NSInternalInconsistencyException", "No target application path specified via test configuration: <XCTestConfiguration: 0x600003368270>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.