about summary refs log tree commit diff
path: root/plugins/withGradleJVMHeapSizeIncrease.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/withGradleJVMHeapSizeIncrease.js')
-rw-r--r--plugins/withGradleJVMHeapSizeIncrease.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/withGradleJVMHeapSizeIncrease.js b/plugins/withGradleJVMHeapSizeIncrease.js
new file mode 100644
index 000000000..690b8ee75
--- /dev/null
+++ b/plugins/withGradleJVMHeapSizeIncrease.js
@@ -0,0 +1,34 @@
+const {withGradleProperties} = require('expo/config-plugins')
+
+function setGradlePropertiesValue(config, key, value) {
+  return withGradleProperties(config, exportedConfig => {
+    const keyIdx = exportedConfig.modResults.findIndex(
+      item => item.type === 'property' && item.key === key,
+    )
+    if (keyIdx >= 0) {
+      exportedConfig.modResults.splice(keyIdx, 1, {
+        type: 'property',
+        key,
+        value,
+      })
+    } else {
+      exportedConfig.modResults.push({
+        type: 'property',
+        key,
+        value,
+      })
+    }
+
+    return exportedConfig
+  })
+}
+
+module.exports = function withGradleJVMHeapSizeIncrease(config) {
+  config = setGradlePropertiesValue(
+    config,
+    'org.gradle.jvmargs',
+    '-Xmx4096m -XX:MaxMetaspaceSize=1024m', //Set data of your choice
+  )
+
+  return config
+}