• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 14856597402

06 May 2025 09:45AM UTC coverage: 67.59% (-0.08%) from 67.672%
14856597402

Pull #1242

github

web-flow
Merge d3d39f777 into a0320eff8
Pull Request #1242: #809: Enhance uninstall with --force to remove from the software repo

3108 of 5006 branches covered (62.09%)

Branch coverage included in aggregate %.

7997 of 11424 relevant lines covered (70.0%)

3.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.07
cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
1
package com.devonfw.tools.ide.tool;
2

3
import java.nio.file.Files;
4
import java.nio.file.LinkOption;
5
import java.nio.file.Path;
6
import java.util.Collection;
7
import java.util.Set;
8

9
import com.devonfw.tools.ide.common.Tag;
10
import com.devonfw.tools.ide.context.IdeContext;
11
import com.devonfw.tools.ide.environment.EnvironmentVariables;
12
import com.devonfw.tools.ide.io.FileAccess;
13
import com.devonfw.tools.ide.io.FileCopyMode;
14
import com.devonfw.tools.ide.process.EnvironmentContext;
15
import com.devonfw.tools.ide.process.ProcessContext;
16
import com.devonfw.tools.ide.step.Step;
17
import com.devonfw.tools.ide.tool.repository.ToolRepository;
18
import com.devonfw.tools.ide.url.model.file.json.ToolDependency;
19
import com.devonfw.tools.ide.version.GenericVersionRange;
20
import com.devonfw.tools.ide.version.VersionIdentifier;
21
import com.devonfw.tools.ide.version.VersionRange;
22

23
/**
24
 * {@link ToolCommandlet} that is installed locally into the IDEasy.
25
 */
26
public abstract class LocalToolCommandlet extends ToolCommandlet {
1✔
27

28
  /**
29
   * The constructor.
30
   *
31
   * @param context the {@link IdeContext}.
32
   * @param tool the {@link #getName() tool name}.
33
   * @param tags the {@link #getTags() tags} classifying the tool. Should be created via {@link Set#of(Object) Set.of} method.
34
   */
35
  public LocalToolCommandlet(IdeContext context, String tool, Set<Tag> tags) {
36

37
    super(context, tool, tags);
5✔
38
  }
1✔
39

40
  /**
41
   * @return the {@link Path} where the tool is located (installed).
42
   */
43
  public Path getToolPath() {
44

45
    return this.context.getSoftwarePath().resolve(getName());
7✔
46
  }
47

48
  /**
49
   * @return the {@link Path} where the executables of the tool can be found. Typically a "bin" folder inside {@link #getToolPath() tool path}.
50
   */
51
  public Path getToolBinPath() {
52

53
    Path toolPath = getToolPath();
3✔
54
    Path binPath = this.context.getFileAccess().findFirst(toolPath, path -> path.getFileName().toString().equals("bin"), false);
14✔
55
    if ((binPath != null) && Files.isDirectory(binPath)) {
7!
56
      return binPath;
2✔
57
    }
58
    return toolPath;
2✔
59
  }
60

61
  /**
62
   * @deprecated will be removed once all "dependencies.json" are created in ide-urls.
63
   */
64
  @Deprecated
65
  protected void installDependencies() {
66

67
  }
1✔
68

69
  @Override
70
  public boolean install(boolean silent, ProcessContext processContext) {
71

72
    installDependencies();
2✔
73
    VersionIdentifier configuredVersion = getConfiguredVersion();
3✔
74
    // get installed version before installInRepo actually may install the software
75
    VersionIdentifier installedVersion = getInstalledVersion();
3✔
76
    Step step = this.context.newStep(silent, "Install " + this.tool, configuredVersion);
14✔
77
    try {
78
      // install configured version of our tool in the software repository if not already installed
79
      ToolInstallation installation = installTool(configuredVersion, processContext);
5✔
80

81
      // check if we already have this version installed (linked) locally in IDE_HOME/software
82
      VersionIdentifier resolvedVersion = installation.resolvedVersion();
3✔
83
      if ((resolvedVersion.equals(installedVersion) && !installation.newInstallation())
9✔
84
          || (configuredVersion.matches(installedVersion) && context.isSkipUpdatesMode())) {
6!
85
        return toolAlreadyInstalled(silent, installedVersion, step, processContext);
9✔
86
      }
87
      if (!isIgnoreSoftwareRepo()) {
3✔
88
        // we need to link the version or update the link.
89
        Path toolPath = getToolPath();
3✔
90
        FileAccess fileAccess = this.context.getFileAccess();
4✔
91
        if (Files.exists(toolPath, LinkOption.NOFOLLOW_LINKS)) {
9✔
92
          fileAccess.backup(toolPath);
4✔
93
        }
94
        fileAccess.mkdirs(toolPath.getParent());
4✔
95
        fileAccess.symlink(installation.linkDir(), toolPath);
5✔
96
      }
97
      this.context.getPath().setPath(this.tool, installation.binDir());
8✔
98
      postInstall(true, processContext);
4✔
99
      if (installedVersion == null) {
2✔
100
        step.success("Successfully installed {} in version {}", this.tool, resolvedVersion);
15✔
101
      } else {
102
        step.success("Successfully installed {} in version {} replacing previous version {}", this.tool, resolvedVersion, installedVersion);
18✔
103
      }
104
      return true;
4✔
105
    } catch (RuntimeException e) {
1✔
106
      step.error(e, true);
4✔
107
      throw e;
2✔
108
    } finally {
109
      step.close();
2✔
110
    }
111

112
  }
113

114
  /**
115
   * This method is called after a tool was requested to be installed or updated.
116
   *
117
   * @param newlyInstalled {@code true} if the tool was installed or updated (at least link to software folder was created/updated), {@code false} otherwise
118
   *     (configured version was already installed and nothing changed).
119
   * @param pc the {@link ProcessContext} to use.
120
   */
121
  protected void postInstall(boolean newlyInstalled, ProcessContext pc) {
122

123
    if (newlyInstalled) {
2✔
124
      postInstall();
2✔
125
    }
126
  }
1✔
127

128
  /**
129
   * This method is called after the tool has been newly installed or updated to a new version.
130
   */
131
  protected void postInstall() {
132

133
    // nothing to do by default
134
  }
1✔
135

136
  private boolean toolAlreadyInstalled(boolean silent, VersionIdentifier installedVersion, Step step, ProcessContext pc) {
137
    if (!silent) {
2✔
138
      this.context.info("Version {} of tool {} is already installed", installedVersion, getToolWithEdition());
15✔
139
    }
140
    postInstall(false, pc);
4✔
141
    step.success();
2✔
142
    return false;
2✔
143
  }
144

145
  /**
146
   * Determines whether this tool should be installed directly in the software folder or in the software repository.
147
   *
148
   * @return {@code true} if the tool should be installed directly in the software folder, ignoring the central software repository; {@code false} if the tool
149
   *     should be installed in the central software repository (default behavior).
150
   */
151
  protected boolean isIgnoreSoftwareRepo() {
152

153
    return false;
2✔
154
  }
155

156
  /**
157
   * Performs the installation of the {@link #getName() tool} together with the environment context, managed by this
158
   * {@link com.devonfw.tools.ide.commandlet.Commandlet}.
159
   *
160
   * @param version the {@link GenericVersionRange} requested to be installed.
161
   * @param processContext the {@link ProcessContext} used to
162
   *     {@link #setEnvironment(EnvironmentContext, ToolInstallation, boolean) configure environment variables}.
163
   * @return the {@link ToolInstallation} matching the given {@code version}.
164
   */
165
  public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext) {
166

167
    return installTool(version, processContext, getConfiguredEdition());
7✔
168
  }
169

170
  /**
171
   * Performs the installation of the {@link #getName() tool} together with the environment context  managed by this
172
   * {@link com.devonfw.tools.ide.commandlet.Commandlet}.
173
   *
174
   * @param version the {@link GenericVersionRange} requested to be installed.
175
   * @param processContext the {@link ProcessContext} used to
176
   *     {@link #setEnvironment(EnvironmentContext, ToolInstallation, boolean) configure environment variables}.
177
   * @param edition the specific {@link #getConfiguredEdition() edition} to install.
178
   * @return the {@link ToolInstallation} matching the given {@code version}.
179
   */
180
  public ToolInstallation installTool(GenericVersionRange version, ProcessContext processContext, String edition) {
181

182
    // if version is a VersionRange, we are not called from install() but directly from installAsDependency() due to a version conflict of a dependency
183
    boolean extraInstallation = (version instanceof VersionRange);
3✔
184
    ToolRepository toolRepository = getToolRepository();
3✔
185
    VersionIdentifier resolvedVersion = toolRepository.resolveVersion(this.tool, edition, version, this);
8✔
186
    installToolDependencies(resolvedVersion, edition, processContext);
5✔
187

188
    Path installationPath;
189
    boolean ignoreSoftwareRepo = isIgnoreSoftwareRepo();
3✔
190
    if (ignoreSoftwareRepo) {
2✔
191
      installationPath = getToolPath();
4✔
192
    } else {
193
      Path softwareRepoPath = this.context.getSoftwareRepositoryPath().resolve(toolRepository.getId()).resolve(this.tool).resolve(edition);
12✔
194
      installationPath = softwareRepoPath.resolve(resolvedVersion.toString());
5✔
195
    }
196
    Path toolVersionFile = installationPath.resolve(IdeContext.FILE_SOFTWARE_VERSION);
4✔
197
    FileAccess fileAccess = this.context.getFileAccess();
4✔
198
    if (Files.isDirectory(installationPath)) {
5✔
199
      if (Files.exists(toolVersionFile)) {
5!
200
        if (!ignoreSoftwareRepo || resolvedVersion.equals(getInstalledVersion())) {
2!
201
          this.context.debug("Version {} of tool {} is already installed at {}", resolvedVersion, getToolWithEdition(this.tool, edition), installationPath);
21✔
202
          return createToolInstallation(installationPath, resolvedVersion, toolVersionFile, false, processContext, extraInstallation);
9✔
203
        }
204
      } else {
205
        // Makes sure that IDEasy will not delete itself
206
        if (this.tool.equals(IdeasyCommandlet.TOOL_NAME)) {
×
207
          this.context.warning("Your IDEasy installation is missing the version file at {}", toolVersionFile);
×
208
        } else {
209
          this.context.warning("Deleting corrupted installation at {}", installationPath);
×
210
          fileAccess.delete(installationPath);
×
211
        }
212
      }
213
    }
214
    Path downloadedToolFile = downloadTool(edition, toolRepository, resolvedVersion);
6✔
215
    boolean extract = isExtract();
3✔
216
    if (!extract) {
2✔
217
      this.context.trace("Extraction is disabled for '{}' hence just moving the downloaded file {}.", this.tool, downloadedToolFile);
15✔
218
    }
219
    if (Files.exists(installationPath)) {
5!
220
      fileAccess.backup(installationPath);
×
221
    }
222
    fileAccess.mkdirs(installationPath.getParent());
4✔
223
    fileAccess.extract(downloadedToolFile, installationPath, this::postExtract, extract);
7✔
224
    this.context.writeVersionFile(resolvedVersion, installationPath);
5✔
225
    this.context.debug("Installed {} in version {} at {}", this.tool, resolvedVersion, installationPath);
19✔
226
    return createToolInstallation(installationPath, resolvedVersion, toolVersionFile, true, processContext, extraInstallation);
9✔
227
  }
228

229
  /**
230
   * @param edition the {@link #getConfiguredEdition() tool edition} to download.
231
   * @param toolRepository the {@link ToolRepository} to use.
232
   * @param resolvedVersion the resolved {@link VersionIdentifier version} to download.
233
   * @return the {@link Path} to the downloaded release file.
234
   */
235
  protected Path downloadTool(String edition, ToolRepository toolRepository, VersionIdentifier resolvedVersion) {
236
    return toolRepository.download(this.tool, edition, resolvedVersion, this);
8✔
237
  }
238

239
  /**
240
   * Install this tool as dependency of another tool.
241
   *
242
   * @param version the required {@link VersionRange}. See {@link ToolDependency#versionRange()}.
243
   * @param processContext the {@link ProcessContext}.
244
   * @return {@code true} if the tool was newly installed, {@code false} otherwise (installation was already present).
245
   */
246
  public boolean installAsDependency(VersionRange version, ProcessContext processContext) {
247

248
    VersionIdentifier configuredVersion = getConfiguredVersion();
3✔
249
    if (version.contains(configuredVersion)) {
4✔
250
      // prefer configured version if contained in version range
251
      return install(false, processContext);
5✔
252
    } else {
253
      if (isIgnoreSoftwareRepo()) {
3!
254
        throw new IllegalStateException(
×
255
            "Cannot satisfy dependency to " + this.tool + " in version " + version + " since it is conflicting with configured version " + configuredVersion
256
                + " and this tool does not support the software repository.");
257
      }
258
      this.context.info(
19✔
259
          "Configured version of tool {} is {} but does not match version to install {} - need to use different version from software repository.",
260
          this.tool, configuredVersion, version);
261
    }
262
    ToolInstallation toolInstallation = installTool(version, processContext);
5✔
263
    return toolInstallation.newInstallation();
3✔
264
  }
265

266
  private void installToolDependencies(VersionIdentifier version, String edition, ProcessContext processContext) {
267
    Collection<ToolDependency> dependencies = getToolRepository().findDependencies(this.tool, edition, version);
8✔
268
    String toolWithEdition = getToolWithEdition(this.tool, edition);
5✔
269
    int size = dependencies.size();
3✔
270
    this.context.debug("Tool {} has {} other tool(s) as dependency", toolWithEdition, size);
15✔
271
    for (ToolDependency dependency : dependencies) {
10✔
272
      this.context.trace("Ensuring dependency {} for tool {}", dependency.tool(), toolWithEdition);
15✔
273
      LocalToolCommandlet dependencyTool = this.context.getCommandletManager().getRequiredLocalToolCommandlet(dependency.tool());
7✔
274
      dependencyTool.installAsDependency(dependency.versionRange(), processContext);
6✔
275
    }
1✔
276
  }
1✔
277

278
  /**
279
   * Post-extraction hook that can be overridden to add custom processing after unpacking and before moving to the final destination folder.
280
   *
281
   * @param extractedDir the {@link Path} to the folder with the unpacked tool.
282
   */
283
  protected void postExtract(Path extractedDir) {
284

285
  }
1✔
286

287
  @Override
288
  public VersionIdentifier getInstalledVersion() {
289

290
    return getInstalledVersion(this.context.getSoftwarePath().resolve(getName()));
9✔
291
  }
292

293
  /**
294
   * @param toolPath the installation {@link Path} where to find the version file.
295
   * @return the currently installed {@link VersionIdentifier version} of this tool or {@code null} if not installed.
296
   */
297
  protected VersionIdentifier getInstalledVersion(Path toolPath) {
298

299
    if (!Files.isDirectory(toolPath)) {
5✔
300
      this.context.debug("Tool {} not installed in {}", getName(), toolPath);
15✔
301
      return null;
2✔
302
    }
303
    Path toolVersionFile = toolPath.resolve(IdeContext.FILE_SOFTWARE_VERSION);
4✔
304
    if (!Files.exists(toolVersionFile)) {
5✔
305
      Path legacyToolVersionFile = toolPath.resolve(IdeContext.FILE_LEGACY_SOFTWARE_VERSION);
4✔
306
      if (Files.exists(legacyToolVersionFile)) {
5✔
307
        toolVersionFile = legacyToolVersionFile;
3✔
308
      } else {
309
        this.context.warning("Tool {} is missing version file in {}", getName(), toolVersionFile);
15✔
310
        return null;
2✔
311
      }
312
    }
313
    String version = this.context.getFileAccess().readFileContent(toolVersionFile).trim();
7✔
314
    return VersionIdentifier.of(version);
3✔
315
  }
316

317
  @Override
318
  public String getInstalledEdition() {
319

320
    if (this.context.getSoftwarePath() == null) {
4!
321
      return "";
×
322
    }
323
    return getInstalledEdition(this.context.getSoftwarePath().resolve(this.tool));
9✔
324
  }
325

326
  /**
327
   * @param toolPath the installation {@link Path} where to find currently installed tool. The name of the parent directory of the real path corresponding
328
   *     to the passed {@link Path path} must be the name of the edition.
329
   * @return the installed edition of this tool or {@code null} if not installed.
330
   */
331
  private String getInstalledEdition(Path toolPath) {
332
    if (!Files.isDirectory(toolPath)) {
5✔
333
      this.context.debug("Tool {} not installed in {}", this.tool, toolPath);
15✔
334
      return null;
2✔
335
    }
336
    Path realPath = this.context.getFileAccess().toRealPath(toolPath);
6✔
337
    // if the realPath changed, a link has been resolved
338
    if (realPath.equals(toolPath)) {
4✔
339
      if (!isIgnoreSoftwareRepo()) {
3!
340
        this.context.warning("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
11✔
341
      }
342
      // I do not see any reliable way how we could determine the edition of a tool that does not use software repo or that was installed by devonfw-ide
343
      return getConfiguredEdition();
3✔
344
    }
345
    Path toolRepoFolder = context.getSoftwareRepositoryPath().resolve(ToolRepository.ID_DEFAULT).resolve(this.tool);
9✔
346
    String edition = getEdition(toolRepoFolder, realPath);
5✔
347
    if (!getToolRepository().getSortedEditions(this.tool).contains(edition)) {
8✔
348
      this.context.warning("Undefined edition {} of tool {}", edition, this.tool);
15✔
349
    }
350
    return edition;
2✔
351
  }
352

353
  private String getEdition(Path toolRepoFolder, Path toolInstallFolder) {
354

355
    int toolRepoNameCount = toolRepoFolder.getNameCount();
3✔
356
    int toolInstallNameCount = toolInstallFolder.getNameCount();
3✔
357
    if (toolRepoNameCount < toolInstallNameCount) {
3!
358
      // ensure toolInstallFolder starts with $IDE_ROOT/_ide/software/default/«tool»
359
      for (int i = 0; i < toolRepoNameCount; i++) {
7✔
360
        if (!toolRepoFolder.getName(i).toString().equals(toolInstallFolder.getName(i).toString())) {
10!
361
          return null;
×
362
        }
363
      }
364
      return toolInstallFolder.getName(toolRepoNameCount).toString();
5✔
365
    }
366
    return null;
×
367
  }
368

369
  @Override
370
  public Path getInstalledSoftwareRepoPath() {
371
    if (this.context.getSoftwarePath() == null) {
4!
372
      return null;
×
373
    }
374
    return getInstalledSoftwareRepoPath(this.context.getSoftwarePath().resolve(this.tool));
9✔
375
  }
376

377
  private Path getInstalledSoftwareRepoPath(Path toolPath) {
378
    if (!Files.isDirectory(toolPath)) {
5!
379
      this.context.debug("Tool {} not installed in {}", this.tool, toolPath);
×
380
      return null;
×
381
    }
382
    Path installPath = this.context.getFileAccess().toRealPath(toolPath);
6✔
383
    // if the installPath changed, a link has been resolved
384
    if (installPath.equals(toolPath)) {
4!
385
      if (!isIgnoreSoftwareRepo()) {
×
386
        this.context.warning("Tool {} is not installed via software repository (maybe from devonfw-ide). Please consider reinstalling it.", this.tool);
×
387
      }
388
      // I do not see any reliable way how we could determine the edition of a tool that does not use software repo or that was installed by devonfw-ide
389
      return null;
×
390
    }
391
    Path toolRepoFolder = context.getSoftwareRepositoryPath().resolve(ToolRepository.ID_DEFAULT).resolve(this.tool);
9✔
392
    installPath = getSoftwareRepoPath(toolRepoFolder, installPath);
5✔
393
    return installPath;
2✔
394
  }
395

396
  private Path getSoftwareRepoPath(Path toolRepoFolder, Path toolInstallFolder) {
397
    int toolRepoNameCount = toolRepoFolder.getNameCount();
3✔
398
    int toolInstallNameCount = toolInstallFolder.getNameCount();
3✔
399
    int targetToolInstallNameCount = toolRepoNameCount + 2;
4✔
400
    if (toolRepoNameCount >= toolInstallNameCount) {
3!
401
      return null;
×
402
    }
403
    // ensure toolInstallFolder starts with $IDE_ROOT/_ide/software/default/«tool»
404
    for (int i = 0; i < toolRepoNameCount; i++) {
7✔
405
      if (!toolRepoFolder.getName(i).toString().equals(toolInstallFolder.getName(i).toString())) {
10!
406
        return null;
×
407
      }
408
    }
409
    // return $IDE_ROOT/_ide/software/default/«tool»/«edition»/«version»
410
    if (toolInstallNameCount < targetToolInstallNameCount) {
3!
411
      this.context.warning("Software repository path is faulty {}", toolInstallFolder);
×
412
      return null;
×
413
    } else if (toolInstallNameCount == targetToolInstallNameCount) {
3!
414
      return toolInstallFolder;
2✔
415
    } else {
416
      Path realInstallFolder = toolRepoFolder;
×
417
      for (int i = toolRepoNameCount; i < targetToolInstallNameCount; i++) {
×
418
        realInstallFolder = realInstallFolder.resolve(toolInstallFolder.getName(i));
×
419
      }
420
      return realInstallFolder;
×
421
    }
422
  }
423

424
  @Override
425
  public void uninstall() {
426

427
    try {
428
      Path softwarePath = getToolPath();
3✔
429
      if (Files.exists(softwarePath)) {
5!
430
        try {
431
          this.context.getFileAccess().delete(softwarePath);
5✔
432
          this.context.success("Successfully uninstalled " + this.tool);
6✔
433
        } catch (Exception e) {
×
434
          this.context.error("Couldn't uninstall " + this.tool, e);
×
435
        }
1✔
436
      } else {
437
        this.context.warning("An installed version of " + this.tool + " does not exist");
×
438
      }
439
    } catch (Exception e) {
×
440
      this.context.error(e.getMessage(), e);
×
441
    }
1✔
442
  }
1✔
443

444
  @Override
445
  public void forceUninstall() {
446
    try {
447
      Path repoPath = getInstalledSoftwareRepoPath();
3✔
448
      if (Files.exists(repoPath)) {
5!
449
        this.context.info("Physically deleting " + repoPath + " as requested by the user via force mode.");
6✔
450
        uninstall();
2✔
451
        try {
452
          this.context.getFileAccess().delete(repoPath);
5✔
453
          this.context.success("Successfully deleted " + repoPath + " from your computer.");
6✔
454
        } catch (Exception e) {
×
455
          this.context.error("Couldn't uninstall " + this.tool + " from your computer.", e);
×
456
        }
1✔
457
      } else {
458
        this.context.warning("An installed version of " + this.tool + " does not exist");
×
459
      }
460
    } catch (Exception e) {
×
461
      this.context.error("Couldn't uninstall " + this.tool + " from your computer. Installed version does not exist inside the software repository. ", e);
×
462
    }
1✔
463
  }
1✔
464

465
  private ToolInstallation createToolInstallation(Path rootDir, VersionIdentifier resolvedVersion, Path toolVersionFile,
466
      boolean newInstallation, EnvironmentContext environmentContext, boolean extraInstallation) {
467

468
    Path linkDir = getMacOsHelper().findLinkDir(rootDir, getBinaryName());
7✔
469
    Path binDir = linkDir;
2✔
470
    Path binFolder = binDir.resolve(IdeContext.FOLDER_BIN);
4✔
471
    if (Files.isDirectory(binFolder)) {
5✔
472
      binDir = binFolder;
2✔
473
    }
474
    if (linkDir != rootDir) {
3✔
475
      assert (!linkDir.equals(rootDir));
5!
476
      this.context.getFileAccess().copy(toolVersionFile, linkDir, FileCopyMode.COPY_FILE_OVERRIDE);
7✔
477
    }
478
    ToolInstallation toolInstallation = new ToolInstallation(rootDir, linkDir, binDir, resolvedVersion, newInstallation);
9✔
479
    setEnvironment(environmentContext, toolInstallation, extraInstallation);
5✔
480
    return toolInstallation;
2✔
481
  }
482

483
  /**
484
   * Method to set environment variables for the process context.
485
   *
486
   * @param environmentContext the {@link EnvironmentContext} where to {@link EnvironmentContext#withEnvVar(String, String) set environment variables} for
487
   *     this tool.
488
   * @param toolInstallation the {@link ToolInstallation}.
489
   * @param extraInstallation {@code true} if the {@link ToolInstallation} is an additional installation to the
490
   *     {@link #getConfiguredVersion() configured version} due to a conflicting version of a {@link ToolDependency}, {@code false} otherwise.
491
   */
492
  public void setEnvironment(EnvironmentContext environmentContext, ToolInstallation toolInstallation, boolean extraInstallation) {
493

494
    String pathVariable = EnvironmentVariables.getToolVariablePrefix(this.tool) + "_HOME";
5✔
495
    environmentContext.withEnvVar(pathVariable, toolInstallation.linkDir().toString());
7✔
496
    if (extraInstallation) {
2✔
497
      environmentContext.withPathEntry(toolInstallation.binDir());
5✔
498
    }
499
  }
1✔
500

501

502
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc