Skip to content

Commit 63d46f5

Browse files
Merge pull request #419 from PlayerData/add-gradle-properties-plugin
chore: migrate to dynamic config, add custom gradle plugin
2 parents b4792b5 + 23fd178 commit 63d46f5

File tree

5 files changed

+181
-65
lines changed

5 files changed

+181
-65
lines changed

example/app.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ExpoConfig } from '@expo/config-types';
2+
import 'ts-node/register';
3+
4+
const config: ExpoConfig = {
5+
name: "react-native-mcu-manager-example",
6+
slug: "react-native-mcu-manager-example",
7+
version: "1.0.0",
8+
orientation: "portrait",
9+
assetBundlePatterns: ["**/*"],
10+
ios: {
11+
supportsTablet: true,
12+
bundleIdentifier: "uk.co.playerdata.reactnativemcumanager.example",
13+
infoPlist: {
14+
NSBluetoothAlwaysUsageDescription: "Requires Bluetooth to perform firmware updates.",
15+
},
16+
},
17+
android: {
18+
package: "uk.co.playerdata.reactnativemcumanager.example",
19+
permissions: [
20+
"ACCESS_FINE_LOCATION",
21+
"ACCESS_COARSE_LOCATION",
22+
],
23+
},
24+
plugins: [
25+
["expo-document-picker"],
26+
["./gradlePlugin.ts"]
27+
]
28+
};
29+
30+
export default config;

example/app.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

example/gradlePlugin.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { withGradleProperties } from '@expo/config-plugins';
2+
import { ConfigPlugin } from '@expo/config-plugins';
3+
import { ExpoConfig } from '@expo/config-types';
4+
5+
/**
6+
* A Config Plugin to modify android/gradle.properties.
7+
*/
8+
const withCustomGradleProps: ConfigPlugin<ExpoConfig> = (config) => {
9+
return withGradleProperties(config, (config) => {
10+
const gradleProperties = config.modResults;
11+
12+
gradleProperties.push(
13+
{ type: 'property', key: "org.gradle.parallel", value: "true" },
14+
{ type: 'property', key: "org.gradle.daemon", value: "true" },
15+
{ type: 'property', key: "org.gradle.jvmargs", value: "-Xmx4g -Dfile.encoding=UTF-8" },
16+
{ type: 'property', key: "org.gradle.configureondemand", value: "true" }
17+
);
18+
19+
return config;
20+
});
21+
};
22+
23+
export default withCustomGradleProps;

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@types/react": "18.3.12",
3030
"metro-react-native-babel-preset": "0.77.0",
3131
"pod-install": "0.2.2",
32+
"ts-node": "^10.9.2",
3233
"typescript": "5.6.3"
3334
}
3435
}

0 commit comments

Comments
 (0)