Skip to content
This repository has been archived by the owner. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.yelbota.plugins</groupId>
<artifactId>adt-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0.9-SNAPSHOT</version>
<version>1.0.10-SNAPSHOT</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need to change this version by hand it's done by the maven release plugin. Moreover, your changes can be part of the 1.0.9-SNAPSHOT and be released as part of the 1.0.9 version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


<name>Adobe AIR Development tools Maven plugin</name>

Expand Down
72 changes: 71 additions & 1 deletion src/main/java/com/yelbota/plugins/adt/PackageAdtMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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()) {
Expand All @@ -408,6 +416,68 @@ else if (!keystore.exists())
}
}

private List<String> getPlatformSdkArgs() throws MojoFailureException
{
List<String> args = new ArrayList<String>();

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<String> args, File dir, String name) {
args.add("-C");
args.add(dir.getAbsolutePath());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/yelbota/plugins/adt/UnpackAdtMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -62,7 +62,7 @@ protected void logAlreadyUnpacked() {

@Override
protected void logUnpacking() {
getLog().info("Unpacking sdk");
getLog().info("Unpacking AIR SDK");
}
};

Expand Down