diff options
| author | Curtis Windatt | 2013-03-25 16:52:48 +0000 |
|---|---|---|
| committer | Curtis Windatt | 2013-03-25 16:52:48 +0000 |
| commit | da63be8213cd8b26c57258c12f7bedfa6f8b3b68 (patch) | |
| tree | 21c86a28064d9dd73305a95805f1e82add471727 | |
| parent | ea1307e74badce9e846aa560d3a2f565b21762ef (diff) | |
| download | eclipse.pde.build-da63be8213cd8b26c57258c12f7bedfa6f8b3b68.tar.gz eclipse.pde.build-da63be8213cd8b26c57258c12f7bedfa6f8b3b68.tar.xz eclipse.pde.build-da63be8213cd8b26c57258c12f7bedfa6f8b3b68.zip | |
Revert "Bug 401572 - [CBI] 12 Build test failures in CBI builds"
This reverts commit 2e4ecfabef002ded318e879c196c8d281c708741.
3 files changed, 709 insertions, 719 deletions
diff --git a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/ProductTests.java b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/ProductTests.java index 1494f541..5c78ff7e 100644 --- a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/ProductTests.java +++ b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/ProductTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. All rights reserved. + * Copyright (c) 2007, 2011 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html @@ -35,45 +35,44 @@ import org.osgi.framework.Version; */ public class ProductTests extends PDETestCase { - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testBug192127() throws Exception { - // IFolder buildFolder = newTest("192127"); - // IFolder containerFeature = Utils.createFolder(buildFolder, "features/org.eclipse.pde.build.container.feature"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // // Exporting from the UI gives the container feature some /Eclipse.App root files - // Utils.generateFeature(buildFolder, "org.eclipse.pde.build.container.feature", null, null, "/rcp/rcp.product", true, true, null); - // Properties featureProperties = new Properties(); - // featureProperties.put("root", "/temp/"); - // Utils.storeBuildProperties(containerFeature, featureProperties); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("product", "/rcp/rcp.product"); - // properties.put("configs", "macosx,cocoa,x86"); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/productBuild/allElements.xml"), null); - // properties.put("allElementsFile", FileLocator.toFileURL(resource).getPath()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runBuild(buildFolder); - // - // Set entries = new HashSet(); - // entries.add("eclipse/.eclipseproduct"); - // entries.add("eclipse/configuration/config.ini"); - // entries.add("eclipse/rcp.app/Contents/Info.plist"); - // entries.add("eclipse/rcp.app/Contents/MacOS/rcp"); - // entries.add("eclipse/rcp.app/Contents/MacOS/rcp.ini"); - // - // entries.add("eclipse/Eclipse.app/"); - // - // //bug 206788 names the archive .zip - // assertZipContents(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", entries, false); - // assertTrue(entries.contains("eclipse/Eclipse.app/")); - // assertTrue(entries.size() == 1); - // } + public void testBug192127() throws Exception { + IFolder buildFolder = newTest("192127"); + IFolder containerFeature = Utils.createFolder(buildFolder, "features/org.eclipse.pde.build.container.feature"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + // Exporting from the UI gives the container feature some /Eclipse.App root files + Utils.generateFeature(buildFolder, "org.eclipse.pde.build.container.feature", null, null, "/rcp/rcp.product", true, true, null); + Properties featureProperties = new Properties(); + featureProperties.put("root", "/temp/"); + Utils.storeBuildProperties(containerFeature, featureProperties); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("product", "/rcp/rcp.product"); + properties.put("configs", "macosx,cocoa,x86"); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/productBuild/allElements.xml"), null); + properties.put("allElementsFile", FileLocator.toFileURL(resource).getPath()); + Utils.storeBuildProperties(buildFolder, properties); + + runBuild(buildFolder); + + Set entries = new HashSet(); + entries.add("eclipse/.eclipseproduct"); + entries.add("eclipse/configuration/config.ini"); + entries.add("eclipse/rcp.app/Contents/Info.plist"); + entries.add("eclipse/rcp.app/Contents/MacOS/rcp"); + entries.add("eclipse/rcp.app/Contents/MacOS/rcp.ini"); + + entries.add("eclipse/Eclipse.app/"); + + //bug 206788 names the archive .zip + assertZipContents(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", entries, false); + assertTrue(entries.contains("eclipse/Eclipse.app/")); + assertTrue(entries.size() == 1); + } public void test218878() throws Exception { //platform specific config.ini files @@ -109,29 +108,28 @@ public class ProductTests extends PDETestCase { assertEquals("linux", props.getProperty("os")); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void test234032() throws Exception { - // IFolder buildFolder = newTest("234032"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("product", "test.product"); - // properties.put("configs", "macosx,cocoa,x86"); - // properties.put("archivesFormat", "macosx,cocoa,x86-folder"); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // IFile iniFile = buildFolder.getFile("tmp/eclipse/test.app/Contents/MacOS/test.ini"); - // assertLogContainsLine(iniFile, "-Dfoo=bar"); - // //bug 313940 - // assertLogContainsLine(iniFile, "-Dschemes1=archive zip jar"); - // assertLogContainsLine(iniFile, "-Dschemes2=archive zip jar"); - // } + public void test234032() throws Exception { + IFolder buildFolder = newTest("234032"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("product", "test.product"); + properties.put("configs", "macosx,cocoa,x86"); + properties.put("archivesFormat", "macosx,cocoa,x86-folder"); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + IFile iniFile = buildFolder.getFile("tmp/eclipse/test.app/Contents/MacOS/test.ini"); + assertLogContainsLine(iniFile, "-Dfoo=bar"); + //bug 313940 + assertLogContainsLine(iniFile, "-Dschemes1=archive zip jar"); + assertLogContainsLine(iniFile, "-Dschemes2=archive zip jar"); + } public void test237922() throws Exception { IFolder buildFolder = newTest("237922"); @@ -536,49 +534,48 @@ public class ProductTests extends PDETestCase { } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testBug269540() throws Exception { - // IFolder buildFolder = newTest("269540"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // IFolder a = Utils.createFolder(buildFolder, "plugins/A"); - // Utils.generateBundle(a, "A"); - // Attributes manifestAdditions = new Attributes(); - // manifestAdditions.put(new Attributes.Name("Eclipse-PlatformFilter"), "(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))"); - // Utils.generateBundleManifest(a, "A", "1.0.0", manifestAdditions); - // Utils.generatePluginBuildProperties(a, null); - // Utils.writeBuffer(a.getFile("src/a.java"), new StringBuffer("class A {}")); - // - // StringBuffer buffer = new StringBuffer(); - // buffer.append("<launcher name=\"rcp\"> \n"); - // buffer.append(" <win useIco=\"true\"> \n"); - // buffer.append(" <ico path=\"/A/mail.ico\"/> \n"); - // buffer.append(" </win> \n"); - // buffer.append("</launcher> \n"); - // IFile product = buildFolder.getFile("foo.product"); - // Utils.generateProduct(product, "rcp", "1.0.0", null, "rcp", new String[] {"A"}, false, buffer); - // - // //steal the icons from test 237922 - // URL ico = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path("/resources/237922/rcp/icons/mail.ico"), null); - // IFile icoFile = a.getFile("mail.ico"); - // icoFile.create(ico.openStream(), IResource.FORCE, null); - // - // Properties buildProperties = BuildConfiguration.getBuilderProperties(buildFolder); - // buildProperties.put("product", product.getLocation().toOSString()); - // buildProperties.put("filteredDependencies", "true"); - // buildProperties.put("pluginPath", delta.getAbsolutePath()); - // buildProperties.put("configs", "win32, win32, x86"); - // //buildProperties.put("archivesFormat", "win32,win32,x86 - folder"); - // - // Utils.storeBuildProperties(buildFolder, buildProperties); - // - // runProductBuild(buildFolder); - // - // Set entries = new HashSet(); - // entries.add("eclipse/plugins/A_1.0.0.jar"); - // entries.add("eclipse/rcp.exe"); - // assertZipContents(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip", entries); - // } + public void testBug269540() throws Exception { + IFolder buildFolder = newTest("269540"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + IFolder a = Utils.createFolder(buildFolder, "plugins/A"); + Utils.generateBundle(a, "A"); + Attributes manifestAdditions = new Attributes(); + manifestAdditions.put(new Attributes.Name("Eclipse-PlatformFilter"), "(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))"); + Utils.generateBundleManifest(a, "A", "1.0.0", manifestAdditions); + Utils.generatePluginBuildProperties(a, null); + Utils.writeBuffer(a.getFile("src/a.java"), new StringBuffer("class A {}")); + + StringBuffer buffer = new StringBuffer(); + buffer.append("<launcher name=\"rcp\"> \n"); + buffer.append(" <win useIco=\"true\"> \n"); + buffer.append(" <ico path=\"/A/mail.ico\"/> \n"); + buffer.append(" </win> \n"); + buffer.append("</launcher> \n"); + IFile product = buildFolder.getFile("foo.product"); + Utils.generateProduct(product, "rcp", "1.0.0", null, "rcp", new String[] {"A"}, false, buffer); + + //steal the icons from test 237922 + URL ico = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path("/resources/237922/rcp/icons/mail.ico"), null); + IFile icoFile = a.getFile("mail.ico"); + icoFile.create(ico.openStream(), IResource.FORCE, null); + + Properties buildProperties = BuildConfiguration.getBuilderProperties(buildFolder); + buildProperties.put("product", product.getLocation().toOSString()); + buildProperties.put("filteredDependencies", "true"); + buildProperties.put("pluginPath", delta.getAbsolutePath()); + buildProperties.put("configs", "win32, win32, x86"); + //buildProperties.put("archivesFormat", "win32,win32,x86 - folder"); + + Utils.storeBuildProperties(buildFolder, buildProperties); + + runProductBuild(buildFolder); + + Set entries = new HashSet(); + entries.add("eclipse/plugins/A_1.0.0.jar"); + entries.add("eclipse/rcp.exe"); + assertZipContents(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip", entries); + } } diff --git a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java index d69e8992..00bd2d12 100644 --- a/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java +++ b/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java @@ -26,107 +26,108 @@ import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.artifact.*; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; +import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.pde.build.internal.tests.Utils; import org.eclipse.pde.build.tests.BuildConfiguration; +import org.eclipse.pde.internal.build.site.QualifierReplacer; public class P2Tests extends P2TestCase { - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testP2SimpleProduct() throws Exception { - // IFolder buildFolder = newTest("p2.SimpleProduct"); - // IFolder repo = Utils.createFolder(buildFolder, "repo"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // String os = Platform.getOS(); - // String ws = Platform.getWS(); - // String arch = Platform.getOSArch(); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("product", "/test/test.product"); - // properties.put("configs", os + ',' + ws + ',' + arch); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // - // String repoLocation = "file:" + repo.getLocation().toOSString(); - // properties.put("generate.p2.metadata", "true"); - // properties.put("p2.metadata.repo", repoLocation); - // properties.put("p2.artifact.repo", repoLocation); - // properties.put("p2.flavor", "tooling"); - // properties.put("p2.publish.artifacts", "true"); - // - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // String p2Config = ws + '.' + os + '.' + arch; - // IMetadataRepository repository = loadMetadataRepository(repoLocation); - // assertNotNull(repository); - // - // //some basic existance - // ArrayList ius = new ArrayList(); - // ius.add(getIU(repository, "test")); - // ius.add(getIU(repository, "org.eclipse.equinox.launcher")); - // ius.add(getIU(repository, OSGI)); - // ius.add(getIU(repository, CORE_RUNTIME)); - // - // //check some start level info - // IInstallableUnit iu = getIU(repository, "tooling" + p2Config + CORE_RUNTIME); - // assertTouchpoint(iu, "configure", "markStarted(started: true);"); - // ius.add(iu); - // - // iu = getIU(repository, "tooling" + p2Config + EQUINOX_COMMON); - // assertTouchpoint(iu, "configure", "setStartLevel(startLevel:2);markStarted(started: true);"); - // ius.add(iu); - // - // //product settings - // getIU(repository, "toolingtest.product.ini." + p2Config); - // - // iu = getIU(repository, "toolingtest.product.config." + p2Config); - // assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.application,propValue:test.application);"); - // assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.product,propValue:test.product);"); - // assertProvides(iu, "toolingtest.product", "test.product.config"); - // - // //some launcher stuff - // iu = getIU(repository, "toolingorg.eclipse.equinox.launcher"); - // assertTouchpoint(iu, "configure", "addProgramArg(programArg:-startup);addProgramArg(programArg:@artifact);"); - // ius.add(iu); - // iu = getIU(repository, "toolingorg.eclipse.equinox.launcher." + p2Config); - // assertTouchpoint(iu, "configure", "addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"); - // ius.add(iu); - // - // iu = getIU(repository, "test.product.rootfiles." + p2Config); - // assertProvides(iu, "toolingtest.product", "test.product.rootfiles"); - // // assertRequires(iu, "org.eclipse.equinox.p2.iu", "org.eclipse.equinox.launcher." + launcherConfig); - // - // //And the main product IU - // iu = getIU(repository, "test.product"); - // // assertRequires(iu, "toolingtest.product", "test.product.launcher"); - // // assertRequires(iu, "toolingtest.product", "test.product.ini"); - // // assertRequires(iu, "toolingtest.product", "test.product.config"); - // // assertRequires(iu, ius, true); - // - // iu = getIU(repository, "toolingtest.product.rootfiles." + p2Config); - // assertTouchpoint(iu, "configure", "setLauncherName(name:test"); - // - // IFolder installFolder = buildFolder.getFolder("install"); - // properties.put("p2.director.installPath", installFolder.getLocation().toOSString()); - // properties.put("p2.repo", "file:" + buildFolder.getFolder("repo").getLocation().toOSString()); - // properties.put("p2.director.iu", "test.product"); - // properties.put("os", os); - // properties.put("ws", ws); - // properties.put("arch", arch); - // properties.put("equinoxLauncherJar", FileLocator.getBundleFile(Platform.getBundle("org.eclipse.equinox.launcher")).getAbsolutePath()); - // URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/genericTargets.xml"), null); - // String buildXMLPath = FileLocator.toFileURL(resource).getPath(); - // runAntScript(buildXMLPath, new String[] {"runDirector"}, buildFolder.getLocation().toOSString(), properties); - // - // IFile iniFile = os.equals("macosx") ? installFolder.getFile("test.app/Contents/MacOS/test.ini") : installFolder.getFile("test.ini"); - // assertLogContainsLine(iniFile, "-startup"); - // assertLogContainsLine(iniFile, "--launcher.library"); - // assertLogContainsLine(iniFile, "-foo"); - // } + public void testP2SimpleProduct() throws Exception { + IFolder buildFolder = newTest("p2.SimpleProduct"); + IFolder repo = Utils.createFolder(buildFolder, "repo"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + String os = Platform.getOS(); + String ws = Platform.getWS(); + String arch = Platform.getOSArch(); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("product", "/test/test.product"); + properties.put("configs", os + ',' + ws + ',' + arch); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + + String repoLocation = "file:" + repo.getLocation().toOSString(); + properties.put("generate.p2.metadata", "true"); + properties.put("p2.metadata.repo", repoLocation); + properties.put("p2.artifact.repo", repoLocation); + properties.put("p2.flavor", "tooling"); + properties.put("p2.publish.artifacts", "true"); + + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + String p2Config = ws + '.' + os + '.' + arch; + IMetadataRepository repository = loadMetadataRepository(repoLocation); + assertNotNull(repository); + + //some basic existance + ArrayList ius = new ArrayList(); + ius.add(getIU(repository, "test")); + ius.add(getIU(repository, "org.eclipse.equinox.launcher")); + ius.add(getIU(repository, OSGI)); + ius.add(getIU(repository, CORE_RUNTIME)); + + //check some start level info + IInstallableUnit iu = getIU(repository, "tooling" + p2Config + CORE_RUNTIME); + assertTouchpoint(iu, "configure", "markStarted(started: true);"); + ius.add(iu); + + iu = getIU(repository, "tooling" + p2Config + EQUINOX_COMMON); + assertTouchpoint(iu, "configure", "setStartLevel(startLevel:2);markStarted(started: true);"); + ius.add(iu); + + //product settings + getIU(repository, "toolingtest.product.ini." + p2Config); + + iu = getIU(repository, "toolingtest.product.config." + p2Config); + assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.application,propValue:test.application);"); + assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.product,propValue:test.product);"); + assertProvides(iu, "toolingtest.product", "test.product.config"); + + //some launcher stuff + iu = getIU(repository, "toolingorg.eclipse.equinox.launcher"); + assertTouchpoint(iu, "configure", "addProgramArg(programArg:-startup);addProgramArg(programArg:@artifact);"); + ius.add(iu); + iu = getIU(repository, "toolingorg.eclipse.equinox.launcher." + p2Config); + assertTouchpoint(iu, "configure", "addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"); + ius.add(iu); + + iu = getIU(repository, "test.product.rootfiles." + p2Config); + assertProvides(iu, "toolingtest.product", "test.product.rootfiles"); + // assertRequires(iu, "org.eclipse.equinox.p2.iu", "org.eclipse.equinox.launcher." + launcherConfig); + + //And the main product IU + iu = getIU(repository, "test.product"); + // assertRequires(iu, "toolingtest.product", "test.product.launcher"); + // assertRequires(iu, "toolingtest.product", "test.product.ini"); + // assertRequires(iu, "toolingtest.product", "test.product.config"); + // assertRequires(iu, ius, true); + + iu = getIU(repository, "toolingtest.product.rootfiles." + p2Config); + assertTouchpoint(iu, "configure", "setLauncherName(name:test"); + + IFolder installFolder = buildFolder.getFolder("install"); + properties.put("p2.director.installPath", installFolder.getLocation().toOSString()); + properties.put("p2.repo", "file:" + buildFolder.getFolder("repo").getLocation().toOSString()); + properties.put("p2.director.iu", "test.product"); + properties.put("os", os); + properties.put("ws", ws); + properties.put("arch", arch); + properties.put("equinoxLauncherJar", FileLocator.getBundleFile(Platform.getBundle("org.eclipse.equinox.launcher")).getAbsolutePath()); + URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/genericTargets.xml"), null); + String buildXMLPath = FileLocator.toFileURL(resource).getPath(); + runAntScript(buildXMLPath, new String[] {"runDirector"}, buildFolder.getLocation().toOSString(), properties); + + IFile iniFile = os.equals("macosx") ? installFolder.getFile("test.app/Contents/MacOS/test.ini") : installFolder.getFile("test.ini"); + assertLogContainsLine(iniFile, "-startup"); + assertLogContainsLine(iniFile, "--launcher.library"); + assertLogContainsLine(iniFile, "-foo"); + } public void testBug237096() throws Exception { IFolder buildFolder = newTest("237096"); @@ -171,69 +172,68 @@ public class P2Tests extends P2TestCase { assertRequires(rootIU, ius, true); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testBug242346() throws Exception { - // IFolder buildFolder = newTest("242346"); - // IFile productFile = buildFolder.getFile("rcp.product"); - // IFolder repo = Utils.createFolder(buildFolder, "repo"); - // - // Utils.generateProduct(productFile, "rcp.product", "1.0.0.qualifier", new String[] {OSGI, SIMPLE_CONFIGURATOR}, false); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // String repoLocation = "file:" + repo.getLocation().toOSString(); - // properties.put("product", productFile.getLocation().toOSString()); - // properties.put("configs", "win32,win32,x86"); - // properties.put("generate.p2.metadata", "true"); - // properties.put("p2.metadata.repo", repoLocation); - // properties.put("p2.artifact.repo", repoLocation); - // properties.put("p2.flavor", "tooling"); - // properties.put("p2.publish.artifacts", "true"); - // // properties.put("p2.product.qualifier", "v1234"); //bug 246060 //commented out for bug 297064 - // Utils.storeBuildProperties(buildFolder, properties); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // IMetadataRepository repository = loadMetadataRepository(repoLocation); - // assertNotNull(repository); - // - // IInstallableUnit iu = getIU(repository, "toolingrcp.product.config.win32.win32.x86"); - // ArrayList requiredIUs = new ArrayList(); - // IInstallableUnit rootFileCU = getIU(repository, "toolingrcp.product.rootfiles.win32.win32.x86"); - // requiredIUs.add(rootFileCU); - // requiredIUs.add(getIU(repository, "rcp.product.rootfiles.win32.win32.x86")); - // - // assertTouchpoint(rootFileCU, "configure", "setLauncherName"); - // iu = getIU(repository, "toolingrcp.product.rootfiles"); - // assertRequires(iu, requiredIUs, true); - // requiredIUs.clear(); - // requiredIUs.add(iu); - // - // iu = getIU(repository, "rcp.product"); - // assertRequires(iu, requiredIUs, true); - // //check up to the date on the timestamp, don't worry about hours/mins - // assertTrue(PublisherHelper.toOSGiVersion(iu.getVersion()).getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8))); - // - // IFolder installFolder = buildFolder.getFolder("install"); - // properties.put("p2.director.installPath", installFolder.getLocation().toOSString()); - // properties.put("p2.repo", "file:" + buildFolder.getFolder("repo").getLocation().toOSString()); - // properties.put("p2.director.iu", "rcp.product"); - // properties.put("os", "win32"); - // properties.put("ws", "win32"); - // properties.put("arch", "x86"); - // properties.put("equinoxLauncherJar", FileLocator.getBundleFile(Platform.getBundle("org.eclipse.equinox.launcher")).getAbsolutePath()); - // URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/genericTargets.xml"), null); - // String buildXMLPath = FileLocator.toFileURL(resource).getPath(); - // runAntScript(buildXMLPath, new String[] {"runDirector"}, buildFolder.getLocation().toOSString(), properties); - // - // assertResourceFile(installFolder, "eclipse.exe"); - // assertLogContainsLine(installFolder.getFile("configuration/config.ini"), "org.eclipse.equinox.simpleconfigurator.configUrl=file\\:org.eclipse.equinox.simpleconfigurator"); - // } + public void testBug242346() throws Exception { + IFolder buildFolder = newTest("242346"); + IFile productFile = buildFolder.getFile("rcp.product"); + IFolder repo = Utils.createFolder(buildFolder, "repo"); + + Utils.generateProduct(productFile, "rcp.product", "1.0.0.qualifier", new String[] {OSGI, SIMPLE_CONFIGURATOR}, false); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + String repoLocation = "file:" + repo.getLocation().toOSString(); + properties.put("product", productFile.getLocation().toOSString()); + properties.put("configs", "win32,win32,x86"); + properties.put("generate.p2.metadata", "true"); + properties.put("p2.metadata.repo", repoLocation); + properties.put("p2.artifact.repo", repoLocation); + properties.put("p2.flavor", "tooling"); + properties.put("p2.publish.artifacts", "true"); + // properties.put("p2.product.qualifier", "v1234"); //bug 246060 //commented out for bug 297064 + Utils.storeBuildProperties(buildFolder, properties); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + IMetadataRepository repository = loadMetadataRepository(repoLocation); + assertNotNull(repository); + + IInstallableUnit iu = getIU(repository, "toolingrcp.product.config.win32.win32.x86"); + ArrayList requiredIUs = new ArrayList(); + IInstallableUnit rootFileCU = getIU(repository, "toolingrcp.product.rootfiles.win32.win32.x86"); + requiredIUs.add(rootFileCU); + requiredIUs.add(getIU(repository, "rcp.product.rootfiles.win32.win32.x86")); + + assertTouchpoint(rootFileCU, "configure", "setLauncherName"); + iu = getIU(repository, "toolingrcp.product.rootfiles"); + assertRequires(iu, requiredIUs, true); + requiredIUs.clear(); + requiredIUs.add(iu); + + iu = getIU(repository, "rcp.product"); + assertRequires(iu, requiredIUs, true); + //check up to the date on the timestamp, don't worry about hours/mins + assertTrue(PublisherHelper.toOSGiVersion(iu.getVersion()).getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8))); + + IFolder installFolder = buildFolder.getFolder("install"); + properties.put("p2.director.installPath", installFolder.getLocation().toOSString()); + properties.put("p2.repo", "file:" + buildFolder.getFolder("repo").getLocation().toOSString()); + properties.put("p2.director.iu", "rcp.product"); + properties.put("os", "win32"); + properties.put("ws", "win32"); + properties.put("arch", "x86"); + properties.put("equinoxLauncherJar", FileLocator.getBundleFile(Platform.getBundle("org.eclipse.equinox.launcher")).getAbsolutePath()); + URL resource = FileLocator.find(Platform.getBundle("org.eclipse.pde.build"), new Path("/scripts/genericTargets.xml"), null); + String buildXMLPath = FileLocator.toFileURL(resource).getPath(); + runAntScript(buildXMLPath, new String[] {"runDirector"}, buildFolder.getLocation().toOSString(), properties); + + assertResourceFile(installFolder, "eclipse.exe"); + assertLogContainsLine(installFolder.getFile("configuration/config.ini"), "org.eclipse.equinox.simpleconfigurator.configUrl=file\\:org.eclipse.equinox.simpleconfigurator"); + } public void testBug222962_305837() throws Exception { IFolder buildFolder = newTest("222962"); @@ -927,87 +927,86 @@ public class P2Tests extends P2TestCase { assertResourceFile(installFolder, "plugins/A_1.0.0.jar"); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testMetadataGenerator_BootStrap() throws Exception { - // IFolder testFolder = newTest("metadataGenerator_Bootstrap"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // IFile productFile = testFolder.getFile("Bootstrap.product"); - // - // //Step one, build old fashioned product - // IFolder buildFolder = Utils.createFolder(testFolder, "build"); - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("configs", "win32,win32,x86"); - // properties.put("archivesFormat", "win32,win32,x86-folder"); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // properties.put("product", productFile.getLocation().toOSString()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // IFolder repoFolder = testFolder.getFolder("repository"); - // IFolder installFolder = testFolder.getFolder("install"); - // - // //step two, invoke the metadata generator on the product - // StringBuffer scriptBuffer = new StringBuffer(); - // scriptBuffer.append("<project name=\"project\" default=\"go\"> \n"); - // scriptBuffer.append(" <target name=\"go\"> \n"); - // scriptBuffer.append(" <last id=\"launcher\"> \n"); - // scriptBuffer.append(" <sort> \n"); - // scriptBuffer.append(" <fileset dir=\"${eclipse.home}/plugins\" includes=\"org.eclipse.equinox.launcher_*\" /> \n"); - // scriptBuffer.append(" </sort> \n"); - // scriptBuffer.append(" </last> \n"); - // scriptBuffer.append(" <property name=\"launcher\" refid=\"launcher\" /> \n"); - // scriptBuffer.append(" <condition property=\"p2.director.devMode\" value=\"-dev "${osgi.dev}"\" else=\"\"> \n"); - // scriptBuffer.append(" <isset property=\"osgi.dev\" /> \n"); - // scriptBuffer.append(" </condition> \n"); - // scriptBuffer.append(" <java dir=\"${basedir}\" jar=\"${launcher}\" fork=\"true\"> \n"); - // scriptBuffer.append(" <arg line=\"-application org.eclipse.equinox.p2.publisher.EclipseGenerator\" /> \n"); - // scriptBuffer.append(" <arg line=\"${p2.director.devMode}\" /> \n"); - // scriptBuffer.append(" <sysproperty key=\"osgi.configuration.area\" value=\"${osgi.configuration.area}\" /> \n"); - // scriptBuffer.append(" <arg line=\"-metadataRepositoryName BootStrapRepo\" /> \n"); - // scriptBuffer.append(" <arg value=\"-metadataRepository\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); - // scriptBuffer.append(" <arg value=\"-artifactRepository\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); - // scriptBuffer.append(" <arg value=\"-source\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + buildFolder.getFolder("tmp/eclipse").getLocation().toOSString() + "\" /> \n"); - // scriptBuffer.append(" <arg line=\"-root bootstrap -rootVersion 1.2.0.12345\" /> \n"); - // scriptBuffer.append(" <arg line=\"-flavor tooling -publishArtifacts -append\" /> \n"); - // //scriptBuffer.append(" <jvmarg line=\"-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\" /> \n"); - // scriptBuffer.append(" </java> \n"); - // - // //step three call the director - // scriptBuffer.append(" <java dir=\"${basedir}\" jar=\"${launcher}\" fork=\"true\"> \n"); - // scriptBuffer.append(" <arg line=\"${p2.director.devMode}\" /> \n"); - // scriptBuffer.append(" <sysproperty key=\"osgi.configuration.area\" value=\"${osgi.configuration.area}\" /> \n"); - // scriptBuffer.append(" <arg line=\"-application org.eclipse.equinox.p2.director\" /> \n"); - // scriptBuffer.append(" <arg value=\"-metadataRepository\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); - // scriptBuffer.append(" <arg value=\"-artifactRepository\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); - // scriptBuffer.append(" <arg line=\"-installIU bootstrap/1.2.0.12345 -profile bootProfile\" /> \n"); - // scriptBuffer.append(" <arg line=\"-profileProperties org.eclipse.update.install.features=true\" /> \n"); - // scriptBuffer.append(" <arg line=\"-p2.os win32 -p2.ws win32 -p2.arch x86\" /> \n"); - // scriptBuffer.append(" <arg value=\"-destination\" /> \n"); - // scriptBuffer.append(" <arg value=\"" + installFolder.getLocation().toOSString() + "\" /> \n"); - // //scriptBuffer.append(" <jvmarg value=\"-Declipse.p2.data.area=" + installFolder.getLocation().toOSString() + "/p2\" /> \n"); - // //scriptBuffer.append(" <jvmarg line=\"-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\" /> \n"); - // scriptBuffer.append(" </java> \n"); - // scriptBuffer.append(" </target> \n"); - // scriptBuffer.append("</project> \n"); - // IFile script = buildFolder.getFile("build.xml"); - // Utils.writeBuffer(script, scriptBuffer); - // - // runAntScript(script.getLocation().toOSString(), new String[] {"go"}, testFolder.getLocation().toOSString(), null); - // - // IMetadataRepository metaRepo = loadMetadataRepository(repoFolder.getLocationURI()); - // assertEquals(metaRepo.getName(), "BootStrapRepo"); - // IInstallableUnit iu = getIU(metaRepo, "bootstrap"); - // assertEquals(iu.getVersion().toString(), "1.2.0.12345"); - // assertResourceFile(installFolder, "eclipse.exe"); - // } + public void testMetadataGenerator_BootStrap() throws Exception { + IFolder testFolder = newTest("metadataGenerator_Bootstrap"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + IFile productFile = testFolder.getFile("Bootstrap.product"); + + //Step one, build old fashioned product + IFolder buildFolder = Utils.createFolder(testFolder, "build"); + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("configs", "win32,win32,x86"); + properties.put("archivesFormat", "win32,win32,x86-folder"); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + properties.put("product", productFile.getLocation().toOSString()); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + IFolder repoFolder = testFolder.getFolder("repository"); + IFolder installFolder = testFolder.getFolder("install"); + + //step two, invoke the metadata generator on the product + StringBuffer scriptBuffer = new StringBuffer(); + scriptBuffer.append("<project name=\"project\" default=\"go\"> \n"); + scriptBuffer.append(" <target name=\"go\"> \n"); + scriptBuffer.append(" <last id=\"launcher\"> \n"); + scriptBuffer.append(" <sort> \n"); + scriptBuffer.append(" <fileset dir=\"${eclipse.home}/plugins\" includes=\"org.eclipse.equinox.launcher_*\" /> \n"); + scriptBuffer.append(" </sort> \n"); + scriptBuffer.append(" </last> \n"); + scriptBuffer.append(" <property name=\"launcher\" refid=\"launcher\" /> \n"); + scriptBuffer.append(" <condition property=\"p2.director.devMode\" value=\"-dev "${osgi.dev}"\" else=\"\"> \n"); + scriptBuffer.append(" <isset property=\"osgi.dev\" /> \n"); + scriptBuffer.append(" </condition> \n"); + scriptBuffer.append(" <java dir=\"${basedir}\" jar=\"${launcher}\" fork=\"true\"> \n"); + scriptBuffer.append(" <arg line=\"-application org.eclipse.equinox.p2.publisher.EclipseGenerator\" /> \n"); + scriptBuffer.append(" <arg line=\"${p2.director.devMode}\" /> \n"); + scriptBuffer.append(" <sysproperty key=\"osgi.configuration.area\" value=\"${osgi.configuration.area}\" /> \n"); + scriptBuffer.append(" <arg line=\"-metadataRepositoryName BootStrapRepo\" /> \n"); + scriptBuffer.append(" <arg value=\"-metadataRepository\" /> \n"); + scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); + scriptBuffer.append(" <arg value=\"-artifactRepository\" /> \n"); + scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); + scriptBuffer.append(" <arg value=\"-source\" /> \n"); + scriptBuffer.append(" <arg value=\"" + buildFolder.getFolder("tmp/eclipse").getLocation().toOSString() + "\" /> \n"); + scriptBuffer.append(" <arg line=\"-root bootstrap -rootVersion 1.2.0.12345\" /> \n"); + scriptBuffer.append(" <arg line=\"-flavor tooling -publishArtifacts -append\" /> \n"); + //scriptBuffer.append(" <jvmarg line=\"-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\" /> \n"); + scriptBuffer.append(" </java> \n"); + + //step three call the director + scriptBuffer.append(" <java dir=\"${basedir}\" jar=\"${launcher}\" fork=\"true\"> \n"); + scriptBuffer.append(" <arg line=\"${p2.director.devMode}\" /> \n"); + scriptBuffer.append(" <sysproperty key=\"osgi.configuration.area\" value=\"${osgi.configuration.area}\" /> \n"); + scriptBuffer.append(" <arg line=\"-application org.eclipse.equinox.p2.director\" /> \n"); + scriptBuffer.append(" <arg value=\"-metadataRepository\" /> \n"); + scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); + scriptBuffer.append(" <arg value=\"-artifactRepository\" /> \n"); + scriptBuffer.append(" <arg value=\"" + URIUtil.toUnencodedString(repoFolder.getLocationURI()) + "\" /> \n"); + scriptBuffer.append(" <arg line=\"-installIU bootstrap/1.2.0.12345 -profile bootProfile\" /> \n"); + scriptBuffer.append(" <arg line=\"-profileProperties org.eclipse.update.install.features=true\" /> \n"); + scriptBuffer.append(" <arg line=\"-p2.os win32 -p2.ws win32 -p2.arch x86\" /> \n"); + scriptBuffer.append(" <arg value=\"-destination\" /> \n"); + scriptBuffer.append(" <arg value=\"" + installFolder.getLocation().toOSString() + "\" /> \n"); + //scriptBuffer.append(" <jvmarg value=\"-Declipse.p2.data.area=" + installFolder.getLocation().toOSString() + "/p2\" /> \n"); + //scriptBuffer.append(" <jvmarg line=\"-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\" /> \n"); + scriptBuffer.append(" </java> \n"); + scriptBuffer.append(" </target> \n"); + scriptBuffer.append("</project> \n"); + IFile script = buildFolder.getFile("build.xml"); + Utils.writeBuffer(script, scriptBuffer); + + runAntScript(script.getLocation().toOSString(), new String[] {"go"}, testFolder.getLocation().toOSString(), null); + + IMetadataRepository metaRepo = loadMetadataRepository(repoFolder.getLocationURI()); + assertEquals(metaRepo.getName(), "BootStrapRepo"); + IInstallableUnit iu = getIU(metaRepo, "bootstrap"); + assertEquals(iu.getVersion().toString(), "1.2.0.12345"); + assertResourceFile(installFolder, "eclipse.exe"); + } } 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 a46d3da0..8226d5e4 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 IBM Corporation and others. All rights reserved. + * Copyright (c) 2008, 2012 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html @@ -22,18 +22,17 @@ import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.metadata.VersionRange; +import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.pde.build.internal.tests.Utils; +import org.eclipse.pde.build.tests.Activator; import org.eclipse.pde.build.tests.BuildConfiguration; import org.eclipse.pde.internal.build.P2InfUtils; -import org.eclipse.pde.internal.build.site.BuildTimeFeature; -import org.eclipse.pde.internal.build.site.BuildTimeFeatureFactory; +import org.eclipse.pde.internal.build.site.*; import org.osgi.framework.Constants; public class PublishingTests extends P2TestCase { @@ -425,59 +424,58 @@ public class PublishingTests extends P2TestCase { assertProvides(iu, "test", "my.provides"); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testPublishFeature_ExecutableFeature() throws Exception { - // IFolder buildFolder = newTest("PublishFeature_Executable"); - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // File originalExecutable = findExecutableFeature(delta); - // - // Properties properties = BuildConfiguration.getScriptGenerationProperties(buildFolder, "feature", EQUINOX_EXECUTABLE); - // properties.put("launcherName", "eclipse"); - // properties.put("p2.gathering", "true"); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // generateScripts(buildFolder, properties); - // - // String buildXMLPath = new File(originalExecutable, "build.xml").getAbsolutePath(); - // runAntScript(buildXMLPath, new String[] {"publish.bin.parts"}, buildFolder.getLocation().toOSString(), properties); - // - // String executable = EQUINOX_EXECUTABLE; - // String fileName = originalExecutable.getName(); - // String version = fileName.substring(fileName.indexOf('_') + 1); - // Set entries = new HashSet(); - // entries.add("launcher"); - // assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.motif.aix.ppc_" + version, entries); - // - // // Linux zips contain launcher and about.html (libCairo no longer packaged in the delta pack (bug 354978)) - // // entries.add("libcairo-swt.so"); - // // entries.add("about_files/about_cairo.html"); - // // entries.add("about_files/mpl-v11.txt"); - // // entries.add("about_files/pixman-licenses.txt"); - // // entries.add("about_files/"); - // entries.add("about.html"); - // assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.gtk.linux.x86_" + version, entries); - // - // // Mac zips contain app structure - // entries.add("Eclipse.app/"); - // entries.add("Eclipse.app/Contents/"); - // entries.add("Eclipse.app/Contents/Info.plist"); - // entries.add("Eclipse.app/Contents/MacOS/"); - // entries.add("Eclipse.app/Contents/MacOS/eclipse.ini"); - // entries.add("Eclipse.app/Contents/MacOS/launcher"); - // assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.carbon.macosx.ppc_" + version, entries); - // - // // Windows zips just contain the launcher - // - // IMetadataRepository repository = loadMetadataRepository("file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); - // assertNotNull(repository); - // - // IInstallableUnit iu = getIU(repository, "org.eclipse.equinox.executable_root.gtk.linux.ppc"); - // assertEquals(iu.getVersion().toString(), version); - // // LibCairo no longer installed using a touchpoint (Bug 354978) - // // assertTouchpoint(iu, "install", "chmod(targetDir:${installFolder}, targetFile:libcairo-swt.so, permissions:755);"); - // } + public void testPublishFeature_ExecutableFeature() throws Exception { + IFolder buildFolder = newTest("PublishFeature_Executable"); + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + File originalExecutable = findExecutableFeature(delta); + + Properties properties = BuildConfiguration.getScriptGenerationProperties(buildFolder, "feature", EQUINOX_EXECUTABLE); + properties.put("launcherName", "eclipse"); + properties.put("p2.gathering", "true"); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + generateScripts(buildFolder, properties); + + String buildXMLPath = new File(originalExecutable, "build.xml").getAbsolutePath(); + runAntScript(buildXMLPath, new String[] {"publish.bin.parts"}, buildFolder.getLocation().toOSString(), properties); + + String executable = EQUINOX_EXECUTABLE; + String fileName = originalExecutable.getName(); + String version = fileName.substring(fileName.indexOf('_') + 1); + Set entries = new HashSet(); + entries.add("launcher"); + assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.motif.aix.ppc_" + version, entries); + + // Linux zips contain launcher and about.html (libCairo no longer packaged in the delta pack (bug 354978)) + // entries.add("libcairo-swt.so"); + // entries.add("about_files/about_cairo.html"); + // entries.add("about_files/mpl-v11.txt"); + // entries.add("about_files/pixman-licenses.txt"); + // entries.add("about_files/"); + entries.add("about.html"); + assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.gtk.linux.x86_" + version, entries); + + // Mac zips contain app structure + entries.add("Eclipse.app/"); + entries.add("Eclipse.app/Contents/"); + entries.add("Eclipse.app/Contents/Info.plist"); + entries.add("Eclipse.app/Contents/MacOS/"); + entries.add("Eclipse.app/Contents/MacOS/eclipse.ini"); + entries.add("Eclipse.app/Contents/MacOS/launcher"); + assertZipContents(buildFolder.getFolder("buildRepo/binary"), executable + "_root.carbon.macosx.ppc_" + version, entries); + + // Windows zips just contain the launcher + + IMetadataRepository repository = loadMetadataRepository("file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); + assertNotNull(repository); + + IInstallableUnit iu = getIU(repository, "org.eclipse.equinox.executable_root.gtk.linux.ppc"); + assertEquals(iu.getVersion().toString(), version); + // LibCairo no longer installed using a touchpoint (Bug 354978) + // assertTouchpoint(iu, "install", "chmod(targetDir:${installFolder}, targetFile:libcairo-swt.so, permissions:755);"); + } public void testPublishBundle_APITooling() throws Exception { IFolder buildFolder = newTest("PublishBundle_APITooling"); @@ -607,88 +605,87 @@ public class PublishingTests extends P2TestCase { assertZipContents(buildFolder, "buildRepo/plugins/bundle.source_1.0.0.jar", entries); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testPublish_Brand_1() throws Exception { - // IFolder buildFolder = newTest("brand_1"); - // IFolder rcp = Utils.createFolder(buildFolder, "rcp"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // File executable = findExecutableFeature(delta); - // String executableVersion = executable.getName().substring(executable.getName().indexOf('_') + 1); - // - // IFile product = rcp.getFile("rcp.product"); - // StringBuffer branding = new StringBuffer(); - // branding.append("<launcher name=\"branded\"> \n"); - // branding.append(" <macosx icon=\"mail.icns\" /> \n"); - // branding.append(" <win useIco=\"true\"> \n"); - // branding.append(" <ico path=\"mail.ico\" /> \n"); - // branding.append(" <bmp/> \n"); - // branding.append(" </win> \n"); - // branding.append("</launcher> \n"); - // - // //bug 273115 - no version - // Utils.generateProduct(product, "org.example.rcp", null, null, new String[] {OSGI}, false, branding); - // - // //steal the icons from test 237922 - // URL ico = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path("/resources/237922/rcp/icons/mail.ico"), null); - // IFile icoFile = rcp.getFile("mail.ico"); - // icoFile.create(ico.openStream(), IResource.FORCE, null); - // - // //cheat and spoof a icns file for mac - // Utils.copy(icoFile.getLocation().toFile(), new File(rcp.getLocation().toFile(), "mail.icns")); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("product", product.getLocation().toOSString()); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // //bug 274527 - cocoa.x86_64 - // properties.put("configs", "win32,win32,x86 & macosx, cocoa, x86_64"); - // properties.put("p2.gathering", "true"); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // Set entries = new HashSet(); - // entries.add("branded.app/Contents/Info.plist"); - // entries.add("branded.app/Contents/MacOS/branded.ini"); - // entries.add("branded.app/Contents/MacOS/branded"); - // entries.add("branded.app/Contents/Resources/mail.icns"); - // assertZipContents(buildFolder.getFolder("buildRepo/binary"), "org.example.rcp_root.cocoa.macosx.x86_64_" + executableVersion, entries); - // - // entries.clear(); - // entries.add("branded.exe"); - // assertZipContents(buildFolder.getFolder("buildRepo/binary"), "org.example.rcp_root.win32.win32.x86_" + executableVersion, entries); - // - // IMetadataRepository repository = loadMetadataRepository("file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); - // assertNotNull(repository); - // - // IInstallableUnit iu = getIU(repository, "org.example.rcp"); - // assertEquals(iu.getId(), "org.example.rcp"); - // assertEquals(iu.getVersion().toString(), "0.0.0"); - // assertRequires(iu, "org.eclipse.equinox.p2.iu", OSGI); - // - // //bug 218377 - // iu = getIU(repository, "org.example.rcp_root.cocoa.macosx.x86_64"); - // assertTouchpoint(iu, "install", "targetFile:branded.app/Contents/MacOS/branded"); - // - // assertResourceFile(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip"); - // - // iu = getIU(repository, "org.eclipse.equinox.launcher.cocoa.macosx.x86_64"); - // entries.clear(); - // entries.add("eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_" + iu.getVersion() + "/"); - // assertZipContents(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", entries); - // - // //bug 295282, bug 282652 - // IFile iniFile = buildFolder.getFile("branded.ini"); - // Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", "eclipse/branded.app/Contents/MacOS/branded.ini", iniFile); - // assertLogContainsLine(iniFile, "../../../plugins/org.eclipse.equinox.launcher"); - // - // IFile wrongFile = buildFolder.getFile("wrong.ini"); - // Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", "eclipse/Branded.app/Contents/MacOS/branded.ini", wrongFile); - // assertFalse(wrongFile.exists()); - // } + public void testPublish_Brand_1() throws Exception { + IFolder buildFolder = newTest("brand_1"); + IFolder rcp = Utils.createFolder(buildFolder, "rcp"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + File executable = findExecutableFeature(delta); + String executableVersion = executable.getName().substring(executable.getName().indexOf('_') + 1); + + IFile product = rcp.getFile("rcp.product"); + StringBuffer branding = new StringBuffer(); + branding.append("<launcher name=\"branded\"> \n"); + branding.append(" <macosx icon=\"mail.icns\" /> \n"); + branding.append(" <win useIco=\"true\"> \n"); + branding.append(" <ico path=\"mail.ico\" /> \n"); + branding.append(" <bmp/> \n"); + branding.append(" </win> \n"); + branding.append("</launcher> \n"); + + //bug 273115 - no version + Utils.generateProduct(product, "org.example.rcp", null, null, new String[] {OSGI}, false, branding); + + //steal the icons from test 237922 + URL ico = FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID), new Path("/resources/237922/rcp/icons/mail.ico"), null); + IFile icoFile = rcp.getFile("mail.ico"); + icoFile.create(ico.openStream(), IResource.FORCE, null); + + //cheat and spoof a icns file for mac + Utils.copy(icoFile.getLocation().toFile(), new File(rcp.getLocation().toFile(), "mail.icns")); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("product", product.getLocation().toOSString()); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + //bug 274527 - cocoa.x86_64 + properties.put("configs", "win32,win32,x86 & macosx, cocoa, x86_64"); + properties.put("p2.gathering", "true"); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + Set entries = new HashSet(); + entries.add("branded.app/Contents/Info.plist"); + entries.add("branded.app/Contents/MacOS/branded.ini"); + entries.add("branded.app/Contents/MacOS/branded"); + entries.add("branded.app/Contents/Resources/mail.icns"); + assertZipContents(buildFolder.getFolder("buildRepo/binary"), "org.example.rcp_root.cocoa.macosx.x86_64_" + executableVersion, entries); + + entries.clear(); + entries.add("branded.exe"); + assertZipContents(buildFolder.getFolder("buildRepo/binary"), "org.example.rcp_root.win32.win32.x86_" + executableVersion, entries); + + IMetadataRepository repository = loadMetadataRepository("file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); + assertNotNull(repository); + + IInstallableUnit iu = getIU(repository, "org.example.rcp"); + assertEquals(iu.getId(), "org.example.rcp"); + assertEquals(iu.getVersion().toString(), "0.0.0"); + assertRequires(iu, "org.eclipse.equinox.p2.iu", OSGI); + + //bug 218377 + iu = getIU(repository, "org.example.rcp_root.cocoa.macosx.x86_64"); + assertTouchpoint(iu, "install", "targetFile:branded.app/Contents/MacOS/branded"); + + assertResourceFile(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip"); + + iu = getIU(repository, "org.eclipse.equinox.launcher.cocoa.macosx.x86_64"); + entries.clear(); + entries.add("eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_" + iu.getVersion() + "/"); + assertZipContents(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", entries); + + //bug 295282, bug 282652 + IFile iniFile = buildFolder.getFile("branded.ini"); + Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", "eclipse/branded.app/Contents/MacOS/branded.ini", iniFile); + assertLogContainsLine(iniFile, "../../../plugins/org.eclipse.equinox.launcher"); + + IFile wrongFile = buildFolder.getFile("wrong.ini"); + Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86_64.zip", "eclipse/Branded.app/Contents/MacOS/branded.ini", wrongFile); + assertFalse(wrongFile.exists()); + } public void testAssemblePackage() throws Exception { IFolder buildFolder = newTest("publishAssemblePackage"); @@ -772,106 +769,105 @@ public class PublishingTests extends P2TestCase { getIU(repo, "new_category_1"); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testPublishAndRunSimpleProduct() throws Exception { - // IFolder buildFolder = newTest("PublishAndRunSimpleProduct"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // //headless rcp hello world - // IFolder headless = Utils.createFolder(buildFolder, "plugins/headless"); - // StringBuffer buffer = new StringBuffer(); - // buffer.append("package headless; \n"); - // buffer.append("import org.eclipse.equinox.app.IApplication; \n"); - // buffer.append("import org.eclipse.equinox.app.IApplicationContext; \n"); - // buffer.append("public class Application implements IApplication { \n"); - // buffer.append(" public Object start(IApplicationContext context) throws Exception { \n"); - // buffer.append(" System.out.println(\"Hello RCP World!\"); \n"); - // buffer.append(" return IApplication.EXIT_OK; \n"); - // buffer.append(" } \n"); - // buffer.append(" public void stop() { \n"); - // buffer.append(" } \n"); - // buffer.append("} \n"); - // Utils.writeBuffer(headless.getFile("src/headless/Application.java"), buffer); - // - // buffer = new StringBuffer(); - // buffer.append("<plugin> \n"); - // buffer.append(" <extension id=\"application\" point=\"org.eclipse.core.runtime.applications\">\n"); - // buffer.append(" <application> \n"); - // buffer.append(" <run class=\"headless.Application\"/> \n"); - // buffer.append(" </application> \n"); - // buffer.append(" </extension> \n"); - // buffer.append(" <extension id=\"product\" point=\"org.eclipse.core.runtime.products\"> \n"); - // buffer.append(" <product application=\"headless.application\" name=\"Headless Name\"/> \n"); - // buffer.append(" </extension> \n"); - // buffer.append("</plugin> \n"); - // Utils.writeBuffer(headless.getFile("plugin.xml"), buffer); - // - // Attributes additionalAttributes = new Attributes(); - // additionalAttributes = new Attributes(); - // additionalAttributes.put(new Attributes.Name("Require-Bundle"), "org.eclipse.core.runtime"); - // additionalAttributes.put(new Attributes.Name("Bundle-ActivationPolicy"), "lazy"); - // Utils.generateBundleManifest(headless, "headless;singleton:=true", "1.0.0", additionalAttributes); - // Properties properties = new Properties(); - // properties.put("bin.includes", "META-INF/, ., plugin.xml"); - // Utils.generatePluginBuildProperties(headless, properties); - // - // IFile productFile = buildFolder.getFile("headless.product"); - // String[] bundles = new String[] {"headless", "org.eclipse.core.contenttype", "org.eclipse.core.jobs", "org.eclipse.core.runtime", EQUINOX_APP, EQUINOX_COMMON, EQUINOX_PREFERENCES, EQUINOX_REGISTRY, OSGI}; - // Utils.generateProduct(productFile, "headless.product", "1.0.0.qualifier", "headless.application", "headless", bundles, false, null); - // Properties p2Inf = new Properties(); // bug 268223 - // p2Inf.put("instructions.configure", "addRepository(type:0,location:file${#58}//foo/bar);"); - // Utils.storeProperties(buildFolder.getFile("p2.inf"), p2Inf); - // - // properties = BuildConfiguration.getBuilderProperties(buildFolder); - // String config = Platform.getOS() + ',' + Platform.getWS() + ',' + Platform.getOSArch(); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // properties.put("product", productFile.getLocation().toOSString()); - // properties.put("configs", config); - // properties.put("archivesFormat", config + "-folder"); - // properties.put("filteredDependencyCheck", "true"); - // properties.put("p2.gathering", "true"); - // properties.put("p2.metadata.repo", "file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); - // properties.put("p2.artifact.repo", "file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // IFile configFile = buildFolder.getFile("/tmp/eclipse/configuration/config.ini"); - // assertLogContainsLine(configFile, "eclipse.application=headless.application"); - // assertLogContainsLine(configFile, "eclipse.product=headless.product"); - // - // if (Platform.getOS().equals("macosx")) { - // IFile iniFile = buildFolder.getFile("/tmp/eclipse/headless.app/Contents/MacOS/headless.ini"); - // assertLogContainsLines(iniFile, new String[] {"-startup", "plugins/org.eclipse.equinox.launcher_"}); - // assertLogContainsLines(iniFile, new String[] {"--launcher.library", "plugins/org.eclipse.equinox.launcher."}); - // } else { - // IFile iniFile = buildFolder.getFile("/tmp/eclipse/headless.ini"); - // assertLogContainsLines(iniFile, new String[] {"-startup", "plugins/org.eclipse.equinox.launcher_"}); - // assertLogContainsLines(iniFile, new String[] {"--launcher.library", "plugins/org.eclipse.equinox.launcher."}); - // } - // - // IFolder binaryFolder = buildFolder.getFolder("/tmp/eclipse/binary"); - // assertFalse(binaryFolder.exists()); - // - // IMetadataRepository finalRepo = loadMetadataRepository("file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); - // getIU(finalRepo, "a.jre.javase"); - // IInstallableUnit productIu = getIU(finalRepo, "headless.product"); - // assertFalse(productIu.getVersion().toString().equals("1.0.0.qualifier")); //bug 246060, should be a timestamp - // //check up to the date on the timestamp, don't worry about hours/mins - // assertTrue(PublisherHelper.toOSGiVersion(productIu.getVersion()).getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8))); - // assertTouchpoint(productIu, "configure", "addRepository(type:0,location:file${#58}//foo/bar);"); - // - // IInstallableUnit iu = getIU(finalRepo, "toolingorg.eclipse.equinox.common"); - // assertEquals(iu.getVersion(), productIu.getVersion()); - // - // iu = getIU(finalRepo, "toolingheadless.product_root." + Platform.getWS() + '.' + Platform.getOS() + '.' + Platform.getOSArch()); - // assertTouchpoint(iu, "configure", "setLauncherName(name:headless"); - // assertEquals(iu.getVersion(), productIu.getVersion()); - // - // } + public void testPublishAndRunSimpleProduct() throws Exception { + IFolder buildFolder = newTest("PublishAndRunSimpleProduct"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + //headless rcp hello world + IFolder headless = Utils.createFolder(buildFolder, "plugins/headless"); + StringBuffer buffer = new StringBuffer(); + buffer.append("package headless; \n"); + buffer.append("import org.eclipse.equinox.app.IApplication; \n"); + buffer.append("import org.eclipse.equinox.app.IApplicationContext; \n"); + buffer.append("public class Application implements IApplication { \n"); + buffer.append(" public Object start(IApplicationContext context) throws Exception { \n"); + buffer.append(" System.out.println(\"Hello RCP World!\"); \n"); + buffer.append(" return IApplication.EXIT_OK; \n"); + buffer.append(" } \n"); + buffer.append(" public void stop() { \n"); + buffer.append(" } \n"); + buffer.append("} \n"); + Utils.writeBuffer(headless.getFile("src/headless/Application.java"), buffer); + + buffer = new StringBuffer(); + buffer.append("<plugin> \n"); + buffer.append(" <extension id=\"application\" point=\"org.eclipse.core.runtime.applications\">\n"); + buffer.append(" <application> \n"); + buffer.append(" <run class=\"headless.Application\"/> \n"); + buffer.append(" </application> \n"); + buffer.append(" </extension> \n"); + buffer.append(" <extension id=\"product\" point=\"org.eclipse.core.runtime.products\"> \n"); + buffer.append(" <product application=\"headless.application\" name=\"Headless Name\"/> \n"); + buffer.append(" </extension> \n"); + buffer.append("</plugin> \n"); + Utils.writeBuffer(headless.getFile("plugin.xml"), buffer); + + Attributes additionalAttributes = new Attributes(); + additionalAttributes = new Attributes(); + additionalAttributes.put(new Attributes.Name("Require-Bundle"), "org.eclipse.core.runtime"); + additionalAttributes.put(new Attributes.Name("Bundle-ActivationPolicy"), "lazy"); + Utils.generateBundleManifest(headless, "headless;singleton:=true", "1.0.0", additionalAttributes); + Properties properties = new Properties(); + properties.put("bin.includes", "META-INF/, ., plugin.xml"); + Utils.generatePluginBuildProperties(headless, properties); + + IFile productFile = buildFolder.getFile("headless.product"); + String[] bundles = new String[] {"headless", "org.eclipse.core.contenttype", "org.eclipse.core.jobs", "org.eclipse.core.runtime", EQUINOX_APP, EQUINOX_COMMON, EQUINOX_PREFERENCES, EQUINOX_REGISTRY, OSGI}; + Utils.generateProduct(productFile, "headless.product", "1.0.0.qualifier", "headless.application", "headless", bundles, false, null); + Properties p2Inf = new Properties(); // bug 268223 + p2Inf.put("instructions.configure", "addRepository(type:0,location:file${#58}//foo/bar);"); + Utils.storeProperties(buildFolder.getFile("p2.inf"), p2Inf); + + properties = BuildConfiguration.getBuilderProperties(buildFolder); + String config = Platform.getOS() + ',' + Platform.getWS() + ',' + Platform.getOSArch(); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + properties.put("product", productFile.getLocation().toOSString()); + properties.put("configs", config); + properties.put("archivesFormat", config + "-folder"); + properties.put("filteredDependencyCheck", "true"); + properties.put("p2.gathering", "true"); + properties.put("p2.metadata.repo", "file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); + properties.put("p2.artifact.repo", "file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + IFile configFile = buildFolder.getFile("/tmp/eclipse/configuration/config.ini"); + assertLogContainsLine(configFile, "eclipse.application=headless.application"); + assertLogContainsLine(configFile, "eclipse.product=headless.product"); + + if (Platform.getOS().equals("macosx")) { + IFile iniFile = buildFolder.getFile("/tmp/eclipse/headless.app/Contents/MacOS/headless.ini"); + assertLogContainsLines(iniFile, new String[] {"-startup", "plugins/org.eclipse.equinox.launcher_"}); + assertLogContainsLines(iniFile, new String[] {"--launcher.library", "plugins/org.eclipse.equinox.launcher."}); + } else { + IFile iniFile = buildFolder.getFile("/tmp/eclipse/headless.ini"); + assertLogContainsLines(iniFile, new String[] {"-startup", "plugins/org.eclipse.equinox.launcher_"}); + assertLogContainsLines(iniFile, new String[] {"--launcher.library", "plugins/org.eclipse.equinox.launcher."}); + } + + IFolder binaryFolder = buildFolder.getFolder("/tmp/eclipse/binary"); + assertFalse(binaryFolder.exists()); + + IMetadataRepository finalRepo = loadMetadataRepository("file:" + buildFolder.getFolder("finalRepo").getLocation().toOSString()); + getIU(finalRepo, "a.jre.javase"); + IInstallableUnit productIu = getIU(finalRepo, "headless.product"); + assertFalse(productIu.getVersion().toString().equals("1.0.0.qualifier")); //bug 246060, should be a timestamp + //check up to the date on the timestamp, don't worry about hours/mins + assertTrue(PublisherHelper.toOSGiVersion(productIu.getVersion()).getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8))); + assertTouchpoint(productIu, "configure", "addRepository(type:0,location:file${#58}//foo/bar);"); + + IInstallableUnit iu = getIU(finalRepo, "toolingorg.eclipse.equinox.common"); + assertEquals(iu.getVersion(), productIu.getVersion()); + + iu = getIU(finalRepo, "toolingheadless.product_root." + Platform.getWS() + '.' + Platform.getOS() + '.' + Platform.getOSArch()); + assertTouchpoint(iu, "configure", "setLauncherName(name:headless"); + assertEquals(iu.getVersion(), productIu.getVersion()); + + } public void testBug265726() throws Exception { IFolder buildFolder = newTest("265726"); @@ -1428,62 +1424,61 @@ public class PublishingTests extends P2TestCase { removeMetadataRepository(repoURI); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testPublish_FeatureBasedProduct() throws Exception { - // IFolder buildFolder = newTest("featureBasedProduct"); - // IFolder finalRepo = Utils.createFolder(buildFolder, "final"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // Utils.generateFeature(buildFolder, "f", null, new String[] {OSGI, EQUINOX_COMMON}); - // Utils.writeBuffer(buildFolder.getFile("features/f/important.txt"), new StringBuffer("boo-urns")); - // Properties properties = new Properties(); - // properties.put("bin.includes", "feature.xml"); - // properties.put("root.folder.sub", "file:important.txt"); //bug 272392 - // Utils.storeBuildProperties(buildFolder.getFolder("features/f"), properties); - // - // IFile productFile = buildFolder.getFile("rcp.product"); - // Utils.generateProduct(productFile, "rcp.product", "1.0.0", new String[] {"f"}, true); - // - // properties = BuildConfiguration.getBuilderProperties(buildFolder); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // properties.put("configs", "win32,win32,x86"); - // properties.put("product", productFile.getLocation().toOSString()); - // properties.put("filteredDependencyCheck", "true"); - // properties.put("p2.gathering", "true"); - // properties.put("skipMirroring", "true"); - // properties.put("p2.build.repo", "file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); - // Utils.storeBuildProperties(buildFolder, properties); - // - // //bug 269523 - // StringBuffer customBuffer = new StringBuffer(); - // customBuffer.append("<project name=\"custom\" default=\"noDefault\"> \n"); - // customBuffer.append(" <import file=\"${eclipse.pdebuild.templates}/headless-build/customTargets.xml\"/> \n"); - // customBuffer.append(" <target name=\"postBuild\"> \n"); - // customBuffer.append(" <p2.mirror destination=\"" + finalRepo.getLocation().toOSString() + "\" \n"); - // customBuffer.append(" source=\"${p2.build.repo}\" > \n"); - // customBuffer.append(" <slicingOptions platformFilter=\"win32,win32,x86\" \n"); - // customBuffer.append(" followStrict=\"true\" /> \n"); - // customBuffer.append(" <iu id=\"rcp.product\" version=\"1.0.0\" /> \n"); - // customBuffer.append(" </p2.mirror> \n"); - // customBuffer.append(" </target> \n"); - // customBuffer.append("</project> \n"); - // Utils.writeBuffer(buildFolder.getFile("customTargets.xml"), customBuffer); - // - // runProductBuild(buildFolder); - // - // assertResourceFile(finalRepo, "binary/f_root_1.0.0"); - // assertResourceFile(finalRepo, "binary/rcp.product_root.win32.win32.x86_1.0.0"); - // assertResourceFile(finalRepo, "features/f_1.0.0.jar"); - // - // HashSet entries = new HashSet(); - // entries.add("eclipse/eclipse.exe"); - // entries.add("eclipse/features/f_1.0.0/feature.xml"); - // entries.add("eclipse/sub/important.txt"); - // assertZipContents(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip", entries); - // } + public void testPublish_FeatureBasedProduct() throws Exception { + IFolder buildFolder = newTest("featureBasedProduct"); + IFolder finalRepo = Utils.createFolder(buildFolder, "final"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + Utils.generateFeature(buildFolder, "f", null, new String[] {OSGI, EQUINOX_COMMON}); + Utils.writeBuffer(buildFolder.getFile("features/f/important.txt"), new StringBuffer("boo-urns")); + Properties properties = new Properties(); + properties.put("bin.includes", "feature.xml"); + properties.put("root.folder.sub", "file:important.txt"); //bug 272392 + Utils.storeBuildProperties(buildFolder.getFolder("features/f"), properties); + + IFile productFile = buildFolder.getFile("rcp.product"); + Utils.generateProduct(productFile, "rcp.product", "1.0.0", new String[] {"f"}, true); + + properties = BuildConfiguration.getBuilderProperties(buildFolder); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + properties.put("configs", "win32,win32,x86"); + properties.put("product", productFile.getLocation().toOSString()); + properties.put("filteredDependencyCheck", "true"); + properties.put("p2.gathering", "true"); + properties.put("skipMirroring", "true"); + properties.put("p2.build.repo", "file:" + buildFolder.getFolder("buildRepo").getLocation().toOSString()); + Utils.storeBuildProperties(buildFolder, properties); + + //bug 269523 + StringBuffer customBuffer = new StringBuffer(); + customBuffer.append("<project name=\"custom\" default=\"noDefault\"> \n"); + customBuffer.append(" <import file=\"${eclipse.pdebuild.templates}/headless-build/customTargets.xml\"/> \n"); + customBuffer.append(" <target name=\"postBuild\"> \n"); + customBuffer.append(" <p2.mirror destination=\"" + finalRepo.getLocation().toOSString() + "\" \n"); + customBuffer.append(" source=\"${p2.build.repo}\" > \n"); + customBuffer.append(" <slicingOptions platformFilter=\"win32,win32,x86\" \n"); + customBuffer.append(" followStrict=\"true\" /> \n"); + customBuffer.append(" <iu id=\"rcp.product\" version=\"1.0.0\" /> \n"); + customBuffer.append(" </p2.mirror> \n"); + customBuffer.append(" </target> \n"); + customBuffer.append("</project> \n"); + Utils.writeBuffer(buildFolder.getFile("customTargets.xml"), customBuffer); + + runProductBuild(buildFolder); + + assertResourceFile(finalRepo, "binary/f_root_1.0.0"); + assertResourceFile(finalRepo, "binary/rcp.product_root.win32.win32.x86_1.0.0"); + assertResourceFile(finalRepo, "features/f_1.0.0.jar"); + + HashSet entries = new HashSet(); + entries.add("eclipse/eclipse.exe"); + entries.add("eclipse/features/f_1.0.0/feature.xml"); + entries.add("eclipse/sub/important.txt"); + assertZipContents(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip", entries); + } public void testDirectorLogging() throws Exception { IFolder buildFolder = newTest("directorLogging"); @@ -1575,79 +1570,78 @@ public class PublishingTests extends P2TestCase { assertProvides(iu, P2InfUtils.NAMESPACE_IU, "testid0"); } - // This test currently disabled due to CBI delta pack issues (Bug 401572) - // public void testBug268498() throws Exception { - // IFolder buildFolder = newTest("268498"); - // IFolder rcp = Utils.createFolder(buildFolder, "rcp"); - // - // File delta = Utils.findDeltaPack(); - // assertNotNull(delta); - // - // IFile product = rcp.getFile("rcp.product"); - // StringBuffer extra = new StringBuffer(); - // extra.append("<launcherArgs> \n"); - // extra.append(" <programArgsMac>-vm myVm -showsplash org.eclipse.platform</programArgsMac> \n"); - // extra.append(" <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> \n"); - // extra.append(" </launcherArgs> \n"); - // extra.append(" <configurations> \n"); - // extra.append(" <plugin id=\"" + EQUINOX_COMMON + "\" autoStart=\"true\" startLevel=\"2\" /> \n"); - // extra.append(" </configurations> \n"); - // Utils.generateProduct(product, "org.example.rcp", "1.0.0", null, new String[] {OSGI, EQUINOX_COMMON}, false, extra); - // - // Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); - // properties.put("product", product.getLocation().toOSString()); - // if (!delta.equals(new File((String) properties.get("baseLocation")))) - // properties.put("pluginPath", delta.getAbsolutePath()); - // properties.put("configs", "macosx, cocoa, x86"); - // properties.put("p2.gathering", "true"); - // Utils.storeBuildProperties(buildFolder, properties); - // - // runProductBuild(buildFolder); - // - // IFile ini = buildFolder.getFile("eclipse.ini"); - // boolean lowerCase = true; - // if (!Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", "eclipse/eclipse.app/Contents/MacOS/eclipse.ini", ini)) { - // lowerCase = false; - // Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", "eclipse/Eclipse.app/Contents/MacOS/eclipse.ini", ini); - // } - // - // IFile zip = buildFolder.getFile("I.TestBuild/eclipse-macosx.cocoa.x86.zip"); - // String exeString = (lowerCase ? "eclipse/eclipse.app/" : "eclipse/Eclipse.app/") + "Contents/MacOS/eclipse"; - // assertZipPermissions(zip, exeString, "-rwxr-xr-x"); - // - // assertLogContainsLines(ini, new String[] {"-vm", "myVm"}); - // boolean duplicate = false; - // try { - // assertLogContainsLines(ini, new String[] {"-XstartOnFirstThread", "-XstartOnFirstThread"}); - // duplicate = true; - // } catch (Error e) { - // //expected - // } - // assertFalse(duplicate); - // - // try { - // assertLogContainsLines(ini, new String[] {"-showSplash", "org.eclipse.platform", "-showSplash", "org.eclipse.platform"}); - // duplicate = true; - // } catch (Error e) { - // //expected - // } - // assertFalse(duplicate); - // - // IMetadataRepository repo = loadMetadataRepository(buildFolder.getFolder("buildRepo").getLocationURI()); - // IInstallableUnit iu = getIU(repo, "toolingcocoa.macosx.x86org.eclipse.equinox.common"); - // assertEquals(iu.getVersion().toString(), "1.0.0"); - // - // IInstallableUnit common = getIU(repo, EQUINOX_COMMON); - // Collection/*<IRequirement>*/required = iu.getRequirements(); - // assertEquals(required.size(), 2); - // Iterator it = required.iterator(); - // IRequiredCapability req0 = (IRequiredCapability) it.next(); - // IRequiredCapability req1 = (IRequiredCapability) it.next(); - // if (req0.getName().equals(EQUINOX_COMMON)) - // assertEquals(req0.getRange(), new VersionRange(common.getVersion(), true, Version.MAX_VERSION, true)); - // else - // assertEquals(req1.getRange(), new VersionRange(common.getVersion(), true, Version.MAX_VERSION, true)); - // } + public void testBug268498() throws Exception { + IFolder buildFolder = newTest("268498"); + IFolder rcp = Utils.createFolder(buildFolder, "rcp"); + + File delta = Utils.findDeltaPack(); + assertNotNull(delta); + + IFile product = rcp.getFile("rcp.product"); + StringBuffer extra = new StringBuffer(); + extra.append("<launcherArgs> \n"); + extra.append(" <programArgsMac>-vm myVm -showsplash org.eclipse.platform</programArgsMac> \n"); + extra.append(" <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> \n"); + extra.append(" </launcherArgs> \n"); + extra.append(" <configurations> \n"); + extra.append(" <plugin id=\"" + EQUINOX_COMMON + "\" autoStart=\"true\" startLevel=\"2\" /> \n"); + extra.append(" </configurations> \n"); + Utils.generateProduct(product, "org.example.rcp", "1.0.0", null, new String[] {OSGI, EQUINOX_COMMON}, false, extra); + + Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); + properties.put("product", product.getLocation().toOSString()); + if (!delta.equals(new File((String) properties.get("baseLocation")))) + properties.put("pluginPath", delta.getAbsolutePath()); + properties.put("configs", "macosx, cocoa, x86"); + properties.put("p2.gathering", "true"); + Utils.storeBuildProperties(buildFolder, properties); + + runProductBuild(buildFolder); + + IFile ini = buildFolder.getFile("eclipse.ini"); + boolean lowerCase = true; + if (!Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", "eclipse/eclipse.app/Contents/MacOS/eclipse.ini", ini)) { + lowerCase = false; + Utils.extractFromZip(buildFolder, "I.TestBuild/eclipse-macosx.cocoa.x86.zip", "eclipse/Eclipse.app/Contents/MacOS/eclipse.ini", ini); + } + + IFile zip = buildFolder.getFile("I.TestBuild/eclipse-macosx.cocoa.x86.zip"); + String exeString = (lowerCase ? "eclipse/eclipse.app/" : "eclipse/Eclipse.app/") + "Contents/MacOS/eclipse"; + assertZipPermissions(zip, exeString, "-rwxr-xr-x"); + + assertLogContainsLines(ini, new String[] {"-vm", "myVm"}); + boolean duplicate = false; + try { + assertLogContainsLines(ini, new String[] {"-XstartOnFirstThread", "-XstartOnFirstThread"}); + duplicate = true; + } catch (Error e) { + //expected + } + assertFalse(duplicate); + + try { + assertLogContainsLines(ini, new String[] {"-showSplash", "org.eclipse.platform", "-showSplash", "org.eclipse.platform"}); + duplicate = true; + } catch (Error e) { + //expected + } + assertFalse(duplicate); + + IMetadataRepository repo = loadMetadataRepository(buildFolder.getFolder("buildRepo").getLocationURI()); + IInstallableUnit iu = getIU(repo, "toolingcocoa.macosx.x86org.eclipse.equinox.common"); + assertEquals(iu.getVersion().toString(), "1.0.0"); + + IInstallableUnit common = getIU(repo, EQUINOX_COMMON); + Collection/*<IRequirement>*/required = iu.getRequirements(); + assertEquals(required.size(), 2); + Iterator it = required.iterator(); + IRequiredCapability req0 = (IRequiredCapability) it.next(); + IRequiredCapability req1 = (IRequiredCapability) it.next(); + if (req0.getName().equals(EQUINOX_COMMON)) + assertEquals(req0.getRange(), new VersionRange(common.getVersion(), true, Version.MAX_VERSION, true)); + else + assertEquals(req1.getRange(), new VersionRange(common.getVersion(), true, Version.MAX_VERSION, true)); + } public void testPublish_P2InfConfigProperty() throws Exception { IFolder buildFolder = newTest("infConfig"); |
