use of org.eclipse.tycho.core.maven.TychoInterpolator in project tycho by eclipse.
the class BuildPropertiesParserImpl method interpolate.
protected void interpolate(Properties properties, File baseDir) {
if (properties.isEmpty()) {
return;
}
MavenSession mavenSession = legacySupport.getSession();
if (mavenSession == null) {
logger.warn("No maven session available, values in the build.properties will not be interpolated!");
return;
}
// find the maven project for the currently used basedir, so that the correct maven project is used by the interpolator.
// if no project could be found, it does not make sense to interpolate the properties
MavenProject mavenProject = MavenSessionUtils.getMavenProject(mavenSession, baseDir);
if (mavenProject == null) {
logger.warn("No maven project found for baseDir '" + baseDir.getAbsolutePath() + "', values in the build.properties will not be interpolated!");
return;
}
TychoInterpolator interpolator = new TychoInterpolator(mavenSession, mavenProject);
for (Entry<Object, Object> entry : properties.entrySet()) {
entry.setValue(interpolator.interpolate((String) entry.getValue()));
}
}
use of org.eclipse.tycho.core.maven.TychoInterpolator in project tycho by eclipse.
the class PublishProductMojo method publishContent.
@Override
protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException {
Interpolator interpolator = new TychoInterpolator(getSession(), getProject());
PublishProductTool publisher = publisherServiceFactory.createProductPublisher(getReactorProject(), getEnvironments(), getQualifier(), interpolator);
List<DependencySeed> seeds = new ArrayList<>();
for (File productFile : getEclipseRepositoryProject().getProductFiles(getProject())) {
try {
ProductConfiguration productConfiguration = ProductConfiguration.read(productFile);
if (isEmpty(productConfiguration.getId())) {
throw new MojoExecutionException("The product file " + productFile.getName() + " does not contain the mandatory attribute 'uid'. Please ensure you entered an id in the product file.");
} else if (isEmpty(productConfiguration.getVersion())) {
throw new MojoExecutionException("The product file " + productFile.getName() + " does not contain the mandatory attribute 'version'. Please ensure you entered a version in the product file.");
}
seeds.addAll(publisher.publishProduct(productFile, productConfiguration.includeLaunchers() ? getExpandedLauncherBinaries() : null, flavor));
} catch (IOException e) {
throw new MojoExecutionException("I/O exception while writing product definition or copying launcher icons", e);
}
}
return seeds;
}
Aggregations