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

devonfw / IDEasy / 25362807967

05 May 2026 07:09AM UTC coverage: 70.716% (+0.06%) from 70.657%
25362807967

Pull #1832

github

web-flow
Merge 9a27bd7a6 into 84fe4e9bf
Pull Request #1832: #1754: Add support for VS Code plugin versions

4417 of 6890 branches covered (64.11%)

Branch coverage included in aggregate %.

11337 of 15388 relevant lines covered (73.67%)

3.12 hits per line

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

84.44
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.Locale;
5
import java.util.Properties;
6
import java.util.Set;
7

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

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

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

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

29
  @Override
30
  public Set<Tag> getTags() {
31

32
    return this.tags;
×
33
  }
34

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

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

59
  private static boolean getBoolean(Properties properties, String key, String legacyKey, Path propertiesFile) {
60

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

75
  private static String getString(Properties properties, String key, String legacyKey) {
76

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

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