Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 255913 | Differences between
and this patch

Collapse All | Expand All

(-)build.properties (-2 / +8 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2007 IBM Corporation and others.
2
# Copyright (c) 2007, 2009 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 14-19 Link Here
14
               .,\
14
               .,\
15
               about.html,\
15
               about.html,\
16
               plugin.xml,\
16
               plugin.xml,\
17
               plugin.properties
17
               plugin.properties,\
18
               ant_tasks/metadataRepository-ant.jar
18
src.includes = about.html,\
19
src.includes = about.html,\
19
               schema/
20
               schema/
21
jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar
22
jars.compile.order = .,\
23
                     ant_tasks/metadataRepository-ant.jar
24
source.ant_tasks/metadataRepository-ant.jar = src_ant/
25
output.ant_tasks/metadataRepository-ant.jar = bin_ant/
(-).classpath (+1 lines)
Lines 3-7 Link Here
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="src" output="bin_ant" path="src_ant"/>
6
	<classpathentry kind="output" path="bin"/>
7
	<classpathentry kind="output" path="bin"/>
7
</classpath>
8
</classpath>
(-)plugin.xml (+34 lines)
Lines 22-25 Link Here
22
        <filter suffix="compositeContent.xml"/>
22
        <filter suffix="compositeContent.xml"/>
23
        <factory class="org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory"/>
23
        <factory class="org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory"/>
24
   </extension>
24
   </extension>
25
   
26
   <extension point="org.eclipse.ant.core.antTasks">
27
		<antTask
28
			library="ant_tasks/metadataRepository-ant.jar"
29
			name="eclipse.p2.CompositeMetadataRepository.addChild"
30
			class="org.eclipse.equinox.internal.p2.metadata.repository.ant.AddChildTask">
31
		</antTask>
32
		
33
		<antTask
34
			library="ant_tasks/metadataRepository-ant.jar"
35
			name="eclipse.p2.CompositeMetadataRepository.create"
36
			class="org.eclipse.equinox.internal.p2.metadata.repository.ant.CreateCompositeMetadataRepositoryTask">
37
		</antTask>
38
		
39
   		<antTask
40
			library="ant_tasks/metadataRepository-ant.jar"
41
			name="eclipse.p2.metadataMirrorApplication"
42
			class="org.eclipse.equinox.internal.p2.metadata.repository.ant.MirrorApplicationTask">
43
		</antTask>
44
		
45
		<antTask
46
			library="ant_tasks/metadataRepository-ant.jar"
47
			name="eclipse.p2.CompositeMetadataRepository.removeAllChildren"
48
			class="org.eclipse.equinox.internal.p2.metadata.repository.ant.RemoveAllChildrenTask">
49
		</antTask>
50
51
		<antTask
52
			library="ant_tasks/metadataRepository-ant.jar"
53
			name="eclipse.p2.CompositeMetadataRepository.removeChild"
54
			class="org.eclipse.equinox.internal.p2.metadata.repository.ant.RemoveChildTask">
55
		</antTask>
56
		
57
	</extension>
58
25
</plugin>
59
</plugin>
(-).project (+10 lines)
Lines 25-30 Link Here
25
			<arguments>
25
			<arguments>
26
			</arguments>
26
			</arguments>
27
		</buildCommand>
27
		</buildCommand>
28
		<buildCommand>
29
			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
30
			<triggers>full,incremental,</triggers>
31
			<arguments>
32
				<dictionary>
33
					<key>LaunchConfigHandle</key>
34
					<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy buildAntTasks.xml.launch</value>
35
				</dictionary>
36
			</arguments>
37
		</buildCommand>
28
	</buildSpec>
38
	</buildSpec>
29
	<natures>
39
	<natures>
30
		<nature>org.eclipse.pde.PluginNature</nature>
40
		<nature>org.eclipse.pde.PluginNature</nature>
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java (+79 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
19
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
20
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
24
/**
25
 * Ant task for adding a child repository to a composite metadata repository.
26
 */
27
public class AddChildTask extends Task {
28
29
	URI location; // location of the composite repository
30
	URI child; // address of the child to add
31
32
	/* (non-Javadoc)
33
	 * @see org.apache.tools.ant.Task#execute()
34
	 */
35
	public void execute() {
36
		validate();
37
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
38
		if (manager == null)
39
			throw new BuildException("Unable to aquire metadata repository manager service.");
40
41
		// load the composite repository
42
		CompositeMetadataRepository repo = null;
43
		try {
44
			repo = (CompositeMetadataRepository) manager.loadRepository(location, null);
45
		} catch (ClassCastException e) {
46
			throw new BuildException("Repository at location: " + location + " is not a composite metadata repository.");
47
		} catch (ProvisionException e) {
48
			throw new BuildException("Error occurred while loading repository.", e);
49
		}
50
51
		// add the child
52
		repo.addChild(child);
53
		manager.removeRepository(location);
54
	}
55
56
	/*
57
	 * Validate user input to ensure we have enough information to go forward.
58
	 */
59
	private void validate() {
60
		if (location == null)
61
			throw new BuildException("Need to specify the composite repository location.");
62
		if (child == null)
63
			throw new BuildException("Need to specify the child repository location.");
64
	}
65
66
	/*
67
	 * Set the location of the composite repository.
68
	 */
69
	public void setLocation(String value) throws URISyntaxException {
70
		location = URIUtil.fromString(value);
71
	}
72
73
	/*
74
	 * Set the location of the child repository.
75
	 */
76
	public void setChild(String value) throws URISyntaxException {
77
		child = URIUtil.fromString(value);
78
	}
79
}
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java (+62 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
19
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
20
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
24
/**
25
 * Ant task to remove a specific child repository from a composite metadata repository.
26
 */
27
public class RemoveChildTask extends Task {
28
29
	URI location; // location of the composite repository
30
	URI child; // address of the child to be removed
31
32
	/* (non-Javadoc)
33
	 * @see org.apache.tools.ant.Task#execute()
34
	 */
35
	public void execute() {
36
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
37
		if (manager == null)
38
			throw new BuildException("Unable to aquire metadata repository manager service.");
39
40
		CompositeMetadataRepository repo;
41
		try {
42
			repo = (CompositeMetadataRepository) manager.loadRepository(location, null);
43
		} catch (ProvisionException e) {
44
			throw new BuildException("Error occurred while loading repository.", e);
45
		}
46
		repo.removeChild(child);
47
	}
48
49
	/*
50
	 * Set the location of the composite repository.
51
	 */
52
	public void setLocation(String value) throws URISyntaxException {
53
		location = URIUtil.fromString(value);
54
	}
55
56
	/*
57
	 * Set the location of the child repository to remove.
58
	 */
59
	public void setChild(String value) throws URISyntaxException {
60
		child = URIUtil.fromString(value);
61
	}
62
}
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveAllChildrenTask.java (+56 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
19
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
20
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
21
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
22
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
23
24
/**
25
 * Ant task to remove all the children repositories from a composite metadata repository.
26
 */
27
public class RemoveAllChildrenTask extends Task {
28
	URI location; // location of the composite repository
29
30
	/* (non-Javadoc)
31
	 * @see org.apache.tools.ant.Task#execute()
32
	 */
33
	public void execute() {
34
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
35
		if (manager == null)
36
			throw new BuildException("Unable to aquire metadata repository manager service.");
37
38
		// load the repository
39
		CompositeMetadataRepository repo = null;
40
		try {
41
			repo = (CompositeMetadataRepository) manager.loadRepository(location, null);
42
		} catch (ProvisionException e) {
43
			throw new BuildException("Exception while loading repository.", e);
44
		}
45
46
		// remove all children
47
		repo.removeAllChildren();
48
	}
49
50
	/*
51
	 * Set the repository location.
52
	 */
53
	public void setLocation(String value) throws URISyntaxException {
54
		location = URIUtil.fromString(value);
55
	}
56
}
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java (+80 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.util.HashMap;
16
import java.util.Map;
17
import org.apache.tools.ant.BuildException;
18
import org.apache.tools.ant.Task;
19
import org.eclipse.core.runtime.URIUtil;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.p2.metadata.repository.Activator;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
24
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
25
26
/**
27
 * Ant task for creating a new composite metadata repository.
28
 */
29
public class CreateCompositeMetadataRepositoryTask extends Task {
30
31
	URI location; // desired location of the composite repository
32
	String name = "Composite Metadata Repository";
33
	boolean compressed = true; // compress by default
34
	Map properties = new HashMap();
35
36
	/* (non-Javadoc)
37
	 * @see org.apache.tools.ant.Task#execute()
38
	 */
39
	public void execute() {
40
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
41
		if (manager == null)
42
			throw new BuildException("Unable to aquire metadata repository manager service.");
43
44
		// remove the repo first.
45
		manager.removeRepository(location);
46
47
		// create the properties
48
		if (compressed)
49
			properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true));
50
51
		// create the repository
52
		try {
53
			manager.createRepository(location, name, IMetadataRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties);
54
		} catch (ProvisionException e) {
55
			throw new BuildException("Error occurred while creating composite metadata repository.", e);
56
		}
57
	}
58
59
	/*
60
	 * Set the name of the composite repository.
61
	 */
62
	public void setName(String value) {
63
		name = value;
64
	}
65
66
	/*
67
	 * Set the repository location.
68
	 */
69
	public void setLocation(String value) throws URISyntaxException {
70
		location = URIUtil.fromString(value);
71
	}
72
73
	/*
74
	 * Set whether or not this repository should be compressed.
75
	 */
76
	public void setCompressed(boolean value) {
77
		compressed = value;
78
	}
79
80
}
(-)src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/MirrorApplicationTask.java (+117 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
12
13
import java.net.MalformedURLException;
14
import java.net.URL;
15
import java.util.HashMap;
16
import java.util.Map;
17
import org.apache.tools.ant.BuildException;
18
import org.apache.tools.ant.Task;
19
import org.eclipse.equinox.app.IApplicationContext;
20
import org.eclipse.equinox.internal.p2.metadata.mirror.MirrorApplication;
21
import org.osgi.framework.Bundle;
22
23
/**
24
 * Ant task for running the metadata mirror application.
25
 */
26
public class MirrorApplicationTask extends Task {
27
28
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
29
	private static final String ARG_DESTINATION = "-destination"; //$NON-NLS-1$
30
	private static final String ARG_SOURCE = "-source"; //$NON-NLS-1$
31
	private static final String ARG_WRITE_MODE = "-writeMode"; //$NON-NLS-1$
32
	URL source;
33
	URL destination;
34
	String writeMode;
35
36
	//TODO add transitive and roots attributed when implemented.
37
38
	/*
39
	 * Run the mirror application with the given arguments.
40
	 */
41
	private void runMirrorApplication(final String[] args) throws Exception {
42
		new MirrorApplication().start(new IApplicationContext() {
43
44
			public void applicationRunning() {
45
				// nothing to do
46
			}
47
48
			public Map getArguments() {
49
				Map arguments = new HashMap();
50
				arguments.put(IApplicationContext.APPLICATION_ARGS, args);
51
				return arguments;
52
			}
53
54
			public String getBrandingApplication() {
55
				return null;
56
			}
57
58
			public Bundle getBrandingBundle() {
59
				return null;
60
			}
61
62
			public String getBrandingDescription() {
63
				return null;
64
			}
65
66
			public String getBrandingId() {
67
				return null;
68
			}
69
70
			public String getBrandingName() {
71
				return null;
72
			}
73
74
			public String getBrandingProperty(String key) {
75
				return null;
76
			}
77
		});
78
	}
79
80
	/* (non-Javadoc)
81
	 * @see org.apache.tools.ant.Task#execute()
82
	 */
83
	public void execute() {
84
		// create arguments
85
		String[] args = new String[] { //
86
		ARG_SOURCE, source.toExternalForm(), //
87
				ARG_DESTINATION, destination.toExternalForm(), // 
88
				ARG_WRITE_MODE, writeMode == null ? EMPTY_STRING : writeMode};
89
90
		try {
91
			runMirrorApplication(args);
92
		} catch (Exception e) {
93
			throw new BuildException("Error occurred while running metadata mirror application.", e);
94
		}
95
	}
96
97
	/*
98
	 * Set the source location.
99
	 */
100
	public void setSource(String value) throws MalformedURLException {
101
		source = new URL(value);
102
	}
103
104
	/*
105
	 * Set the destination location.
106
	 */
107
	public void setDestination(String value) throws MalformedURLException {
108
		destination = new URL(value);
109
	}
110
111
	/*
112
	 * Set the write mode for the application. (e.g. clean or append)
113
	 */
114
	public void setWriteMode(String value) {
115
		writeMode = value;
116
	}
117
}
(-)buildAntTasks.xml (+9 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project name="org.eclipse.equinox.p2.metadata.generator" default="default" basedir=".">
3
4
	<target name="default" description="Compile ant tasks" >
5
		<mkdir dir="${basedir}/ant_tasks" />
6
		<delete file="${basedir}/ant_tasks/metadataRepository-ant.jar" failonerror="false"/>
7
		<jar destfile="${basedir}/ant_tasks/metadataRepository-ant.jar" basedir="${basedir}/bin_ant"/>
8
	</target>
9
</project>
(-).externalToolBuilders/org.eclipse.equinox.p2.metadata.reposiroy (+18 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
3
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
4
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
5
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
6
<listEntry value="/org.eclipse.equinox.p2.metadata.repository/buildAntTasks.xml"/>
7
</listAttribute>
8
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
9
<listEntry value="1"/>
10
</listAttribute>
11
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
12
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
13
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
14
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.metadata.repository"/>
15
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.metadata.repository/buildAntTasks.xml}"/>
16
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
17
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
18
</launchConfiguration>
(-).classpath (+1 lines)
Lines 3-7 Link Here
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="src" output="bin_ant" path="src_ant"/>
6
	<classpathentry kind="output" path="bin"/>
7
	<classpathentry kind="output" path="bin"/>
7
</classpath>
8
</classpath>
(-)plugin.xml (+41 lines)
Lines 43-46 Link Here
43
		<artifactComparator class="org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5ArtifactComparator"
43
		<artifactComparator class="org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5ArtifactComparator"
44
		id="org.eclipse.equinox.artifact.md5.comparator"/>
44
		id="org.eclipse.equinox.artifact.md5.comparator"/>
45
	</extension>
45
	</extension>
46
	
47
	<extension point="org.eclipse.ant.core.antTasks">
48
		
49
		<antTask
50
			library="ant_tasks/artifactRepository-ant.jar"
51
			name="eclipse.p2.CompositeArtifactRepository.addChild"
52
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.AddChildTask">
53
		</antTask>
54
		
55
		<antTask
56
			library="ant_tasks/artifactRepository-ant.jar"
57
			name="eclipse.p2.CompositeArtifactRepository.create"
58
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.CreateCompositeArtifactRepositoryTask">
59
		</antTask>
60
61
		<antTask
62
			library="ant_tasks/artifactRepository-ant.jar"
63
			name="eclipse.p2.artifactMirrorApplication"
64
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.MirrorApplicationTask">
65
		</antTask>
66
		
67
		<antTask
68
			library="ant_tasks/artifactRepository-ant.jar"
69
			name="eclipse.p2.CompositeArtifactRepository.removeAllChildren"
70
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.RemoveAllChildrenTask">
71
		</antTask>
72
		
73
		<antTask
74
			library="ant_tasks/artifactRepository-ant.jar"
75
			name="eclipse.p2.CompositeArtifactRepository.removeChild"
76
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.RemoveChildTask">
77
		</antTask>
78
		
79
		<antTask
80
			library="ant_tasks/artifactRepository-ant.jar"
81
			name="eclipse.p2.CompositeArtifactRepository.validate"
82
			class="org.eclipse.equinox.internal.p2.artifact.repository.ant.ValidateTask">
83
		</antTask>
84
85
	</extension>
86
46
</plugin>
87
</plugin>
(-)build.properties (-2 / +8 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2007 IBM Corporation and others.
2
# Copyright (c) 2007, 2009 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 14-19 Link Here
14
               .,\
14
               .,\
15
               plugin.xml,\
15
               plugin.xml,\
16
               about.html,\
16
               about.html,\
17
               plugin.properties
17
               plugin.properties,\
18
               ant_tasks/artifactRepository-ant.jar
18
src.includes = about.html,\
19
src.includes = about.html,\
19
               schema/
20
               schema/
21
jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar
22
jars.compile.order = .,\
23
                     ant_tasks/artifactRepository-ant.jar
24
source.ant_tasks/artifactRepository-ant.jar = src_ant/
25
output.ant_tasks/artifactRepository-ant.jar = bin_ant/
(-).project (+10 lines)
Lines 20-25 Link Here
20
			<arguments>
20
			<arguments>
21
			</arguments>
21
			</arguments>
22
		</buildCommand>
22
		</buildCommand>
23
		<buildCommand>
24
			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
25
			<triggers>full,incremental,</triggers>
26
			<arguments>
27
				<dictionary>
28
					<key>LaunchConfigHandle</key>
29
					<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.equinox.p2.artifact.repository buildAntTasks.xml.launch</value>
30
				</dictionary>
31
			</arguments>
32
		</buildCommand>
23
	</buildSpec>
33
	</buildSpec>
24
	<natures>
34
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
35
		<nature>org.eclipse.pde.PluginNature</nature>
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java (+91 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.util.HashMap;
16
import java.util.Map;
17
import org.apache.tools.ant.BuildException;
18
import org.apache.tools.ant.Task;
19
import org.eclipse.core.runtime.URIUtil;
20
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
21
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
22
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
23
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
24
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
25
26
/**
27
 * Ant task for creating a new composite artifact repository.
28
 */
29
public class CreateCompositeArtifactRepositoryTask extends Task {
30
31
	URI location; // desired location of the composite repository
32
	String name = "Composite Artifact Repository";
33
	boolean compressed = true;
34
	Map properties = new HashMap();
35
36
	/* (non-Javadoc)
37
	 * @see org.apache.tools.ant.Task#execute()
38
	 */
39
	public void execute() {
40
		validate();
41
		IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
42
		if (manager == null)
43
			throw new BuildException("Unable to aquire artifact repository manager service.");
44
45
		// remove the repo first.
46
		manager.removeRepository(location);
47
48
		// set the properties
49
		if (compressed)
50
			properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true));
51
52
		// create the repository
53
		try {
54
			manager.createRepository(location, name, IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties);
55
		} catch (ProvisionException e) {
56
			throw new BuildException("Error occurred while creating composite artifact repository.", e);
57
		}
58
	}
59
60
	/*
61
	 * Perform basic sanity checking of some of the parameters.
62
	 */
63
	private void validate() {
64
		if (location == null)
65
			throw new BuildException("Must specify repository location.");
66
		if (name == null)
67
			throw new BuildException("Must specify a repository name.");
68
	}
69
70
	/*
71
	 * Set the name of the composite repository.
72
	 */
73
	public void setName(String value) {
74
		name = value;
75
	}
76
77
	/*
78
	 * Set the location of the repository.
79
	 */
80
	public void setLocation(String value) throws URISyntaxException {
81
		location = URIUtil.fromString(value);
82
	}
83
84
	/*
85
	 * Set a value indicating whether or not the repository should be compressed.
86
	 */
87
	public void setCompressed(boolean value) {
88
		compressed = value;
89
	}
90
91
}
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java (+184 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.MalformedURLException;
14
import java.net.URL;
15
import java.util.HashMap;
16
import java.util.Map;
17
import org.apache.tools.ant.BuildException;
18
import org.apache.tools.ant.Task;
19
import org.eclipse.equinox.app.IApplicationContext;
20
import org.eclipse.equinox.internal.p2.artifact.mirror.MirrorApplication;
21
import org.osgi.framework.Bundle;
22
23
/**
24
 * Ant task for running the artifact repository mirroring application.
25
 */
26
public class MirrorApplicationTask extends Task {
27
28
	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
29
	private static final String ARG_COMPARATOR = "-comparator"; //$NON-NLS-1$
30
	private static final String ARG_COMPARE = "-compare"; //$NON-NLS-1$
31
	private static final String ARG_COMPARE_AGAINST = "-compareAgainst"; //$NON-NLS-1$
32
	private static final String ARG_DESTINATION = "-destination"; //$NON-NLS-1$
33
	private static final String ARG_IGNORE_ERRORS = "-ignoreErrors"; //$NON-NLS-1$
34
	private static final String ARG_RAW = "-raw"; //$NON-NLS-1$
35
	private static final String ARG_SOURCE = "-source"; //$NON-NLS-1$
36
	private static final String ARG_VERBOSE = "-verbose"; //$NON-NLS-1$
37
	private static final String ARG_WRITE_MODE = "-writeMode"; //$NON-NLS-1$
38
39
	URL source;
40
	URL destination;
41
	URL baseline; // location of known good repository for compare against (optional)
42
	String comparatorID; // specifies a comparator (optional)
43
	String writeMode;
44
	boolean compare = false;
45
	boolean ignoreErrors = false;
46
	boolean raw = false; // use raw artifact descriptors?
47
	boolean verbose = false;
48
49
	/*
50
	 * Runs the mirror application with the given arguments.
51
	 */
52
	private void runMirrorApplication(final String[] args) throws Exception {
53
		new MirrorApplication().start(new IApplicationContext() {
54
55
			public void applicationRunning() {
56
				// nothing to do
57
			}
58
59
			public Map getArguments() {
60
				Map arguments = new HashMap();
61
				arguments.put(IApplicationContext.APPLICATION_ARGS, args);
62
				return arguments;
63
			}
64
65
			public String getBrandingApplication() {
66
				return null;
67
			}
68
69
			public Bundle getBrandingBundle() {
70
				return null;
71
			}
72
73
			public String getBrandingDescription() {
74
				return null;
75
			}
76
77
			public String getBrandingId() {
78
				return null;
79
			}
80
81
			public String getBrandingName() {
82
				return null;
83
			}
84
85
			public String getBrandingProperty(String key) {
86
				return null;
87
			}
88
		});
89
	}
90
91
	/* (non-Javadoc)
92
	 * @see org.apache.tools.ant.Task#execute()
93
	 */
94
	public void execute() {
95
		// Compare against if baseline specified
96
		boolean compareAgainst = baseline != null;
97
		boolean comparator = comparatorID != null;
98
99
		// create arguments
100
		String[] args = new String[] { //
101
		ARG_SOURCE, source.toExternalForm(), //
102
				ARG_DESTINATION, destination.toExternalForm(), //
103
				ARG_WRITE_MODE, writeMode == null ? EMPTY_STRING : writeMode, //
104
				compare ? ARG_COMPARE : EMPTY_STRING, //
105
				ignoreErrors ? ARG_IGNORE_ERRORS : EMPTY_STRING, //
106
				raw ? ARG_RAW : EMPTY_STRING, //
107
				verbose ? ARG_VERBOSE : EMPTY_STRING, //
108
				compareAgainst ? ARG_COMPARE_AGAINST : EMPTY_STRING, //
109
				compareAgainst ? baseline.toExternalForm() : EMPTY_STRING, //
110
				comparator ? ARG_COMPARATOR : EMPTY_STRING, //
111
				comparator ? comparatorID : EMPTY_STRING};
112
113
		try {
114
			runMirrorApplication(args);
115
		} catch (Exception e) {
116
			throw new BuildException("Exception while running mirror application.", e);
117
		}
118
	}
119
120
	/*
121
	 * Set the location of the source.
122
	 */
123
	public void setSource(String value) throws MalformedURLException {
124
		source = new URL(value);
125
	}
126
127
	/*
128
	 * Set the location of the destination.
129
	 */
130
	public void setDestination(String value) throws MalformedURLException {
131
		destination = new URL(value);
132
	}
133
134
	/*
135
	 * Set the location of the baseline repository. (used in comparison)
136
	 */
137
	public void setBaseline(String value) throws MalformedURLException {
138
		baseline = new URL(value);
139
		compare = true;
140
	}
141
142
	/*
143
	 * Set the identifier of the comparator to use.
144
	 */
145
	public void setComparatorID(String value) {
146
		comparatorID = value;
147
		compare = true;
148
	}
149
150
	/*
151
	 * Set the write mode. (e.g. clean or append)
152
	 */
153
	public void setWriteMode(String value) {
154
		writeMode = value;
155
	}
156
157
	/*
158
	 * Set whether or not the application should be calling a comparator when mirroring.
159
	 */
160
	public void setCompare(boolean value) {
161
		compare = value;
162
	}
163
164
	/*
165
	 * Set whether or not we should ignore errors when running the mirror application.
166
	 */
167
	public void setIgnoreErrors(boolean value) {
168
		ignoreErrors = value;
169
	}
170
171
	/*
172
	 * Set whether or not the the artifacts are raw.
173
	 */
174
	public void setRaw(boolean value) {
175
		raw = value;
176
	}
177
178
	/*
179
	 * Set whether or not the mirror application should be run in verbose mode.
180
	 */
181
	public void setVerbose(boolean value) {
182
		verbose = value;
183
	}
184
}
(-)buildAntTasks.xml (+9 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project name="org.eclipse.equinox.p2.metadata.generator" default="default" basedir=".">
3
4
	<target name="default" description="Jar up the binaries that were compiled by the jdt builder" >
5
		<mkdir dir="${basedir}/ant_tasks" />
6
		<delete file="${basedir}/ant_tasks/artifactRepository-ant.jar" failonerror="false"/>
7
		<jar destfile="${basedir}/ant_tasks/artifactRepository-ant.jar" basedir="${basedir}/bin_ant"/>
8
	</target>
9
</project>
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveAllChildrenTask.java (+56 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
19
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
24
/**
25
 * Ant task for removing all the children from an existing composite artifact repository.
26
 */
27
public class RemoveAllChildrenTask extends Task {
28
	URI location; // location of the composite repository
29
30
	/* (non-Javadoc)
31
	 * @see org.apache.tools.ant.Task#execute()
32
	 */
33
	public void execute() {
34
		IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
35
		if (manager == null)
36
			throw new BuildException("Unable to aquire artifact repository manager service.");
37
38
		// load repository
39
		CompositeArtifactRepository repo = null;
40
		try {
41
			repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
42
		} catch (ProvisionException e) {
43
			throw new BuildException("Error occurred while loading repository.", e);
44
		}
45
46
		// remove all children
47
		repo.removeAllChildren();
48
	}
49
50
	/*
51
	 * Set the repository location.
52
	 */
53
	public void setLocation(String value) throws URISyntaxException {
54
		location = URIUtil.fromString(value);
55
	}
56
}
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java (+82 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
19
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
24
/**
25
 * Ant task to add a child artifact repository to an already-existing composite artifact repository.
26
 */
27
public class AddChildTask extends Task {
28
29
	URI location; // location of the composite repository
30
	URI child; // address of the child to add
31
	String comparatorID; // comparator to use for compare (optional)
32
33
	/* (non-Javadoc)
34
	 * @see org.apache.tools.ant.Task#execute()
35
	 */
36
	public void execute() {
37
		IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
38
		if (manager == null)
39
			throw new BuildException("Unable to acquire artifact repository manager service.");
40
41
		// get the composite repository
42
		CompositeArtifactRepository repo = null;
43
		try {
44
			repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
45
		} catch (ProvisionException e) {
46
			throw new BuildException("Exception while loading repository.", e);
47
		}
48
49
		// just do a straight add if the user didn't specify a comparator.
50
		if (comparatorID == null) {
51
			repo.addChild(child);
52
			return;
53
		}
54
55
		// otherwise run the comparator when we try and add the child and print out the result.
56
		if (repo.addChild(child, comparatorID))
57
			System.out.println(child + " was added successfully.");
58
		else
59
			System.out.println(child + " was not added.");
60
	}
61
62
	/*
63
	 * Set the location of the composite repository.
64
	 */
65
	public void setLocation(String value) throws URISyntaxException {
66
		location = URIUtil.fromString(value);
67
	}
68
69
	/*
70
	 * Set the location of the child repository.
71
	 */
72
	public void setChild(String value) throws URISyntaxException {
73
		child = URIUtil.fromString(value);
74
	}
75
76
	/*
77
	 * Set the identifier of the comparator to use.
78
	 */
79
	public void setComparatorID(String value) {
80
		comparatorID = value;
81
	}
82
}
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java (+68 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
19
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
24
/**
25
 * Ant task for validating the contents of a composite artifact repository.
26
 */
27
public class ValidateTask extends Task {
28
29
	URI location; // location of the composite repository
30
	String comparatorID; // specifies the comparator we want to use.
31
32
	/* (non-Javadoc)
33
	 * @see org.apache.tools.ant.Task#execute()
34
	 */
35
	public void execute() {
36
		IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
37
		if (manager == null)
38
			throw new BuildException("Unable to aquire artifact repository manager service.");
39
40
		// load the repository
41
		CompositeArtifactRepository repo = null;
42
		try {
43
			repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
44
		} catch (ProvisionException e) {
45
			throw new BuildException("Exception while loading repository.", e);
46
		}
47
48
		// perform the sanity check
49
		if (repo.validate(comparatorID))
50
			System.err.println("Valid repository at: " + location);
51
		else
52
			System.err.println("Invalid repository at: " + location);
53
	}
54
55
	/*
56
	 * Set the repository location.
57
	 */
58
	public void setLocation(String value) throws URISyntaxException {
59
		location = URIUtil.fromString(value);
60
	}
61
62
	/*
63
	 * Set the ID of the comparator.
64
	 */
65
	public void setComparatorID(String value) {
66
		comparatorID = value;
67
	}
68
}
(-)src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.equinox.internal.p2.artifact.repository.ant;
12
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import org.apache.tools.ant.BuildException;
16
import org.apache.tools.ant.Task;
17
import org.eclipse.core.runtime.URIUtil;
18
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
19
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
20
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
21
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
22
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
23
24
/**
25
 * Ant task for removing a specific child from a composite artifact repository.
26
 */
27
public class RemoveChildTask extends Task {
28
29
	URI location; // location of the composite repository
30
	URI child; // address of child to remove
31
32
	/* (non-Javadoc)
33
	 * @see org.apache.tools.ant.Task#execute()
34
	 */
35
	public void execute() {
36
		IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
37
		if (manager == null)
38
			throw new BuildException("Unable to aquire artifact repository manager service.");
39
40
		// load repository
41
		CompositeArtifactRepository repo;
42
		try {
43
			repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
44
		} catch (ProvisionException e) {
45
			throw new BuildException("Error occurred while loading repository.", e);
46
		}
47
48
		// remove the child
49
		repo.removeChild(child);
50
	}
51
52
	/*
53
	 * Set the repository location.
54
	 */
55
	public void setLocation(String value) throws URISyntaxException {
56
		location = URIUtil.fromString(value);
57
	}
58
59
	/*
60
	 * Set the child repository location.
61
	 */
62
	public void setChild(String value) throws URISyntaxException {
63
		child = URIUtil.fromString(value);
64
	}
65
}
(-).externalToolBuilders/org.eclipse.equinox.p2.artifact.repository (+18 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
3
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
4
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
5
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
6
<listEntry value="/org.eclipse.equinox.p2.artifact.repository/buildAntTasks.xml"/>
7
</listAttribute>
8
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
9
<listEntry value="1"/>
10
</listAttribute>
11
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
12
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
13
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
14
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.artifact.repository"/>
15
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.artifact.repository/buildAntTasks.xml}"/>
16
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
17
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
18
</launchConfiguration>

Return to bug 255913