Skip to content

Commit

Permalink
[build-properties] Add field to enable/disable privacy manifest aggre…
Browse files Browse the repository at this point in the history
…gation (#28646)

# Why

There are a few issues right now with privacy manifest aggregation
(facebook/react-native#44410,
facebook/react-native#44402,
facebook/react-native#44402) that I expect will
be fixed in React Native 0.74.2, but in order to ensure that this
doesn't break builds I've disabled it by default and added this build
property to allow folks to toggle it on. We can switch on by default
when 0.74.2 is released and proven to handle some edge cases better.

# How

Same old process for adding a new property

# Test Plan

Run tests

# Checklist

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
  • Loading branch information
brentvatne committed May 6, 2024
1 parent 19f4c9a commit 9a1f53f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 76 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/public/static/data/v51.0.0/expo-build-properties.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ target 'HelloWorld' do
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
:mac_catalyst_enabled => false,
:ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true'
# Temporarily disable privacy file aggregation by default, until React
# Native 0.74.2 is released with fixes.
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] == 'true',
)
# This is necessary for Xcode 14, because it signs resource bundles by default
Expand Down
1 change: 1 addition & 0 deletions packages/expo-build-properties/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### 🎉 New features

- Add `ios.ccacheEnabled` option to enable the C++ compiler cache for iOS builds. ([#28638](https://github.com/expo/expo/pull/28638) by [@byCedric](https://github.com/byCedric))
- Add `ios.privacyManifestAggregationEnabled` option to enable/disable privacy manifest aggregation. ([#28646](https://github.com/expo/expo/pull/28646) by [@brentvatne](https://github.com/brentvatne)).

### 🐛 Bug fixes

Expand Down
9 changes: 9 additions & 0 deletions packages/expo-build-properties/build/pluginConfig.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/expo-build-properties/build/pluginConfig.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ describe(withBuildProperties, () => {
}).rejects.toThrow();
});

it('generates the apple.ccache property', async () => {
it('generates the apple.ccacheEnabled property', async () => {
const { modResults: iosModResultsEnabled } = await compileMockModWithResultsAsync(
{},
{
plugin: withBuildProperties,
pluginProps: { ios: { ccache: true } },
pluginProps: { ios: { ccacheEnabled: true } },
mod: withPodfileProperties,
modResults: {},
}
Expand All @@ -171,4 +171,19 @@ describe(withBuildProperties, () => {
'apple.ccacheEnabled': 'true',
});
});

it('generates the apple.privacyManifestAggregationEnabled property', async () => {
const { modResults: iosModResultsEnabled } = await compileMockModWithResultsAsync(
{},
{
plugin: withBuildProperties,
pluginProps: { ios: { privacyManifestAggregationEnabled: true } },
mod: withPodfileProperties,
modResults: {},
}
);
expect(iosModResultsEnabled).toMatchObject({
'apple.privacyManifestAggregationEnabled': 'true',
});
});
});
5 changes: 5 additions & 0 deletions packages/expo-build-properties/src/ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const withIosBuildProperties = createBuildPodfilePropsConfigPlugin<Plugin
propName: 'apple.ccacheEnabled',
propValueGetter: (config) => (config.ios?.ccacheEnabled ?? false).toString(),
},
{
propName: 'apple.privacyManifestAggregationEnabled',
propValueGetter: (config) =>
(config.ios?.privacyManifestAggregationEnabled ?? false).toString(),
},
],
'withIosBuildProperties'
);
Expand Down
11 changes: 11 additions & 0 deletions packages/expo-build-properties/src/pluginConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,16 @@ export interface PluginConfigTypeIos {
* @see https://ccache.dev/
*/
ccacheEnabled?: boolean;

/**
* Enable aggregation of Privacy Manifests (`PrivacyInfo.xcprivacy`) from
* CocoaPods resource bundles. If enabled, the manifests will be merged into a
* single file. If not enabled, developers will need to manually aggregate them.
*
* @see https://docs.expo.dev/guides/apple-privacy/
* @see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
*/
privacyManifestAggregationEnabled?: boolean;
}

/**
Expand Down Expand Up @@ -543,6 +553,7 @@ const schema: JSONSchemaType<PluginConfigType> = {

networkInspector: { type: 'boolean', nullable: true },
ccacheEnabled: { type: 'boolean', nullable: true },
privacyManifestAggregationEnabled: { type: 'boolean', nullable: true },

extraPods: {
type: 'array',
Expand Down

This file was deleted.

63 changes: 0 additions & 63 deletions packages/expo-localization/plugin/build/withExpoLocalization.js

This file was deleted.

3 changes: 3 additions & 0 deletions templates/expo-template-bare-minimum/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ target 'HelloWorld' do
config[:reactNativePath],
:mac_catalyst_enabled => false,
:ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true'
# Temporarily disable privacy file aggregation by default, until React
# Native 0.74.2 is released with fixes.
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] == 'true',
)

# This is necessary for Xcode 14, because it signs resource bundles by default
Expand Down

0 comments on commit 9a1f53f

Please sign in to comment.