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

devonfw / IDEasy / 30072174238

24 Jul 2026 06:24AM UTC coverage: 72.588% (+0.03%) from 72.561%
30072174238

Pull #2195

github

web-flow
Merge 2561b9c45 into dd45e9162
Pull Request #2195: #2181: Merge VSCodium plugins folder to VSCode

4985 of 7588 branches covered (65.7%)

Branch coverage included in aggregate %.

12839 of 16967 relevant lines covered (75.67%)

3.2 hits per line

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

86.89
cli/src/main/java/com/devonfw/tools/ide/tool/plugin/ToolPluginDescriptor.java
1
package com.devonfw.tools.ide.tool.plugin;
2

3
import java.nio.file.Path;
4
import java.util.HashSet;
5
import java.util.Locale;
6
import java.util.Properties;
7
import java.util.Set;
8

9
import org.slf4j.Logger;
10
import org.slf4j.LoggerFactory;
11

12
import com.devonfw.tools.ide.common.Tag;
13
import com.devonfw.tools.ide.common.Tags;
14
import com.devonfw.tools.ide.context.IdeContext;
15

16
/**
17
 * Implementation of {@link ToolPluginDescriptor}.
18
 *
19
 * @param id the unique identifier of the plugin.
20
 * @param name the name of the plugin properties file excluding the extension.
21
 * @param url the optional plugin URL (download/update site).
22
 * @param version the optional plugin version to install.
23
 * @param active {@code true} if the plugin is active and shall be installed automatically, {@code false} otherwise.
24
 * @param tags the {@link #tags () tags}.
25
 */
26
public record ToolPluginDescriptor(String id, String name, String url, String version, boolean active, Set<Tag> tags, Set<String> excludedEditions) implements
24✔
27
    Tags {
28

29
  private static final Logger LOG = LoggerFactory.getLogger(ToolPluginDescriptor.class);
4✔
30

31
  @Override
32
  public Set<Tag> getTags() {
33

34
    return this.tags;
×
35
  }
36

37
  /**
38
   * @param propertiesFile the {@link Path} to the plugin {@link Properties} file.
39
   * @param context the {@link IdeContext}.
40
   * @param needUrl - {@code true} if {@link ToolPluginDescriptor#url () URL} needs to be present and a warning shall be logged if missing, {@code false}
41
   *     otherwise.
42
   * @return the loaded {@link ToolPluginDescriptor}.
43
   */
44
  public static ToolPluginDescriptor of(Path propertiesFile, IdeContext context, boolean needUrl) {
45

46
    String name = propertiesFile.getFileName().toString();
4✔
47
    name = name.substring(0, name.length() - IdeContext.EXT_PROPERTIES.length());
9✔
48
    Properties properties = context.getFileAccess().readProperties(propertiesFile);
5✔
49
    String id = getString(properties, "id", "plugin_id");
5✔
50
    String url = getString(properties, "url", "plugin_url");
5✔
51
    String version = getString(properties, "version", "plugin_version");
5✔
52
    if (needUrl && ((url == null) || url.isBlank())) {
7!
53
      LOG.warn("Missing plugin URL in {}", propertiesFile);
×
54
    }
55
    boolean active = getBoolean(properties, "active", "plugin_active", propertiesFile);
6✔
56
    String tagsCsv = getString(properties, "tags", "plugin_tags");
5✔
57
    Set<Tag> tags = Tag.parseCsv(tagsCsv);
3✔
58
    Set<String> excludedEditions = getExcludedEditions(properties, "excluded-editions");
4✔
59
    return new ToolPluginDescriptor(id, name, url, version, active, tags, excludedEditions);
11✔
60
  }
61

62
  private static boolean getBoolean(Properties properties, String key, String legacyKey, Path propertiesFile) {
63

64
    String value = getString(properties, key, legacyKey);
5✔
65
    if (value == null) {
2✔
66
      return false;
2✔
67
    }
68
    String lower = value.toLowerCase(Locale.ROOT);
4✔
69
    if ("true".equals(lower)) {
4✔
70
      return true;
2✔
71
    } else if ("false".equals(lower)) {
4!
72
      return false;
2✔
73
    }
74
    LOG.warn("Invalid boolean value '{}' for property '{}' in {}", value, key, propertiesFile);
×
75
    return false;
×
76
  }
77

78
  private static String getString(Properties properties, String key, String legacyKey) {
79

80
    String value = properties.getProperty(key);
4✔
81
    if (value == null) {
2✔
82
      value = properties.getProperty(legacyKey);
4✔
83
    }
84
    return value != null ? value.trim() : null;
7✔
85
  }
86

87
  private static Set<String> getExcludedEditions(Properties properties, String key) {
88
    String excludedEditionsString = properties.getProperty(key);
4✔
89
    if (excludedEditionsString != null) {
2✔
90
      Set<String> result = new HashSet<>();
4✔
91
      for (String edition : excludedEditionsString.split(",")) {
18✔
92
        String trimmed = edition.trim();
3✔
93
        if (!trimmed.isEmpty()) {
3!
94
          result.add(trimmed);
4✔
95
        }
96
      }
97
      return result;
2✔
98
    }
99
    return Set.of();
2✔
100
  }
101

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

© 2026 Coveralls, Inc