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

Enable pde build tests #905

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 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,5 @@ bin.includes = META-INF/,\
test.xml
src.includes = about.html
jars.compile.order = .
pom.model.property.skipTests = true
pom.model.property.skipTests = false
pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings}
29 changes: 29 additions & 0 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,33 @@
<module>org.eclipse.pde.build</module>
<module>org.eclipse.pde.build.tests</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<dependencies>
<dependency>
<type>eclipse-plugin</type>
<artifactId>org.eclipse.osgi.compatibility.state</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.equinox.executable</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>eclipse-feature</type>
<artifactId>org.eclipse.sdk</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
<testRuntime>p2Installed</testRuntime>
</configuration>
Comment on lines +27 to +51
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really necessary to have it installed at that stage (my concern is that test execution in requirements aren't so portable)?
Could it be replaced by some instructions in p2.inf?
Could it be replaced by creation of a TargetPlatform in the tests that would consist of running target?
Do you really need it as "p2installed", or would running this setting the right testProduct/testApplication to usual SDK values be sufficient? p2installed is usually useful only when there are crazy things like touchpoints or when you need the files to be organized on disk similarly to an installation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this really necessary to have it installed at that stage (my concern is that test execution in requirements aren't so portable)?

I tried without but didn't work so well... I have no clue why the compatibility is not discovered automatically but it seems a common problem.

Could it be replaced by some instructions in p2.inf?

Probably yes, but last time I tried it wasn't that obvious and introduced build cycles in aggregator.

Could it be replaced by creation of a TargetPlatform in the tests that would consist of running target?

The problem is that the test don't start at all, the only good think is that one can easily try this standalone and play around by go into the folder eclipse.pde/build/org.eclipse.pde.build.tests and execute mvn clean verify and it is also quite fast.

Do you really need it as "p2installed"

p2installed was just something I tried here because the test do special stuff, especially require that the plugins are exploded, that an installation location is set and so on, I haven't debugged this in detail and there might be mitigations but as pde-build is nothing I have experience with its hard for me to decide.

p2installed is usually useful only when there are crazy things like touchpoints or when you need the files to be organized on disk similarly to an installation.

I fear that's the case here...

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no clue why the compatibility is not discovered automatically but it seems a common problem.

It's a fragment of org.eclipse.osgi, and it's required whenever one invokes Platform.getPlatformAdmin().

I added it (in p2.inf) and see that it indeed seems to require a full installation (using the simpleconfigurator/bundles.info file).

But I see the text.xml file contains 2 launches, one with a system property. Passing this system property may help running the tests here.
I'm actually curious as to whether PDE would handle this case as well without enabling p2.

</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.pde.internal.core.schema;

import java.io.PrintWriter;
import java.util.Objects;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.internal.core.PDECore;
Expand All @@ -24,6 +25,8 @@

public class SchemaInclude extends SchemaObject implements ISchemaInclude {

private static final PathSchemaProvider DEFAULT_SCHEMA_PROVIDER = new PathSchemaProvider(null);

private static final long serialVersionUID = 1L;

private String fLocation;
Expand Down Expand Up @@ -57,7 +60,7 @@ public SchemaInclude(ISchemaObject parent, String location, boolean abbreviated,
super(parent, location);
fLocation = location;
fAbbreviated = abbreviated;
this.schemaProvider = schemaProvider;
this.schemaProvider = Objects.requireNonNullElse(schemaProvider, DEFAULT_SCHEMA_PROVIDER);
}

/**
Expand Down Expand Up @@ -98,7 +101,7 @@ public ISchema getIncludedSchema() {
if (fAbbreviated) {
SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry();
fIncludedSchema = registry.getIncludedSchema(descriptor, fLocation);
} else if (fIncludedSchema == null && schemaProvider != null) {
} else if (fIncludedSchema == null) {
fIncludedSchema = schemaProvider.createSchema(descriptor, fLocation);
}
return fIncludedSchema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,17 @@ public static boolean openSchema(IFile file) {

public static boolean openSchema(IPath path) {
String pluginId = path.segment(0);
int remove;
if ("schema:".equals(pluginId)) { //$NON-NLS-1$
pluginId = path.segment(1);
remove = 2;
} else {
remove = 1;
}
IPluginModelBase model = PluginRegistry.findModel(pluginId);
if (model != null && model.getUnderlyingResource() != null) {
IProject project = model.getUnderlyingResource().getProject();
IFile file = project.getFile(path.removeFirstSegments(1));
IFile file = project.getFile(path.removeFirstSegments(remove));
return openSchema(file);
}
return false;
Expand Down
Loading