Skip to content

Commit 4f2e4dc

Browse files
authored
Removed simple ignore rule pattern - it was too easy to strip things by accident (#254)
1 parent 5c547b8 commit 4f2e4dc

File tree

3 files changed

+7
-54
lines changed

3 files changed

+7
-54
lines changed

cli/src/main/java/ca/weblite/jdeploy/models/JDeployIgnorePattern.java

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ private boolean matchesNamespace(String filePath, String pattern) {
8383
}
8484
if (pattern.contains("*")) {
8585
// Wildcard match - convert to regex
86-
String regex = pattern.replace(".", "\\.").replace("*", "[^/]*");
86+
String regex = pattern
87+
.replace(".", "\\.")
88+
.replace("**", "{DOUBLE_ASTERISK}")
89+
.replace("*", "[^/]*")
90+
.replace("{DOUBLE_ASTERISK}", ".*");
8791
return filePath.matches(regex);
8892
}
8993
if (pattern.endsWith("/")) {
@@ -107,48 +111,6 @@ private boolean matchesNamespace(String filePath, String pattern) {
107111
return true;
108112
}
109113

110-
// Handle simple namespace patterns that should match file names
111-
// E.g., pattern "debug" should match:
112-
// - debug.class
113-
// - com/example/Debug.class
114-
// - any/path/debug.log
115-
if (matchesSimplePattern(pattern, filePath)) {
116-
return true;
117-
}
118-
119-
return false;
120-
}
121-
122-
/**
123-
* Checks if a simple pattern (like "debug") matches a file path.
124-
* For simple patterns (no slashes), match if the pattern appears as:
125-
* 1. The exact filename (debug.class)
126-
* 2. Part of a filename with case-insensitive matching (Debug.class)
127-
* 3. Part of any path component
128-
*/
129-
private boolean matchesSimplePattern(String pattern, String filePath) {
130-
if (pattern.contains("/")) {
131-
return false; // Not a simple pattern
132-
}
133-
134-
// Split the file path into components
135-
String[] pathComponents = filePath.split("/");
136-
137-
// Check each component
138-
for (String component : pathComponents) {
139-
// Remove file extension for comparison
140-
String nameWithoutExtension = component;
141-
int dotIndex = component.lastIndexOf('.');
142-
if (dotIndex > 0) {
143-
nameWithoutExtension = component.substring(0, dotIndex);
144-
}
145-
146-
// Check if pattern matches the component (case-insensitive)
147-
if (nameWithoutExtension.toLowerCase().contains(pattern.toLowerCase())) {
148-
return true;
149-
}
150-
}
151-
152114
return false;
153115
}
154116

cli/src/main/java/ca/weblite/jdeploy/services/RecommendedIgnoreRulesService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ public List<String> generateGlobalIgnoreRules() {
3535
rules.add("/libjavafx_*.dylib");
3636
rules.add("/libjavafx_*.so");
3737

38-
rules.add("");
39-
rules.add("# Development and testing libraries");
40-
rules.add("junit");
41-
rules.add("org/junit");
42-
rules.add("org/mockito");
43-
rules.add("org/hamcrest");
44-
rules.add("org/testng");
45-
rules.add("test");
46-
rules.add("debug");
47-
4838
return rules;
4939
}
5040

cli/src/test/java/ca/weblite/jdeploy/services/DefaultBundleProcessingTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ private void createGlobalIgnoreFile(JDeployProject project) throws IOException {
168168
File globalIgnore = new File(projectDir, ".jdpignore");
169169

170170
String patterns = "# Global ignore patterns\n" +
171-
"debug\n" +
171+
"**debug**\n" +
172+
"**Debug**\n" +
172173
"/log\n";
173174

174175
FileUtils.writeStringToFile(globalIgnore, patterns, "UTF-8");

0 commit comments

Comments
 (0)