Example usage for org.apache.maven.project MavenProject getBuild

List of usage examples for org.apache.maven.project MavenProject getBuild

Introduction

In this page you can find the example usage for org.apache.maven.project MavenProject getBuild.

Prototype

public Build getBuild() 

Source Link

Usage

From source file:com.sap.prd.mobile.ios.mios.FolderLayout.java

License:Apache License

static File getFolderForAdditionalPackagingType(MavenProject project, String type) {
    return new File(new File(new File(project.getBuild().getDirectory()), XCODE_DEPS_TARGET_FOLDER), type);
}

From source file:com.sap.prd.mobile.ios.mios.FolderLayout.java

License:Apache License

static File getFolderForExtractedFatLibs(MavenProject project, final String configuration) {
    return new File(project.getBuild().getDirectory() + "/" + XCODE_DEPS_TARGET_FOLDER + "/" + LIBS_DIR_NAME
            + "/" + configuration);
}

From source file:com.sap.prd.mobile.ios.mios.FolderLayout.java

License:Apache License

static File getFolderForExtractedMainArtifact(MavenProject project) {
    return new File(new File(project.getBuild().getDirectory()), "main.artifact");
}

From source file:com.sap.prd.mobile.ios.mios.FolderLayout.java

License:Apache License

static File getFolderForExtractedPrimaryArtifact(MavenProject project, Artifact primaryArtifact) {
    return new File(new File(new File(new File(project.getBuild().getDirectory()), "extractedPrimaryArtifacts"),
            primaryArtifact.getGroupId()), primaryArtifact.getArtifactId());
}

From source file:com.sap.prd.mobile.ios.mios.XCodePackageManager.java

License:Apache License

private void attachBundle(File compileDir, MavenProject project, Set<String> bundles, File mainArtifact)
        throws IOException {

    final Set<String> bundleNames = new HashSet<String>();

    for (String bundleName : bundles) {
        File bundleDirectory = XCodeBuildLayout.getBundleDirectory(compileDir, bundleName);

        if (!bundleDirectory.exists()) {
            LOGGER.info(//from w  w  w  .ja  v a 2 s. c o m
                    "Bundle directory '" + bundleDirectory + "' does not exist. Bundle will not be attached.");
            continue;
        }
        final File bundleFile = new File(new File(project.getBuild().getDirectory()), bundleName + ".bundle");

        try {

            archive("zip", bundleDirectory, bundleFile, new String[] { "**/*" }, null);
            LOGGER.info("Bundle zip file created (" + bundleFile + ")");
        } catch (XCodeException ex) {
            throw new RuntimeException("Could not archive header directory '" + bundleDirectory + "'", ex);
        } catch (NoSuchArchiverException ex) {
            throw new RuntimeException("Could not archive header directory '" + bundleDirectory + "'", ex);
        }

        String escapedBundleName = escapeBundleName(bundleName);
        prepareBundleFileForDeployment(project, bundleFile, escapedBundleName);
        bundleNames.add(getBundleReference(project, escapedBundleName));
    }

    addBundleInfoToMainArtifact(bundleNames, new File(mainArtifact, "bundles.txt"));
}

From source file:com.sap.prd.mobile.ios.mios.XCodePackageManager.java

License:Apache License

private File archiveMainArtifact(final MavenProject project, File mainArtifact) throws IOException {
    final File mainArtifactTarFile = new File(new File(project.getBuild().getDirectory()), "main.artifact.tar");

    try {// w w  w . j av a  2s  .c  o m

        archive("tar", mainArtifact, mainArtifactTarFile, new String[] { "**/*" }, null);
        LOGGER.info("header tar file created (" + mainArtifactTarFile + ")");
    } catch (XCodeException ex) {
        throw new RuntimeException("Could not archive main artifact directory '" + mainArtifact + "'", ex);
    } catch (NoSuchArchiverException ex) {
        throw new RuntimeException("Could not archive main artifact directory '" + mainArtifact + "'", ex);
    }
    return mainArtifactTarFile;
}

From source file:com.sap.prd.mobile.ios.mios.XCodePackageManager.java

License:Apache License

void packageHeaders(final XCodeContext xcodeContext, MavenProject project,
        String relativeAlternatePublicHeaderFolderPath) throws IOException, XCodeException {
    final File publicHeaderFolderPath = getPublicHeaderFolderPath(
            EffectiveBuildSettings.getBuildSetting(xcodeContext, EffectiveBuildSettings.BUILT_PRODUCTS_DIR),
            EffectiveBuildSettings.getBuildSetting(xcodeContext,
                    EffectiveBuildSettings.PUBLIC_HEADERS_FOLDER_PATH),
            relativeAlternatePublicHeaderFolderPath);

    if (!publicHeaderFolderPath.canRead()) {
        LOGGER.warning("Public header folder path '" + publicHeaderFolderPath
                + "' cannot be read. Unable to package headers.");
        return;/*  ww w  .  j  a v a2s  . c  om*/
    }

    final File headersFile = new File(new File(new File(project.getBuild().getDirectory()),
            xcodeContext.getConfiguration() + "-" + xcodeContext.getSDK()), "headers.tar");

    try {

        archive("tar", publicHeaderFolderPath, headersFile, new String[] { "**/*.h" }, null);
        LOGGER.info("header tar file created (" + headersFile + ")");
    } catch (XCodeException ex) {
        throw new RuntimeException("Could not archive header directory '" + publicHeaderFolderPath + "'", ex);
    } catch (NoSuchArchiverException ex) {
        throw new RuntimeException("Could not archive header directory '" + publicHeaderFolderPath + "'", ex);
    }

    prepareHeaderFileForDeployment(project, xcodeContext.getConfiguration(), xcodeContext.getSDK(),
            headersFile);

}

From source file:com.sap.prd.mobile.ios.mios.XCodePrepareBuildManager.java

License:Apache License

private void extractFramework(MavenProject project, final Artifact primaryArtifact, String configuration,
        File frameworkArtifact) throws MojoExecutionException {
    File target = FolderLayout.getFolderForExtractedFrameworkswithGA(project, primaryArtifact.getGroupId(),
            primaryArtifact.getArtifactId(), configuration);
    createDirectory(target);/*w  w w. j a  va2 s  .c  o m*/
    try {
        extractFileWithShellScript(frameworkArtifact, target, new File(project.getBuild().getDirectory()));
    } catch (IOException ioe) {
        throw new MojoExecutionException(
                "Cannot unarchive framework from " + frameworkArtifact + " to " + target);
    }
}

From source file:com.sap.prd.mobile.ios.mios.XCodePrepareBuildManager.java

License:Apache License

private void handlePrimaryArtifact(MavenProject project, final Artifact primaryArtifact,
        Collection<String> configurations) throws MojoExecutionException {
    if (primaryArtifact != null) {
        final File source = primaryArtifact.getFile();
        for (String configuration : configurations) {
            final File target = FolderLayout.getFolderForExtractedFrameworkswithGA(project,
                    primaryArtifact.getGroupId(), primaryArtifact.getArtifactId());
            extractFramework(project, primaryArtifact, configuration, source);

            try {
                extractFileWithShellScript(source, target, new File(project.getBuild().getDirectory()));
            } catch (IOException ioe) {
                throw new MojoExecutionException("Cannot unarchive framework from " + source + " to " + target);
            }/*from w w  w . j  a  v  a  2  s  . c  om*/

            LOGGER.info("Framework unarchived from " + source + " to " + target);
        }
    }
}

From source file:com.simpligility.maven.plugins.android.common.UnpackedLibHelper.java

License:Open Source License

public UnpackedLibHelper(ArtifactResolverHelper artifactResolverHelper, MavenProject project, Logger log,
        File unpackedLibsFolder) {
    this.artifactResolverHelper = artifactResolverHelper;
    if (unpackedLibsFolder != null) {
        // if absolute then use it.
        // if relative then make it relative to the basedir of the project.
        this.unpackedLibsDirectory = unpackedLibsFolder.isAbsolute() ? unpackedLibsFolder
                : new File(project.getBasedir(), unpackedLibsFolder.getPath());
    } else {/*from w  ww.j a v a  2s  . c  om*/
        // If not specified then default to target/unpacked-libs
        final File targetFolder = new File(project.getBuild().getDirectory());
        this.unpackedLibsDirectory = new File(targetFolder, "unpacked-libs");
    }
    this.log = log;
}