Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2009-04-25 23:02:39 +0000
committerAndrew Niefer2009-04-25 23:02:39 +0000
commitf7dd620b1c1de452dc7d3295604e41d1ad026b0c (patch)
treef73d1f5c0ffd721dd97c30b1cf38dbb700deb0ee
parent1f83dd3f060efb3238586f74f4b02e691924ab5e (diff)
downloadeclipse.pde.build-20090425.tar.gz
eclipse.pde.build-20090425.tar.xz
eclipse.pde.build-20090425.zip
bug 272362 - export categoriesv20090425
-rw-r--r--org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2TestCase.java12
-rw-r--r--org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java14
-rw-r--r--org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java1
-rw-r--r--org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java1
-rw-r--r--org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java2
-rw-r--r--org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java3
-rw-r--r--org.eclipse.pde.build/src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java2
-rw-r--r--org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/FeaturesAndBundlesTask.java14
8 files changed, 46 insertions, 3 deletions
diff --git a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2TestCase.java b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2TestCase.java
index 14955982..90c0f413 100644
--- a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2TestCase.java
+++ b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2TestCase.java
@@ -62,6 +62,18 @@ public class P2TestCase extends PDETestCase {
artifactManager = (IArtifactRepositoryManager) result;
}
+ public void removeMetadataRepository(URI location) throws Exception {
+ if (metadataManager == null)
+ initialize();
+ metadataManager.removeRepository(location);
+ }
+
+ public void removeArtifactRepository(URI location) throws Exception {
+ if (artifactManager == null)
+ initialize();
+ artifactManager.removeRepository(location);
+ }
+
public IMetadataRepository loadMetadataRepository(String metadataLocation) throws Exception {
if (metadataLocation == null)
return null;
diff --git a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java
index 25c18bd1..ae47ac05 100644
--- a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java
+++ b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java
@@ -826,6 +826,9 @@ public class PublishingTests extends P2TestCase {
iuB = getIU(repo, "b");
assertTrue(Boolean.valueOf((String) iuB.getProperties().get("pde.build")).booleanValue());
+
+ repo = null;
+ removeMetadataRepository(uri);
}
public void testBug267461_2() throws Exception {
@@ -982,6 +985,12 @@ public class PublishingTests extends P2TestCase {
buffer.append("</site> \n");
IFile siteXML = buildFolder.getFile("site.xml");
Utils.writeBuffer(siteXML, buffer);
+
+ //bug 272362
+ IFile categoryXML = buildFolder.getFile("category.xml");
+ String categoryString = buffer.toString();
+ categoryString = categoryString.replaceAll("new_category_1", "new_category_2");
+ Utils.writeBuffer(categoryXML, new StringBuffer(categoryString));
properties = BuildConfiguration.getBuilderProperties(buildFolder);
properties.put("topLevelElementId", "f");
@@ -989,6 +998,7 @@ public class PublishingTests extends P2TestCase {
properties.put("filteredDependencyCheck", "true");
properties.put("archivesFormat", "group,group,group-folder");
properties.put("p2.category.site", "file:" + siteXML.getLocation().toOSString());
+ properties.put("p2.category.definition", "file:" + categoryXML.getLocation().toOSString());
Utils.storeBuildProperties(buildFolder, properties);
runBuild(buildFolder);
@@ -1001,6 +1011,7 @@ public class PublishingTests extends P2TestCase {
IMetadataRepository metadata = loadMetadataRepository(repoURI);
assertNotNull(getIU(metadata, "new_category_1"));
+ assertNotNull(getIU(metadata, "new_category_2"));
}
public void testBug264743_PublishExecutable() throws Exception {
@@ -1150,6 +1161,9 @@ public class PublishingTests extends P2TestCase {
getIU(metadata, "a");
getIU(metadata, "f2_root"); //bug 271848, mirroring from context
assertResourceFile(build2, "buildRepo/binary/f2_root_1.0.0");
+
+ metadata = null;
+ removeMetadataRepository(repoURI);
}
public void testPublish_FeatureBasedProduct() throws Exception {
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java
index 73c6c60b..5171a0c8 100644
--- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java
+++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java
@@ -779,6 +779,7 @@ public class AssembleConfigScriptGenerator extends AbstractScriptGenerator {
script.printAttribute("artifactRepositoryName", Utils.getPropertyFormat(PROPERTY_P2_ARTIFACT_REPO_NAME), true); //$NON-NLS-1$
script.printAttribute("publishArtifacts", Utils.getPropertyFormat(PROPERTY_P2_PUBLISH_ARTIFACTS), true); //$NON-NLS-1$
script.printAttribute("site", Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE), true); //$NON-NLS-1$
+ script.printAttribute("category", Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_DEFINITION), true); //$NON-NLS-1$
script.printAttribute("p2OS", configInfo.getOs(), true); //$NON-NLS-1$
if (!havePDEUIState() || rootFileProviders.size() > 0)
script.printAttribute("mode", "incremental", true); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java
index 75f35e10..aaab3587 100644
--- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java
+++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java
@@ -91,6 +91,7 @@ public interface IBuildPropertiesConstants {
public static final String PROPERTY_P2_CONTEXT_REPOS = "p2.context.repos"; //$NON-NLS-1$
public static final String PROPERTY_P2_PUBLISH_ARTIFACTS = "p2.publish.artifacts"; //$NON-NLS-1$
public static final String PROPERTY_P2_CATEGORY_SITE = "p2.category.site"; //$NON-NLS-1$
+ public static final String PROPERTY_P2_CATEGORY_DEFINITION = "p2.category.definition"; //$NON-NLS-1$
public static final String PROPERTY_P2_CATEGORY_PREFIX = "p2.category.prefix"; //$NON-NLS-1$
public static final String PROPERTY_P2_ROOT_NAME = "p2.root.name"; //$NON-NLS-1$
public static final String PROPERTY_P2_ROOT_VERSION = "p2.root.version"; //$NON-NLS-1$
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java
index 81d2d45d..3f7fd2a6 100644
--- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java
+++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java
@@ -392,7 +392,7 @@ public class P2ConfigScriptGenerator extends AssembleConfigScriptGenerator {
}
String repo = Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO);
- script.printP2PublishFeaturesAndBundles(repo, repo, (FileSet[]) binaryBundles.toArray(new FileSet[binaryBundles.size()]), (FileSet[]) binaryFeatures.toArray(new FileSet[binaryFeatures.size()]), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_PREFIX), contextMetadata);
+ script.printP2PublishFeaturesAndBundles(repo, repo, (FileSet[]) binaryBundles.toArray(new FileSet[binaryBundles.size()]), (FileSet[]) binaryFeatures.toArray(new FileSet[binaryFeatures.size()]), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_PREFIX), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_DEFINITION), contextMetadata);
script.printTargetEnd();
script.println();
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java
index 11264994..dc02479b 100644
--- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java
+++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ant/AntScript.java
@@ -85,7 +85,7 @@ public class AntScript implements IAntScript {
}
}
- public void printP2PublishFeaturesAndBundles(String metadataRepository, String artifactRepository, FileSet[] bundles, FileSet[] features, String siteXML, String siteQualifier, URI[] contextMetadata) {
+ public void printP2PublishFeaturesAndBundles(String metadataRepository, String artifactRepository, FileSet[] bundles, FileSet[] features, String siteXML, String siteQualifier, String categoryDefintion, URI[] contextMetadata) {
printTab();
output.print("<eclipse.publish.featuresAndBundles"); //$NON-NLS-1$
if (metadataRepository.equals(artifactRepository)) {
@@ -95,6 +95,7 @@ public class AntScript implements IAntScript {
printAttribute("artifactRepository", artifactRepository, true); //$NON-NLS-1$
}
printAttribute("site", siteXML, false); //$NON-NLS-1$
+ printAttribute("category", categoryDefintion, false); //$NON-NLS-1$
printAttribute("siteQualifier", siteQualifier, false); //$NON-NLS-1$
output.println(">"); //$NON-NLS-1$
indent++;
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java
index 0beff730..f4f832ea 100644
--- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java
+++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java
@@ -99,7 +99,7 @@ public class PackageConfigScriptGenerator extends AssembleConfigScriptGenerator
if (BuildDirector.p2Gathering) {
String repo = "file:" + getWorkingDirectory() + "/buildRepo"; //$NON-NLS-1$ //$NON-NLS-2$
- script.printP2PublishFeaturesAndBundles(repo, repo, (FileSet[]) p2Bundles.toArray(new FileSet[p2Bundles.size()]), (FileSet[]) p2Features.toArray(new FileSet[p2Features.size()]), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_PREFIX), contextMetadata);
+ script.printP2PublishFeaturesAndBundles(repo, repo, (FileSet[]) p2Bundles.toArray(new FileSet[p2Bundles.size()]), (FileSet[]) p2Features.toArray(new FileSet[p2Features.size()]), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_PREFIX), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_DEFINITION), contextMetadata);
}
if (packagingProperties.size() != 0) {
diff --git a/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/FeaturesAndBundlesTask.java b/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/FeaturesAndBundlesTask.java
index ff1aedaf..8f622940 100644
--- a/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/FeaturesAndBundlesTask.java
+++ b/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/FeaturesAndBundlesTask.java
@@ -16,6 +16,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction;
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
@@ -24,6 +25,7 @@ public class FeaturesAndBundlesTask extends AbstractPublisherTask {
private final ArrayList features = new ArrayList();
private final ArrayList bundles = new ArrayList();
private URI siteXML = null;
+ private URI categoryXML = null;
private String siteQualifier = ""; //$NON-NLS-1$
public void execute() throws BuildException {
@@ -37,6 +39,8 @@ public class FeaturesAndBundlesTask extends AbstractPublisherTask {
application.addAction(new BundlesAction(b));
if (siteXML != null)
application.addAction(new SiteXMLAction(siteXML, siteQualifier));
+ if (categoryXML != null)
+ application.addAction(new CategoryXMLAction(categoryXML, siteQualifier));
try {
application.run(getPublisherInfo());
@@ -79,6 +83,16 @@ public class FeaturesAndBundlesTask extends AbstractPublisherTask {
this.siteQualifier = siteQualifier;
}
+ public void setCategory(String value) {
+ if (value != null && value.length() > 0 && !value.startsWith(ANT_PREFIX)) {
+ try {
+ categoryXML = URIUtil.fromString(value);
+ } catch (URISyntaxException e) {
+ throw new IllegalArgumentException("Category description location (" + value + ") must be a URL."); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+ }
+
public void setSite(String value) {
if (value != null && value.length() > 0 && !value.startsWith(ANT_PREFIX)) {
try {

Back to the top