use of org.eclipse.tycho.core.resolver.shared.DependencySeed in project tycho by eclipse.
the class PublishProductToolImpl method addRootFeatures.
private static void addRootFeatures(ExpandedProduct product, List<DependencySeed> seeds) {
final String productId = product.getId();
// add root features as special dependency seed which are marked as "add-on" for the product
DependencySeed.Filter filter = new DependencySeed.Filter() {
@Override
public boolean isAddOnFor(String type, String id) {
return ArtifactType.TYPE_ECLIPSE_PRODUCT.equals(type) && productId.equals(id);
}
};
for (IInstallableUnit featureIU : product.getRootFeatures()) {
ArtifactKey featureArtifact = ArtifactTypeHelper.toTychoArtifact(featureIU);
seeds.add(new DependencySeed(featureArtifact.getType(), featureArtifact.getId(), featureIU, filter));
}
}
use of org.eclipse.tycho.core.resolver.shared.DependencySeed in project tycho by eclipse.
the class DirectorMojo method execute.
// TODO extract methods
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
List<Product> products = getProductConfig().getProducts();
if (products.isEmpty()) {
getLog().info("No product definitions found. Nothing to do.");
}
DirectorRuntime director = getDirectorRuntime();
RepositoryReferences sources = getSourceRepositories();
for (Product product : products) {
for (TargetEnvironment env : getEnvironments()) {
DirectorRuntime.Command command = director.newInstallCommand();
File destination = getProductMaterializeDirectory(product, env);
String rootFolder = product.getRootFolder(env.getOs());
if (rootFolder != null && rootFolder.length() > 0) {
destination = new File(destination, rootFolder);
}
command.addMetadataSources(sources.getMetadataRepositories());
command.addArtifactSources(sources.getArtifactRepositories());
command.addUnitToInstall(product.getId());
for (DependencySeed seed : product.getAdditionalInstallationSeeds()) {
command.addUnitToInstall(seed);
}
command.setDestination(destination);
command.setProfileName(ProfileName.getNameForEnvironment(env, profileNames, profile));
command.setEnvironment(env);
command.setInstallFeatures(installFeatures);
getLog().info("Installing product " + product.getId() + " for environment " + env + " to " + destination.getAbsolutePath());
try {
command.execute();
} catch (DirectorCommandException e) {
throw new MojoFailureException("Installation of product " + product.getId() + " for environment " + env + " failed", e);
}
}
}
}
use of org.eclipse.tycho.core.resolver.shared.DependencySeed in project tycho by eclipse.
the class AbstractPublishMojo method execute.
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
PublisherServiceFactory publisherServiceFactory = osgiServices.getService(PublisherServiceFactory.class);
Collection<DependencySeed> units = publishContent(publisherServiceFactory);
postPublishedIUs(units);
}
use of org.eclipse.tycho.core.resolver.shared.DependencySeed in project tycho by eclipse.
the class MirrorApplicationServiceImpl method toInstallableUnitList.
private static List<IInstallableUnit> toInstallableUnitList(Collection<DependencySeed> seeds, IMetadataRepository sourceRepository, RepositoryReferences sourceRepositoryNames) throws FacadeException {
List<IInstallableUnit> result = new ArrayList<>(seeds.size());
for (DependencySeed seed : seeds) {
if (seed.getInstallableUnit() == null) {
// TODO 372780 drop this when getInstallableUnit can no longer be null
String unitId = seed.getId() + (ArtifactType.TYPE_ECLIPSE_FEATURE.equals(seed.getType()) ? ".feature.group" : "");
result.addAll(querySourceIus(Collections.singletonList(new IUDescription(unitId, null)), sourceRepository, sourceRepositoryNames));
} else {
result.add((IInstallableUnit) seed.getInstallableUnit());
}
}
if (result.isEmpty()) {
throw new IllegalArgumentException("List of seed units for repository aggregation must not be empty");
}
return result;
}
use of org.eclipse.tycho.core.resolver.shared.DependencySeed in project tycho by eclipse.
the class PublishProductToolImpl method publishProduct.
@Override
public List<DependencySeed> publishProduct(File productFile, File launcherBinaries, String flavor) throws IllegalArgumentException {
IProductDescriptor originalProduct = loadProductFile(productFile);
ExpandedProduct expandedProduct = new ExpandedProduct(originalProduct, buildQualifier, targetPlatform, interpolator, logger);
IPublisherAdvice[] advice = getProductSpecificAdviceFileAdvice(productFile, expandedProduct);
ProductAction action = new ProductAction(null, expandedProduct, flavor, launcherBinaries);
IMetadataRepository metadataRepository = publishingRepository.getMetadataRepository();
IArtifactRepository artifactRepository = publishingRepository.getArtifactRepositoryForWriting(new ProductBinariesWriteSession(expandedProduct.getId()));
Collection<IInstallableUnit> allIUs = publisherRunner.executeAction(action, metadataRepository, artifactRepository, advice);
List<DependencySeed> seeds = new ArrayList<>();
seeds.add(createSeed(ArtifactType.TYPE_ECLIPSE_PRODUCT, selectUnit(allIUs, expandedProduct.getId())));
addRootFeatures(expandedProduct, seeds);
return seeds;
}
Aggregations