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

devonfw / IDEasy / 30462283487

29 Jul 2026 02:43PM UTC coverage: 72.611% (+0.02%) from 72.593%
30462283487

Pull #2195

github

web-flow
Merge 6f38cfe22 into ec264ffca
Pull Request #2195: #2181: Merge VSCodium plugins folder to VSCode

4997 of 7607 branches covered (65.69%)

Branch coverage included in aggregate %.

12874 of 17005 relevant lines covered (75.71%)

3.21 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
 * @param excludedEditions the ide editions that this plugin should not be installed for
26
 */
27
public record ToolPluginDescriptor(String id, String name, String url, String version, boolean active, Set<Tag> tags, Set<String> excludedEditions) implements
24✔
28
    Tags {
29

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

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

35
    return this.tags;
×
36
  }
37

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

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

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

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

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

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

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

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