Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 573f783

Browse files
committed
feat(args): add --minerr_js_resource_path parameter
1 parent c7b055e commit 573f783

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/org/angularjs/closurerunner/NgClosureRunner.java

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ public class NgClosureRunner extends CommandLineRunner {
2121

2222
private boolean minerrPass;
2323
private String minerrErrors, minerrUrl, minerrSeparator;
24+
private String minerrJsResourcePath;
2425
private Compiler cachedCompiler;
2526

26-
protected NgClosureRunner(String[] args,
27-
boolean minerrPass,
28-
String minerrErrors,
27+
protected NgClosureRunner(String[] args,
28+
boolean minerrPass,
29+
String minerrErrors,
2930
String minerrUrl,
30-
String minerrSeparator) {
31+
String minerrSeparator,
32+
String minerrJsResourcePath) {
3133
super(args);
3234
this.minerrPass = minerrPass;
3335
this.minerrSeparator = minerrSeparator;
34-
36+
this.minerrJsResourcePath = minerrJsResourcePath;
37+
3538
if (minerrErrors != null) {
3639
this.minerrErrors = minerrErrors;
3740
} else {
@@ -60,12 +63,12 @@ private String loadTextResource(String asset) throws IOException {
6063
private CompilerPass createMinerrPass() throws IOException {
6164
AbstractCompiler compiler = createCompiler();
6265
PrintStream output = new PrintStream(minerrErrors);
63-
String code = loadTextResource("minErr.js");
66+
String code = loadTextResource(minerrJsResourcePath);
6467

6568
if (minerrUrl != null) {
66-
return new MinerrPass(compiler,
67-
output,
68-
MinerrPass.substituteInCode(code, minerrUrl, minerrSeparator));
69+
return new MinerrPass(
70+
compiler, output,
71+
MinerrPass.substituteInCode(code, minerrUrl, minerrSeparator));
6972
}
7073
return new MinerrPass(compiler, output);
7174
}
@@ -101,7 +104,10 @@ protected Compiler createCompiler() {
101104

102105
public static void main(String[] args) {
103106
boolean minerrPass = false;
104-
String minerrErrors = "errors.json", minerrUrl = null, minerrSeparator = "/";
107+
String minerrErrors = "errors.json";
108+
String minerrUrl = null;
109+
String minerrSeparator = "/";
110+
String minerrJsResourcePath = "minErr.js";
105111
List<String> passthruArgs = new ArrayList<String>();
106112

107113
for (int i = 0; i < args.length; i++) {
@@ -114,18 +120,22 @@ public static void main(String[] args) {
114120
minerrUrl = args[++i];
115121
} else if (arg.equals("--minerr_separate_with_colon")) {
116122
minerrSeparator = ":";
123+
} else if (arg.equals("--minerr_js_resource_path")) {
124+
minerrJsResourcePath = args[++i];
117125
} else {
118126
passthruArgs.add(arg);
119127
}
120128
}
121129

122-
NgClosureRunner runner = new NgClosureRunner(passthruArgs.toArray(new String[]{}),
123-
minerrPass, minerrErrors, minerrUrl, minerrSeparator);
130+
NgClosureRunner runner = new NgClosureRunner(
131+
passthruArgs.toArray(new String[]{}),
132+
minerrPass, minerrErrors, minerrUrl, minerrSeparator,
133+
minerrJsResourcePath);
124134

125135
if (runner.shouldRunCompiler()) {
126136
runner.run();
127137
} else {
128138
System.exit(-1);
129139
}
130140
}
131-
}
141+
}

0 commit comments

Comments
 (0)