From 0b232e1ac4aca678284034b8eb17874b2c3ab988 Mon Sep 17 00:00:00 2001 From: Shane Rosenthal Date: Tue, 31 Mar 2026 14:07:15 -0400 Subject: [PATCH] Support optional BasicAuthentication for plugin Maven repositories Plugins can now declare "authentication": "basic" in their nativephp.json repository config to generate the required BasicAuthentication block in settings.gradle.kts. This is needed by Maven repos like Mapbox Navigation SDK that require preemptive Basic auth for credential-based access. --- src/Plugins/Compilers/AndroidPluginCompiler.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Plugins/Compilers/AndroidPluginCompiler.php b/src/Plugins/Compilers/AndroidPluginCompiler.php index a65b5da..69ccee2 100644 --- a/src/Plugins/Compilers/AndroidPluginCompiler.php +++ b/src/Plugins/Compilers/AndroidPluginCompiler.php @@ -890,14 +890,25 @@ protected function buildRepositoryBlock(array $repo): ?string { $url = $repo['url']; $credentials = $repo['credentials'] ?? null; + $authentication = $repo['authentication'] ?? null; if ($credentials) { $username = $this->substituteEnvPlaceholders($credentials['username'] ?? 'mapbox'); $password = $this->substituteEnvPlaceholders($credentials['password'] ?? ''); + $authBlock = ''; + if ($authentication === 'basic') { + $authBlock = <<("basic") + } +KOTLIN; + } + return <<