Skip to content

Commit 8844ff1

Browse files
authored
Merge pull request #49 from ralfgrossklaus/Ignore_Errors_Switch
SuppressErrors
2 parents e6579a3 + 141cea7 commit 8844ff1

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/main/java/com/diffplug/gradle/eclipserunner/EclipseApp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public class EclipseApp {
9292
* such as `org.eclipse.ant.core.antRunner` or `org.eclipse.equinox.p2.director`
9393
*/
9494
public EclipseApp(String application) {
95+
addArg("-launcher.suppressErrors");
9596
addArg("application", application);
9697
}
9798

src/main/java/com/diffplug/gradle/eclipserunner/EquinoxLauncher.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
*/
1616
package com.diffplug.gradle.eclipserunner;
1717

18+
import static java.util.stream.Collectors.toList;
19+
1820
import java.io.File;
1921
import java.util.HashMap;
2022
import java.util.List;
2123
import java.util.Map;
2224
import java.util.Objects;
2325
import java.util.SortedSet;
2426
import java.util.function.BiConsumer;
27+
import java.util.stream.Collectors;
2528

2629
import org.eclipse.core.runtime.adaptor.EclipseStarter;
2730
import org.osgi.framework.BundleContext;
@@ -107,7 +110,12 @@ private File getPluginRequireSingle(String name) {
107110

108111
/** Sets the application arguments which will be passed to the runtime. */
109112
public EquinoxLauncher setArgs(List<String> args) {
110-
this.args = ImmutableList.copyOf(args);
113+
// Filter --launcher.suppressErrors
114+
List<String> filteredArgs = args.stream()
115+
.filter(Objects::nonNull)
116+
.filter(arg -> !arg.equals("--launcher.suppressErrors"))
117+
.collect(toList());
118+
this.args = ImmutableList.copyOf(filteredArgs);
111119
return this;
112120
}
113121

src/test/java/com/diffplug/gradle/eclipserunner/EclipseAppTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public void test() {
3131
app.addArg("prop", "a");
3232
app.addArg("prop", "b");
3333
app.addArg("flag");
34-
Assert.assertEquals("-application diffplug -prop a,b -flag", Joiner.on(" ").join(app.toArgList()));
35-
Assert.assertEquals("-application diffplug\n-prop a,b\n-flag\n", app.toString());
34+
Assert.assertEquals("--launcher.suppressErrors -application diffplug -prop a,b -flag", Joiner.on(" ").join(app.toArgList()));
35+
Assert.assertEquals("--launcher.suppressErrors\n-application diffplug\n-prop a,b\n-flag\n", app.toString());
3636
}
3737

3838
@Test
@@ -41,7 +41,7 @@ public void testDoubleAdd() {
4141
app.addArg("flag");
4242
app.addArg("flag");
4343
app.addArg("flag");
44-
Assert.assertEquals("-application diffplug -flag", Joiner.on(" ").join(app.toArgList()));
44+
Assert.assertEquals("--launcher.suppressErrors -application diffplug -flag", Joiner.on(" ").join(app.toArgList()));
4545
}
4646

4747
@SuppressWarnings("unchecked")
@@ -53,13 +53,14 @@ public void testAnt() {
5353
task.attributes().put("prop", "propvalue");
5454
ant.setTask(task);
5555

56-
Assert.assertEquals("-application org.eclipse.ant.core.antRunner -Dkey=value", Joiner.on(" ").join(ant.toArgList()));
56+
Assert.assertEquals("--launcher.suppressErrors -application org.eclipse.ant.core.antRunner -Dkey=value", Joiner.on(" ").join(ant.toArgList()));
5757
Assert.assertEquals(StringPrinter.buildStringFromLines(
5858
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><project>",
5959
" <anttask prop=\"propvalue\"/>",
6060
"</project>"), ant.buildXml());
6161
Assert.assertEquals(StringPrinter.buildStringFromLines(
6262
"### ARGS ###",
63+
"--launcher.suppressErrors",
6364
"-application org.eclipse.ant.core.antRunner",
6465
"-Dkey=value",
6566
"",

src/test/java/com/diffplug/gradle/p2/P2ModelTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public void testDirectorArgs() {
3939
File dest = new File("dest");
4040
String actual = testData().directorApp(dest, "profile").completeState();
4141
String expected = StringPrinter.buildStringFromLines(
42+
"--launcher.suppressErrors",
4243
"-application org.eclipse.equinox.p2.director",
4344
"-clean",
4445
"-consolelog",
@@ -57,6 +58,7 @@ public void testMirrorAntFile() {
5758
String actual = testData().mirrorApp(dest).completeState();
5859
String expected = StringPrinter.buildStringFromLines(
5960
"### ARGS ###",
61+
"--launcher.suppressErrors",
6062
"-application org.eclipse.ant.core.antRunner",
6163
"",
6264
"### BUILD.XML ###",
@@ -85,6 +87,7 @@ public void testMirrorAntFileWithSlicingOptions() {
8587
String actual = p2.mirrorApp(dest).completeState();
8688
String expected = StringPrinter.buildStringFromLines(
8789
"### ARGS ###",
90+
"--launcher.suppressErrors",
8891
"-application org.eclipse.ant.core.antRunner",
8992
"",
9093
"### BUILD.XML ###",
@@ -112,6 +115,7 @@ public void testMirrorAntFileWithAppend() {
112115
String actual = p2.mirrorApp(dest).completeState();
113116
String expected = StringPrinter.buildStringFromLines(
114117
"### ARGS ###",
118+
"--launcher.suppressErrors",
115119
"-application org.eclipse.ant.core.antRunner",
116120
"",
117121
"### BUILD.XML ###",
@@ -137,6 +141,7 @@ public void testMirrorAntFileWithAppendDefault() {
137141
String actual = p2.mirrorApp(dest).completeState();
138142
String expected = StringPrinter.buildStringFromLines(
139143
"### ARGS ###",
144+
"--launcher.suppressErrors",
140145
"-application org.eclipse.ant.core.antRunner",
141146
"",
142147
"### BUILD.XML ###",

0 commit comments

Comments
 (0)