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

Add bundle_id to apple_resource_bundle rule or support Info.plist variable substitution for PRODUCT_BUNDLE_IDENTIFIER #679

Closed
thii opened this issue Dec 19, 2019 · 3 comments

Comments

@thii
Copy link
Member

thii commented Dec 19, 2019

The Info.plist file comes with a resource bundle target out of the box coming from Xcode by default has a PRODUCT_BUNDLE_IDENTIFIER variable. Although bundle ID isn't needed for resource bundles (according to Bazel) it would be nice to make this work for the default targets that get generated by Xcode.

@thii
Copy link
Member Author

thii commented Dec 19, 2019

We're currently having to workaround this by editing the generated Info.plist every time we add a new resource bundle target.

@steeve
Copy link
Contributor

steeve commented Dec 19, 2019

As a workaround, you can use a script that uses plutil like this, for example for the version:

ios_application(
...
    ipa_post_processor = ":plist_generate",
...
)

sh_binary(
    name = "plist_generate",
    srcs = ["plist_generate.sh"],
)
#!/bin/bash

set -euo pipefail

archive_root_path=${1}
framework_path=$(find ${archive_root_path} -type d -name '*.framework')
framework_name=$(basename ${framework_path%.framework*})

# Read the stamps to get the version
eval $(cat bazel-out/stable-status.txt bazel-out/volatile-status.txt | sed 's/ /=/')

plutil -convert binary1 -o "${framework_path}/Info.plist" - <<EOF
{
    "CFBundleExecutable": "${framework_name}",
    "CFBundlePackageType": "FMWK",
    "CFBundleShortVersionString": "${STABLE_VERSION}",
    "MinimumOSVersion": "11.0",
    "CFBundleSupportedPlatforms": [
        "iPhoneOS",
        "iPhoneSimulator",
    ],
}
EOF

@jschear
Copy link
Contributor

jschear commented Jun 9, 2021

Looks like this has been resolved by #1182.

@keith keith closed this as completed Jun 9, 2021
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 a pull request may close this issue.

4 participants