コード例 #1
0
  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 FileFilter() {

                    @Override
                    public boolean accept(File file) {
                      return file.isFile() && file.getName().endsWith(".product");
                    }
                  });
      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();
  }
コード例 #2
0
 private MutableBundleManifest getBundleManifest(ProjectMetadata project) {
   MutableBundleManifest mf = project.getMetadata(MutableBundleManifest.class);
   if (mf == null) {
     File file = getManifestFile(project);
     try {
       mf = MutableBundleManifest.read(file);
     } catch (IOException e) {
       throw new IllegalArgumentException("Could not parse bundle manifest " + file, e);
     }
     project.putMetadata(mf);
   }
   return mf;
 }
コード例 #3
0
 @Override
 public void writeMetadata(ProjectMetadata project) throws IOException {
   MutableBundleManifest mf = project.getMetadata(MutableBundleManifest.class);
   if (mf != null) {
     MutableBundleManifest.write(mf, getManifestFile(project));
   }
 }
コード例 #4
0
 @Override
 public void writeMetadata(ProjectMetadata project) throws IOException {
   ProductConfigurations products = project.getMetadata(ProductConfigurations.class);
   if (products != null) {
     for (Map.Entry<File, ProductConfiguration> entry :
         products.getProductConfigurations().entrySet()) {
       ProductConfiguration.write(entry.getValue(), entry.getKey());
     }
   }
 }
コード例 #5
0
 private File getManifestFile(ProjectMetadata project) {
   return new File(project.getBasedir(), "META-INF/MANIFEST.MF");
 }
コード例 #6
0
 private boolean isEclipseRepository(ProjectMetadata project) {
   return PackagingType.TYPE_ECLIPSE_REPOSITORY.equals(
       project.getMetadata(MutablePomFile.class).getPackaging());
 }