expo-build-properties 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +5 -3
- package/build/android.d.ts +1 -0
- package/build/android.js +30 -1
- package/build/ios.js +9 -0
- package/build/pluginConfig.d.ts +26 -0
- package/build/pluginConfig.js +19 -1
- package/build/withBuildProperties.js +1 -0
- package/package.json +2 -2
- package/src/android.ts +46 -1
- package/src/ios.ts +9 -0
- package/src/pluginConfig.ts +57 -1
- package/src/withBuildProperties.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.5.2 — 2023-04-03
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Added `enableShrinkResourcesInReleaseBuilds` property to enable Android `shrinkResources` build feature. ([#21911](https://github.com/expo/expo/pull/21911) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
19
|
+
## 0.5.1 — 2023-02-09
|
|
20
|
+
|
|
21
|
+
### 🎉 New features
|
|
22
|
+
|
|
23
|
+
- Add support for enabling [Flipper](https://fbflipper.com/) as bundled with react-native. ([#20890](https://github.com/expo/expo/pull/20861) by [@jakobo](https://github.com/jakobo))
|
|
24
|
+
|
|
13
25
|
## 0.5.0 — 2023-02-03
|
|
14
26
|
|
|
15
27
|
### 🎉 New features
|
package/README.md
CHANGED
|
@@ -27,10 +27,12 @@ Add plugin to `app.json`. For example:
|
|
|
27
27
|
"android": {
|
|
28
28
|
"compileSdkVersion": 31,
|
|
29
29
|
"targetSdkVersion": 31,
|
|
30
|
-
"buildToolsVersion": "31.0.0"
|
|
30
|
+
"buildToolsVersion": "31.0.0",
|
|
31
|
+
"flipper": true
|
|
31
32
|
},
|
|
32
33
|
"ios": {
|
|
33
|
-
"deploymentTarget": "13.0"
|
|
34
|
+
"deploymentTarget": "13.0",
|
|
35
|
+
"flipper": true
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
]
|
|
@@ -41,7 +43,7 @@ Add plugin to `app.json`. For example:
|
|
|
41
43
|
|
|
42
44
|
## Contributing
|
|
43
45
|
|
|
44
|
-
Contributions are very welcome! Please refer to guidelines described in the [contributing guide][contributing].
|
|
46
|
+
Contributions are very welcome! Please refer to guidelines described in the [contributing guide][../../contributing.md].
|
|
45
47
|
|
|
46
48
|
[docs-main]: https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/build-properties.mdx
|
|
47
49
|
[docs-stable]: https://docs.expo.dev/versions/latest/sdk/build-properties/
|
package/build/android.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
2
|
import type { PluginConfigType } from './pluginConfig';
|
|
3
3
|
export declare const withAndroidBuildProperties: ConfigPlugin<PluginConfigType>;
|
|
4
|
+
export declare const withAndroidFlipper: ConfigPlugin<PluginConfigType>;
|
|
4
5
|
/**
|
|
5
6
|
* Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
|
|
6
7
|
*/
|
package/build/android.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updateAndroidProguardRules = exports.withAndroidPurgeProguardRulesOnce = exports.withAndroidProguardRules = exports.withAndroidBuildProperties = void 0;
|
|
6
|
+
exports.updateAndroidProguardRules = exports.withAndroidPurgeProguardRulesOnce = exports.withAndroidProguardRules = exports.withAndroidFlipper = exports.withAndroidBuildProperties = void 0;
|
|
7
7
|
const config_plugins_1 = require("expo/config-plugins");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -54,7 +54,36 @@ exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
|
|
|
54
54
|
propName: 'android.enableProguardInReleaseBuilds',
|
|
55
55
|
propValueGetter: (config) => config.android?.enableProguardInReleaseBuilds?.toString(),
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
propName: 'android.enableShrinkResourcesInReleaseBuilds',
|
|
59
|
+
propValueGetter: (config) => config.android?.enableShrinkResourcesInReleaseBuilds?.toString(),
|
|
60
|
+
},
|
|
57
61
|
], 'withAndroidBuildProperties');
|
|
62
|
+
const withAndroidFlipper = (config, props) => {
|
|
63
|
+
const ANDROID_FLIPPER_KEY = 'FLIPPER_VERSION';
|
|
64
|
+
const FLIPPER_FALLBACK = '0.125.0';
|
|
65
|
+
// when not set, make no changes
|
|
66
|
+
if (props.android?.flipper === undefined) {
|
|
67
|
+
return config;
|
|
68
|
+
}
|
|
69
|
+
return (0, config_plugins_1.withGradleProperties)(config, (c) => {
|
|
70
|
+
// check for Flipper version in package. If set, use that
|
|
71
|
+
let existing;
|
|
72
|
+
const found = c.modResults.find((item) => item.type === 'property' && item.key === ANDROID_FLIPPER_KEY);
|
|
73
|
+
if (found && found.type === 'property') {
|
|
74
|
+
existing = found.value;
|
|
75
|
+
}
|
|
76
|
+
// strip key and re-add based on setting
|
|
77
|
+
c.modResults = c.modResults.filter((item) => !(item.type === 'property' && item.key === ANDROID_FLIPPER_KEY));
|
|
78
|
+
c.modResults.push({
|
|
79
|
+
type: 'property',
|
|
80
|
+
key: ANDROID_FLIPPER_KEY,
|
|
81
|
+
value: (props.android?.flipper ?? existing ?? FLIPPER_FALLBACK),
|
|
82
|
+
});
|
|
83
|
+
return c;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
exports.withAndroidFlipper = withAndroidFlipper;
|
|
58
87
|
/**
|
|
59
88
|
* Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
|
|
60
89
|
*/
|
package/build/ios.js
CHANGED
|
@@ -12,6 +12,15 @@ exports.withIosBuildProperties = createBuildPodfilePropsConfigPlugin([
|
|
|
12
12
|
propName: 'ios.useFrameworks',
|
|
13
13
|
propValueGetter: (config) => config.ios?.useFrameworks,
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
propName: 'ios.flipper',
|
|
17
|
+
propValueGetter: (config) => {
|
|
18
|
+
if (typeof config.ios?.flipper === 'string' || typeof config.ios?.flipper === 'boolean') {
|
|
19
|
+
return config.ios.flipper.toString();
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
15
24
|
], 'withIosBuildProperties');
|
|
16
25
|
const withIosDeploymentTarget = (config, props) => {
|
|
17
26
|
const deploymentTarget = props.ios?.deploymentTarget;
|
package/build/pluginConfig.d.ts
CHANGED
|
@@ -46,6 +46,11 @@ export interface PluginConfigTypeAndroid {
|
|
|
46
46
|
* Enable [Proguard or R8](https://developer.android.com/studio/build/shrink-code) in release builds to obfuscate Java code and reduce app size.
|
|
47
47
|
*/
|
|
48
48
|
enableProguardInReleaseBuilds?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Enable [`shrinkResources`](https://developer.android.com/studio/build/shrink-code#shrink-resources) in release builds to remove unused resources from the app.
|
|
51
|
+
* This property should be used in combination with `enableProguardInReleaseBuilds`.
|
|
52
|
+
*/
|
|
53
|
+
enableShrinkResourcesInReleaseBuilds?: boolean;
|
|
49
54
|
/**
|
|
50
55
|
* Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to **android/app/proguard-rules.pro**.
|
|
51
56
|
*/
|
|
@@ -54,6 +59,14 @@ export interface PluginConfigTypeAndroid {
|
|
|
54
59
|
* Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
|
|
55
60
|
*/
|
|
56
61
|
packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
|
|
62
|
+
/**
|
|
63
|
+
* By default, Flipper is enabled with the version that comes bundled with `react-native`.
|
|
64
|
+
*
|
|
65
|
+
* Use this to change the [Flipper](https://fbflipper.com/) version when
|
|
66
|
+
* running your app on Android. You can set the `flipper` property to a
|
|
67
|
+
* semver string and specify an alternate Flipper version.
|
|
68
|
+
*/
|
|
69
|
+
flipper?: string;
|
|
57
70
|
}
|
|
58
71
|
/**
|
|
59
72
|
* Interface representing available configuration for iOS native build properties.
|
|
@@ -73,8 +86,21 @@ export interface PluginConfigTypeIos {
|
|
|
73
86
|
/**
|
|
74
87
|
* Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
|
|
75
88
|
* in `Podfile` to use frameworks instead of static libraries for Pods.
|
|
89
|
+
*
|
|
90
|
+
* > You cannot use `useFrameworks` and `flipper` at the same time , and
|
|
91
|
+
* doing so will generate an error.
|
|
76
92
|
*/
|
|
77
93
|
useFrameworks?: 'static' | 'dynamic';
|
|
94
|
+
/**
|
|
95
|
+
* Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
|
|
96
|
+
* Debug mode. Setting `true` enables the default version of Flipper, while
|
|
97
|
+
* setting a semver string will enable a specific version of Flipper you've
|
|
98
|
+
* declared in your **package.json**. The default for this configuration is `false`.
|
|
99
|
+
*
|
|
100
|
+
* > You cannot use `flipper` at the same time as `useFrameworks`, and
|
|
101
|
+
* doing so will generate an error.
|
|
102
|
+
*/
|
|
103
|
+
flipper?: boolean | string;
|
|
78
104
|
}
|
|
79
105
|
/**
|
|
80
106
|
* Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
|
package/build/pluginConfig.js
CHANGED
|
@@ -34,7 +34,12 @@ const schema = {
|
|
|
34
34
|
buildToolsVersion: { type: 'string', nullable: true },
|
|
35
35
|
kotlinVersion: { type: 'string', nullable: true },
|
|
36
36
|
enableProguardInReleaseBuilds: { type: 'boolean', nullable: true },
|
|
37
|
+
enableShrinkResourcesInReleaseBuilds: { type: 'boolean', nullable: true },
|
|
37
38
|
extraProguardRules: { type: 'string', nullable: true },
|
|
39
|
+
flipper: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
nullable: true,
|
|
42
|
+
},
|
|
38
43
|
packagingOptions: {
|
|
39
44
|
type: 'object',
|
|
40
45
|
properties: {
|
|
@@ -54,6 +59,10 @@ const schema = {
|
|
|
54
59
|
newArchEnabled: { type: 'boolean', nullable: true },
|
|
55
60
|
deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
|
|
56
61
|
useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
|
|
62
|
+
flipper: {
|
|
63
|
+
type: ['boolean', 'string'],
|
|
64
|
+
nullable: true,
|
|
65
|
+
},
|
|
57
66
|
},
|
|
58
67
|
nullable: true,
|
|
59
68
|
},
|
|
@@ -112,11 +121,20 @@ function maybeThrowInvalidVersions(config) {
|
|
|
112
121
|
* @ignore
|
|
113
122
|
*/
|
|
114
123
|
function validateConfig(config) {
|
|
115
|
-
const validate = new ajv_1.default().compile(schema);
|
|
124
|
+
const validate = new ajv_1.default({ allowUnionTypes: true }).compile(schema);
|
|
116
125
|
if (!validate(config)) {
|
|
117
126
|
throw new Error('Invalid expo-build-properties config: ' + JSON.stringify(validate.errors));
|
|
118
127
|
}
|
|
119
128
|
maybeThrowInvalidVersions(config);
|
|
129
|
+
// explicitly block using use_frameworks and Flipper in iOS
|
|
130
|
+
// https://github.com/facebook/flipper/issues/2414
|
|
131
|
+
if (config?.ios?.flipper !== undefined && config?.ios?.useFrameworks !== undefined) {
|
|
132
|
+
throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
|
|
133
|
+
}
|
|
134
|
+
if (config.android?.enableShrinkResourcesInReleaseBuilds === true &&
|
|
135
|
+
config.android?.enableProguardInReleaseBuilds !== true) {
|
|
136
|
+
throw new Error('`android.enableShrinkResourcesInReleaseBuilds` requires `android.enableProguardInReleaseBuilds` to be enabled.');
|
|
137
|
+
}
|
|
120
138
|
return config;
|
|
121
139
|
}
|
|
122
140
|
exports.validateConfig = validateConfig;
|
|
@@ -20,6 +20,7 @@ const withBuildProperties = (config, props) => {
|
|
|
20
20
|
//
|
|
21
21
|
// plugins order matter: the later one would run first
|
|
22
22
|
config = (0, android_1.withAndroidPurgeProguardRulesOnce)(config);
|
|
23
|
+
config = (0, android_1.withAndroidFlipper)(config, pluginConfig);
|
|
23
24
|
config = (0, ios_1.withIosBuildProperties)(config, pluginConfig);
|
|
24
25
|
config = (0, ios_1.withIosDeploymentTarget)(config, pluginConfig);
|
|
25
26
|
return config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-build-properties",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Config plugin to customize native build properties on prebuild",
|
|
5
5
|
"main": "build/withBuildProperties.js",
|
|
6
6
|
"types": "build/withBuildProperties.d.ts",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"expo": "*"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "014aa056080fd88a11b09b5be7c3ba078fbec7d0"
|
|
44
44
|
}
|
package/src/android.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AndroidConfig,
|
|
3
|
+
ConfigPlugin,
|
|
4
|
+
History,
|
|
5
|
+
withDangerousMod,
|
|
6
|
+
withGradleProperties,
|
|
7
|
+
} from 'expo/config-plugins';
|
|
2
8
|
import fs from 'fs';
|
|
3
9
|
import path from 'path';
|
|
4
10
|
|
|
@@ -53,10 +59,49 @@ export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<Plu
|
|
|
53
59
|
propName: 'android.enableProguardInReleaseBuilds',
|
|
54
60
|
propValueGetter: (config) => config.android?.enableProguardInReleaseBuilds?.toString(),
|
|
55
61
|
},
|
|
62
|
+
{
|
|
63
|
+
propName: 'android.enableShrinkResourcesInReleaseBuilds',
|
|
64
|
+
propValueGetter: (config) => config.android?.enableShrinkResourcesInReleaseBuilds?.toString(),
|
|
65
|
+
},
|
|
56
66
|
],
|
|
57
67
|
'withAndroidBuildProperties'
|
|
58
68
|
);
|
|
59
69
|
|
|
70
|
+
export const withAndroidFlipper: ConfigPlugin<PluginConfigType> = (config, props) => {
|
|
71
|
+
const ANDROID_FLIPPER_KEY = 'FLIPPER_VERSION';
|
|
72
|
+
const FLIPPER_FALLBACK = '0.125.0';
|
|
73
|
+
|
|
74
|
+
// when not set, make no changes
|
|
75
|
+
if (props.android?.flipper === undefined) {
|
|
76
|
+
return config;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return withGradleProperties(config, (c) => {
|
|
80
|
+
// check for Flipper version in package. If set, use that
|
|
81
|
+
let existing: string | undefined;
|
|
82
|
+
|
|
83
|
+
const found = c.modResults.find(
|
|
84
|
+
(item) => item.type === 'property' && item.key === ANDROID_FLIPPER_KEY
|
|
85
|
+
);
|
|
86
|
+
if (found && found.type === 'property') {
|
|
87
|
+
existing = found.value;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// strip key and re-add based on setting
|
|
91
|
+
c.modResults = c.modResults.filter(
|
|
92
|
+
(item) => !(item.type === 'property' && item.key === ANDROID_FLIPPER_KEY)
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
c.modResults.push({
|
|
96
|
+
type: 'property',
|
|
97
|
+
key: ANDROID_FLIPPER_KEY,
|
|
98
|
+
value: (props.android?.flipper ?? existing ?? FLIPPER_FALLBACK) as string,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return c;
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
60
105
|
/**
|
|
61
106
|
* Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
|
|
62
107
|
*/
|
package/src/ios.ts
CHANGED
|
@@ -14,6 +14,15 @@ export const withIosBuildProperties = createBuildPodfilePropsConfigPlugin<Plugin
|
|
|
14
14
|
propName: 'ios.useFrameworks',
|
|
15
15
|
propValueGetter: (config) => config.ios?.useFrameworks,
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
propName: 'ios.flipper',
|
|
19
|
+
propValueGetter: (config) => {
|
|
20
|
+
if (typeof config.ios?.flipper === 'string' || typeof config.ios?.flipper === 'boolean') {
|
|
21
|
+
return config.ios.flipper.toString();
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
17
26
|
],
|
|
18
27
|
'withIosBuildProperties'
|
|
19
28
|
);
|
package/src/pluginConfig.ts
CHANGED
|
@@ -66,6 +66,11 @@ export interface PluginConfigTypeAndroid {
|
|
|
66
66
|
* Enable [Proguard or R8](https://developer.android.com/studio/build/shrink-code) in release builds to obfuscate Java code and reduce app size.
|
|
67
67
|
*/
|
|
68
68
|
enableProguardInReleaseBuilds?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Enable [`shrinkResources`](https://developer.android.com/studio/build/shrink-code#shrink-resources) in release builds to remove unused resources from the app.
|
|
71
|
+
* This property should be used in combination with `enableProguardInReleaseBuilds`.
|
|
72
|
+
*/
|
|
73
|
+
enableShrinkResourcesInReleaseBuilds?: boolean;
|
|
69
74
|
/**
|
|
70
75
|
* Append custom [Proguard rules](https://www.guardsquare.com/manual/configuration/usage) to **android/app/proguard-rules.pro**.
|
|
71
76
|
*/
|
|
@@ -74,6 +79,15 @@ export interface PluginConfigTypeAndroid {
|
|
|
74
79
|
* Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
|
|
75
80
|
*/
|
|
76
81
|
packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* By default, Flipper is enabled with the version that comes bundled with `react-native`.
|
|
85
|
+
*
|
|
86
|
+
* Use this to change the [Flipper](https://fbflipper.com/) version when
|
|
87
|
+
* running your app on Android. You can set the `flipper` property to a
|
|
88
|
+
* semver string and specify an alternate Flipper version.
|
|
89
|
+
*/
|
|
90
|
+
flipper?: string;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
/**
|
|
@@ -91,11 +105,26 @@ export interface PluginConfigTypeIos {
|
|
|
91
105
|
* - `PBXNativeTarget` with "com.apple.product-type.application" `productType` in the app project.
|
|
92
106
|
*/
|
|
93
107
|
deploymentTarget?: string;
|
|
108
|
+
|
|
94
109
|
/**
|
|
95
110
|
* Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
|
|
96
111
|
* in `Podfile` to use frameworks instead of static libraries for Pods.
|
|
112
|
+
*
|
|
113
|
+
* > You cannot use `useFrameworks` and `flipper` at the same time , and
|
|
114
|
+
* doing so will generate an error.
|
|
97
115
|
*/
|
|
98
116
|
useFrameworks?: 'static' | 'dynamic';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
|
|
120
|
+
* Debug mode. Setting `true` enables the default version of Flipper, while
|
|
121
|
+
* setting a semver string will enable a specific version of Flipper you've
|
|
122
|
+
* declared in your **package.json**. The default for this configuration is `false`.
|
|
123
|
+
*
|
|
124
|
+
* > You cannot use `flipper` at the same time as `useFrameworks`, and
|
|
125
|
+
* doing so will generate an error.
|
|
126
|
+
*/
|
|
127
|
+
flipper?: boolean | string;
|
|
99
128
|
}
|
|
100
129
|
|
|
101
130
|
/**
|
|
@@ -135,8 +164,14 @@ const schema: JSONSchemaType<PluginConfigType> = {
|
|
|
135
164
|
kotlinVersion: { type: 'string', nullable: true },
|
|
136
165
|
|
|
137
166
|
enableProguardInReleaseBuilds: { type: 'boolean', nullable: true },
|
|
167
|
+
enableShrinkResourcesInReleaseBuilds: { type: 'boolean', nullable: true },
|
|
138
168
|
extraProguardRules: { type: 'string', nullable: true },
|
|
139
169
|
|
|
170
|
+
flipper: {
|
|
171
|
+
type: 'string',
|
|
172
|
+
nullable: true,
|
|
173
|
+
},
|
|
174
|
+
|
|
140
175
|
packagingOptions: {
|
|
141
176
|
type: 'object',
|
|
142
177
|
properties: {
|
|
@@ -156,6 +191,11 @@ const schema: JSONSchemaType<PluginConfigType> = {
|
|
|
156
191
|
newArchEnabled: { type: 'boolean', nullable: true },
|
|
157
192
|
deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
|
|
158
193
|
useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
|
|
194
|
+
|
|
195
|
+
flipper: {
|
|
196
|
+
type: ['boolean', 'string'],
|
|
197
|
+
nullable: true,
|
|
198
|
+
},
|
|
159
199
|
},
|
|
160
200
|
nullable: true,
|
|
161
201
|
},
|
|
@@ -221,11 +261,27 @@ function maybeThrowInvalidVersions(config: PluginConfigType) {
|
|
|
221
261
|
* @ignore
|
|
222
262
|
*/
|
|
223
263
|
export function validateConfig(config: any): PluginConfigType {
|
|
224
|
-
const validate = new Ajv().compile(schema);
|
|
264
|
+
const validate = new Ajv({ allowUnionTypes: true }).compile(schema);
|
|
225
265
|
if (!validate(config)) {
|
|
226
266
|
throw new Error('Invalid expo-build-properties config: ' + JSON.stringify(validate.errors));
|
|
227
267
|
}
|
|
228
268
|
|
|
229
269
|
maybeThrowInvalidVersions(config);
|
|
270
|
+
|
|
271
|
+
// explicitly block using use_frameworks and Flipper in iOS
|
|
272
|
+
// https://github.com/facebook/flipper/issues/2414
|
|
273
|
+
if (config?.ios?.flipper !== undefined && config?.ios?.useFrameworks !== undefined) {
|
|
274
|
+
throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (
|
|
278
|
+
config.android?.enableShrinkResourcesInReleaseBuilds === true &&
|
|
279
|
+
config.android?.enableProguardInReleaseBuilds !== true
|
|
280
|
+
) {
|
|
281
|
+
throw new Error(
|
|
282
|
+
'`android.enableShrinkResourcesInReleaseBuilds` requires `android.enableProguardInReleaseBuilds` to be enabled.'
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
230
286
|
return config;
|
|
231
287
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
withAndroidBuildProperties,
|
|
5
5
|
withAndroidProguardRules,
|
|
6
6
|
withAndroidPurgeProguardRulesOnce,
|
|
7
|
+
withAndroidFlipper,
|
|
7
8
|
} from './android';
|
|
8
9
|
import { withIosBuildProperties, withIosDeploymentTarget } from './ios';
|
|
9
10
|
import { PluginConfigType, validateConfig } from './pluginConfig';
|
|
@@ -27,6 +28,7 @@ export const withBuildProperties: ConfigPlugin<PluginConfigType> = (config, prop
|
|
|
27
28
|
// plugins order matter: the later one would run first
|
|
28
29
|
config = withAndroidPurgeProguardRulesOnce(config);
|
|
29
30
|
|
|
31
|
+
config = withAndroidFlipper(config, pluginConfig);
|
|
30
32
|
config = withIosBuildProperties(config, pluginConfig);
|
|
31
33
|
config = withIosDeploymentTarget(config, pluginConfig);
|
|
32
34
|
|