Commit 645eb86f authored by Evan W. Patton's avatar Evan W. Patton

Add option to generate extensions with old-style layout

Prior to the IOT release, extensions were packaged using the FQCN of
the extension inside of the AIX file. To faciltate being able to
contain multiple extension components in a single package, we switched
to using the package name rather than the FQCN. This causes backward
compatibility issues for extension developers who released extensions
prior to the update.

This commit adds a extensions.packagefqcn property to ant that can be
set to true by developers supporting older extensions so that the
internals of the extension package reflect the older layout. It is
recommended that all new extensions be built with the default (false)
to benefit from the new layout.

Change-Id: Idd9134c7d4d7c19f9a8869e4f88e164e2efa5cc8
parent 902ac3d8
......@@ -39,6 +39,8 @@
<property name="ExternalComponent.dir" location="${local.build.dir}/externalComponents" />
<property name="ExternalComponent-class.dir" location="${local.build.dir}/externalComponents-class" />
<property name="Extensions.dir" location="${local.build.dir}/extensions" />
<!-- Can be used by extension authors to use the old-style AIX package layout -->
<property name="extensions.packagefqcn" value="false" />
<!-- =====================================================================
CommonConstants: library of constants used across App Inventor
......@@ -483,6 +485,7 @@
<arg value="${AndroidRuntime-class.dir}" />
<arg value="${buildserver.files.library.dir}"/>
<arg value="${ExternalComponent-class.dir}"/>
<arg value="${extensions.packagefqcn}"/>
<classpath>
<pathelement location="${ExternalComponentGenerator-class.dir}" />
<pathelement location="${lib.dir}/json/json.jar" />
......
......@@ -32,6 +32,7 @@ public class ExternalComponentGenerator {
private static String androidRuntimeClassDirPath;
private static String buildServerClassDirPath;
private static String externalComponentsTempDirPath;
private static boolean useFQCN = false;
private static Map<String, List<ExternalComponentInfo>> externalComponentsByPackage =
new TreeMap<String, List<ExternalComponentInfo>>();
......@@ -53,6 +54,7 @@ public class ExternalComponentGenerator {
androidRuntimeClassDirPath = args[3];
buildServerClassDirPath = args[4];
externalComponentsTempDirPath = args[5];
useFQCN = Boolean.valueOf(args[6]);
JSONArray simpleComponentDescriptors = new JSONArray(simple_component_json);
JSONArray simpleComponentBuildInfos = new JSONArray(simple_component_build_info_json);
Map<String, JSONObject> buildInfos = buildInfoAsMap(simpleComponentBuildInfos);
......@@ -101,14 +103,15 @@ public class ExternalComponentGenerator {
private static void generateAllExtensions() throws IOException, JSONException {
System.out.println("\nExtensions : Generating extensions");
for (Map.Entry<String, List<ExternalComponentInfo>> entry : externalComponentsByPackage.entrySet()) {
String logComponentType = "[" + entry.getKey() + "]";
String name = useFQCN && entry.getValue().size() == 1 ? entry.getValue().get(0).type : entry.getKey();
String logComponentType = "[" + name + "]";
System.out.println("\nExtensions : Generating files " + logComponentType);
generateExternalComponentDescriptors(entry.getKey(), entry.getValue());
generateExternalComponentDescriptors(name, entry.getValue());
for (ExternalComponentInfo info : entry.getValue()) {
copyIcon(entry.getKey(), info.type, info.descriptor);
copyIcon(name, info.type, info.descriptor);
}
generateExternalComponentBuildFiles(entry.getKey(), entry.getValue());
generateExternalComponentOtherFiles(entry.getKey());
generateExternalComponentBuildFiles(name, entry.getValue());
generateExternalComponentOtherFiles(name);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment