Skip to content

Commit

Permalink
- Added generation of the templates artifacts for flex and air
Browse files Browse the repository at this point in the history
- Added generation of an "adl" zip-artifact containing the adl executables for the air-runtime package
  • Loading branch information
Christofer Dutz committed Jul 23, 2016
1 parent 868e68e commit eb90937
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 9 deletions.
Expand Up @@ -61,6 +61,7 @@ protected void processDirectory() throws ConverterException {
generateCompilerArtifacts();
generateRuntimeArtifacts();
generateFrameworkArtifacts();
generateTemplatesArtifact();
}

/**
Expand Down Expand Up @@ -271,19 +272,25 @@ protected void generateRuntimeArtifacts() throws ConverterException {
runtime.setVersion(airSdkVersion);
runtime.setPackaging("pom");

// Create a list of all libs that should belong to the AIR SDK runtime.
// Generate artifacts from the adl/adl.exe files
MavenArtifact adl = new MavenArtifact();
adl.setGroupId("com.adobe.air.runtime");
adl.setArtifactId("adl");
adl.setVersion(airSdkVersion);
adl.setPackaging("zip");
final File directory = new File(rootSourceDirectory, "bin");
if (!directory.exists() || !directory.isDirectory()) {
throw new ConverterException("Runtime directory does not exist.");
}
final List<File> files = new ArrayList<File>();
files.addAll(Arrays.asList(directory.listFiles(new AirRuntimeFilter())));

// Generate artifacts for every jar in the input directories (Actually this is only one file).
for (final File sourceFile : files) {
final MavenArtifact artifact = resolveArtifact(sourceFile, "com.adobe.air.runtime", airSdkVersion);
runtime.addDependency(artifact);
try {
File adlZip = File.createTempFile("adl-" + airSdkVersion, "zip");
generateZip(directory.listFiles(new AirRuntimeFilter()), adlZip);
adl.addDefaultBinaryArtifact(adlZip);
} catch (IOException e) {
throw new ConverterException("Error creating adl zip.", e);
}
runtime.addDependency(adl);
writeArtifact(adl);

// Zip up the AIR runtime directory.
final MavenArtifact airRuntimeArtifact = generateAirRuntimeArtifact(rootSourceDirectory);
Expand Down Expand Up @@ -327,6 +334,34 @@ protected void generateFrameworkArtifacts() throws ConverterException {
writeArtifact(framework);
}

protected void generateTemplatesArtifact() throws ConverterException {
// Create the root artifact.
final MavenArtifact templates = new MavenArtifact();
templates.setGroupId("com.adobe.air");
templates.setArtifactId("templates");
templates.setVersion(airSdkVersion);
templates.setPackaging("jar");

final File templatesDir = new File(rootSourceDirectory, "templates");
final File[] directories = templatesDir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory() && ("air".equals(pathname.getName()) ||
"extensions".equals(pathname.getName()) || "sdk".equals(pathname.getName()));
}
});

try {
final File jar = File.createTempFile("air-templates-" + airSdkVersion, "jar");
generateZip(directories, jar);
templates.addDefaultBinaryArtifact(jar);
} catch (IOException e) {
throw new ConverterException("Error creating runtime zip.", e);
}

// Write this artifact to file.
writeArtifact(templates);
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Utility methods
Expand Down Expand Up @@ -411,7 +446,7 @@ public boolean accept(File dir, String name) {

public static class AirRuntimeFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return name.equalsIgnoreCase("adl.exe");
return name.equalsIgnoreCase("adl.exe") || name.equalsIgnoreCase("adl");
}
}

Expand Down
Expand Up @@ -69,6 +69,7 @@ protected void processDirectory() throws ConverterException {

generateCompilerArtifacts();
generateFrameworkArtifacts();
generateTemplatesArtifact();
}

/**
Expand Down Expand Up @@ -195,6 +196,31 @@ protected void generateThemeArtifacts() throws ConverterException {
}
}

protected void generateTemplatesArtifact() throws ConverterException {
// Create the root artifact.
final MavenArtifact templates = new MavenArtifact();
templates.setGroupId("org.apache.flex");
templates.setArtifactId("templates");
templates.setVersion(flexSdkVersion);
templates.setPackaging("jar");

final File templatesDir = new File(rootSourceDirectory, "templates");
final File[] directories = templatesDir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory() && "automation-runtimeloading-files".equals(pathname.getName());
}
});

try {
final File jar = File.createTempFile("flex-templates-" + flexSdkVersion, "jar");
generateZip(directories, jar);
templates.addDefaultBinaryArtifact(jar);
} catch (IOException e) {
throw new ConverterException("Error creating runtime zip.", e);
}

}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Utility methods
Expand Down

0 comments on commit eb90937

Please sign in to comment.