facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

[App Clips]How we use buck to generate app clips? #2597

Open dingjingpisces2015 opened 3 years ago

dingjingpisces2015 commented 3 years ago

Found this PR. But when try write BUCK as test file did, it can not work properly. @Lcsmarcal Could you help to provide some usage document? Thanks! 🙏

Lcsmarcal commented 3 years ago

Sure! @dingjingpisces2015. Sorry for not publish a documentation about it yet. Soon I'll open a PR updating the documentation.

For now you can:

Create a normal application that will be the app clips and add it as dependency of the main app bundle. You only need to set the AppleBundle's is_app_clip property to true and xcode_product_type to com.apple.product-type.application.on-demand-install-capable, this one just for Xcode project compatibility.

apple_bundle(
     name = "AppClip",
     visibility = ["PUBLIC"],
     extension = "app",
     binary = ":ClipBinary",
     product_name = "Clip",
     info_plist = "Info.plist",
     is_app_clip = True,
     xcode_product_type = "com.apple.product-type.application.on-demand-install-capable"
 )

also you need to create a entitlements file for your app clip

apple_binary(
     name = "ClipBinary",
     visibility = ["PUBLIC"],
     ...
     entitlements_file = "Clip.entitlements"
 )

With following content:

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>com.apple.developer.parent-application-identifiers</key>
     <array>
         <string>$(AppIdentifierPrefix)com.buck.test.appclipapp</string>
     </array>
 </dict>
 </plist>

And that's it.

If you have any problem, specially if there's something wrong with the code sign phase, please let me know.

Lcsmarcal commented 3 years ago

I see that you was guided by the integration test. Can you say what exactly didn’t worked properly? So, if theres a problem with the implementation knowing what’s going on will help me to submit a fix for that.