You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/01/25 18:52:25 UTC
[royale-compiler] 01/02: MXMLJSC: validate targets compiler option
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 707d100cb03b167a1e17922aae2cf209c6f82f53
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Jan 25 10:49:13 2022 -0800
MXMLJSC: validate targets compiler option
---
.../org/apache/royale/compiler/clients/MXMLJSC.java | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
index 33cfb43..9b3a2ec 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java
@@ -174,7 +174,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
if (text.equalsIgnoreCase(jsTargetType.text))
return jsTargetType;
}
- return JS_ROYALE;
+ return null;
}
}
@@ -928,6 +928,23 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider,
return false;
}
+ for(String target : config.getCompilerTargets())
+ {
+ JSTargetType jsTargetType = JSTargetType.fromString(target);
+ if (jsTargetType == null)
+ {
+ String message = "configuration variable 'targets' must be one of the following: ";
+ for (JSTargetType type : JSTargetType.values())
+ {
+ message += "'" + type.text + "', ";
+ }
+ message += "got '" + target + "'";
+ final ICompilerProblem problem = new ConfigurationProblem(null, -1,
+ -1, -1, -1, message);
+ problems.add(problem);
+ }
+ }
+
if (problems.hasErrors())
return false;