Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Functional] Add example Siri Shortcut #86

Open
wants to merge 101 commits into
base: master
Choose a base branch
from

Conversation

bachand
Copy link
Collaborator

@bachand bachand commented Apr 20, 2019

Status

We are seeing the following in the CI logs, even though CI passes. We should resolve this before merging.

    Falling back to contents of entitlements file "XCUITestsHostAppBinary.entitlements" because it was modified during the build process. Modifying the entitlements file during the build is unsupported.error: The file “XCUITestsHostAppBinary.entitlements” couldn’t be opened because there is no such file.
2019-05-14 01:46:10.832 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithPrecompiledDependencyTests-6D945B4E-57D4-4A0C-96E4-A49C530B0235/Session-SwiftWithPrecompiledDependencyTests-2019-05-14_014500-fMlHPJ.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithPrecompiledDependencyTests-6D945B4E-57D4-4A0C-96E4-A49C530B0235/Session-SwiftWithPrecompiledDependencyTests-2019-05-14_014500-fMlHPJ.log}
2019-05-14 01:46:10.832 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/Cpp1Tests-7A0F5FF2-F799-4A6B-86E5-A55F373AD89C/Session-Cpp1Tests-2019-05-14_014501-1OXfFr.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/Cpp1Tests-7A0F5FF2-F799-4A6B-86E5-A55F373AD89C/Session-Cpp1Tests-2019-05-14_014501-1OXfFr.log}
2019-05-14 01:46:10.833 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/UnitTests-CF58403B-EE66-4891-9154-6AAA28ADF22D/Session-UnitTests-2019-05-14_014501-hr6Azx.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/UnitTests-CF58403B-EE66-4891-9154-6AAA28ADF22D/Session-UnitTests-2019-05-14_014501-hr6Azx.log}
2019-05-14 01:46:10.833 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SecondSwiftModuleTests-22E75077-AF13-4122-AB43-A792707F8DE0/Session-SecondSwiftModuleTests-2019-05-14_014501-4s1LO2.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SecondSwiftModuleTests-22E75077-AF13-4122-AB43-A792707F8DE0/Session-SecondSwiftModuleTests-2019-05-14_014501-4s1LO2.log}
2019-05-14 01:46:10.834 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/UnitTestsWithHostApp-53F5F704-C499-4B22-A6FA-4FF81A0A8273/Session-UnitTestsWithHostApp-2019-05-14_014502-AjS7h5.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/UnitTestsWithHostApp-53F5F704-C499-4B22-A6FA-4FF81A0A8273/Session-UnitTestsWithHostApp-2019-05-14_014502-AjS7h5.log}
2019-05-14 01:46:10.834 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithAssetsTests-8ECF0C54-16F3-43FC-98EA-CA2503BD1FE2/Session-SwiftWithAssetsTests-2019-05-14_014501-uoRqJ1.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithAssetsTests-8ECF0C54-16F3-43FC-98EA-CA2503BD1FE2/Session-SwiftWithAssetsTests-2019-05-14_014501-uoRqJ1.log}
2019-05-14 01:46:10.834 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/ObjcAndSwiftTests-9189C46C-8BF0-403B-8F3E-301DEBB9501D/Session-ObjcAndSwiftTests-2019-05-14_014503-UL7mZi.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/ObjcAndSwiftTests-9189C46C-8BF0-403B-8F3E-301DEBB9501D/Session-ObjcAndSwiftTests-2019-05-14_014503-UL7mZi.log}
2019-05-14 01:46:10.835 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftReliesOnCXXTests-9794159E-B3C4-4806-9394-42EC56CCB76C/Session-SwiftReliesOnCXXTests-2019-05-14_014503-WPbMyt.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftReliesOnCXXTests-9794159E-B3C4-4806-9394-42EC56CCB76C/Session-SwiftReliesOnCXXTests-2019-05-14_014503-WPbMyt.log}
2019-05-14 01:46:10.836 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/XCUITests-803628DD-1AD3-41A4-9CF6-29903A02922A/Session-XCUITests-2019-05-14_014503-mxVdsy.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/XCUITests-803628DD-1AD3-41A4-9CF6-29903A02922A/Session-XCUITests-2019-05-14_014503-mxVdsy.log}
2019-05-14 01:46:10.837 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/Objc1Tests-70F09922-0D22-4F1C-9B61-A9425AA74859/Session-Objc1Tests-2019-05-14_014503-CE6bIc.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/Objc1Tests-70F09922-0D22-4F1C-9B61-A9425AA74859/Session-Objc1Tests-2019-05-14_014503-CE6bIc.log}
2019-05-14 01:46:10.837 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftAndObjcTests-7B157255-85F1-4B49-8F46-3149DC0B61B2/Session-SwiftAndObjcTests-2019-05-14_014503-JwAuVn.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftAndObjcTests-7B157255-85F1-4B49-8F46-3149DC0B61B2/Session-SwiftAndObjcTests-2019-05-14_014503-JwAuVn.log}
2019-05-14 01:46:10.837 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/ASwiftModuleTests-6DCE2DD9-7E39-4312-AE89-2A79F6544849/Session-ASwiftModuleTests-2019-05-14_014503-njyw32.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/ASwiftModuleTests-6DCE2DD9-7E39-4312-AE89-2A79F6544849/Session-ASwiftModuleTests-2019-05-14_014503-njyw32.log}
2019-05-14 01:46:10.838 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithMLModelTests-738D1029-A091-4996-A67F-35E56189932D/Session-SwiftWithMLModelTests-2019-05-14_014503-h2Sk8d.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/SwiftWithMLModelTests-738D1029-A091-4996-A67F-35E56189932D/Session-SwiftWithMLModelTests-2019-05-14_014503-h2Sk8d.log}
2019-05-14 01:46:10.838 xcodebuild[5864:23621] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/YetAnotherSwiftModuleTests-066A81FD-52C3-4044-AB04-6FCC8DC2F6C3/Session-YetAnotherSwiftModuleTests-2019-05-14_014503-rcJyZR.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/com.apple.dt.XCTest/IDETestRunSession-BB95E2B7-9325-4B86-B16E-40DA14730096/YetAnotherSwiftModuleTests-066A81FD-52C3-4044-AB04-6FCC8DC2F6C3/Session-YetAnotherSwiftModuleTests-2019-05-14_014503-rcJyZR.log}
Testing failed:
	error: The file “XCUITestsHostAppBinary.entitlements” couldn’t be opened because there is no such file.
** TEST FAILED **
The following build commands failed:
	ProcessProductPackaging "" /Users/travis/Library/Developer/Xcode/DerivedData/ExampleApp-emlsyjfjxoteniavyduxkenpwsji/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/XCUITestsHostApp.build/XCUITestsHostApp.app-Simulated.xcent
(1 failure)

This PR adds an example of a custom Siri Intent to BuckSample.

Buck-generated Xcode project Buck CLI

To make this PR, I followed this great guide. I performed each step in a manually managed Xcode project and then ported the step over to Buck. You can find the complete manually managed Xcode project (with Git history) here: XcodeExampleApp.zip

Localization

This intent is localized for Spanish.

Buck-generated Xcode project Buck CLI

One gotcha is that Siri's language does not seem to change to Spanish even after you set the simulator's language to Spanish. You may have to set Siri's language to Spanish manually in Settings.

Generating Swift interface for intents

There is no standalone command for this. IntentDefinitionCodegen is built into Xcode. As such, we run xcodebuild in a genrule.

.intentdefinition processing

/Applications/Xcode.app/Contents/Developer/usr/bin/intentbuilderc SOURCE_DEFINITION \
  DESTINATION_DIR ""

I diff'ed the source .intentdefinition file against the output of running intentbuilderc. The file outputted by intentbuilderc is the same. Nonetheless, it seems worth running this command for the purposes of future proofing.

After being processed, this file should be copied into any target that uses the intent.

ExampleApp ExampleIntentExtension ExampleIntentUIExtension
Screen Shot 2019-04-27 at 9 57 24 PM Screen Shot 2019-04-27 at 9 57 31 PM Screen Shot 2019-04-27 at 9 57 46 PM

Verification / Testing

Entitlements

TL;DR ✅

I tried running codesign -d --entitlements OUTPUT_PATH BINARY_PATH on the ExampleApp binary produced by Buck CLI and the Buck-generated Xcode project. Both times this command produced an empty set of entitlements. I verified that this behavior is the same for a manually managed Xcode test project.

This command also produced an empty set of entitlements when run the Airbnb binary produced by a Buck CLI build. Running this command on the Airbnb binary produced by a Buck-generated Xcode project produced a non-empty file with one entitlement entry, which did not represent the specified entitlements that had many more entries.

I verified that if I passed apple_binary() a path to a non-existent entitlements file, it failed. So it is in fact doing something with this entitlements file (or at least validating its existence).

Since BuckSample does not yet support creating a release build, this validation makes me sufficiently convinced that I'm setting entitlements correctly.

Launching the app by clicking on the Intent UI shown by Siri

I verified that the code that I added to AppDelegate.swift works correctly.
Screen Shot 2019-04-28 at 9 07 26 PM

n.b.

When creating a Siri Shortcut in a manually managed project, I flipped on the Siri capability for the application target.
Screen Shot 2019-04-20 at 5 54 06 PM

That resulted in this this change to the project file.
Screen Shot 2019-04-20 at 5 52 23 PM

I don't know how to reproduce this change directly in the Buck-generated project, but I am seeing the capability checked one seemingly from the entitlements file. As such, I'm not going to investigate this further.
Screen Shot 2019-04-21 at 8 06 05 PM

Running this PR

This feature is disabled by default since CI still runs Xcode 9. If you are running Xcode 10, remove -DDISABLE_SIRI_SHORTCUT from this line to use the feature.

@bachand bachand force-pushed the mb--add-siri-shortcut branch from 7013d36 to 812c83f Compare April 21, 2019 19:23
srcs = [definition_directory + definition_name + ".intentdefinition"],
bash = """
developer_dir=`xcode-select -p`
"$developer_dir/usr/bin/intentbuilderc" $SRCS $TMP ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's easier to just call xcrun intentbuilderc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bachand bachand force-pushed the mb--add-siri-shortcut branch 2 times, most recently from b7e2d52 to 1f64b99 Compare April 28, 2019 05:43
@bachand bachand changed the title [WIP] Add example Siri Shortcut [WIP] Add example Siri Shortcut (with one caveat) Apr 29, 2019
]
+ first_party_library_dependencies
+ build_phase_scripts,
frameworks = [
"$SDKROOT/System/Library/Frameworks/Intents.framework",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure that Intents.framework is strictly necessary, but I have added it to reduce the potential causes of unexpected failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nevermind. This is used by the generated intent source code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So it's good we keep Intents.framework 👍

<!--Intent View Controller-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController id="ObA-dk-sSI" customClass="IntentViewController" customModule="ExampleIntentUIBinary" sceneMemberID="viewController">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

customModule must be explicitly set in order to get Buck CLI to work. This is noted in a comment in App/Buck.

@@ -0,0 +1,329 @@
// !$*UTF8*$!
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This Xcode project exists for running code generation on the .intentdefinition. The README.md explains more.

@bachand bachand changed the title [WIP] Add example Siri Shortcut (with one caveat) [WIP][Blocked] Add example Siri Shortcut with one caveat Apr 29, 2019
@bachand bachand changed the title [WIP][Blocked] Add example Siri Shortcut with one caveat [WIP][Blocked on CI Upgrade] Add example Siri Shortcut May 2, 2019
@bachand bachand force-pushed the mb--add-siri-shortcut branch from 4832824 to 3a0e4d8 Compare May 4, 2019 19:28
)

apple_bundle(
name = intent_bundle_name,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If necessary you can also set product_name to name the .appex file and its associated binary, but that's only necessary if you want name to be different.

Copy link
Collaborator Author

@bachand bachand May 6, 2019

Choose a reason for hiding this comment

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

When unspecified product_name == name.

fi
else
intent_interface="$TMP/Dummy.swift"
echo "class Dummy { }" > "$intent_interface"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I should update this to copy a pre-built version of BuckPhotoIntent.swift. If I do that I think the PR will build.

}
#else
// Xcode 9
func application(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't wait to upgrade CI to get rid of this stuff.

// This file was automatically generated and should not be edited.
//

import Foundation
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Temporary until we upgrade CI.

@@ -8,7 +8,7 @@

[swift]
version = 4.0
compiler_flags = -DBUCK -enable-testing -g -Onone -whole-module-optimization $(config custom.other_swift_compiler_flags)
compiler_flags = -DBUCK -enable-testing -g -Onone -whole-module-optimization $(config custom.other_swift_compiler_flags) -DDISABLE_SIRI_SHORTCUT
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's behind a feature flag.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This works around having Xcode 9 in CI.

@bachand bachand changed the title [WIP][Blocked on CI Upgrade] Add example Siri Shortcut Add example Siri Shortcut May 9, 2019
@bachand bachand force-pushed the mb--add-siri-shortcut branch from 684879f to 5117a1d Compare May 9, 2019 07:46
@bachand bachand changed the title Add example Siri Shortcut [WIP] Add example Siri Shortcut May 9, 2019
@bachand
Copy link
Collaborator Author

bachand commented May 9, 2019

Almost done...

XCUITestHostsApp tests are broken with this error

Falling back to contents of entitlements file "XCUITestsHostAppBinary.entitlements" because it was modified during the build process. Modifying the entitlements file during the build is unsupported.error: The file “XCUITestsHostAppBinary.entitlements” couldn’t be opened because there is no such file.`

I may need to map different entitlements to different binaries.

@bachand bachand force-pushed the mb--add-siri-shortcut branch from c575ae1 to e40af55 Compare May 14, 2019 01:23
logging_genrule(
name = interface_source_name,
srcs = [
compiler_xcodeproj,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: we'll need to pass the .intentdefinition here too in order to invalidate the rule when we make changes to that file.

# missing _main "-Xlinker -rpath -Xlinker @executable_path/../../Frameworks" tells the
# executable binary to look for frameworks in ExampleApp.app/Frameworks instead of PlugIns, so
# that we don't need to have the libSwift*.dylib in ExampleApp.app/PlugIns/*.appex/Frameworks
linker_flags = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to add /usr/lib/swift as a search path to make it work on iOS 12.2 forward. It was the case for me:

    linker_flags = [
        "-e",
        "_NSExtensionMain",
        "-Xlinker",
        "-rpath",
        "-Xlinker",
        "/usr/lib/swift"
        "-Xlinker",
        "-rpath",
        "-Xlinker",
        "@executable_path/../../Frameworks",
    ],

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting. Thanks for sharing @rockbruno. Are you on Swift 5?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I’m trying to understand if this is because the Swift libraries packaged with the app are now being ignored. If I understand correctly this occurs with Swift 5+ and iOS 12.2+.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on 4.2, but I'm using Xcode 10.2 which IIRC uses the Swift 5 compiler regardless of the version.
I remember they changed Buck to add this import by default so I'm surprised I had to do this, so maybe it's just the extension bundles that weren't covered by the change...

@bachand bachand changed the title [WIP] Add example Siri Shortcut [WIP][Functional] Add example Siri Shortcut Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants