1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

fix compile errors.

This commit is contained in:
Doug Schaefer 2009-04-06 21:22:10 +00:00
parent e0e3ea021e
commit befb3fc080
7 changed files with 101 additions and 73 deletions

View file

@ -12,7 +12,7 @@
package org.eclipse.cdt.p2.generator;
import java.io.File;
import java.net.URL;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
@ -24,20 +24,20 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.ArtifactD
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.Version;
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.internal.provisional.p2.metadata.ILicense;
import org.eclipse.equinox.internal.provisional.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.IUpdateDescriptor;
import org.eclipse.equinox.internal.provisional.p2.metadata.License;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
import org.eclipse.equinox.internal.provisional.p2.metadata.ProvidedCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.RequiredCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.internal.provisional.p2.metadata.generator.MetadataGeneratorHelper;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
/**
* @author DSchaefe
@ -60,7 +60,7 @@ public class MinGWGenerator implements IApplication {
new File(repoDir, "artifacts.xml").delete();
new File(repoDir, "content.xml").delete();
URL repoLocation = new File("C:\\Wascana\\repo").toURI().toURL();
URI repoLocation = new File("C:\\Wascana\\repo").toURI();
IMetadataRepositoryManager metaRepoMgr = Activator.getDefault().getService(IMetadataRepositoryManager.class);
IArtifactRepositoryManager artiRepoMgr = Activator.getDefault().getService(IArtifactRepositoryManager.class);
@ -68,11 +68,11 @@ public class MinGWGenerator implements IApplication {
metaRepo = metaRepoMgr.createRepository(repoLocation, REPO_NAME, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
artiRepo = artiRepoMgr.createRepository(repoLocation, REPO_NAME, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
License publicDomainLic = MetadataFactory.createLicense(null, publicDomain);
License gplLic = MetadataFactory.createLicense(gplURL, gpl);
License lgplLic = MetadataFactory.createLicense(lgplURL, lgpl);
License zlibLic = MetadataFactory.createLicense(zlibLicURL, zlibLicText);
License wxLic = MetadataFactory.createLicense(wxLicURL, wxLicText);
ILicense publicDomainLic = MetadataFactory.createLicense(null, publicDomain);
ILicense gplLic = MetadataFactory.createLicense(new URI(gplURL), gpl);
ILicense lgplLic = MetadataFactory.createLicense(new URI(lgplURL), lgpl);
ILicense zlibLic = MetadataFactory.createLicense(new URI(zlibLicURL), zlibLicText);
ILicense wxLic = MetadataFactory.createLicense(new URI(wxLicURL), wxLicText);
Version wascanaVersion = new Version("1.0.0");
String mingwSubdir = "mingw";
@ -108,7 +108,7 @@ public class MinGWGenerator implements IApplication {
String gcc4coreId = "wascana.mingw.gcc4.core";
Version gcc4Version = new Version("4.3.2.tdm-1");
InstallableUnitDescription gcc4coreIUDesc = createIUDesc(gcc4coreId, gcc4Version, "Wascana MinGW gcc-4 core", gplLic);
RequiredCapability[] gcc4coreReqs = new RequiredCapability[] {
IRequiredCapability[] gcc4coreReqs = new IRequiredCapability[] {
MetadataFactory.createRequiredCapability(
IInstallableUnit.NAMESPACE_IU_ID,
runtimeIU.getId(), new VersionRange(null), null, false, false),
@ -129,7 +129,7 @@ public class MinGWGenerator implements IApplication {
String gcc4gppId = "wascana.mingw.gcc4.g++";
InstallableUnitDescription gcc4gppIUDesc = createIUDesc(gcc4gppId, gcc4Version, "Wascana MinGW gcc-4 g++", gplLic);
gcc4gppIUDesc.setLicense(gplLic);
RequiredCapability[] gcc4gppReqs = new RequiredCapability[] {
IRequiredCapability[] gcc4gppReqs = new IRequiredCapability[] {
MetadataFactory.createRequiredCapability(
IInstallableUnit.NAMESPACE_IU_ID,
gcc4coreIU.getId(), new VersionRange(gcc4Version, true, gcc4Version, true), null, false, false),
@ -161,7 +161,7 @@ public class MinGWGenerator implements IApplication {
// MinGW toolchain category
InstallableUnitDescription mingwToolchainDesc = createIUDesc("wascana.mingw", wascanaVersion, "MinGW Toolchain", null);;
mingwToolchainDesc.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.TRUE.toString());
RequiredCapability[] mingwToolchainReqs = new RequiredCapability[] {
IRequiredCapability[] mingwToolchainReqs = new IRequiredCapability[] {
createRequiredCap(runtimeId),
createRequiredCap(w32apiId),
createRequiredCap(binutilsId),
@ -203,7 +203,7 @@ public class MinGWGenerator implements IApplication {
// Libraries toolchain category
InstallableUnitDescription libsIUDesc = createIUDesc("wascana.libs", wascanaVersion, "Libraries", null);;
libsIUDesc.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.TRUE.toString());
RequiredCapability[] libsReqs = new RequiredCapability[] {
IRequiredCapability[] libsReqs = new IRequiredCapability[] {
createRequiredCap(zlibId),
createRequiredCap(sdlId),
createRequiredCap(wxId),
@ -236,14 +236,14 @@ public class MinGWGenerator implements IApplication {
public void stop() {
}
private InstallableUnitDescription createIUDesc(String id, Version version, String name, License license) throws ProvisionException {
private InstallableUnitDescription createIUDesc(String id, Version version, String name, ILicense license) throws ProvisionException {
InstallableUnitDescription iuDesc = new MetadataFactory.InstallableUnitDescription();
iuDesc.setId(id);
iuDesc.setVersion(version);
iuDesc.setLicense(license);
iuDesc.setSingleton(true);
iuDesc.setProperty(IInstallableUnit.PROP_NAME, name);
iuDesc.setCapabilities(new ProvidedCapability[] {
iuDesc.setCapabilities(new IProvidedCapability[] {
MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, id, version)
});
iuDesc.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, new VersionRange(null), IUpdateDescriptor.NORMAL, ""));
@ -266,7 +266,7 @@ public class MinGWGenerator implements IApplication {
return MetadataFactory.createInstallableUnit(iuDesc);
}
private RequiredCapability createRequiredCap(String id) {
private IRequiredCapability createRequiredCap(String id) {
return MetadataFactory.createRequiredCapability(
IInstallableUnit.NAMESPACE_IU_ID,
id, new VersionRange(null), null, false, false);

View file

@ -17,8 +17,18 @@
<touchpoint
class="org.eclipse.cdt.p2.internal.touchpoint.SDKTouchpoint"
type="org.eclipse.cdt.p2.internal.touchpoint.SDKTouchpoint"
version="1">
version="1.0.0">
</touchpoint>
</extension>
<extension
point="org.eclipse.equinox.p2.engine.actions">
<action
class="org.eclipse.cdt.p2.internal.touchpoint.ExtractAction"
name="extract"
touchpointType="org.eclipse.cdt.p2.internal.touchpoint.SDKTouchpoint"
touchpointVersion="1.0.0"
version="1.0.0">
</action>
</extension>
</plugin>

View file

@ -17,7 +17,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
@ -66,7 +66,7 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
// to be installed at a time.
private Map<String, IArtifactDescriptor> artifacts = new HashMap<String, IArtifactDescriptor>();
public InstallArtifactRepository(URL aLocation, String aName, Map aProperties) {
public InstallArtifactRepository(URI aLocation, String aName, Map aProperties) {
super(aName, InstallArtifactRepository.class.getName(), VERSION, aLocation, DESCRIPTION, PROVIDER, aProperties);
save();
}
@ -83,15 +83,15 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
* @param mappingRules
* @param _properties
*/
InstallArtifactRepository(String _name, String _type, String _version, URL _location, String _description, String _provider, Set<ArtifactDescriptor> _artifacts, Map _properties) {
InstallArtifactRepository(String _name, String _type, String _version, URI _location, String _description, String _provider, Set<ArtifactDescriptor> _artifacts, Map _properties) {
super(_name, _type, _version, _location, _description, _provider, _properties);
for (IArtifactDescriptor descriptor : _artifacts)
artifacts.put(descriptor.getArtifactKey().getId(), descriptor);
}
public static URL getActualLocation(URL base) {
public static URI getActualLocation(URI base) {
final String name = FILENAME;
String spec = base.toExternalForm();
String spec = base.toString();
if (spec.endsWith(name))
return base;
if (spec.endsWith("/")) //$NON-NLS-1$
@ -99,8 +99,8 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
else
spec += "/" + name; //$NON-NLS-1$
try {
return new URL(spec);
} catch (MalformedURLException e) {
return new URI(spec);
} catch (URISyntaxException e) {
return null;
}
}
@ -111,16 +111,16 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
profileId = profileId.replaceAll("[:/\\\\]", "_"); //$NON-NLS-1$ //$NON-NLS-2$
try {
URL url = location.getDataArea(Activator.PLUGIN_ID);
url = new URL(url.toExternalForm() + "installDirRepo/" + profileId + "/" + FILENAME); //$NON-NLS-1$ //$NON-NLS-2$
URI uri = new URI(url.toExternalForm() + "installDirRepo/" + profileId + "/" + FILENAME); //$NON-NLS-1$ //$NON-NLS-2$
IArtifactRepositoryManager repoMgr = Activator.getDefault().getService(IArtifactRepositoryManager.class);
try {
return repoMgr.loadRepository(url, null);
return repoMgr.loadRepository(uri, null);
} catch (ProvisionException e) {
Map<String, String> properties = new HashMap<String, String>();
properties.put(INSTALL_DIR, profile.getLocalProperty(IProfile.PROP_INSTALL_FOLDER));
return repoMgr.createRepository(url, profile.getProfileId(), InstallArtifactRepository.class.getName(), properties);
return repoMgr.createRepository(uri, profile.getProfileId(), InstallArtifactRepository.class.getName(), properties);
}
} catch (MalformedURLException e) {
} catch (URISyntaxException e) {
Activator.getDefault().log(IStatus.ERROR, "Creating install repo URI", e); //$NON-NLS-1$
return null;
}
@ -197,12 +197,7 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
}
private File getFileListFile(String artifact) throws IOException {
File file;
try {
file = new File(URLUtil.toURI(location));
} catch (URISyntaxException e) {
throw new IOException(e);
}
File file = new File(location);
if (file.getName().equals(FILENAME))
file = file.getParentFile();
return new File(file, artifact + ".txt"); //$NON-NLS-1$
@ -210,9 +205,6 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
@Override
public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException {
// Do the modifiable check in the superclass
super.getOutputStream(descriptor);
// Add the descriptor to the list and save it
IArtifactDescriptor oldDesc = artifacts.get(descriptor.getArtifactKey().getId());
if (oldDesc != null)
@ -292,8 +284,8 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
try {
OutputStream os = null;
try {
URL actualLocation = getActualLocation(location);
File artifactsFile = new File(actualLocation.getPath());
URI actualLocation = getActualLocation(location);
File artifactsFile = new File(actualLocation);
artifactsFile.getParentFile().mkdirs();
os = new FileOutputStream(artifactsFile);
super.setProperty(IRepository.PROP_TIMESTAMP, Long.toString(System.currentTimeMillis()));
@ -309,5 +301,11 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
e.printStackTrace();
}
}
public IStatus getRawArtifact(IArtifactDescriptor descriptor,
OutputStream destination, IProgressMonitor monitor) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -17,7 +17,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URI;
import java.util.Map;
import org.eclipse.cdt.p2.Activator;
@ -26,20 +26,20 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.IArtifactRepositoryFactory;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
import org.eclipse.osgi.util.NLS;
/**
* @author DSchaefe
*
*/
public class InstallArtifactRepositoryFactory implements IArtifactRepositoryFactory {
public class InstallArtifactRepositoryFactory extends ArtifactRepositoryFactory {
public IArtifactRepository create(URL location, String name, String type, Map properties) throws ProvisionException {
public IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
return new InstallArtifactRepository(location, name, properties);
}
public IArtifactRepository load(URL location, IProgressMonitor monitor) throws ProvisionException {
public IArtifactRepository load(URI location, IProgressMonitor monitor) throws ProvisionException {
File localFile = null;
boolean local = false;
try {
@ -48,7 +48,7 @@ public class InstallArtifactRepositoryFactory implements IArtifactRepositoryFact
try {
descriptorStream = new BufferedInputStream(new FileInputStream(localFile));
InstallArtifactRepositoryIO io = new InstallArtifactRepositoryIO();
return io.read(localFile.toURI().toURL(), descriptorStream);
return io.read(localFile.toURI(), descriptorStream);
} finally {
if (descriptorStream != null)
descriptorStream.close();

View file

@ -18,7 +18,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@ -42,11 +42,11 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifact
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.Version;
import org.eclipse.equinox.internal.provisional.p2.core.VersionRange;
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@ -85,7 +85,7 @@ public class InstallArtifactRepositoryIO {
*
* This method performs buffering, and closes the stream when finished.
*/
public IArtifactRepository read(URL location, InputStream input) throws ProvisionException {
public IArtifactRepository read(URI location, InputStream input) throws ProvisionException {
BufferedInputStream bufferedInput = null;
try {
try {
@ -210,9 +210,9 @@ public class InstallArtifactRepositoryIO {
private class Parser extends XMLParser implements XMLConstants {
private InstallArtifactRepository theRepository;
final URL location;
final URI location;
public Parser(BundleContext _context, String _bundleId, URL _location) {
public Parser(BundleContext _context, String _bundleId, URI _location) {
super(_context, _bundleId);
location = _location;
}

View file

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. 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
*
* Contributors:
* Doug Schaefer - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.p2.internal.touchpoint;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
public class ExtractAction extends ProvisioningAction {
public ExtractAction() {
// TODO Auto-generated constructor stub
}
@Override
public IStatus execute(Map parameters) {
// TODO Auto-generated method stub
return null;
}
@Override
public IStatus undo(Map parameters) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -11,11 +11,10 @@
package org.eclipse.cdt.p2.internal.touchpoint;
import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
import org.eclipse.equinox.internal.provisional.p2.core.Version;
import org.eclipse.equinox.internal.provisional.p2.engine.Touchpoint;
import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
import org.eclipse.equinox.internal.provisional.p2.metadata.TouchpointType;
import org.osgi.framework.Version;
/**
* @author DSchaefe
@ -23,21 +22,6 @@ import org.osgi.framework.Version;
*/
public class SDKTouchpoint extends Touchpoint {
public static final TouchpointType TOUCHPOINT_TYPE = MetadataFactory.createTouchpointType(SDKTouchpoint.class.getName(), new Version("1"));
public static final ITouchpointType TOUCHPOINT_TYPE = MetadataFactory.createTouchpointType(SDKTouchpoint.class.getName(), new Version("1"));
@Override
public ProvisioningAction getAction(String actionId) {
if (CollectAction.ACTION_NAME.equals(actionId))
return new CollectAction();
else if (UninstallAction.ACTION_NAME.equals(actionId))
return new UninstallAction();
else
return null;
}
@Override
public TouchpointType getTouchpointType() {
return TOUCHPOINT_TYPE;
}
}