Skip to content

Commit 79cf238

Browse files
committed
be more flexible with suboptimal ABI requests, but still favor armv8a (pixel 2 and above) for the superior vectorization codegen that's possible
1 parent b2e4240 commit 79cf238

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/plugins/withJscAndroid.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const assert = require('assert');
22
const {
33
withAppBuildGradle,
4+
withGradleProperties,
45
withProjectBuildGradle,
56
} = require('expo/config-plugins');
67

@@ -47,6 +48,7 @@ afterEvaluate {
4748
`;
4849
config.modResults.contents += code;
4950
}
51+
5052
return config;
5153
});
5254
};
@@ -73,6 +75,34 @@ const withJscAndroidProjectBuildGradle = (config) => {
7375
const withJscAndroid = (config) => {
7476
config = withJscAndroidAppBuildGradle(config);
7577
config = withJscAndroidProjectBuildGradle(config);
78+
config = withGradleProperties(config, (config) => {
79+
const propertyName = 'reactNativeArchitectures';
80+
const desiredValue = 'arm64-v8a';
81+
const existingProp = config.modResults.find(
82+
(item) => item.type === 'property' && item.key === propertyName
83+
);
84+
const cleanValue = (value) => {
85+
if (!value) return desiredValue;
86+
const archs = value
87+
.split(',')
88+
.map((arch) => arch.trim())
89+
.filter(Boolean);
90+
if (!archs.length) return desiredValue;
91+
const result = archs.filter((arch) => arch !== 'armeabi-v7a');
92+
if (!result.length) return desiredValue;
93+
return Array.from(new Set(result)).join(',');
94+
};
95+
if (existingProp) {
96+
existingProp.value = cleanValue(existingProp.value);
97+
} else {
98+
config.modResults.push({
99+
type: 'property',
100+
key: propertyName,
101+
value: desiredValue,
102+
});
103+
}
104+
return config;
105+
});
76106
return config;
77107
};
78108

0 commit comments

Comments
 (0)