Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 126299 Details for
Bug 265524
Repo2RunnableTask should create jar:file: URIs for zipped repos
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
265524.txt (text/plain), 8.55 KB, created by
Andrew Niefer
on 2009-02-20 09:58:40 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Andrew Niefer
Created:
2009-02-20 09:58:40 EST
Size:
8.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.repository.tools >Index: src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractRepositoryTask.java >--- src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java 17 Feb 2009 20:16:08 -0000 1.1 >+++ src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java 20 Feb 2009 14:58:07 -0000 >@@ -12,6 +12,7 @@ > > import java.io.File; > import java.net.URI; >+import java.net.URISyntaxException; > import java.util.*; > import org.apache.tools.ant.*; > import org.apache.tools.ant.types.FileSet; >@@ -121,7 +122,17 @@ > String[][] elements = new String[][] {scanner.getIncludedDirectories(), scanner.getIncludedFiles()}; > for (int i = 0; i < 2; i++) { > for (int j = 0; j < elements[i].length; j++) { >- URI uri = new File(fileset.getDir(), elements[i][j]).toURI(); >+ File file = new File(fileset.getDir(), elements[i][j]); >+ URI uri = file.toURI(); >+ >+ if (file.isFile() && file.getName().endsWith(".zip")) { //$NON-NLS-1$ >+ try { >+ uri = new URI("jar:" + uri.toString() + "!/"); //$NON-NLS-1$ //$NON-NLS-2$ >+ } catch (URISyntaxException e) { >+ //? >+ continue; >+ } >+ } > application.addSourceArtifactRepository(uri); > application.addSourceMetadataRepository(uri); > } >@@ -156,7 +167,7 @@ > } > > if (collector.isEmpty()) >- throw new BuildException("Unable to find: " + id + (version != null ? " " + version : "")); >+ throw new BuildException("Unable to find: " + id + (version != null ? " " + version : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > result.add(collector.iterator().next()); > } > return result; >#P org.eclipse.pde.build.tests >Index: src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/build/org.eclipse.pde.build.tests/src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java,v >retrieving revision 1.5 >diff -u -r1.5 P2Tests.java >--- src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java 19 Feb 2009 21:32:45 -0000 1.5 >+++ src/org/eclipse/pde/build/internal/tests/p2/P2Tests.java 20 Feb 2009 14:58:08 -0000 >@@ -1,16 +1,18 @@ > package org.eclipse.pde.build.internal.tests.p2; > >-import java.io.File; >-import java.io.FilenameFilter; >+import java.io.*; > import java.net.URL; >-import java.util.ArrayList; >-import java.util.Properties; >+import java.util.*; >+import java.util.zip.ZipOutputStream; > > import junit.framework.AssertionFailedError; > >+import org.apache.tools.ant.BuildException; > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IFolder; > import org.eclipse.core.runtime.*; >+import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; > import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; > import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository; > import org.eclipse.pde.build.internal.tests.Utils; >@@ -257,10 +259,10 @@ > > public void testBug258126() throws Exception { > IFolder buildFolder = newTest("258126"); >- >+ > File delta = Utils.findDeltaPack(); > assertNotNull(delta); >- >+ > IFolder repo = Utils.createFolder(buildFolder, "repo"); > > Utils.generateFeature(buildFolder, "F", null, new String[] {"org.eclipse.osgi;unpack=false", "org.eclipse.core.runtime;unpack=false"}); >@@ -276,10 +278,10 @@ > String repoLocation = "file:" + repo.getLocation().toOSString(); > Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); > properties.put("product", productFile.getLocation().toOSString()); >- properties.put("configs", "win32,win32,x86"); >+ properties.put("configs", "win32,win32,x86"); > if (!delta.equals(new File((String) properties.get("baseLocation")))) > properties.put("pluginPath", delta.getAbsolutePath()); >- >+ > properties.put("archivesFormat", "win32,win32,x86-folder"); > properties.put("generate.p2.metadata", "true"); > properties.put("p2.metadata.repo", repoLocation); >@@ -301,18 +303,18 @@ > assertEquals(e.getMessage(), "Action not found:addProgramArg(programArg:-vmargs);"); > } > } >- >+ > public void testBug262421() throws Exception { > IFolder buildFolder = newTest("262421"); >- >+ > IFile productFile = buildFolder.getFile("rcp.product"); >- Utils.generateProduct(productFile, "rcp.product", "1.0.0", new String [] {"org.eclipse.osgi"}, false); >- >+ Utils.generateProduct(productFile, "rcp.product", "1.0.0", new String[] {"org.eclipse.osgi"}, false); >+ > IFile p2Inf = buildFolder.getFile("p2.inf"); > StringBuffer buffer = new StringBuffer(); > buffer.append("instructions.configure=addRepository(type:0,location:http${#58}//download.eclipse.org/eclipse/updates/3.4);"); > Utils.writeBuffer(p2Inf, buffer); >- >+ > IFolder repo = Utils.createFolder(buildFolder, "repo"); > String repoLocation = "file:" + repo.getLocation().toOSString(); > Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); >@@ -326,23 +328,23 @@ > Utils.storeBuildProperties(buildFolder, properties); > > runProductBuild(buildFolder); >- >+ > IMetadataRepository repository = loadMetadataRepository(repoLocation); > IInstallableUnit iu = getIU(repository, "rcp.product"); > assertTouchpoint(iu, "configure", "addRepository"); > } >- >- public void testBug265526() throws Exception { >- IFolder buildFolder= newTest("265526"); >+ >+ public void testBug265526_265524() throws Exception { >+ IFolder buildFolder = newTest("265526"); > IFolder a = Utils.createFolder(buildFolder, "plugins/a"); > IFolder b = Utils.createFolder(buildFolder, "plugins/b"); >- >+ > Utils.generateFeature(buildFolder, "F", null, new String[] {"a;unpack=false", "b;unpack=true"}); > Utils.generateBundle(a, "a"); > Utils.writeBuffer(a.getFile("src/a.java"), new StringBuffer("class A {}")); > Utils.generateBundle(b, "b"); > Utils.writeBuffer(b.getFile("src/b.java"), new StringBuffer("class B {}")); >- >+ > IFolder repo = Utils.createFolder(buildFolder, "repo/r1"); > String repoLocation = "file:" + repo.getLocation().toOSString(); > Properties properties = BuildConfiguration.getBuilderProperties(buildFolder); >@@ -355,16 +357,34 @@ > Utils.storeBuildProperties(buildFolder, properties); > > runBuild(buildFolder); >- >+ > properties.put("repoBaseLocation", buildFolder.getFolder("repo").getLocation().toOSString()); > properties.put("transformedRepoLocation", buildFolder.getFolder("outRepo").getLocation().toOSString()); > 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[] {"transformRepos"}, buildFolder.getLocation().toOSString(), properties); >- >+ > assertResourceFile(buildFolder, "outRepo/plugins/b_1.0.0/B.class"); > assertResourceFile(buildFolder, "outRepo/plugins/a_1.0.0.jar"); > assertResourceFile(buildFolder, "outRepo/artifacts.xml"); > assertResourceFile(buildFolder, "outRepo/content.xml"); >+ >+ //part 2, zipped repos >+ IFolder zipped = Utils.createFolder(buildFolder, "zipped"); >+ ZipOutputStream output = new ZipOutputStream(new FileOutputStream(new File(zipped.getLocation().toFile(), "zipped repo.zip"))); >+ File root = buildFolder.getFolder("repo/r1").getLocation().toFile(); >+ FileUtils.zip(output, root, Collections.EMPTY_SET, FileUtils.createRootPathComputer(root)); >+ org.eclipse.pde.internal.build.Utils.close(output); >+ >+ IFolder outRepo2 = Utils.createFolder(buildFolder, "outRepo2"); >+ properties.put("repoBaseLocation", zipped.getLocation().toOSString()); >+ properties.put("transformedRepoLocation", outRepo2.getLocation().toOSString()); >+ runAntScript(buildXMLPath, new String[] {"transformRepos"}, buildFolder.getLocation().toOSString(), properties); >+ >+ assertResourceFile(outRepo2, "plugins/b_1.0.0/B.class"); >+ assertResourceFile(outRepo2, "plugins/a_1.0.0.jar"); >+ assertResourceFile(outRepo2, "artifacts.xml"); >+ assertResourceFile(outRepo2, "content.xml"); > } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 265524
: 126299