about summary refs log tree commit diff
path: root/plugins/withGradleJVMHeapSizeIncrease.js
blob: 690b8ee754945dc97bf24c9a00d1cdf3a95c2741 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
}