use of org.eclipse.tycho.core.ee.StandardExecutionEnvironment in project tycho by eclipse.
the class AbstractOsgiCompilerMojo method checkTargetLevelCompatibleWithManifestBREEs.
private void checkTargetLevelCompatibleWithManifestBREEs(String effectiveTargetLevel, StandardExecutionEnvironment[] manifestBREEs) throws MojoExecutionException {
List<String> incompatibleBREEs = new ArrayList<>();
for (StandardExecutionEnvironment ee : manifestBREEs) {
if (!ee.isCompatibleCompilerTargetLevel(effectiveTargetLevel)) {
incompatibleBREEs.add(ee.getProfileName() + " (assumes " + ee.getCompilerTargetLevelDefault() + ")");
}
}
if (!incompatibleBREEs.isEmpty()) {
String message = "The effective compiler target level " + effectiveTargetLevel + " is incompatible with the following OSGi execution environments: " + incompatibleBREEs + " @ " + project;
if (strictCompilerTarget) {
throw new MojoExecutionException(message);
}
getLog().warn(message);
}
}
use of org.eclipse.tycho.core.ee.StandardExecutionEnvironment in project tycho by eclipse.
the class OsgiBundleProject method readExecutionEnvironmentConfiguration.
@Override
public void readExecutionEnvironmentConfiguration(MavenProject project, ExecutionEnvironmentConfiguration sink) {
// read packaging-type independent configuration
super.readExecutionEnvironmentConfiguration(project, sink);
// only in plugin projects, the profile may also be ...
// ... specified in build.properties (for PDE compatibility)
String pdeProfile = getEclipsePluginProject(DefaultReactorProject.adapt(project)).getBuildProperties().getJreCompilationProfile();
if (pdeProfile != null) {
sink.setProfileConfiguration(pdeProfile.trim(), "build.properties");
} else {
// ... derived from BREE in bundle manifest
StandardExecutionEnvironment[] manifestBREEs = getManifest(project).getExecutionEnvironments();
if (manifestBREEs.length > 0) {
TargetPlatformConfiguration tpConfiguration = TychoProjectUtils.getTargetPlatformConfiguration(project);
switch(tpConfiguration.getBREEHeaderSelectionPolicy()) {
case first:
sink.setProfileConfiguration(manifestBREEs[0].getProfileName(), "Bundle-RequiredExecutionEnvironment (first entry)");
break;
case minimal:
ExecutionEnvironment manifestMinimalEE = Collections.min(Arrays.asList(manifestBREEs));
sink.setProfileConfiguration(manifestMinimalEE.getProfileName(), "Bundle-RequiredExecutionEnvironment (minimal entry)");
}
}
}
}
use of org.eclipse.tycho.core.ee.StandardExecutionEnvironment in project tycho by eclipse.
the class GeneratePomsMojo method addPluginImpl.
private void addPluginImpl(Set<File> result, File basedir) throws MojoExecutionException {
if (result.add(basedir)) {
try {
StandardExecutionEnvironment ee = ExecutionEnvironmentUtils.getExecutionEnvironment(executionEnvironment);
State state = resolver.newResolvedState(basedir, ee, platform);
BundleDescription bundle = state.getBundleByLocation(basedir.getAbsolutePath());
if (bundle != null) {
for (DependencyComputer.DependencyEntry entry : dependencyComputer.computeDependencies(state.getStateHelper(), bundle)) {
BundleDescription supplier = entry.desc;
File suppliedDir = new File(supplier.getLocation());
if (supplier.getHost() == null && isModuleDir(suppliedDir)) {
addPlugin(result, suppliedDir.getName());
}
}
} else {
getLog().warn("Not an OSGi bundle " + basedir.toString());
}
} catch (BundleException e) {
warnNoBundleDependencies(e);
}
}
}
use of org.eclipse.tycho.core.ee.StandardExecutionEnvironment in project tycho by eclipse.
the class AbstractOsgiCompilerMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
StandardExecutionEnvironment[] manifestBREEs = bundleReader.loadManifest(project.getBasedir()).getExecutionEnvironments();
getLog().debug("Manifest BREEs: " + Arrays.toString(manifestBREEs));
getLog().debug("Effective EE: " + getTargetExecutionEnvironment());
String effectiveTargetLevel = getTargetLevel();
getLog().debug("Effective source/target: " + getSourceLevel() + "/" + effectiveTargetLevel);
checkTargetLevelCompatibleWithManifestBREEs(effectiveTargetLevel, manifestBREEs);
for (BuildOutputJar jar : getEclipsePluginProject().getOutputJars()) {
this.outputJar = jar;
this.outputJar.getOutputDirectory().mkdirs();
super.execute();
doCopyResources();
}
// this does not include classes from nested jars
BuildOutputJar dotOutputJar = getEclipsePluginProject().getDotOutputJar();
if (dotOutputJar != null) {
project.getArtifact().setFile(dotOutputJar.getOutputDirectory());
}
}
Aggregations