use of org.eclipse.tycho.core.shared.TargetEnvironment 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.shared.TargetEnvironment in project tycho by eclipse.
the class StandaloneDirectorRuntimeFactory method installStandaloneDirector.
private void installStandaloneDirector(File installLocation, ArtifactRepository localMavenRepository) throws MojoExecutionException {
// using the internal director...
DirectorRuntime bootstrapDirector = osgiServices.getService(DirectorRuntime.class);
try {
// ... install from a zipped p2 repository obtained via Maven ...
URI directorRuntimeRepo = URI.create("jar:" + getDirectorRepositoryZip(localMavenRepository).toURI() + "!/");
DirectorRuntime.Command command = bootstrapDirector.newInstallCommand();
command.addMetadataSources(Arrays.asList(directorRuntimeRepo));
command.addArtifactSources(Arrays.asList(directorRuntimeRepo));
// ... a product that includes the p2 director application ...
command.addUnitToInstall("tycho-standalone-p2-director");
command.setProfileName("director");
// ... to a location in the target folder
command.setDestination(installLocation);
// there is only this environment in the p2 repository zip
// TODO use a "no environment-specific units" setting
command.setEnvironment(new TargetEnvironment("linux", "gtk", "x86_64"));
logger.info("Installing a standalone p2 Director...");
command.execute();
} catch (DirectorCommandException e) {
throw new MojoExecutionException("Could not install the standalone director", e);
}
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class AbstractArtifactDependencyWalker method traverseProduct.
protected void traverseProduct(ProductConfiguration product, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
if (product.useFeatures()) {
for (FeatureRef ref : product.getFeatures()) {
traverseFeature(ref, visitor, visited);
}
} else {
for (PluginRef ref : product.getPlugins()) {
traversePlugin(ref, visitor, visited);
}
}
Set<String> bundles = new HashSet<>();
for (ArtifactDescriptor artifact : visited.getVisited()) {
ArtifactKey key = artifact.getKey();
if (ArtifactType.TYPE_ECLIPSE_PLUGIN.equals(key.getType())) {
bundles.add(key.getId());
}
}
if (environments != null && product.includeLaunchers()) {
for (TargetEnvironment environment : environments) {
String os = environment.getOs();
String ws = environment.getWs();
String arch = environment.getArch();
String id;
// see http://jira.codehaus.org/browse/MNGECLIPSE-1075
if (PlatformPropertiesUtils.OS_MACOSX.equals(os) && (PlatformPropertiesUtils.ARCH_X86.equals(arch) || PlatformPropertiesUtils.ARCH_PPC.equals(arch))) {
id = "org.eclipse.equinox.launcher." + ws + "." + os;
} else {
id = "org.eclipse.equinox.launcher." + ws + "." + os + "." + arch;
}
if (!bundles.contains(id)) {
PluginRef ref = new PluginRef("plugin");
ref.setId(id);
ref.setOs(os);
ref.setWs(ws);
ref.setArch(arch);
ref.setUnpack(true);
traversePlugin(ref, visitor, visited);
}
}
}
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class EquinoxResolver method getPlatformProperties.
protected Properties getPlatformProperties(MavenProject project, ExecutionEnvironment ee) {
TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
TargetEnvironment environment = configuration.getEnvironments().get(0);
Properties properties = new Properties();
properties.putAll((Properties) project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES));
return getPlatformProperties(properties, environment, ee);
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReader method newTargetEnvironment.
private static TargetEnvironment newTargetEnvironment(Xpp3Dom environmentDom) throws TargetPlatformConfigurationException {
Xpp3Dom osDom = environmentDom.getChild("os");
if (osDom == null) {
String message = "<os> element is missing within target-platform-configuration (element <environment>)";
throw new TargetPlatformConfigurationException(message);
}
Xpp3Dom wsDom = environmentDom.getChild("ws");
if (wsDom == null) {
String message = "<ws> element is missing within target-platform-configuration (element <environment>)";
throw new TargetPlatformConfigurationException(message);
}
Xpp3Dom archDom = environmentDom.getChild("arch");
if (archDom == null) {
String message = "<arch> element is missing within target-platform-configuration (element <environment>)";
throw new TargetPlatformConfigurationException(message);
}
return new TargetEnvironment(osDom.getValue(), wsDom.getValue(), archDom.getValue());
}
Aggregations