From d378352e4321a5ebb7725cf93e286c436fa13580 Mon Sep 17 00:00:00 2001 From: "Andy Xu(devdiv)" Date: Tue, 24 Aug 2021 17:09:17 +0800 Subject: [PATCH] Rename authentication to auth in configuration with legacy setAuthentication (#108) --- azure-functions-gradle-plugin/CHANGELOG.md | 4 ++-- azure-functions-gradle-plugin/README.md | 2 +- .../gradle/AzureFunctionsExtension.java | 16 +++++++++++----- .../functions/gradle/GradleFunctionContext.java | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/azure-functions-gradle-plugin/CHANGELOG.md b/azure-functions-gradle-plugin/CHANGELOG.md index becf723..ec2cccf 100644 --- a/azure-functions-gradle-plugin/CHANGELOG.md +++ b/azure-functions-gradle-plugin/CHANGELOG.md @@ -27,12 +27,12 @@ All notable changes to the "Azure Function Plugin for Gradle" will be documented - Support detach Application Insights from an existing function app ## 1.2.0 -- Update depdendencies +- Update dependencies - Fix issue [46](https://github.com/microsoft/azure-gradle-plugins/issues/46): java.io.IOException: Resource not found: /version.txt ## 1.1.0 -- Update depdendencies +- Update dependencies - Fix the plugin name in telemetry - Fix bug: Cannot resolve func.exe when it is located at a folder with SPACE diff --git a/azure-functions-gradle-plugin/README.md b/azure-functions-gradle-plugin/README.md index b07c786..9c4efd8 100644 --- a/azure-functions-gradle-plugin/README.md +++ b/azure-functions-gradle-plugin/README.md @@ -39,7 +39,7 @@ azurefunctions { = } - authentication { + auth { type = 'azure_cli' } // enable local debug diff --git a/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/AzureFunctionsExtension.java b/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/AzureFunctionsExtension.java index bb0812c..aedfb94 100644 --- a/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/AzureFunctionsExtension.java +++ b/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/AzureFunctionsExtension.java @@ -47,7 +47,7 @@ public class AzureFunctionsExtension { private String appServicePlanName; @Nullable - private GradleAuthConfig authentication; + private GradleAuthConfig auth; @Nullable private Deployment deployment; @@ -121,8 +121,8 @@ public String getAppServicePlanResourceGroup() { @Input @Optional - public GradleAuthConfig getAuthentication() { - return authentication; + public GradleAuthConfig getAuth() { + return auth; } @Input @@ -191,9 +191,15 @@ public void setPricingTier(String pricingTier) { this.pricingTier = pricingTier; } + public void setAuth(Closure closure) { + this.auth = new GradleAuthConfig(); + project.configure(auth, closure); + } + + @Deprecated public void setAuthentication(Closure closure) { - this.authentication = new GradleAuthConfig(); - project.configure(authentication, closure); + this.auth = new GradleAuthConfig(); + project.configure(auth, closure); } public void setDeployment(Closure closure) { diff --git a/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/GradleFunctionContext.java b/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/GradleFunctionContext.java index ad4c070..7d7adf0 100644 --- a/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/GradleFunctionContext.java +++ b/azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/GradleFunctionContext.java @@ -51,7 +51,7 @@ public IProject getProject() { public AzureAppService getOrCreateAzureAppServiceClient() { if (appServiceClient == null) { try { - GradleAuthHelper.login(functionsExtension.getAuthentication(), functionsExtension.getSubscription()); + GradleAuthHelper.login(functionsExtension.getAuth(), functionsExtension.getSubscription()); appServiceClient = Azure.az(AzureAppService.class); } catch (AzureToolkitRuntimeException e) { throw new AzureToolkitRuntimeException(String.format("Cannot authenticate due to error %s", e.getMessage()), e); @@ -135,7 +135,7 @@ public Map getAppSettings() { @Override public GradleAuthConfig getAuth() { - return functionsExtension.getAuthentication(); + return functionsExtension.getAuth(); } @Override