Skip to content

Substitute ${ENV_VAR} placeholders in Android plugin meta-data#167

Open
voicecode-bv wants to merge 1 commit into
NativePHP:mainfrom
voicecode-bv:fix/android-metadata-env-substitution
Open

Substitute ${ENV_VAR} placeholders in Android plugin meta-data#167
voicecode-bv wants to merge 1 commit into
NativePHP:mainfrom
voicecode-bv:fix/android-metadata-env-substitution

Conversation

@voicecode-bv

Copy link
Copy Markdown
Contributor

Problem

The iOS compiler resolves ${ENV_VAR} placeholders in info_plist values (IOSPluginCompiler::substituteEnvPlaceholders), but the Android compiler writes meta_data values verbatim. A plugin declaring:

"meta_data": [{ "name": "com.example.API_KEY", "value": "${SOME_KEY}" }]

ships the literal ${SOME_KEY} into AndroidManifest.xml, where the manifest merger then fails the build with:

Attribute meta-data#com.example.API_KEY@value requires a placeholder
substitution but no value for <SOME_KEY> is provided.

Fix

Resolve ${ENV_VAR} placeholders for both application-level (buildMetaDataEntry) and component-level (buildComponentMetaData) string meta-data values, mirroring the existing iOS info_plist behaviour. Unset variables are left as-is, matching substituteEnvPlaceholders' documented "validation will catch this" contract.

Tests

Adds two tests covering application- and service-level meta-data substitution. The full AndroidCompilerTest suite (33 tests) passes.

The iOS compiler already resolves ${ENV_VAR} placeholders in info_plist
values, but the Android compiler wrote meta-data values verbatim. A plugin
declaring <meta-data android:value="${SOME_KEY}"> therefore shipped the
literal placeholder into AndroidManifest.xml, where the manifest merger then
failed with "requires a placeholder substitution but no value is provided".

Resolve placeholders for both application-level (buildMetaDataEntry) and
component-level (buildComponentMetaData) string meta-data values, mirroring
the existing iOS info_plist behaviour. Adds tests for both paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant