Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #88, A layer can expect multiple add-on families #89

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: mvn clean install -Dversion.org.wildfly.glow=${{ env.WILDFLY_GLOW_VERSION }}
shell: bash
working-directory: wildfly-maven-plugin
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: surefire-reports-${{ matrix.os }}-${{ matrix.java }}
Expand Down
29 changes: 15 additions & 14 deletions core/src/main/java/org/wildfly/glow/GlowSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -929,21 +929,22 @@ private static void fixAddOns(ErrorIdentificationSession errorSession,
}
// handle the case of layers expecting addOn
for (Layer l : layers) {
String familyExpected = l.getExpectFamily();
if (familyExpected != null) {
boolean found = false;
for (AddOn addOn : allEnabledAddOns) {
if (addOn.getFamily().equals(familyExpected)) {
found = true;
break;
for (String familyExpected : l.getExpectFamilies()) {
if (familyExpected != null) {
boolean found = false;
for (AddOn addOn : allEnabledAddOns) {
if (addOn.getFamily().equals(familyExpected)) {
found = true;
break;
}
}
if (!found) {
Set<AddOn> members = mapping.getAddOnFamilyMembers().get(familyExpected);
IdentifiedError err = new IdentifiedError("expected add-on not found",
"an add-on of the " + familyExpected + " family is expected by the " + l + " layer", ERROR);
err.getPossibleAddons().addAll(members);
errorSession.addError(err);
}
}
if (!found) {
Set<AddOn> members = mapping.getAddOnFamilyMembers().get(familyExpected);
IdentifiedError err = new IdentifiedError("expected add-on not found",
"an add-on of the " + familyExpected + " family is expected by the " + l + " layer", ERROR);
err.getPossibleAddons().addAll(members);
errorSession.addError(err);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/org/wildfly/glow/Layer.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Layer implements Comparable<Layer> {
private final Set<String> bringDatasources = new TreeSet<>();
private boolean isAutomaticInjection;
private final Set<String> configuration = new TreeSet<>();
private String expectFamily;
private final Set<String> expectFamilies = new TreeSet<>();
private boolean banned;

Layer(String name) {
Expand Down Expand Up @@ -157,15 +157,15 @@ public Set<String> getConfiguration() {
/**
* @return the expectFamily
*/
public String getExpectFamily() {
return expectFamily;
public Set<String> getExpectFamilies() {
return expectFamilies;
}

/**
* @param expectFamily the expectFamily to set
*/
public void setExpectFamily(String expectFamily) {
this.expectFamily = expectFamily;
public void addExpectFamily(String expectFamily) {
expectFamilies.add(expectFamily);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/wildfly/glow/LayerMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public abstract class LayerMetadata {
public static final String CLASS = PREFIX + "class";
public static final String CONFIGURATION = PREFIX + "configuration";
public static final String EXPECT_ADD_ON_FAMILY = PREFIX + "expect-add-on-family";
public static final String EXPECT_ADD_ON_FAMILIES = PREFIX + "expect-add-on-families";
public static final String EXPECTED_FILE = PREFIX + "expected-file";
public static final String HIDDEN_IF = PREFIX + "hidden-if";
public static final String INCLUSION_MODE = PREFIX + "inclusion-mode";
Expand All @@ -63,6 +64,7 @@ public abstract class LayerMetadata {
FULLY_NAMED_RULES.add(CLASS);
FULLY_NAMED_RULES.add(CONFIGURATION);
FULLY_NAMED_RULES.add(EXPECT_ADD_ON_FAMILY);
FULLY_NAMED_RULES.add(EXPECT_ADD_ON_FAMILIES);
FULLY_NAMED_RULES.add(INCLUSION_MODE);
FULLY_NAMED_RULES.add(KIND);

Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/org/wildfly/glow/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,15 @@ public static LayerMapping buildMapping(Map<String, Layer> layers, Set<String> p
continue;
}
if (LayerMetadata.EXPECT_ADD_ON_FAMILY.equals(k)) {
l.setExpectFamily(l.getProperties().get(k));
l.addExpectFamily(l.getProperties().get(k));
continue;
}
if (LayerMetadata.EXPECT_ADD_ON_FAMILIES.equals(k)) {
String val = l.getProperties().get(k);
String[] split = val.split(",");
for(String v : split) {
l.addExpectFamily(v.trim());
}
continue;
}
if (LayerMetadata.ADD_ON.equals(k)) {
Expand Down
Loading