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

devonfw / IDEasy / 22264313095

21 Feb 2026 09:03PM UTC coverage: 70.645% (+0.2%) from 70.474%
22264313095

Pull #1710

github

web-flow
Merge eff4c822e into 379acdc9d
Pull Request #1710: #404: allow logging via SLF4J

4121 of 6440 branches covered (63.99%)

Branch coverage included in aggregate %.

10696 of 14534 relevant lines covered (73.59%)

3.13 hits per line

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

50.0
cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
1
package com.devonfw.tools.ide.tool.aws;
2

3
import java.io.IOException;
4
import java.nio.file.Path;
5
import java.util.Set;
6

7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9

10
import com.devonfw.tools.ide.common.Tag;
11
import com.devonfw.tools.ide.context.IdeContext;
12
import com.devonfw.tools.ide.io.FileAccess;
13
import com.devonfw.tools.ide.nls.NlsBundle;
14
import com.devonfw.tools.ide.process.EnvironmentContext;
15
import com.devonfw.tools.ide.process.ProcessContext;
16
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
17
import com.devonfw.tools.ide.tool.ToolInstallRequest;
18
import com.devonfw.tools.ide.tool.ToolInstallation;
19

20
/**
21
 * {@link LocalToolCommandlet} for <a href="https://docs.aws.amazon.com/cli/">AWS CLI</a> (Amazon Web Services Command Line Interface).
22
 */
23
public class Aws extends LocalToolCommandlet {
24

25
  private static final Logger LOG = LoggerFactory.getLogger(Aws.class);
4✔
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param context the {@link IdeContext}.
31
   */
32
  public Aws(IdeContext context) {
33

34
    super(context, "aws", Set.of(Tag.CLOUD));
6✔
35
  }
1✔
36

37
  @Override
38
  protected void postInstallOnNewInstallation(ToolInstallRequest request) {
39

40
    super.postInstallOnNewInstallation(request);
3✔
41
    Path awsConfigDir = this.context.getConfPath().resolve("aws");
6✔
42
    this.context.getFileAccess().mkdirs(awsConfigDir);
5✔
43
  }
1✔
44

45
  @Override
46
  protected void postExtract(Path extractedDir) {
47

48
    if (this.context.getSystemInfo().isLinux()) {
5!
49
      // running the install-script that aws shipped
50
      ProcessContext pc = this.context.newProcess();
×
51
      Path linuxInstallScript = extractedDir.resolve("install");
×
52
      pc.executable(linuxInstallScript);
×
53
      pc.addArgs("-i", extractedDir.toString(), "-b", extractedDir.toString());
×
54
      pc.run();
×
55

56
      // The install-script that aws ships creates symbolic links to binaries but using absolute paths.
57
      // Since the current process happens in a temporary dir, these links wouldn't be valid after moving the
58
      // installation files to the target dir. So the absolute paths are replaced by relative ones.
59
      FileAccess fileAccess = this.context.getFileAccess();
×
60
      for (String file : new String[] { "aws", "aws_completer", "v2/current" }) {
×
61
        Path link = extractedDir.resolve(file);
×
62
        try {
63
          fileAccess.symlink(link.toRealPath(), link, true);
×
64
        } catch (IOException e) {
×
65
          throw new RuntimeException(
×
66
              "Failed to replace absolute link (" + link + ") provided by AWS install script with relative link.", e);
67
        }
×
68
      }
69
      fileAccess.delete(linuxInstallScript);
×
70
      fileAccess.delete(extractedDir.resolve("dist"));
×
71
    }
72
  }
1✔
73

74
  @Override
75
  public void printHelp(NlsBundle bundle) {
76

77
    LOG.info("To get detailed help about the usage of the AWS CLI, use \"aws help\"");
3✔
78
  }
1✔
79

80
  @Override
81
  public void setEnvironment(EnvironmentContext environmentContext, ToolInstallation toolInstallation, boolean additionalInstallation) {
82

83
    super.setEnvironment(environmentContext, toolInstallation, additionalInstallation);
5✔
84
    Path awsConfigDir = this.context.getConfPath().resolve("aws");
6✔
85
    environmentContext.withEnvVar("AWS_CONFIG_FILE", awsConfigDir.resolve("config").toString());
8✔
86
    environmentContext.withEnvVar("AWS_SHARED_CREDENTIALS_FILE", awsConfigDir.resolve("credentials").toString());
8✔
87
  }
1✔
88

89
}
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

© 2026 Coveralls, Inc