cmvr-wms/mobile-app/plugins/with-short-cmake-paths.cjs

14 lines
704 B
JavaScript
Raw Normal View History

const { withAppBuildGradle } = require('expo/config-plugins');
// Windows Ninja cannot stat >260-character object paths. Let CMake hash them
// instead of changing machine-wide long-path/security settings or moving source.
module.exports = config => withAppBuildGradle(config, cfg => {
if (cfg.modResults.contents.includes('CMAKE_OBJECT_PATH_MAX=250')) return cfg;
if (!/defaultConfig\s*\{/.test(cfg.modResults.contents)) throw Error('Unknown Android defaultConfig template');
cfg.modResults.contents = cfg.modResults.contents.replace(/defaultConfig\s*\{/, `defaultConfig {
externalNativeBuild {
cmake { arguments "-DCMAKE_OBJECT_PATH_MAX=250" }
}
`);
return cfg;
});