Skip to content

Commit

Permalink
Add support for specify test requirements of a bundle
Browse files Browse the repository at this point in the history
Currently there is only limited support for "test only" dependencies of
a bundle, the usual way is to add an (optional) import/require bundle to
the test but this is not very suitable when one wants to have tests in
the bundle itself, also some requirements can't be expressed as a
package/bundle without binding to a particular implementation and even
if, these are still added as regular dependencies and not with test
scope.

This ads a way to specify a list of 'test.requirements' in the
build.properties to account for this.
  • Loading branch information
laeubi committed Nov 12, 2023
1 parent af86173 commit d126b73
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %name
Bundle-SymbolicName: org.eclipse.pde.core; singleton:=true
Bundle-Version: 3.17.200.qualifier
Bundle-Version: 3.18.0.qualifier
Bundle-Activator: org.eclipse.pde.internal.core.PDECore
Bundle-Vendor: %provider-name
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,47 @@ public interface IBuildEntry extends IWritable {
/**
* A property name for changes to the 'name' field.
*/
public static final String P_NAME = "name"; //$NON-NLS-1$
String P_NAME = "name"; //$NON-NLS-1$
/**
* The prefix for any key denoting the source folders that
* should be compiled into a JAR. The suffix will
* be the name of the JAR.
*/
public static final String JAR_PREFIX = "source."; //$NON-NLS-1$
String JAR_PREFIX = "source."; //$NON-NLS-1$
/**
* The prefix for any key denoting output folders for a particular
* JAR. The suffix will be the name of the JAR.
*/
public static final String OUTPUT_PREFIX = "output."; //$NON-NLS-1$
String OUTPUT_PREFIX = "output."; //$NON-NLS-1$
/**
* The name of the key that lists all the folders and files
* to be included in the binary build.
*/
public static final String BIN_INCLUDES = "bin.includes"; //$NON-NLS-1$
String BIN_INCLUDES = "bin.includes"; //$NON-NLS-1$
/**
* The name of the key that lists all the folders and files
* to be included in the source build.
*/
public static final String SRC_INCLUDES = "src.includes"; //$NON-NLS-1$
String SRC_INCLUDES = "src.includes"; //$NON-NLS-1$
/**
* The name of the key that declares extra library entries to be added
* to the class path at build time only..
*/
public static final String JARS_EXTRA_CLASSPATH = "jars.extra.classpath"; //$NON-NLS-1$
String JARS_EXTRA_CLASSPATH = "jars.extra.classpath"; //$NON-NLS-1$
/**
* The name of the key that declares additional plug-in dependencies to augment development classpath
*
* @since 3.2
*/
public static final String SECONDARY_DEPENDENCIES = "additional.bundles"; //$NON-NLS-1$
String SECONDARY_DEPENDENCIES = "additional.bundles"; //$NON-NLS-1$

/**
* The name of the key that declares additional plug-in requirements for
* tests
*
* @since 3.18
*/
String TEST_REQUIREMENTS = "test.requirements"; //$NON-NLS-1$

/**
* Adds the token to the list of token for this entry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ private List<IClasspathEntry> computePluginEntriesByModel() {
}
if (fBuild != null) {
addSecondaryDependencies(desc, added, entries);
addTestDependencies(desc, added, entries);
}
addBndClasspath(desc, added, entries);

Expand Down Expand Up @@ -231,6 +232,12 @@ private List<IClasspathEntry> computePluginEntriesByModel() {
return entries;
}

private void addTestDependencies(BundleDescription desc, Set<BundleDescription> added,
List<IClasspathEntry> entries) {
// TODO Auto-generated method stub

}

private void addBndClasspath(BundleDescription desc, Set<BundleDescription> added, List<IClasspathEntry> entries) {
try {
Optional<Project> bndProject = BndProjectManager.getBndProject(project);
Expand Down

0 comments on commit d126b73

Please sign in to comment.