39 lines
1.8 KiB
JavaScript
39 lines
1.8 KiB
JavaScript
// Resolve through the consuming Expo project first. This keeps a config plugin
|
|
// installed from an npm tarball aligned with the host's Expo SDK instead of
|
|
// accidentally loading a nested or globally-hoisted copy.
|
|
const configPlugins = require(
|
|
require.resolve("expo/config-plugins", {
|
|
paths: [process.cwd(), __dirname],
|
|
}),
|
|
);
|
|
|
|
const {
|
|
CodeGenerator,
|
|
withPodfile,
|
|
withProjectBuildGradle,
|
|
} = configPlugins;
|
|
|
|
const androidMarker = "// @navsea/maplibre-particle-rn Android OpenGL release";
|
|
const iosTag = "navsea-maplibre-particle-rn-maplibre-spm";
|
|
|
|
/** Resolves MLRN's single Native SDK request to the NavSea release artifact, never a second AAR. */
|
|
module.exports = function withNavSeaMapLibreParticle(config) {
|
|
config = withProjectBuildGradle(config, (project) => {
|
|
if (project.modResults.contents.includes(androidMarker)) return project;
|
|
project.modResults.contents += `\n${androidMarker}\ngradle.projectsEvaluated {\n allprojects { p ->\n p.repositories.maven { repository -> repository.url = p.uri("https://pbf.jpcn.ccwu.cc/maven") }\n p.configurations.configureEach { configuration ->\n configuration.resolutionStrategy.dependencySubstitution {\n substitute module("org.maplibre.gl:android-sdk-opengl") using module("cc.navsea.maplibre:android-sdk-particle-opengl:13.4.1-particle.9")\n }\n }\n }\n}\nrootProject.ext.set("org.maplibre.reactnative.nativeVersion", "13.4.1")\nrootProject.ext.set("org.maplibre.reactnative.nativeVariant", "opengl")\n`;
|
|
return project;
|
|
});
|
|
|
|
return withPodfile(config, (podfile) => {
|
|
podfile.modResults.contents = CodeGenerator.mergeContents({
|
|
src: podfile.modResults.contents,
|
|
newSrc: "$MLRN_PARTICLE.post_install(installer)",
|
|
tag: iosTag,
|
|
comment: "#",
|
|
anchor: /post_install do \|installer\|/,
|
|
offset: 1,
|
|
}).contents;
|
|
return podfile;
|
|
});
|
|
};
|