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

devonfw / IDEasy / 20330220431

18 Dec 2025 07:58AM UTC coverage: 70.087% (+0.03%) from 70.061%
20330220431

push

github

hohwille
#1596: Add support for comma-separated workspace values in repository configuration (#1569)

Co-authored-by: Malte Brunnlieb <malte.brunnlieb@capgemini.com>
Co-authored-by: Malte Brunnlieb <maybeec@users.noreply.github.com>

3980 of 6253 branches covered (63.65%)

Branch coverage included in aggregate %.

10186 of 13959 relevant lines covered (72.97%)

3.15 hits per line

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

80.0
cli/src/main/java/com/devonfw/tools/ide/git/repository/RepositoryConfig.java
1
package com.devonfw.tools.ide.git.repository;
2

3
import java.nio.file.Path;
4
import java.util.List;
5
import java.util.Properties;
6
import java.util.Set;
7

8
import com.devonfw.tools.ide.context.IdeContext;
9
import com.devonfw.tools.ide.git.GitUrl;
10

11
/**
12
 * Represents the configuration of a repository to be used by the {@link RepositoryCommandlet}.
13
 *
14
 * @param path Path into which the project is cloned. This path is relative to the workspace.
15
 * @param workingSets The working sets associated with the repository.
16
 * @param workspaces Workspaces to use for checkout and import. Supports comma-separated values. Default is main.
17
 * @param gitUrl Git URL to use for cloning the project.
18
 * @param gitBranch Git branch to checkout. Git default branch is default.
19
 * @param buildPath The build path for the repository.
20
 * @param buildCmd The command to invoke to build the repository after clone or pull. If omitted no build is triggered.
21
 * @param imports list of IDEs where the repository will be imported to.
22
 * @param active {@code true} to setup the repository during setup, {@code false} to skip.
23
 */
24
public record RepositoryConfig(
25
    String path,
26
    String workingSets,
27
    List<String> workspaces,
28
    String gitUrl,
29
    String gitBranch,
30
    String buildPath,
31
    String buildCmd,
32
    Set<String> imports,
33
    boolean active) {
34

35
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #path()}. */
36
  public static final String PROPERTY_PATH = "path";
37

38
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #workingSets()}. */
39
  public static final String PROPERTY_WORKING_SETS = "workingsets";
40

41
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #workspaces()}. */
42
  public static final String PROPERTY_WORKSPACES = "workspaces";
43

44
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #gitUrl()}. */
45
  public static final String PROPERTY_GIT_URL = "git_url";
46

47
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #buildPath()}. */
48
  public static final String PROPERTY_BUILD_PATH = "build_path";
49

50
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #buildCmd()}. */
51
  public static final String PROPERTY_BUILD_CMD = "build_cmd";
52

53
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #active()}. */
54
  public static final String PROPERTY_ACTIVE = "active";
55

56
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #gitBranch()}. */
57
  public static final String PROPERTY_GIT_BRANCH = "git_branch";
58

59
  /** {@link RepositoryProperties#getProperty(String) Property name} for {@link #imports()}. */
60
  public static final String PROPERTY_IMPORT = "import";
61

62
  /** Legacy {@link RepositoryProperties#getProperty(String) property name} for {@link #imports()}. */
63
  public static final String PROPERTY_ECLIPSE = "eclipse";
64

65
  public RepositoryConfig {
29✔
66
    if (workspaces == null || workspaces.isEmpty()) {
5!
67
      throw new IllegalArgumentException("workspaces cannot be empty");
×
68
    }
69
  }
1✔
70

71
  /**
72
   * @return the {@link GitUrl} from {@link #gitUrl()} and {@link #gitBranch()}.
73
   */
74
  public GitUrl asGitUrl() {
75

76
    if (this.gitUrl == null) {
3!
77
      return null;
×
78
    }
79
    return new GitUrl(this.gitUrl, this.gitBranch);
8✔
80
  }
81

82
  /**
83
   * @param filePath the {@link Path} to the {@link Properties} to load.
84
   * @param context the {@link IdeContext}.
85
   * @return the parsed {@link RepositoryConfig}.
86
   */
87
  public static RepositoryConfig loadProperties(Path filePath, IdeContext context) {
88

89
    RepositoryProperties properties = new RepositoryProperties(filePath, context);
6✔
90

91
    Set<String> importsSet = properties.getImports();
3✔
92
    List<String> workspaces = properties.getWorkspaces();
3✔
93

94
    return new RepositoryConfig(properties.getProperty(PROPERTY_PATH), properties.getProperty(PROPERTY_WORKING_SETS),
13✔
95
        workspaces, properties.getProperty(PROPERTY_GIT_URL, true), properties.getProperty(PROPERTY_GIT_BRANCH),
6✔
96
        properties.getProperty(PROPERTY_BUILD_PATH), properties.getProperty(PROPERTY_BUILD_CMD), importsSet,
7✔
97
        parseBoolean(properties.getProperty(PROPERTY_ACTIVE)));
3✔
98
  }
99

100
  private static boolean parseBoolean(String value) {
101

102
    if (value == null) {
2✔
103
      return true;
2✔
104
    }
105
    return "true".equals(value.trim());
5✔
106
  }
107
}
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