Skip to content

Commit

Permalink
remove FlexJS (Royale is still supported, of course)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Feb 20, 2024
1 parent e855cfd commit 26cea35
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 239 deletions.
57 changes: 8 additions & 49 deletions asconfigc/src/main/java/com/as3mxml/asconfigc/ASConfigC.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import com.as3mxml.asconfigc.compiler.RoyaleTarget;
import com.as3mxml.asconfigc.compiler.WorkerFields;
import com.as3mxml.asconfigc.htmlTemplate.HTMLTemplateOptionsParser;
import com.as3mxml.asconfigc.utils.ApacheFlexJSUtils;
import com.as3mxml.asconfigc.utils.ApacheRoyaleUtils;
import com.as3mxml.asconfigc.utils.ConfigUtils;
import com.as3mxml.asconfigc.utils.GenericSDKUtils;
Expand Down Expand Up @@ -262,11 +261,8 @@ public ASConfigC(ASConfigCOptions options) throws ASConfigCException {
private List<String> airDescriptorPaths;
private List<String> sourcePaths;
private boolean configRequiresRoyale;
private boolean configRequiresRoyaleOrFlexJS;
private boolean configRequiresFlexJS;
private boolean configRequiresAIR;
private boolean sdkIsRoyale;
private boolean sdkIsFlexJS;
private boolean isSWFTargetOnly;
private boolean outputIsJS;
private String sdkHome;
Expand Down Expand Up @@ -618,16 +614,15 @@ private void detectConfigRequirements(String configName) {
switch (configName) {
case ConfigName.JS: {
jsOutputType = JSOutputType.JSC;
configRequiresRoyaleOrFlexJS = true;
configRequiresRoyale = true;
break;
}
case ConfigName.NODE: {
jsOutputType = JSOutputType.NODE;
configRequiresRoyaleOrFlexJS = true;
configRequiresRoyale = true;
break;
}
case ConfigName.ROYALE: {
// this option is not supported by FlexJS
configRequiresRoyale = true;
break;
}
Expand Down Expand Up @@ -850,41 +845,21 @@ private void readCompilerOptions(JsonNode compilerOptionsJson) throws ASConfigCE
e.printStackTrace(new PrintWriter(stackTrace));
throw new ASConfigCException("Error: Failed to parse compiler options.\n" + stackTrace.toString());
}
// make sure that we require Royale (or FlexJS) depending on which options are
// specified
// make sure that we require Royale for certain compiler options
if (compilerOptionsJson.has(CompilerOptions.JS_OUTPUT_TYPE)) {
// this option was used in FlexJS 0.7, but it was replaced with
// targets in FlexJS 0.8.
configRequiresFlexJS = true;
configRequiresRoyale = true;
// if it is set explicitly, then clear the default
jsOutputType = null;
}
if (compilerOptionsJson.has(CompilerOptions.TARGETS)) {
JsonNode targets = compilerOptionsJson.get(CompilerOptions.TARGETS);
boolean foundRoyaleTarget = false;
for (JsonNode target : targets) {
String targetAsText = target.asText();
if (targetAsText.equals(RoyaleTarget.JS_ROYALE)
|| targetAsText.equals(RoyaleTarget.JS_ROYALE_CORDOVA)) {
// these targets definitely don't work with FlexJS
configRequiresRoyale = true;
foundRoyaleTarget = true;
}
if (targetAsText.equals(RoyaleTarget.SWF)) {
isSWFTargetOnly = targets.size() == 1;
}
}
if (!foundRoyaleTarget) {
// remaining targets are supported by both Royale and FlexJS
configRequiresRoyaleOrFlexJS = true;
}
configRequiresRoyale = true;
// if targets is set explicitly, then we're using a newer SDK
// that doesn't need js-output-type
jsOutputType = null;
}
if (compilerOptionsJson.has(CompilerOptions.SOURCE_MAP)) {
// source-map compiler option is supported by both Royale and FlexJS
configRequiresRoyaleOrFlexJS = true;
// source-map compiler option is supported by Royale
configRequiresRoyale = true;
}
}

Expand Down Expand Up @@ -922,17 +897,12 @@ private void validateSDK() throws ASConfigCException {
sdkHome = ApacheRoyaleUtils.findSDK();
}
if (sdkHome == null && !configRequiresRoyale) {
sdkHome = ApacheFlexJSUtils.findSDK();
}
if (sdkHome == null && !configRequiresRoyale && !configRequiresRoyaleOrFlexJS && !configRequiresFlexJS) {
sdkHome = GenericSDKUtils.findSDK();
}
if (sdkHome == null) {
String envHome = "FLEX_HOME";
if (configRequiresRoyale) {
envHome = "ROYALE_HOME";
} else if (configRequiresRoyaleOrFlexJS) {
envHome = "ROYALE_HOME for Apache Royale, FLEX_HOME for Apache FlexJS";
}
throw new ASConfigCException(
"SDK not found. Set " + envHome + ", add SDK to PATH environment variable, or use --sdk option.");
Expand All @@ -948,18 +918,7 @@ private void validateSDK() throws ASConfigCException {
"Configuration options in asconfig.json require Apache Royale. Path to SDK is not valid: "
+ sdkHome);
}
sdkIsFlexJS = ApacheFlexJSUtils.isValidSDK(sdkHomePath);
if (configRequiresRoyaleOrFlexJS && !sdkIsRoyale && !sdkIsFlexJS) {
throw new ASConfigCException(
"Configuration options in asconfig.json require Apache Royale. Path to SDK is not valid: "
+ sdkHome);
}
if (configRequiresFlexJS && !sdkIsFlexJS) {
throw new ASConfigCException(
"Configuration options in asconfig.json require Apache FlexJS. Path to SDK is not valid: "
+ sdkHome);
}
outputIsJS = (sdkIsRoyale || sdkIsFlexJS) && !isSWFTargetOnly;
outputIsJS = sdkIsRoyale && !isSWFTargetOnly;
outputPathForTarget = outputIsJS ? jsOutputPath : swfOutputPath;
if (options.verbose) {
System.out.println("SDK: " + sdkHomePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
public class JSOutputType {
public static final String JSC = "jsc";
public static final String NODE = "node";
public static final String FLEXJS = "flexjs";
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public interface IMXMLLibraryConstants {
String MX = "library://ns.adobe.com/flex/mx";
String SPARK = "library://ns.adobe.com/flex/spark";

// Royale
String FLEXJS_BASIC = "library://ns.apache.org/flexjs/basic";
String FLEXJS_EXPRESS = "library://ns.apache.org/flexjs/express";

// Royale
String ROYALE_BASIC = "library://ns.apache.org/royale/basic";
String ROYALE_EXPRESS = "library://ns.apache.org/royale/express";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public static ILspProject createProject(ProjectOptions currentProjectOptions, Wo
Path frameworkLibPath = Paths.get(System.getProperty(PROPERTY_FRAMEWORK_LIB));
boolean frameworkSDKIsRoyale = ActionScriptSDKUtils.isRoyaleFramework(frameworkLibPath);

Path asjscPath = frameworkLibPath.resolve("../js/bin/asjsc");
boolean frameworkSDKIsFlexJS = !frameworkSDKIsRoyale && asjscPath.toFile().exists();

ILspProject project = null;

// we're going to try to determine what kind of project we need
Expand Down Expand Up @@ -125,7 +122,7 @@ else if (currentProjectOptions.config.equals(CONFIG_ROYALE)) {
}
// finally, if the config value is missing, then choose a decent
// default backend when the SDK is Royale
else if (frameworkSDKIsRoyale || frameworkSDKIsFlexJS) {
else if (frameworkSDKIsRoyale) {
backend = new RoyaleBackend();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public class MXMLNamespaceUtils {
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.SPARK, PREFIX_S);
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.MX, PREFIX_MX);

// FlexJS
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.FLEXJS_EXPRESS, PREFIX_JS);
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.FLEXJS_BASIC, PREFIX_JS);

// Royale
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.ROYALE_EXPRESS, PREFIX_JS);
NAMESPACE_TO_PREFIX.put(IMXMLLibraryConstants.ROYALE_BASIC, PREFIX_JS);
Expand All @@ -68,8 +64,8 @@ public class MXMLNamespaceUtils {
}

private static final Pattern[] PATTERNS = {
// Royale/FlexJS library
Pattern.compile("^library:\\/\\/ns\\.apache\\.org\\/(?:flexjs|royale)\\/(\\w+)$"),
// Royale library
Pattern.compile("^library:\\/\\/ns\\.apache\\.org\\/(?:royale)\\/(\\w+)$"),

// Flex library
Pattern.compile("^[a-z]+:\\/\\/flex\\.apache\\.org\\/(\\w+)\\/ns$"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ void testGetNamespaceFromURIWithRoyaleLibrary() {
"MXMLNamespaceUtils.getNamespaceFromURI() returned incorrect prefix.");
}

@Test
void testGetNamespaceFromURIWithFlexJSLibrary() {
String uri = "library://ns.apache.org/flexjs/example";
MXMLNamespace result = MXMLNamespaceUtils.getNamespaceFromURI(uri, new PrefixMap());
Assertions.assertNotNull(result);
Assertions.assertEquals(uri, result.uri, "MXMLNamespaceUtils.getNamespaceFromURI() returned incorrect uri.");
Assertions.assertEquals("example", result.prefix,
"MXMLNamespaceUtils.getNamespaceFromURI() returned incorrect prefix.");
}

@Test
void testGetNamespaceFromURIWithFlexLibrary() {
String uri = "http://flex.apache.org/example/ns";
Expand Down
11 changes: 0 additions & 11 deletions vscode-extension/src/main/ts/commands/selectWorkspaceSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import * as path from "path";
import findSDKName from "../utils/findSDKName";
import validateFrameworkSDK from "../utils/validateFrameworkSDK";
import findSDKInLocalRoyaleNodeModule from "../utils/findSDKInLocalRoyaleNodeModule";
import findSDKInLocalFlexJSNodeModule from "../utils/findSDKInLocalFlexJSNodeModule";
import findSDKInRoyaleHomeEnvironmentVariable from "../utils/findSDKInRoyaleHomeEnvironmentVariable";
import findSDKInFlexHomeEnvironmentVariable from "../utils/findSDKInFlexHomeEnvironmentVariable";
import findSDKsInPathEnvironmentVariable from "../utils/findSDKsInPathEnvironmentVariable";
Expand Down Expand Up @@ -212,16 +211,6 @@ export default function selectWorkspaceSDK(
true
);
}
let flexjsNodeModuleSDK = findSDKInLocalFlexJSNodeModule();
if (flexjsNodeModuleSDK) {
addSDKItem(
flexjsNodeModuleSDK,
DESCRIPTION_NODE_MODULE,
items,
allPaths,
true
);
}
//if the user has defined search paths for SDKs, include them
let searchPaths = vscode.workspace
.getConfiguration("as3mxml")
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions vscode-extension/src/main/ts/utils/findSDKShortName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import findSDKName from "./findSDKName";

const AIR = "AIR ";
const FLEX = "Flex ";
const FLEXJS = "FlexJS ";
const ROYALE = "Royale ";
const FEATHERS = "Feathers ";
const APACHE_FLEX = "Apache Flex ";
const APACHE_FLEXJS = "Apache Flex (FlexJS) ";
const APACHE_ROYALE = "Apache Royale ";
const FEATHERS_SDK = "Feathers SDK ";
const FP = " FP";
Expand Down Expand Up @@ -64,9 +62,6 @@ export default function findSDKShortName(sdkPath: string): string {
if (sdkName.startsWith(APACHE_ROYALE)) {
return stripAfterNextSpace(sdkName, APACHE_ROYALE, ROYALE);
}
if (sdkName.startsWith(APACHE_FLEXJS)) {
return stripAfterNextSpace(sdkName, APACHE_FLEXJS, FLEXJS);
}
if (sdkName.startsWith(APACHE_FLEX)) {
return stripAfterNextSpace(sdkName, APACHE_FLEX);
}
Expand Down
Loading

0 comments on commit 26cea35

Please sign in to comment.