diff --git a/pom.xml b/pom.xml
index f6963dc..e9f1ea7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.yelbota.plugins
adt-maven-plugin
maven-plugin
- 1.0.9-SNAPSHOT
+ 1.0.10-SNAPSHOT
Adobe AIR Development tools Maven plugin
diff --git a/src/main/java/com/yelbota/plugins/adt/PackageAdtMojo.java b/src/main/java/com/yelbota/plugins/adt/PackageAdtMojo.java
index cba16a0..85b109e 100644
--- a/src/main/java/com/yelbota/plugins/adt/PackageAdtMojo.java
+++ b/src/main/java/com/yelbota/plugins/adt/PackageAdtMojo.java
@@ -18,7 +18,11 @@
import com.yelbota.plugins.adt.exceptions.AdtConfigurationException;
import com.yelbota.plugins.adt.model.AneModel;
import com.yelbota.plugins.adt.model.ApplicationDescriptorModel;
+import com.yelbota.plugins.nd.UnpackHelper;
+import com.yelbota.plugins.nd.utils.DefaultUnpackMethods;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.model.Build;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -28,6 +32,8 @@
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.console.ConsoleLoggerManager;
import java.io.File;
import java.io.IOException;
@@ -191,6 +197,8 @@ protected void prepareArguments() throws MojoFailureException
if (aneDir.list().length > 0)
args.addAll(getExtDirArguments(aneDir));
+ args.addAll(getPlatformSdkArgs());
+
String[] argsArray = args.toArray(new String[]{});
getLog().info("Building package " + getFinalName());
@@ -395,7 +403,7 @@ public void validateCertificate() throws AdtConfigurationException {
if (storetype == null || storepass == null || keystore == null)
throw new AdtConfigurationException("Signing options (storetype, keystore, storepass) must be defined");
else if (!keystore.exists())
- throw new AdtConfigurationException("Keystore file doesn't exists");
+ throw new AdtConfigurationException("Keystore file '" + keystore + "' doesn't exist");
}
if (getProvisioningProfileRequired()) {
@@ -408,6 +416,68 @@ else if (!keystore.exists())
}
}
+ private List getPlatformSdkArgs() throws MojoFailureException
+ {
+ List args = new ArrayList();
+
+ if (pluginArtifacts != null) {
+
+ String groupId = null, artifactId = null;
+
+ if (target.startsWith("ipa")) {
+ // Only the iOS platform SDK is currently supported
+ groupId = "com.apple.ios";
+ artifactId = "ios-sdk";
+ }
+
+ if ((groupId != null) && (artifactId != null))
+ {
+ for (Artifact dependency : pluginArtifacts) {
+
+ if (dependency.getGroupId().equals(groupId) &&
+ dependency.getArtifactId().equals(artifactId)) {
+
+ ArtifactResolutionRequest request = new ArtifactResolutionRequest();
+ request.setArtifact(dependency);
+ request.setLocalRepository(localRepository);
+ request.setRemoteRepositories(remoteRepositories);
+ ArtifactResolutionResult resolutionResult = repositorySystem.resolve(request);
+ if (!resolutionResult.isSuccess()) {
+
+ throw new MojoFailureException("Failed to resolve artifact " + dependency + ": " + resolutionResult);
+ }
+
+ File unpackDir = new File(pluginHome, artifactId + "-" + dependency.getVersion());
+ getLog().debug("platform SDK unpackDir = " + unpackDir.getAbsolutePath());
+
+ UnpackHelper unpackHelper = new UnpackHelper() {
+
+ @Override
+ protected void logAlreadyUnpacked() {
+ getLog().debug("Platform SDK already unpacked");
+ }
+
+ @Override
+ protected void logUnpacking() {
+ getLog().info("Unpacking platform sdk");
+ }
+ };
+
+ ConsoleLoggerManager plexusLoggerManager = new ConsoleLoggerManager();
+ Logger plexusLogger = plexusLoggerManager.getLoggerForComponent(ROLE);
+ DefaultUnpackMethods unpackMethods = new DefaultUnpackMethods(plexusLogger);
+ unpackHelper.unpack(unpackDir, dependency, unpackMethods, getLog());
+
+ args.add("-platformsdk");
+ args.add(unpackDir.getAbsolutePath());
+ break;
+ }
+ }
+ }
+ }
+ return args;
+ }
+
private void addIncludeArg(List args, File dir, String name) {
args.add("-C");
args.add(dir.getAbsolutePath());
diff --git a/src/main/java/com/yelbota/plugins/adt/UnpackAdtMojo.java b/src/main/java/com/yelbota/plugins/adt/UnpackAdtMojo.java
index 0dd48a4..1fb9e2a 100644
--- a/src/main/java/com/yelbota/plugins/adt/UnpackAdtMojo.java
+++ b/src/main/java/com/yelbota/plugins/adt/UnpackAdtMojo.java
@@ -50,7 +50,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
Artifact artifact = getAirSdkArtifact();
File unpackDir = new File(pluginHome, artifact.getArtifactId() + "-" + artifact.getVersion());
- getLog().debug("unpackDir = " + unpackDir.getAbsolutePath());
+ getLog().debug("AIR SDK unpackDir = " + unpackDir.getAbsolutePath());
sdkDirectory = unpackDir;
UnpackHelper unpackHelper = new UnpackHelper() {
@@ -62,7 +62,7 @@ protected void logAlreadyUnpacked() {
@Override
protected void logUnpacking() {
- getLog().info("Unpacking sdk");
+ getLog().info("Unpacking AIR SDK");
}
};