From 00768e53ce1f677b0fc97c2122472439f10aecb7 Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Mon, 15 Apr 2024 21:44:03 +0530 Subject: [PATCH] Have location in key of toolContextMap --- .../java/io/ballerina/cli/task/RunBuildToolsTask.java | 8 ++++---- .../java/io/ballerina/projects/BuildToolResolution.java | 2 +- .../src/main/java/io/ballerina/projects/Project.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunBuildToolsTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunBuildToolsTask.java index 5abc581cd81c..4ce7bac53449 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunBuildToolsTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/RunBuildToolsTask.java @@ -88,7 +88,7 @@ public class RunBuildToolsTask implements Task { private final boolean exitWhenFinish; private ClassLoader toolClassLoader = this.getClass().getClassLoader(); ServiceLoader toolServiceLoader = ServiceLoader.load(CodeGeneratorTool.class, toolClassLoader); - private final Map toolContextMap = new HashMap<>(); + private final Map toolContextMap = new HashMap<>(); public RunBuildToolsTask(PrintStream out) { this.outStream = out; @@ -117,7 +117,7 @@ public void execute(Project project) { for (Tool toolEntry : toolEntries) { // Populate tool context ToolContext toolContext = ToolContext.from(toolEntry, project.currentPackage(), outStream); - toolContextMap.put(toolEntry.id().value(), toolContext); + toolContextMap.put(toolEntry.id(), toolContext); } BuildToolResolution buildToolResolution; try { @@ -147,7 +147,7 @@ public void execute(Project project) { .toList(); for (Tool toolEntry : resolvedToolEntries) { String commandName = toolEntry.type().value(); - ToolContext toolContext = toolContextMap.get(toolEntry.id().value()); + ToolContext toolContext = toolContextMap.get(toolEntry.id()); Optional targetTool = BuildToolUtils.getTargetTool(commandName, toolServiceLoader); if (targetTool.isEmpty()) { // If the tool is not found, we skip the execution and report a diagnostic @@ -248,7 +248,7 @@ private boolean validateEmptyOptionsToml(String toolId, Tool.Field toolType) thr return true; } this.outStream.printf("WARNING: Validation of tool options of '%s' for '%s' is skipped due to " + - "no tool options found%n", toolType, toolId); + "no tool options found%n", toolType.value(), toolId); return false; } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BuildToolResolution.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BuildToolResolution.java index fd8d713a0a40..0aad4c38894c 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BuildToolResolution.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/BuildToolResolution.java @@ -90,7 +90,7 @@ public List getResolvedTools() { private void resolveToolDependencies() { Project currentProject = packageContext.project(); - Map toolContextMap = currentProject.getToolContextMap(); + Map toolContextMap = currentProject.getToolContextMap(); if (toolContextMap == null || toolContextMap.isEmpty()) { return; } diff --git a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Project.java b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Project.java index 162260b1d03f..32807620ef96 100644 --- a/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Project.java +++ b/compiler/ballerina-lang/src/main/java/io/ballerina/projects/Project.java @@ -41,7 +41,7 @@ public abstract class Project { private BuildOptions buildOptions; protected ProjectEnvironment projectEnvironment; private final ProjectKind projectKind; - private Map toolContextMap; + private Map toolContextMap; private List compilerPluginContexts; protected Project(ProjectKind projectKind, @@ -106,7 +106,7 @@ public BuildOptions buildOptions() { * * @return map of {@code ToolContext} */ - public Map getToolContextMap() { + public Map getToolContextMap() { return toolContextMap; } @@ -114,7 +114,7 @@ public Map getToolContextMap() { * Assigns a map of build tools. * @param toolContextMap map of {@code ToolContext} */ - public void setToolContextMap(Map toolContextMap) { + public void setToolContextMap(Map toolContextMap) { this.toolContextMap = toolContextMap; }