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 122471 Details for
Bug 255913
[mirror] Need ant tasks for mirroring and composite repositories
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
255913.txt (text/plain), 54.07 KB, created by
DJ Houghton
on 2009-01-13 18:26:06 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
DJ Houghton
Created:
2009-01-13 18:26:06 EST
Size:
54.07 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.metadata.repository >Index: build.properties >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/build.properties,v >retrieving revision 1.3 >diff -u -r1.3 build.properties >--- build.properties 29 Oct 2007 15:33:35 -0000 1.3 >+++ build.properties 13 Jan 2009 23:24:51 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2007 IBM Corporation and others. >+# Copyright (c) 2007, 2009 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 >@@ -14,6 +14,12 @@ > .,\ > about.html,\ > plugin.xml,\ >- plugin.properties >+ plugin.properties,\ >+ ant_tasks/metadataRepository-ant.jar > src.includes = about.html,\ > schema/ >+jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar >+jars.compile.order = .,\ >+ ant_tasks/metadataRepository-ant.jar >+source.ant_tasks/metadataRepository-ant.jar = src_ant/ >+output.ant_tasks/metadataRepository-ant.jar = bin_ant/ >Index: .classpath >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath,v >retrieving revision 1.3 >diff -u -r1.3 .classpath >--- .classpath 22 Feb 2008 16:28:58 -0000 1.3 >+++ .classpath 13 Jan 2009 23:24:51 -0000 >@@ -3,5 +3,6 @@ > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="src" path="src"/> >+ <classpathentry kind="src" output="bin_ant" path="src_ant"/> > <classpathentry kind="output" path="bin"/> > </classpath> >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/plugin.xml,v >retrieving revision 1.6 >diff -u -r1.6 plugin.xml >--- plugin.xml 13 Nov 2008 20:42:50 -0000 1.6 >+++ plugin.xml 13 Jan 2009 23:24:51 -0000 >@@ -22,4 +22,38 @@ > <filter suffix="compositeContent.xml"/> > <factory class="org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory"/> > </extension> >+ >+ <extension point="org.eclipse.ant.core.antTasks"> >+ <antTask >+ library="ant_tasks/metadataRepository-ant.jar" >+ name="eclipse.p2.CompositeMetadataRepository.addChild" >+ class="org.eclipse.equinox.internal.p2.metadata.repository.ant.AddChildTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/metadataRepository-ant.jar" >+ name="eclipse.p2.CompositeMetadataRepository.create" >+ class="org.eclipse.equinox.internal.p2.metadata.repository.ant.CreateCompositeMetadataRepositoryTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/metadataRepository-ant.jar" >+ name="eclipse.p2.metadataMirrorApplication" >+ class="org.eclipse.equinox.internal.p2.metadata.repository.ant.MirrorApplicationTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/metadataRepository-ant.jar" >+ name="eclipse.p2.CompositeMetadataRepository.removeAllChildren" >+ class="org.eclipse.equinox.internal.p2.metadata.repository.ant.RemoveAllChildrenTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/metadataRepository-ant.jar" >+ name="eclipse.p2.CompositeMetadataRepository.removeChild" >+ class="org.eclipse.equinox.internal.p2.metadata.repository.ant.RemoveChildTask"> >+ </antTask> >+ >+ </extension> >+ > </plugin> >Index: .project >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/.project,v >retrieving revision 1.3 >diff -u -r1.3 .project >--- .project 6 Mar 2008 23:13:54 -0000 1.3 >+++ .project 13 Jan 2009 23:24:51 -0000 >@@ -25,6 +25,16 @@ > <arguments> > </arguments> > </buildCommand> >+ <buildCommand> >+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> >+ <triggers>full,incremental,</triggers> >+ <arguments> >+ <dictionary> >+ <key>LaunchConfigHandle</key> >+ <value><project>/.externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch</value> >+ </dictionary> >+ </arguments> >+ </buildCommand> > </buildSpec> > <natures> > <nature>org.eclipse.pde.PluginNature</nature> >Index: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,79 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.metadata.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.metadata.repository.Activator; >+import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager; >+ >+/** >+ * Ant task for adding a child repository to a composite metadata repository. >+ */ >+public class AddChildTask extends Task { >+ >+ URI location; // location of the composite repository >+ URI child; // address of the child to add >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ validate(); >+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire metadata repository manager service."); >+ >+ // load the composite repository >+ CompositeMetadataRepository repo = null; >+ try { >+ repo = (CompositeMetadataRepository) manager.loadRepository(location, null); >+ } catch (ClassCastException e) { >+ throw new BuildException("Repository at location: " + location + " is not a composite metadata repository."); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while loading repository.", e); >+ } >+ >+ // add the child >+ repo.addChild(child); >+ manager.removeRepository(location); >+ } >+ >+ /* >+ * Validate user input to ensure we have enough information to go forward. >+ */ >+ private void validate() { >+ if (location == null) >+ throw new BuildException("Need to specify the composite repository location."); >+ if (child == null) >+ throw new BuildException("Need to specify the child repository location."); >+ } >+ >+ /* >+ * Set the location of the composite repository. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the location of the child repository. >+ */ >+ public void setChild(String value) throws URISyntaxException { >+ child = URIUtil.fromString(value); >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.metadata.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.metadata.repository.Activator; >+import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager; >+ >+/** >+ * Ant task to remove a specific child repository from a composite metadata repository. >+ */ >+public class RemoveChildTask extends Task { >+ >+ URI location; // location of the composite repository >+ URI child; // address of the child to be removed >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire metadata repository manager service."); >+ >+ CompositeMetadataRepository repo; >+ try { >+ repo = (CompositeMetadataRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while loading repository.", e); >+ } >+ repo.removeChild(child); >+ } >+ >+ /* >+ * Set the location of the composite repository. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the location of the child repository to remove. >+ */ >+ public void setChild(String value) throws URISyntaxException { >+ child = URIUtil.fromString(value); >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveAllChildrenTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveAllChildrenTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveAllChildrenTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveAllChildrenTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.metadata.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.metadata.repository.Activator; >+import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager; >+ >+/** >+ * Ant task to remove all the children repositories from a composite metadata repository. >+ */ >+public class RemoveAllChildrenTask extends Task { >+ URI location; // location of the composite repository >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire metadata repository manager service."); >+ >+ // load the repository >+ CompositeMetadataRepository repo = null; >+ try { >+ repo = (CompositeMetadataRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Exception while loading repository.", e); >+ } >+ >+ // remove all children >+ repo.removeAllChildren(); >+ } >+ >+ /* >+ * Set the repository location. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,80 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.metadata.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import java.util.HashMap; >+import java.util.Map; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.metadata.repository.Activator; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository; >+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager; >+ >+/** >+ * Ant task for creating a new composite metadata repository. >+ */ >+public class CreateCompositeMetadataRepositoryTask extends Task { >+ >+ URI location; // desired location of the composite repository >+ String name = "Composite Metadata Repository"; >+ boolean compressed = true; // compress by default >+ Map properties = new HashMap(); >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire metadata repository manager service."); >+ >+ // remove the repo first. >+ manager.removeRepository(location); >+ >+ // create the properties >+ if (compressed) >+ properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true)); >+ >+ // create the repository >+ try { >+ manager.createRepository(location, name, IMetadataRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while creating composite metadata repository.", e); >+ } >+ } >+ >+ /* >+ * Set the name of the composite repository. >+ */ >+ public void setName(String value) { >+ name = value; >+ } >+ >+ /* >+ * Set the repository location. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set whether or not this repository should be compressed. >+ */ >+ public void setCompressed(boolean value) { >+ compressed = value; >+ } >+ >+} >Index: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/MirrorApplicationTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/MirrorApplicationTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/MirrorApplicationTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/MirrorApplicationTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,117 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.metadata.repository.ant; >+ >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.HashMap; >+import java.util.Map; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.equinox.app.IApplicationContext; >+import org.eclipse.equinox.internal.p2.metadata.mirror.MirrorApplication; >+import org.osgi.framework.Bundle; >+ >+/** >+ * Ant task for running the metadata mirror application. >+ */ >+public class MirrorApplicationTask extends Task { >+ >+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$ >+ private static final String ARG_DESTINATION = "-destination"; //$NON-NLS-1$ >+ private static final String ARG_SOURCE = "-source"; //$NON-NLS-1$ >+ private static final String ARG_WRITE_MODE = "-writeMode"; //$NON-NLS-1$ >+ URL source; >+ URL destination; >+ String writeMode; >+ >+ //TODO add transitive and roots attributed when implemented. >+ >+ /* >+ * Run the mirror application with the given arguments. >+ */ >+ private void runMirrorApplication(final String[] args) throws Exception { >+ new MirrorApplication().start(new IApplicationContext() { >+ >+ public void applicationRunning() { >+ // nothing to do >+ } >+ >+ public Map getArguments() { >+ Map arguments = new HashMap(); >+ arguments.put(IApplicationContext.APPLICATION_ARGS, args); >+ return arguments; >+ } >+ >+ public String getBrandingApplication() { >+ return null; >+ } >+ >+ public Bundle getBrandingBundle() { >+ return null; >+ } >+ >+ public String getBrandingDescription() { >+ return null; >+ } >+ >+ public String getBrandingId() { >+ return null; >+ } >+ >+ public String getBrandingName() { >+ return null; >+ } >+ >+ public String getBrandingProperty(String key) { >+ return null; >+ } >+ }); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ // create arguments >+ String[] args = new String[] { // >+ ARG_SOURCE, source.toExternalForm(), // >+ ARG_DESTINATION, destination.toExternalForm(), // >+ ARG_WRITE_MODE, writeMode == null ? EMPTY_STRING : writeMode}; >+ >+ try { >+ runMirrorApplication(args); >+ } catch (Exception e) { >+ throw new BuildException("Error occurred while running metadata mirror application.", e); >+ } >+ } >+ >+ /* >+ * Set the source location. >+ */ >+ public void setSource(String value) throws MalformedURLException { >+ source = new URL(value); >+ } >+ >+ /* >+ * Set the destination location. >+ */ >+ public void setDestination(String value) throws MalformedURLException { >+ destination = new URL(value); >+ } >+ >+ /* >+ * Set the write mode for the application. (e.g. clean or append) >+ */ >+ public void setWriteMode(String value) { >+ writeMode = value; >+ } >+} >\ No newline at end of file >Index: buildAntTasks.xml >=================================================================== >RCS file: buildAntTasks.xml >diff -N buildAntTasks.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buildAntTasks.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<project name="org.eclipse.equinox.p2.metadata.generator" default="default" basedir="."> >+ >+ <target name="default" description="Compile ant tasks" > >+ <mkdir dir="${basedir}/ant_tasks" /> >+ <delete file="${basedir}/ant_tasks/metadataRepository-ant.jar" failonerror="false"/> >+ <jar destfile="${basedir}/ant_tasks/metadataRepository-ant.jar" basedir="${basedir}/bin_ant"/> >+ </target> >+</project> >\ No newline at end of file >Index: .externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch >=================================================================== >RCS file: .externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch >diff -N .externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> >+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> >+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> >+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> >+<listEntry value="/org.eclipse.equinox.p2.metadata.repository/buildAntTasks.xml"/> >+</listAttribute> >+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> >+<listEntry value="1"/> >+</listAttribute> >+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> >+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> >+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> >+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.metadata.repository"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.metadata.repository/buildAntTasks.xml}"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> >+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> >+</launchConfiguration> >#P org.eclipse.equinox.p2.artifact.repository >Index: .classpath >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath,v >retrieving revision 1.4 >diff -u -r1.4 .classpath >--- .classpath 21 Feb 2008 22:42:40 -0000 1.4 >+++ .classpath 13 Jan 2009 23:24:51 -0000 >@@ -3,5 +3,6 @@ > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="src" path="src"/> >+ <classpathentry kind="src" output="bin_ant" path="src_ant"/> > <classpathentry kind="output" path="bin"/> > </classpath> >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/plugin.xml,v >retrieving revision 1.11 >diff -u -r1.11 plugin.xml >--- plugin.xml 20 Nov 2008 00:09:50 -0000 1.11 >+++ plugin.xml 13 Jan 2009 23:24:51 -0000 >@@ -43,4 +43,45 @@ > <artifactComparator class="org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5ArtifactComparator" > id="org.eclipse.equinox.artifact.md5.comparator"/> > </extension> >+ >+ <extension point="org.eclipse.ant.core.antTasks"> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.CompositeArtifactRepository.addChild" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.AddChildTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.CompositeArtifactRepository.create" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.CreateCompositeArtifactRepositoryTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.artifactMirrorApplication" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.MirrorApplicationTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.CompositeArtifactRepository.removeAllChildren" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.RemoveAllChildrenTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.CompositeArtifactRepository.removeChild" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.RemoveChildTask"> >+ </antTask> >+ >+ <antTask >+ library="ant_tasks/artifactRepository-ant.jar" >+ name="eclipse.p2.CompositeArtifactRepository.validate" >+ class="org.eclipse.equinox.internal.p2.artifact.repository.ant.ValidateTask"> >+ </antTask> >+ >+ </extension> >+ > </plugin> >Index: build.properties >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/build.properties,v >retrieving revision 1.3 >diff -u -r1.3 build.properties >--- build.properties 29 Oct 2007 15:33:43 -0000 1.3 >+++ build.properties 13 Jan 2009 23:24:51 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2007 IBM Corporation and others. >+# Copyright (c) 2007, 2009 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 >@@ -14,6 +14,12 @@ > .,\ > plugin.xml,\ > about.html,\ >- plugin.properties >+ plugin.properties,\ >+ ant_tasks/artifactRepository-ant.jar > src.includes = about.html,\ > schema/ >+jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar >+jars.compile.order = .,\ >+ ant_tasks/artifactRepository-ant.jar >+source.ant_tasks/artifactRepository-ant.jar = src_ant/ >+output.ant_tasks/artifactRepository-ant.jar = bin_ant/ >Index: .project >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/.project,v >retrieving revision 1.2 >diff -u -r1.2 .project >--- .project 30 Sep 2007 18:55:28 -0000 1.2 >+++ .project 13 Jan 2009 23:24:51 -0000 >@@ -20,6 +20,16 @@ > <arguments> > </arguments> > </buildCommand> >+ <buildCommand> >+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> >+ <triggers>full,incremental,</triggers> >+ <arguments> >+ <dictionary> >+ <key>LaunchConfigHandle</key> >+ <value><project>/.externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch</value> >+ </dictionary> >+ </arguments> >+ </buildCommand> > </buildSpec> > <natures> > <nature>org.eclipse.pde.PluginNature</nature> >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,91 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import java.util.HashMap; >+import java.util.Map; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.artifact.repository.Activator; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+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.repository.IRepository; >+ >+/** >+ * Ant task for creating a new composite artifact repository. >+ */ >+public class CreateCompositeArtifactRepositoryTask extends Task { >+ >+ URI location; // desired location of the composite repository >+ String name = "Composite Artifact Repository"; >+ boolean compressed = true; >+ Map properties = new HashMap(); >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ validate(); >+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire artifact repository manager service."); >+ >+ // remove the repo first. >+ manager.removeRepository(location); >+ >+ // set the properties >+ if (compressed) >+ properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true)); >+ >+ // create the repository >+ try { >+ manager.createRepository(location, name, IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while creating composite artifact repository.", e); >+ } >+ } >+ >+ /* >+ * Perform basic sanity checking of some of the parameters. >+ */ >+ private void validate() { >+ if (location == null) >+ throw new BuildException("Must specify repository location."); >+ if (name == null) >+ throw new BuildException("Must specify a repository name."); >+ } >+ >+ /* >+ * Set the name of the composite repository. >+ */ >+ public void setName(String value) { >+ name = value; >+ } >+ >+ /* >+ * Set the location of the repository. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set a value indicating whether or not the repository should be compressed. >+ */ >+ public void setCompressed(boolean value) { >+ compressed = value; >+ } >+ >+} >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,184 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.util.HashMap; >+import java.util.Map; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.equinox.app.IApplicationContext; >+import org.eclipse.equinox.internal.p2.artifact.mirror.MirrorApplication; >+import org.osgi.framework.Bundle; >+ >+/** >+ * Ant task for running the artifact repository mirroring application. >+ */ >+public class MirrorApplicationTask extends Task { >+ >+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$ >+ private static final String ARG_COMPARATOR = "-comparator"; //$NON-NLS-1$ >+ private static final String ARG_COMPARE = "-compare"; //$NON-NLS-1$ >+ private static final String ARG_COMPARE_AGAINST = "-compareAgainst"; //$NON-NLS-1$ >+ private static final String ARG_DESTINATION = "-destination"; //$NON-NLS-1$ >+ private static final String ARG_IGNORE_ERRORS = "-ignoreErrors"; //$NON-NLS-1$ >+ private static final String ARG_RAW = "-raw"; //$NON-NLS-1$ >+ private static final String ARG_SOURCE = "-source"; //$NON-NLS-1$ >+ private static final String ARG_VERBOSE = "-verbose"; //$NON-NLS-1$ >+ private static final String ARG_WRITE_MODE = "-writeMode"; //$NON-NLS-1$ >+ >+ URL source; >+ URL destination; >+ URL baseline; // location of known good repository for compare against (optional) >+ String comparatorID; // specifies a comparator (optional) >+ String writeMode; >+ boolean compare = false; >+ boolean ignoreErrors = false; >+ boolean raw = false; // use raw artifact descriptors? >+ boolean verbose = false; >+ >+ /* >+ * Runs the mirror application with the given arguments. >+ */ >+ private void runMirrorApplication(final String[] args) throws Exception { >+ new MirrorApplication().start(new IApplicationContext() { >+ >+ public void applicationRunning() { >+ // nothing to do >+ } >+ >+ public Map getArguments() { >+ Map arguments = new HashMap(); >+ arguments.put(IApplicationContext.APPLICATION_ARGS, args); >+ return arguments; >+ } >+ >+ public String getBrandingApplication() { >+ return null; >+ } >+ >+ public Bundle getBrandingBundle() { >+ return null; >+ } >+ >+ public String getBrandingDescription() { >+ return null; >+ } >+ >+ public String getBrandingId() { >+ return null; >+ } >+ >+ public String getBrandingName() { >+ return null; >+ } >+ >+ public String getBrandingProperty(String key) { >+ return null; >+ } >+ }); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ // Compare against if baseline specified >+ boolean compareAgainst = baseline != null; >+ boolean comparator = comparatorID != null; >+ >+ // create arguments >+ String[] args = new String[] { // >+ ARG_SOURCE, source.toExternalForm(), // >+ ARG_DESTINATION, destination.toExternalForm(), // >+ ARG_WRITE_MODE, writeMode == null ? EMPTY_STRING : writeMode, // >+ compare ? ARG_COMPARE : EMPTY_STRING, // >+ ignoreErrors ? ARG_IGNORE_ERRORS : EMPTY_STRING, // >+ raw ? ARG_RAW : EMPTY_STRING, // >+ verbose ? ARG_VERBOSE : EMPTY_STRING, // >+ compareAgainst ? ARG_COMPARE_AGAINST : EMPTY_STRING, // >+ compareAgainst ? baseline.toExternalForm() : EMPTY_STRING, // >+ comparator ? ARG_COMPARATOR : EMPTY_STRING, // >+ comparator ? comparatorID : EMPTY_STRING}; >+ >+ try { >+ runMirrorApplication(args); >+ } catch (Exception e) { >+ throw new BuildException("Exception while running mirror application.", e); >+ } >+ } >+ >+ /* >+ * Set the location of the source. >+ */ >+ public void setSource(String value) throws MalformedURLException { >+ source = new URL(value); >+ } >+ >+ /* >+ * Set the location of the destination. >+ */ >+ public void setDestination(String value) throws MalformedURLException { >+ destination = new URL(value); >+ } >+ >+ /* >+ * Set the location of the baseline repository. (used in comparison) >+ */ >+ public void setBaseline(String value) throws MalformedURLException { >+ baseline = new URL(value); >+ compare = true; >+ } >+ >+ /* >+ * Set the identifier of the comparator to use. >+ */ >+ public void setComparatorID(String value) { >+ comparatorID = value; >+ compare = true; >+ } >+ >+ /* >+ * Set the write mode. (e.g. clean or append) >+ */ >+ public void setWriteMode(String value) { >+ writeMode = value; >+ } >+ >+ /* >+ * Set whether or not the application should be calling a comparator when mirroring. >+ */ >+ public void setCompare(boolean value) { >+ compare = value; >+ } >+ >+ /* >+ * Set whether or not we should ignore errors when running the mirror application. >+ */ >+ public void setIgnoreErrors(boolean value) { >+ ignoreErrors = value; >+ } >+ >+ /* >+ * Set whether or not the the artifacts are raw. >+ */ >+ public void setRaw(boolean value) { >+ raw = value; >+ } >+ >+ /* >+ * Set whether or not the mirror application should be run in verbose mode. >+ */ >+ public void setVerbose(boolean value) { >+ verbose = value; >+ } >+} >Index: buildAntTasks.xml >=================================================================== >RCS file: buildAntTasks.xml >diff -N buildAntTasks.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ buildAntTasks.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<project name="org.eclipse.equinox.p2.metadata.generator" default="default" basedir="."> >+ >+ <target name="default" description="Jar up the binaries that were compiled by the jdt builder" > >+ <mkdir dir="${basedir}/ant_tasks" /> >+ <delete file="${basedir}/ant_tasks/artifactRepository-ant.jar" failonerror="false"/> >+ <jar destfile="${basedir}/ant_tasks/artifactRepository-ant.jar" basedir="${basedir}/bin_ant"/> >+ </target> >+</project> >\ No newline at end of file >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveAllChildrenTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveAllChildrenTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveAllChildrenTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveAllChildrenTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.artifact.repository.Activator; >+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+ >+/** >+ * Ant task for removing all the children from an existing composite artifact repository. >+ */ >+public class RemoveAllChildrenTask extends Task { >+ URI location; // location of the composite repository >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire artifact repository manager service."); >+ >+ // load repository >+ CompositeArtifactRepository repo = null; >+ try { >+ repo = (CompositeArtifactRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while loading repository.", e); >+ } >+ >+ // remove all children >+ repo.removeAllChildren(); >+ } >+ >+ /* >+ * Set the repository location. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.artifact.repository.Activator; >+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+ >+/** >+ * Ant task to add a child artifact repository to an already-existing composite artifact repository. >+ */ >+public class AddChildTask extends Task { >+ >+ URI location; // location of the composite repository >+ URI child; // address of the child to add >+ String comparatorID; // comparator to use for compare (optional) >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to acquire artifact repository manager service."); >+ >+ // get the composite repository >+ CompositeArtifactRepository repo = null; >+ try { >+ repo = (CompositeArtifactRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Exception while loading repository.", e); >+ } >+ >+ // just do a straight add if the user didn't specify a comparator. >+ if (comparatorID == null) { >+ repo.addChild(child); >+ return; >+ } >+ >+ // otherwise run the comparator when we try and add the child and print out the result. >+ if (repo.addChild(child, comparatorID)) >+ System.out.println(child + " was added successfully."); >+ else >+ System.out.println(child + " was not added."); >+ } >+ >+ /* >+ * Set the location of the composite repository. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the location of the child repository. >+ */ >+ public void setChild(String value) throws URISyntaxException { >+ child = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the identifier of the comparator to use. >+ */ >+ public void setComparatorID(String value) { >+ comparatorID = value; >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,68 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.artifact.repository.Activator; >+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+ >+/** >+ * Ant task for validating the contents of a composite artifact repository. >+ */ >+public class ValidateTask extends Task { >+ >+ URI location; // location of the composite repository >+ String comparatorID; // specifies the comparator we want to use. >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire artifact repository manager service."); >+ >+ // load the repository >+ CompositeArtifactRepository repo = null; >+ try { >+ repo = (CompositeArtifactRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Exception while loading repository.", e); >+ } >+ >+ // perform the sanity check >+ if (repo.validate(comparatorID)) >+ System.err.println("Valid repository at: " + location); >+ else >+ System.err.println("Invalid repository at: " + location); >+ } >+ >+ /* >+ * Set the repository location. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the ID of the comparator. >+ */ >+ public void setComparatorID(String value) { >+ comparatorID = value; >+ } >+} >Index: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java >=================================================================== >RCS file: src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java >diff -N src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,65 @@ >+/******************************************************************************* >+ * Copyright (c) 2008, 2009 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.equinox.internal.p2.artifact.repository.ant; >+ >+import java.net.URI; >+import java.net.URISyntaxException; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.URIUtil; >+import org.eclipse.equinox.internal.p2.artifact.repository.Activator; >+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; >+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >+ >+/** >+ * Ant task for removing a specific child from a composite artifact repository. >+ */ >+public class RemoveChildTask extends Task { >+ >+ URI location; // location of the composite repository >+ URI child; // address of child to remove >+ >+ /* (non-Javadoc) >+ * @see org.apache.tools.ant.Task#execute() >+ */ >+ public void execute() { >+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); >+ if (manager == null) >+ throw new BuildException("Unable to aquire artifact repository manager service."); >+ >+ // load repository >+ CompositeArtifactRepository repo; >+ try { >+ repo = (CompositeArtifactRepository) manager.loadRepository(location, null); >+ } catch (ProvisionException e) { >+ throw new BuildException("Error occurred while loading repository.", e); >+ } >+ >+ // remove the child >+ repo.removeChild(child); >+ } >+ >+ /* >+ * Set the repository location. >+ */ >+ public void setLocation(String value) throws URISyntaxException { >+ location = URIUtil.fromString(value); >+ } >+ >+ /* >+ * Set the child repository location. >+ */ >+ public void setChild(String value) throws URISyntaxException { >+ child = URIUtil.fromString(value); >+ } >+} >Index: .externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch >=================================================================== >RCS file: .externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch >diff -N .externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> >+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> >+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> >+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> >+<listEntry value="/org.eclipse.equinox.p2.artifact.repository/buildAntTasks.xml"/> >+</listAttribute> >+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> >+<listEntry value="1"/> >+</listAttribute> >+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> >+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> >+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> >+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.artifact.repository"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.artifact.repository/buildAntTasks.xml}"/> >+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> >+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> >+</launchConfiguration> >\ No newline at end of file
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 255913
:
119374
|
120212
|
120876
|
120947
| 122471