01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
03: * program and the accompanying materials are made available under the terms of
04: * the Eclipse Public License v1.0 which accompanies this distribution, and is
05: * available at http://www.eclipse.org/legal/epl-v10.html
06: *
07: * Contributors: IBM Corporation - initial API and implementation
08: ******************************************************************************/package org.eclipse.pde.build.internal.tests;
09:
10: import java.io.File;
11: import java.net.URL;
12: import java.util.*;
13:
14: import org.eclipse.core.resources.IFolder;
15: import org.eclipse.core.runtime.*;
16: import org.eclipse.pde.build.tests.BuildConfiguration;
17: import org.eclipse.pde.build.tests.PDETestCase;
18:
19: public class ProductTests extends PDETestCase {
20:
21: public void testBug192127() throws Exception {
22: IFolder buildFolder = newTest("192127");
23: IFolder containerFeature = Utils.createFolder(buildFolder,
24: "features/org.eclipse.pde.build.container.feature");
25:
26: File delta = Utils.findDeltaPack();
27: assertNotNull(delta);
28:
29: // Exporting from the UI gives the container feature some /Eclipse.App root files
30: Utils.generateFeature(buildFolder,
31: "org.eclipse.pde.build.container.feature", null, null,
32: "/rcp/rcp.product", true, true);
33: Properties featureProperties = new Properties();
34: featureProperties.put("root", "/temp/");
35: Utils.storeBuildProperties(containerFeature, featureProperties);
36:
37: Properties properties = BuildConfiguration
38: .getBuilderProperties(buildFolder);
39: properties.put("product", "/rcp/rcp.product");
40: properties.put("configs", "macosx,carbon,x86");
41: if (!delta.equals(new File((String) properties
42: .get("baseLocation"))))
43: properties.put("pluginPath", delta.getAbsolutePath());
44: URL resource = FileLocator.find(Platform
45: .getBundle("org.eclipse.pde.build"), new Path(
46: "/scripts/productBuild/allElements.xml"), null);
47: properties.put("allElementsFile", FileLocator.toFileURL(
48: resource).getPath());
49: Utils.storeBuildProperties(buildFolder, properties);
50:
51: runBuild(buildFolder);
52:
53: Set entries = new HashSet();
54: entries.add("eclipse/.eclipseproduct");
55: entries.add("eclipse/configuration/config.ini");
56: entries.add("eclipse/rcp.app/Contents/Info.plist");
57: entries.add("eclipse/rcp.app/Contents/MacOS/rcp");
58: entries.add("eclipse/rcp.app/Contents/MacOS/rcp.ini");
59:
60: entries.add("eclipse/Eclipse.app/");
61:
62: assertZipContents(buildFolder,
63: "I.TestBuild/eclipse-macosx.carbon.x86.tar.gz",
64: entries, false);
65: assertTrue(entries.contains("eclipse/Eclipse.app/"));
66: assertTrue(entries.size() == 1);
67: }
68: }
|