Files
MapLibreParticleLab/integration/react-native/MapLibreParticleRNTestHost/plugins/withParticleNativeAndroid.js
2026-09-07 16:09:50 +08:00

17 lines
1023 B
JavaScript

const { withProjectBuildGradle } = require("@expo/config-plugins");
const marker = "// MapLibreParticleRNTestHost custom OpenGL SDK";
/**
* Pins MLRN's configurable native dependency and makes org.maplibre.gl resolve from Maven Local
* only. A missing locally-published custom SDK is therefore a build error, never a fallback to
* Maven Central's official AAR.
*/
module.exports = function withParticleNativeAndroid(config) {
return withProjectBuildGradle(config, (project) => {
if (project.modResults.contents.includes(marker)) return project;
project.modResults.contents += `\n${marker}\ngradle.projectsEvaluated {\n allprojects { p ->\n p.repositories.clear()\n p.repositories.mavenLocal()\n p.repositories.google()\n p.repositories.mavenCentral { content { excludeGroup(\"org.maplibre.gl\") } }\n }\n}\nrootProject.ext.set(\"org.maplibre.reactnative.nativeVersion\", \"13.4.1\")\nrootProject.ext.set(\"org.maplibre.reactnative.nativeVariant\", \"opengl\")\n`;
return project;
});
};