Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run some pde.build tests with Tycho (second attempt) #980

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/org.eclipse.pde.build.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.apache.ant,
org.eclipse.debug.core,
org.eclipse.equinox.p2.publisher;bundle-version="1.1.0",
org.eclipse.equinox.p2.publisher.eclipse;bundle-version="1.0.0"
org.eclipse.equinox.p2.publisher.eclipse;bundle-version="1.0.0",
org.eclipse.equinox.p2.repository.tools
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: org.eclipse.equinox.frameworkadmin;version="2.0.0",
org.eclipse.equinox.internal.p2.artifact.repository,
Expand Down
2 changes: 2 additions & 0 deletions build/org.eclipse.pde.build.tests/META-INF/p2.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requires.0.namespace = org.eclipse.equinox.p2.iu
requires.0.name = org.eclipse.osgi.compatibility.state
1 change: 0 additions & 1 deletion build/org.eclipse.pde.build.tests/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ bin.includes = META-INF/,\
test.xml
src.includes = about.html
jars.compile.order = .
pom.model.property.skipTests = true
pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings}
57 changes: 57 additions & 0 deletions build/org.eclipse.pde.build.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.pde</groupId>
<artifactId>eclipse.pde.build</artifactId>
<version>4.31.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.pde.build.tests</artifactId>
<version>1.4.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<!-- The product -->
<type>p2-installable-unit</type>
<id>org.eclipse.sdk.ide</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<product>org.eclipse.sdk.ide</product>
<testRuntime>p2Installed</testRuntime>
<testClass>org.eclipse.pde.build.tests.PDEBuildTestSuite</testClass>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right, that this testClass is used for the default test goal execution of the tycho-surefire-plugin for eclipse-test-plugins and the overwritten value in the separate p2-tests execution refelects the second execution defined in this projects test.xml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

<systemProperties>
<pde.build.includeP2>false</pde.build.includeP2>
</systemProperties>
</configuration>
<executions>
<execution>
<id>p2-tests</id>
<goals><goal>test</goal></goals>
<configuration>
<testClass>org.eclipse.pde.build.tests.P2TestSuite</testClass>
<systemProperties/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<systemProperties/>

Is this necessary? The effective pom view says this element is not configured in a parent pom.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to clear the inherited properties from the default execution/plugin configuration, one might can configure the default execution but lets dont complicate it too much as it already is :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but lets dont complicate it too much as it already is :-)

That's fine :)
But depending on where the to clear property is defined and how this might not be sufficient and something like https://stackoverflow.com/a/33252763/14542697 needs to be applied.
I have not further checked where this is coming from exactly, but I'm sure you are aware of all that.
Just wanted to make sure, it is not just forgotten.

</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.build.internal.tests;

import static org.junit.Assume.assumeTrue;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
Expand Down Expand Up @@ -51,10 +53,10 @@
import org.eclipse.equinox.frameworkadmin.BundleInfo;
import org.eclipse.equinox.simpleconfigurator.manipulator.SimpleConfiguratorManipulator;
import org.eclipse.pde.build.tests.Activator;
import org.eclipse.pde.internal.build.AbstractScriptGenerator;

Check warning on line 56 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
import org.eclipse.pde.internal.build.BundleHelper;

Check warning on line 57 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
import org.eclipse.pde.internal.build.FeatureGenerator;

Check warning on line 58 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory;

Check warning on line 59 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:

public class Utils {
private static final String ID = "id";
Expand Down Expand Up @@ -189,24 +191,24 @@
static public void generateFeature(IFolder workingDirectory, String id, String[] featureList, String[] pluginList,
String product, boolean includeLaunchers, boolean verify, String version)
throws CoreException, IOException {
FeatureGenerator generator = new FeatureGenerator();

Check warning on line 194 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
if (verify) {
AbstractScriptGenerator.setConfigInfo("*,*,*");

Check warning on line 196 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
String baseLocation = Platform.getInstallLocation().getURL().getPath();
BuildTimeSiteFactory.setInstalledBaseSite(baseLocation);

Check warning on line 198 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
File executable = findExecutable();
if (executable != null && !executable.equals(new File(baseLocation)))
generator.setPluginPath(new String[] { executable.getAbsolutePath() });

Check warning on line 201 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
}
generator.setIncludeLaunchers(includeLaunchers);

Check warning on line 203 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setVerify(verify);

Check warning on line 204 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setFeatureId(id);

Check warning on line 205 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setVersion(version);

Check warning on line 206 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setProductFile(product);

Check warning on line 207 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setFeatureList(featureList);

Check warning on line 208 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setPluginList(pluginList);

Check warning on line 209 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.setWorkingDirectory(workingDirectory.getLocation().toOSString());

Check warning on line 210 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
generator.generate();

Check warning on line 211 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
}

static public void generateProduct(IFile productFile, String id, String version, String[] entryList,
Expand Down Expand Up @@ -265,7 +267,7 @@
if (features) {
buffer.append(" <features>\n");
for (String element : entryList) {
Map<String, Object> items = org.eclipse.pde.internal.build.Utils.parseExtraBundlesString(element,

Check warning on line 270 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
false);
buffer.append(" <feature id=\"");
buffer.append(items.get(ID));
Expand All @@ -281,7 +283,7 @@
} else {
buffer.append(" <plugins>\n");
for (String element : entryList) {
Map<String, Object> items = org.eclipse.pde.internal.build.Utils.parseExtraBundlesString(element,

Check warning on line 286 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
false);
buffer.append(" <plugin id=\"");
buffer.append(items.get(ID));
Expand Down Expand Up @@ -352,11 +354,11 @@
if (executableLocation != null)
return executableLocation;

SimpleConfiguratorManipulator manipulator = BundleHelper.getDefault()

Check warning on line 357 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
.acquireService(SimpleConfiguratorManipulator.class);

Check warning on line 358 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
if (manipulator != null) {
BundleInfo[] bundles = manipulator
.loadConfiguration(BundleHelper.getDefault().getBundle().getBundleContext(), null);

Check warning on line 361 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
// find a fragment for a platform we aren't
String id = "org.eclipse.equinox.launcher.win32.win32.x86_64";
for (BundleInfo bundle : bundles) {
Expand All @@ -377,7 +379,10 @@
// Eclipse.app/Contents/Eclipse).
baseLocation = baseLocation.getParentFile().getParentFile();
}
executableLocation = findExecutable(new File(baseLocation.getParent(), "deltapack/eclipse"));
File fallback = new File(baseLocation.getParent(), "deltapack/eclipse");
executableLocation = findExecutable(fallback);
assumeTrue("All attempts to find the executable failed including fallback to " + fallback.getAbsolutePath(),
executableLocation != null);
return executableLocation;
}

Expand Down Expand Up @@ -490,14 +495,14 @@
jar = new JarFile(location.toFile());
return jar.getManifest();
} finally {
org.eclipse.pde.internal.build.Utils.close(jar);

Check warning on line 498 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
}
} else if (location.lastSegment().equalsIgnoreCase("MANIFEST.MF")) {
InputStream stream = new FileInputStream(location.toFile());
try {
return new Manifest(stream);
} finally {
org.eclipse.pde.internal.build.Utils.close(stream);

Check warning on line 505 in build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/Utils.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
}
}
return null;
Expand Down
Loading