diff --git a/p2/org.eclipse.cdt.p2-feature/feature.xml b/p2/org.eclipse.cdt.p2-feature/feature.xml index e4aa0835dcd..cf6e6d1c250 100644 --- a/p2/org.eclipse.cdt.p2-feature/feature.xml +++ b/p2/org.eclipse.cdt.p2-feature/feature.xml @@ -3,7 +3,8 @@ id="org.eclipse.cdt.p2" label="Eclipse SDK p2 support feature" version="1.0.0" - provider-name="Eclipse.org"> + provider-name="Eclipse.org" + plugin="org.eclipse.cdt.p2"> [Enter Feature Description here.] diff --git a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java index 4824620673f..5a4c72fe949 100644 --- a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java +++ b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java @@ -44,7 +44,7 @@ import org.osgi.framework.Version; */ public class MinGWGenerator implements IApplication { - private static final String REPO_NAME = "MinGW"; + private static final String REPO_NAME = "Wascana"; IMetadataRepository metaRepo; IArtifactRepository artiRepo; @@ -55,36 +55,126 @@ public class MinGWGenerator implements IApplication { Activator.getDefault().getBundle("org.eclipse.equinox.p2.exemplarysetup").start(Bundle.START_TRANSIENT); //$NON-NLS-1$ + File repoDir = new File("C:\\Wascana\\repo"); + new File(repoDir, "artifacts.xml").delete(); + new File(repoDir, "content.xml").delete(); + URL repoLocation = new File("C:\\Wascana\\repo").toURI().toURL(); - + IMetadataRepositoryManager metaRepoMgr = Activator.getDefault().getService(IMetadataRepositoryManager.class); IArtifactRepositoryManager artiRepoMgr = Activator.getDefault().getService(IArtifactRepositoryManager.class); metaRepo = metaRepoMgr.createRepository(repoLocation, REPO_NAME, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); artiRepo = artiRepoMgr.createRepository(repoLocation, REPO_NAME, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); - IInstallableUnit binutilsIU = createBinutils(); + Version wascanaVersion = new Version("1.0.0"); + String mingwSubdir = "mingw"; - // toolchain - InstallableUnitDescription mingwToolchainDesc = createIUDesc( - "wascana.mingw", - new Version(1, 0, 0), - "MinGW Toolchain"); + // MinGW Runtime + String runtimeId = "wascana.mingw.mingwrt"; + Version runtimeVersion = new Version("4.15.1"); + InstallableUnitDescription runtimeIUDesc = createIUDesc(runtimeId, runtimeVersion, "MinGW Runtime"); + IInstallableUnit runtimeIU = createIU(runtimeIUDesc, runtimeId, runtimeVersion, + "http://downloads.sourceforge.net/mingw/mingwrt-3.15.1-mingw32.tar.gz", + mingwSubdir, + InstallArtifactRepository.GZIP_COMPRESSON); + + // w32api + String w32apiId = "wascana.mingw.w32api"; + Version w32apiVersion = new Version("3.12"); + InstallableUnitDescription w32apiIUDesc = createIUDesc(w32apiId, w32apiVersion, "MinGW Windows SDK"); + IInstallableUnit w32apiIU = createIU(w32apiIUDesc, w32apiId, w32apiVersion, + "http://downloads.sourceforge.net/mingw/w32api-3.12-mingw32-dev.tar.gz", + mingwSubdir, + InstallArtifactRepository.GZIP_COMPRESSON); + + // binutils + String binutilsId = "wascana.mingw.binutils"; + Version binutilsVersion = new Version("2.18.50.20080109-2"); + InstallableUnitDescription binutilsIUDesc = createIUDesc(binutilsId, binutilsVersion, "MinGW binutils"); + IInstallableUnit binutilsIU = createIU(binutilsIUDesc, binutilsId, binutilsVersion, + "http://downloads.sourceforge.net/mingw/binutils-2.18.50-20080109-2.tar.gz", + mingwSubdir, + InstallArtifactRepository.GZIP_COMPRESSON); + + // gcc-4 core + String gcc4coreId = "wascana.mingw.gcc4.core"; + Version gcc4Version = new Version("4.3.2.tdm-1"); + InstallableUnitDescription gcc4coreIUDesc = createIUDesc(gcc4coreId, gcc4Version, "MinGW gcc-4 core"); + RequiredCapability[] gcc4coreReqs = new RequiredCapability[] { + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + runtimeIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + w32apiIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + binutilsIU.getId(), new VersionRange(null), null, false, false), + }; + gcc4coreIUDesc.setRequiredCapabilities(gcc4coreReqs); + IInstallableUnit gcc4coreIU = createIU(gcc4coreIUDesc, gcc4coreId, gcc4Version, + "http://downloads.sourceforge.net/tdm-gcc/gcc-4.3.2-tdm-1-core.tar.gz", + mingwSubdir, + InstallArtifactRepository.GZIP_COMPRESSON); + + // gcc-4 g++ + String gcc4gppId = "wascana.mingw.gcc4.g++"; + InstallableUnitDescription gcc4gppIUDesc = createIUDesc(gcc4gppId, gcc4Version, "MinGW gcc-4 g++"); + RequiredCapability[] gcc4gppReqs = new RequiredCapability[] { + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + gcc4coreIU.getId(), new VersionRange(gcc4Version, true, gcc4Version, true), null, false, false), + }; + gcc4gppIUDesc.setRequiredCapabilities(gcc4gppReqs); + IInstallableUnit gcc4gppIU = createIU(gcc4gppIUDesc, gcc4gppId, gcc4Version, + "http://downloads.sourceforge.net/tdm-gcc/gcc-4.3.2-tdm-1-g++.tar.gz", + mingwSubdir, + InstallArtifactRepository.GZIP_COMPRESSON); + + // gdb + String gdbId = "wascana.mingw.gdb"; + Version gdbVersion = new Version("6.8.0.3"); + InstallableUnitDescription gdbIUDesc = createIUDesc(gdbId, gdbVersion, "MinGW gdb"); + IInstallableUnit gdbIU = createIU(gdbIUDesc, gdbId, gdbVersion, + "http://downloads.sourceforge.net/mingw/gdb-6.8-mingw-3.tar.bz2", + mingwSubdir, + InstallArtifactRepository.BZIP2_COMPRESSION); + + // MinGW toolchain category + InstallableUnitDescription mingwToolchainDesc = createIUDesc("wascana.mingw", wascanaVersion, "MinGW Toolchain"); + mingwToolchainDesc.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.TRUE.toString()); RequiredCapability[] mingwToolchainReqs = new RequiredCapability[] { MetadataFactory.createRequiredCapability( IInstallableUnit.NAMESPACE_IU_ID, - binutilsIU.getId(), new VersionRange(null), null, false, false) + runtimeIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + w32apiIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + binutilsIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + gcc4coreIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + gcc4gppIU.getId(), new VersionRange(null), null, false, false), + MetadataFactory.createRequiredCapability( + IInstallableUnit.NAMESPACE_IU_ID, + gdbIU.getId(), new VersionRange(null), null, false, false), }; mingwToolchainDesc.setRequiredCapabilities(mingwToolchainReqs); - mingwToolchainDesc.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.TRUE.toString()); IInstallableUnit mingwToolchainIU = MetadataFactory.createInstallableUnit(mingwToolchainDesc); metaRepo.addInstallableUnits(new IInstallableUnit[] { + runtimeIU, + w32apiIU, binutilsIU, -// gccCoreIU, -// gccGppIU, + gcc4coreIU, + gcc4gppIU, + gdbIU, mingwToolchainIU, -// wascanaIU }); System.out.println("done"); @@ -96,23 +186,6 @@ public class MinGWGenerator implements IApplication { public void stop() { } - private IInstallableUnit createBinutils() throws ProvisionException, MalformedURLException { - String binutilsId = "wascana.mingw.binutils"; - Version binutilsVersion = new Version("2.18.50.20080109-2"); - InstallableUnitDescription binutilsDesc = createIUDesc( - binutilsId, binutilsVersion, "MinGW binutils"); - binutilsDesc.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); - IArtifactKey binutilsArti = addRemoteArtifact( - binutilsDesc, - binutilsId, - binutilsVersion, - new File("C:\\Wascana\\tars\\binutils-2.18.50-20080109-2.tar.gz").toURI().toURL(), - "mingw", - InstallArtifactRepository.GZIP_COMPRESSON); - binutilsDesc.setArtifacts(new IArtifactKey[] { binutilsArti }); - return MetadataFactory.createInstallableUnit(binutilsDesc); - } - private InstallableUnitDescription createIUDesc(String id, Version version, String name) throws ProvisionException { InstallableUnitDescription iuDesc = new MetadataFactory.InstallableUnitDescription(); iuDesc.setId(id); @@ -125,9 +198,8 @@ public class MinGWGenerator implements IApplication { return iuDesc; } - private IArtifactKey addRemoteArtifact( - InstallableUnitDescription iuDesc, - String id, Version version, URL location, String subdir, String compression) throws ProvisionException { + private IInstallableUnit createIU(InstallableUnitDescription iuDesc, String id, Version version, String location, String subdir, String compression) throws ProvisionException { + iuDesc.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); iuDesc.setTouchpointType(SDKTouchpoint.TOUCHPOINT_TYPE); Map tpdata = new HashMap(); tpdata.put("uninstall", "uninstall()"); @@ -136,9 +208,10 @@ public class MinGWGenerator implements IApplication { ArtifactDescriptor artiDesc = new ArtifactDescriptor(artiKey); artiDesc.setProperty(InstallArtifactRepository.SUB_DIR, subdir); artiDesc.setProperty(InstallArtifactRepository.COMPRESSION, compression); - artiDesc.setRepositoryProperty("artifact.reference", location.toString()); + artiDesc.setRepositoryProperty("artifact.reference", location); artiRepo.addDescriptor(artiDesc); - return artiKey; + iuDesc.setArtifacts(new IArtifactKey[] { artiKey }); + return MetadataFactory.createInstallableUnit(iuDesc); } - + }