use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.
the class VersionsEngineTest method testProfileNoId.
public void testProfileNoId() throws Exception {
File basedir = TestUtil.getBasedir("projects/profilenoid");
VersionsEngine engine = newEngine(basedir);
engine.addVersionChange("profilenoid", "1.0.1-01");
engine.apply();
}
use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.
the class VersionsEngineTest method testBuildPluginNoGroupId.
public void testBuildPluginNoGroupId() throws Exception {
File basedir = TestUtil.getBasedir("projects/buildpluginnogroupid");
VersionsEngine engine = newEngine(basedir);
engine.addVersionChange("buildpluginnogroupid", "1.0.1-01");
engine.apply();
}
use of org.eclipse.tycho.versions.engine.VersionsEngine in project tycho by eclipse.
the class VersionsEngineTest method assertNonOsgiVersionOsgiProject.
private void assertNonOsgiVersionOsgiProject(String artifactId) throws Exception {
File basedir = TestUtil.getBasedir("projects/nonosgiversion/" + artifactId);
VersionsEngine engine = newEngine(basedir);
engine.addVersionChange(artifactId, "1.0.1-01");
try {
engine.apply();
fail();
} catch (IllegalVersionChangeException e) {
// not a valid osgi version
assertEquals(1, e.getErrors().size());
}
}
use of org.eclipse.tycho.versions.engine.VersionsEngine in project unleash-maven-plugin by shillner.
the class AbstractTychoVersionsStep method rollback.
@RollbackOnError
public void rollback() throws MojoExecutionException, MojoFailureException {
VersionsEngine versionsEngine = initializeVersionsEngine();
try {
// first add all module version changes to the versions engine of tycho and execute the change command
for (MavenProject module : this.reactorProjects) {
String version = this.cachedModuleVersions.get(ProjectToCoordinates.EMPTY_VERSION.apply(module));
versionsEngine.addVersionChange(module.getArtifactId(), version);
}
versionsEngine.apply();
// second step is to revert all pom changes by simply replacing the poms
for (MavenProject module : this.reactorProjects) {
this.log.debug("\tRolling back modifications on POM of module '" + ProjectToString.INSTANCE.apply(this.project) + "'");
ArtifactCoordinates coordinates = ProjectToCoordinates.EMPTY_VERSION.apply(module);
Document document = this.cachedPOMs.get(coordinates);
if (document != null) {
try {
PomUtil.writePOM(document, this.project);
} catch (Throwable t) {
throw new MojoExecutionException("Could not revert the version update after a failed release build.", t);
}
}
String version = this.cachedModuleVersions.get(coordinates);
if (module.getModel().getVersion() != null) {
module.getModel().setVersion(version);
}
}
} catch (IOException e) {
throw new MojoExecutionException("Could not revert the version update after a failed release build.", e);
}
}
use of org.eclipse.tycho.versions.engine.VersionsEngine in project unleash-maven-plugin by shillner.
the class AbstractTychoVersionsStep method initializeVersionsEngine.
private VersionsEngine initializeVersionsEngine() throws MojoExecutionException, MojoFailureException {
if (this.metadataReader == null) {
this.metadataReader = lookup(ProjectMetadataReader.class);
try {
this.metadataReader.addBasedir(this.project.getBasedir());
} catch (IOException e) {
throw new MojoExecutionException("Tycho was unable to read the project structure!", e);
}
}
VersionsEngine versionsEngine = lookup(VersionsEngine.class);
versionsEngine.setUpdateVersionRangeMatchingBounds(false);
versionsEngine.setProjects(this.metadataReader.getProjects());
return versionsEngine;
}
Aggregations