Search in sources :

Example 1 with ProductFileFilter

use of org.eclipse.tycho.versions.utils.ProductFileFilter in project tycho by eclipse.

the class EclipseRepositoryProductFileManipulator method getProductConfigurations.

private Map<File, ProductConfiguration> getProductConfigurations(ProjectMetadata project) {
    ProductConfigurations products = project.getMetadata(ProductConfigurations.class);
    if (products == null) {
        products = new ProductConfigurations();
        File[] productFiles = project.getBasedir().listFiles(new ProductFileFilter());
        if (productFiles != null) {
            for (File productFile : productFiles) {
                try {
                    products.addProductConfiguration(productFile, ProductConfiguration.read(productFile));
                } catch (IOException e) {
                    throw new IllegalArgumentException("Could not read product configuration file " + productFile, e);
                }
            }
        }
        project.putMetadata(products);
    }
    return products.getProductConfigurations();
}
Also used : ProductConfigurations(org.eclipse.tycho.versions.engine.ProductConfigurations) IOException(java.io.IOException) PomFile(org.eclipse.tycho.versions.pom.PomFile) File(java.io.File) ProductFileFilter(org.eclipse.tycho.versions.utils.ProductFileFilter)

Example 2 with ProductFileFilter

use of org.eclipse.tycho.versions.utils.ProductFileFilter in project tycho by eclipse.

the class VersionUpdater method findProductFile.

private static File findProductFile(ProjectMetadata project, PomFile pom, Logger logger) {
    File productFile = new File(project.getBasedir(), pom.getArtifactId() + ".product");
    if (productFile.exists()) {
        return productFile;
    }
    File[] productFiles = project.getBasedir().listFiles(new ProductFileFilter());
    if (productFiles == null || productFiles.length == 0) {
        logger.warn("Skipping updating pom in directory " + project.getBasedir() + " because no product file found to extract the (new) version");
        return null;
    }
    if (productFiles.length > 1) {
        logger.warn("Skipping updating pom in directory " + project.getBasedir() + " because more than one product files have been found. Only one product file is supported or one must be named <artifactId>.product");
        return null;
    }
    return productFiles[0];
}
Also used : PomFile(org.eclipse.tycho.versions.pom.PomFile) File(java.io.File) ProductFileFilter(org.eclipse.tycho.versions.utils.ProductFileFilter)

Aggregations

File (java.io.File)2 PomFile (org.eclipse.tycho.versions.pom.PomFile)2 ProductFileFilter (org.eclipse.tycho.versions.utils.ProductFileFilter)2 IOException (java.io.IOException)1 ProductConfigurations (org.eclipse.tycho.versions.engine.ProductConfigurations)1