expo-build-properties 0.0.0 → 0.3.0

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 CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.0.0 — 2022-05-02
13
+ ## 0.3.0 — 2022-07-07
14
14
 
15
- _This version does not introduce any user-facing changes._
15
+ ### 🎉 New features
16
+
17
+ - Add `android.minSdkVersion` to override the minimum required Android SDK version. ([#17647](https://github.com/expo/expo/pull/17647) by [@Kudo](https://github.com/Kudo))
package/build/android.js CHANGED
@@ -10,6 +10,10 @@ const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const { createBuildGradlePropsConfigPlugin } = config_plugins_1.AndroidConfig.BuildProperties;
12
12
  exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
13
+ {
14
+ propName: 'android.minSdkVersion',
15
+ propValueGetter: (config) => { var _a, _b; return (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.minSdkVersion) === null || _b === void 0 ? void 0 : _b.toString(); },
16
+ },
13
17
  {
14
18
  propName: 'android.compileSdkVersion',
15
19
  propValueGetter: (config) => { var _a, _b; return (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.compileSdkVersion) === null || _b === void 0 ? void 0 : _b.toString(); },
@@ -42,6 +46,10 @@ exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
42
46
  propName: 'android.packagingOptions.doNotStrip',
43
47
  propValueGetter: (config) => { var _a, _b, _c; return (_c = (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.packagingOptions) === null || _b === void 0 ? void 0 : _b.doNotStrip) === null || _c === void 0 ? void 0 : _c.join(','); },
44
48
  },
49
+ {
50
+ propName: 'android.enableProguardInReleaseBuilds',
51
+ propValueGetter: (config) => { var _a, _b; return (_b = (_a = config.android) === null || _a === void 0 ? void 0 : _a.enableProguardInReleaseBuilds) === null || _b === void 0 ? void 0 : _b.toString(); },
52
+ },
45
53
  ], 'withAndroidBuildProperties');
46
54
  /**
47
55
  * Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
@@ -9,6 +9,8 @@ export interface PluginConfigType {
9
9
  * Config for Android native build properties
10
10
  */
11
11
  export interface PluginConfigTypeAndroid {
12
+ /** Override the default `minSdkVersion` version number in `build.gradle` */
13
+ minSdkVersion?: number;
12
14
  /** Override the default `compileSdkVersion` version number in `build.gradle` */
13
15
  compileSdkVersion?: number;
14
16
  /** Override the default `targetSdkVersion` version number in `build.gradle` */
@@ -12,6 +12,7 @@ const semver_1 = __importDefault(require("semver"));
12
12
  */
13
13
  const EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS = {
14
14
  android: {
15
+ minSdkVersion: 21,
15
16
  compileSdkVersion: 31,
16
17
  targetSdkVersion: 31,
17
18
  kotlinVersion: '1.6.10',
@@ -26,6 +27,7 @@ const schema = {
26
27
  android: {
27
28
  type: 'object',
28
29
  properties: {
30
+ minSdkVersion: { type: 'integer', nullable: true },
29
31
  compileSdkVersion: { type: 'integer', nullable: true },
30
32
  targetSdkVersion: { type: 'integer', nullable: true },
31
33
  buildToolsVersion: { type: 'string', nullable: true },
@@ -64,26 +66,31 @@ const schema = {
64
66
  * @ignore
65
67
  */
66
68
  function maybeThrowInvalidVersions(config) {
67
- var _a, _b, _c, _d, _e, _f;
69
+ var _a, _b, _c, _d, _e, _f, _g;
68
70
  const checkItems = [
71
+ {
72
+ name: 'android.minSdkVersion',
73
+ configVersion: (_a = config.android) === null || _a === void 0 ? void 0 : _a.minSdkVersion,
74
+ minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.android.minSdkVersion,
75
+ },
69
76
  {
70
77
  name: 'android.compileSdkVersion',
71
- configVersion: (_a = config.android) === null || _a === void 0 ? void 0 : _a.compileSdkVersion,
78
+ configVersion: (_b = config.android) === null || _b === void 0 ? void 0 : _b.compileSdkVersion,
72
79
  minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.android.compileSdkVersion,
73
80
  },
74
81
  {
75
82
  name: 'android.targetSdkVersion',
76
- configVersion: (_b = config.android) === null || _b === void 0 ? void 0 : _b.targetSdkVersion,
83
+ configVersion: (_c = config.android) === null || _c === void 0 ? void 0 : _c.targetSdkVersion,
77
84
  minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.android.targetSdkVersion,
78
85
  },
79
86
  {
80
87
  name: 'android.kotlinVersion',
81
- configVersion: (_c = config.android) === null || _c === void 0 ? void 0 : _c.kotlinVersion,
88
+ configVersion: (_d = config.android) === null || _d === void 0 ? void 0 : _d.kotlinVersion,
82
89
  minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.android.kotlinVersion,
83
90
  },
84
91
  {
85
92
  name: 'ios.deploymentTarget',
86
- configVersion: (_d = config.ios) === null || _d === void 0 ? void 0 : _d.deploymentTarget,
93
+ configVersion: (_e = config.ios) === null || _e === void 0 ? void 0 : _e.deploymentTarget,
87
94
  minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.ios.deploymentTarget,
88
95
  },
89
96
  ];
@@ -95,7 +102,7 @@ function maybeThrowInvalidVersions(config) {
95
102
  }
96
103
  if (typeof configVersion === 'string' &&
97
104
  typeof minimalVersion === 'string' &&
98
- semver_1.default.lt((_e = semver_1.default.coerce(configVersion)) !== null && _e !== void 0 ? _e : '0.0.0', (_f = semver_1.default.coerce(minimalVersion)) !== null && _f !== void 0 ? _f : '0.0.0')) {
105
+ semver_1.default.lt((_f = semver_1.default.coerce(configVersion)) !== null && _f !== void 0 ? _f : '0.0.0', (_g = semver_1.default.coerce(minimalVersion)) !== null && _g !== void 0 ? _g : '0.0.0')) {
99
106
  throw new Error(`\`${name}\` needs to be at least version ${minimalVersion}.`);
100
107
  }
101
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-build-properties",
3
- "version": "0.0.0",
3
+ "version": "0.3.0",
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",
@@ -31,7 +31,7 @@
31
31
  "license": "MIT",
32
32
  "homepage": "https://docs.expo.dev/versions/latest/sdk/build-properties",
33
33
  "dependencies": {
34
- "@expo/config-plugins": "~4.1.4",
34
+ "@expo/config-plugins": "~5.0.0",
35
35
  "ajv": "^8.11.0",
36
36
  "semver": "^7.3.5"
37
37
  },
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "6720e2f264c7439062be002ea343f33090aa89f8"
47
+ "gitHead": "e893ff2b01e108cf246cec02318c0df9d6bc603c"
48
48
  }
package/src/android.ts CHANGED
@@ -13,6 +13,10 @@ const { createBuildGradlePropsConfigPlugin } = AndroidConfig.BuildProperties;
13
13
 
14
14
  export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<PluginConfigType>(
15
15
  [
16
+ {
17
+ propName: 'android.minSdkVersion',
18
+ propValueGetter: (config) => config.android?.minSdkVersion?.toString(),
19
+ },
16
20
  {
17
21
  propName: 'android.compileSdkVersion',
18
22
  propValueGetter: (config) => config.android?.compileSdkVersion?.toString(),
@@ -45,6 +49,10 @@ export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<Plu
45
49
  propName: 'android.packagingOptions.doNotStrip',
46
50
  propValueGetter: (config) => config.android?.packagingOptions?.doNotStrip?.join(','),
47
51
  },
52
+ {
53
+ propName: 'android.enableProguardInReleaseBuilds',
54
+ propValueGetter: (config) => config.android?.enableProguardInReleaseBuilds?.toString(),
55
+ },
48
56
  ],
49
57
  'withAndroidBuildProperties'
50
58
  );
@@ -7,6 +7,7 @@ import semver from 'semver';
7
7
  */
8
8
  const EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS = {
9
9
  android: {
10
+ minSdkVersion: 21,
10
11
  compileSdkVersion: 31,
11
12
  targetSdkVersion: 31,
12
13
  kotlinVersion: '1.6.10',
@@ -28,6 +29,9 @@ export interface PluginConfigType {
28
29
  * Config for Android native build properties
29
30
  */
30
31
  export interface PluginConfigTypeAndroid {
32
+ /** Override the default `minSdkVersion` version number in `build.gradle` */
33
+ minSdkVersion?: number;
34
+
31
35
  /** Override the default `compileSdkVersion` version number in `build.gradle` */
32
36
  compileSdkVersion?: number;
33
37
 
@@ -88,6 +92,7 @@ const schema: JSONSchemaType<PluginConfigType> = {
88
92
  android: {
89
93
  type: 'object',
90
94
  properties: {
95
+ minSdkVersion: { type: 'integer', nullable: true },
91
96
  compileSdkVersion: { type: 'integer', nullable: true },
92
97
  targetSdkVersion: { type: 'integer', nullable: true },
93
98
  buildToolsVersion: { type: 'string', nullable: true },
@@ -130,6 +135,11 @@ const schema: JSONSchemaType<PluginConfigType> = {
130
135
  */
131
136
  function maybeThrowInvalidVersions(config: PluginConfigType) {
132
137
  const checkItems = [
138
+ {
139
+ name: 'android.minSdkVersion',
140
+ configVersion: config.android?.minSdkVersion,
141
+ minimalVersion: EXPO_SDK_MINIMAL_SUPPORTED_VERSIONS.android.minSdkVersion,
142
+ },
133
143
  {
134
144
  name: 'android.compileSdkVersion',
135
145
  configVersion: config.android?.compileSdkVersion,