Skip to content

Commit

Permalink
better documented TargetPlatformUtil.setTargetPlatform(Class<?>)
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Jan 10, 2024
1 parent 96b1af8 commit 28f0dbd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ public class PerformanceTest extends AbstractXtendUITestCase {

@BeforeClass
public static void setUpProject() throws Exception {
// This shadows org.eclipse.xtend.ide.tests.AbstractXtendUITestCase.setUpProject()
// see https://junit.org/junit4/javadoc/latest/org/junit/BeforeClass.html
// The class passed to TargetPlatformUtil.setTargetPlatform must be in the same bundle
// of the running test, while AbstractXtendUITestCase is in another bundle.
// Manually setting the TP allows the Tycho build to succeed
// otherwise, the required bundles taken from the workspace
// have a wrong layout in "Plug-in Dependencies", and their
// classes cannot be resolved
TargetPlatformUtil.setTargetPlatform(PerformanceTest.class);
IResourcesSetupUtil.cleanWorkspace();
WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public class PerformanceTest extends AbstractXtendUITestCase {

@BeforeClass
public static void createTestProject() throws Exception {
// manually setting the TP allows the Tycho build to succeed
// This shadows org.eclipse.xtend.ide.tests.AbstractXtendUITestCase.setUpProject()
// see https://junit.org/junit4/javadoc/latest/org/junit/BeforeClass.html
// The class passed to TargetPlatformUtil.setTargetPlatform must be in the same bundle
// of the running test, while AbstractXtendUITestCase is in another bundle.
// Manually setting the TP allows the Tycho build to succeed
// otherwise, the required bundles taken from the workspace
// have a wrong layout in "Plug-in Dependencies", and their
// classes cannot be resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public static void setTargetPlatform() throws Exception {

/**
* Sets the target platform for tests (to be used in tycho mainly)
* @param context any class of the test bundle to be able to determine the test bundle
* @param context any class of the test bundle to be able to determine the test bundle;
* the class must be in the same bundle of the test to execute; if the class is in a required
* bundle it will not work.
* @since 2.14
*/
public static void setTargetPlatform(Class<?> context) throws Exception {
Expand Down

0 comments on commit 28f0dbd

Please sign in to comment.