forked from eclipse-tycho/tycho
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tycho-p2-director:director: Fix handling of destination on macOS
Partially revert changes to destination handling from 3f41779 and dc99997 The helper methods in DirectorRuntime are removed again and the special handling in put back into AbstractEclipseTestMojo like before 3f41779. No pre-processing of the destination is done in DirectorMojo anymore: 1) Deriving the pre-processing path from the running environment was incorrect (it would have to consider 'p2os'). 2) We actually do not want any pre-procesing at all. This restores API compatibility of Tycho's tycho-p2-director:director with a legacy eclipse -application org.eclipse.equinox.p2.director -destination <destination> ... stand-alone invocation. This also adds a consistency check that p2os/p2ws/p2arch must all be specified if any of them is. Integration tests for the stand-alone director are added. Fixes eclipse-tycho#3548.
- Loading branch information
Showing
6 changed files
with
325 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 90 additions & 1 deletion
91
tycho-its/src/test/java/org/eclipse/tycho/test/P2DirectorPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,104 @@ | ||
package org.eclipse.tycho.test; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
import org.apache.maven.it.VerificationException; | ||
import org.apache.maven.it.Verifier; | ||
import org.junit.Test; | ||
|
||
public class P2DirectorPluginTest extends AbstractTychoIntegrationTest { | ||
|
||
@Test | ||
public void testDirectorStandalone() throws Exception { | ||
public void testDirectorStandaloneWindows() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-windows"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
assertTrue(Files.isDirectory(Path.of(verifier.getBasedir(), "target", "productwindows", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneLinux() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-linux"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
assertTrue(Files.isDirectory(Path.of(verifier.getBasedir(), "target", "productlinux", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneMacOsDestinationWithAppSuffix() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-macos-destination-with-app-suffix"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
// the DirectorApplication will detect the .app suffix and add Contents/Eclipse | ||
assertTrue(Files.isDirectory( | ||
Path.of(verifier.getBasedir(), "target", "productmacos.app", "Contents", "Eclipse", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneMacOsDestinationWithoutAppSuffix() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-macos-destination-without-app-suffix"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
// no pre-processing must be done by DirectorMojo to the destination to be | ||
// compatible with how a | ||
// eclipse -application org.eclipse.equinox.p2.director -destination | ||
// <destination> ... | ||
// invocation works. | ||
assertTrue(Files.isDirectory(Path.of(verifier.getBasedir(), "target", "productmacos", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneMacOsDestinationWithFullBundlePath() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-macos-destination-with-full-bundle-path"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
// no pre-processing must be done by DirectorMojo to the destination to be | ||
// compatible with how a | ||
// eclipse -application org.eclipse.equinox.p2.director -destination | ||
// <destination> ... | ||
// invocation works. | ||
assertTrue(Files.isDirectory( | ||
Path.of(verifier.getBasedir(), "target", "productmacos.app", "Contents", "Eclipse", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneUsingRunningEnvironment() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-running-environment"); | ||
verifier.executeGoal("package"); | ||
verifier.verifyErrorFreeLog(); | ||
|
||
// to be consistent with the classic | ||
// eclipse -application org.eclipse.equinox.p2.director -destination | ||
// <destination> ... | ||
// API, we also do not want to prep-process <destination> in DirectorMojo, | ||
// see https://github.com/eclipse-tycho/tycho/issues/3548 | ||
// Therefore, the resulting path must be identical, no matter on which platform | ||
// it is executed. | ||
assertTrue(Files.isDirectory(Path.of(verifier.getBasedir(), "target", "product", "plugins"))); | ||
} | ||
|
||
@Test | ||
public void testDirectorStandaloneInconsistentP2Options() throws Exception { | ||
Verifier verifier = getVerifier("tycho-p2-director-plugin/director-goal-standalone", true, true); | ||
verifier.addCliOption("-Pdirector-iconsistent-p2-arguments"); | ||
try { | ||
verifier.executeGoal("package"); | ||
fail(VerificationException.class.getName() + " expected"); | ||
} catch (VerificationException e) { | ||
} | ||
verifier.verifyTextInLog("If any of p2os / p2ws / p2arch is specified, all of them must be specified."); | ||
assertFalse(Files.isDirectory(Path.of(verifier.getBasedir(), "target", "product"))); | ||
} | ||
|
||
} |
Oops, something went wrong.