diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.director.app')
10 files changed, 284 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.classpath b/bundles/org.eclipse.equinox.p2.director.app/.classpath index ce0c7a5d4..47ddcce2d 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.classpath +++ b/bundles/org.eclipse.equinox.p2.director.app/.classpath @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="src_ant"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.equinox.p2.director.app/.cvsignore b/bundles/org.eclipse.equinox.p2.director.app/.cvsignore index c5e82d745..905d1d66d 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.cvsignore +++ b/bundles/org.eclipse.equinox.p2.director.app/.cvsignore @@ -1 +1,2 @@ -bin
\ No newline at end of file +bin +ant_tasks
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.director.app/.externalToolBuilders/Build Director Ant Tasks.launch b/bundles/org.eclipse.equinox.p2.director.app/.externalToolBuilders/Build Director Ant Tasks.launch new file mode 100644 index 000000000..4fe9972cb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.director.app/.externalToolBuilders/Build Director Ant Tasks.launch @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<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"/> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/org.eclipse.equinox.p2.director.app/scripts/buildExtraJAR.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> +<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> +<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.director.app"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/org.eclipse.equinox.p2.director.app/scripts/buildExtraJAR.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> diff --git a/bundles/org.eclipse.equinox.p2.director.app/.project b/bundles/org.eclipse.equinox.p2.director.app/.project index 94d69c3bd..e163d3d36 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.project +++ b/bundles/org.eclipse.equinox.p2.director.app/.project @@ -11,6 +11,16 @@ </arguments> </buildCommand> <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/Build Director Ant Tasks.launch</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> diff --git a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs index 03102cb3f..6eb32386b 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,4 @@ -#Sun Sep 23 11:57:58 EDT 2007 +#Thu Nov 08 11:15:08 EST 2007 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_core @@ -12,6 +12,7 @@ sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_serial_version_id=false @@ -20,14 +21,16 @@ sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true @@ -46,7 +49,7 @@ sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false +sp_cleanup.sort_members=true sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false diff --git a/bundles/org.eclipse.equinox.p2.director.app/build.properties b/bundles/org.eclipse.equinox.p2.director.app/build.properties index 4bbd9bd55..fd5507d03 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/build.properties +++ b/bundles/org.eclipse.equinox.p2.director.app/build.properties @@ -9,10 +9,15 @@ # IBM Corporation - initial API and implementation ############################################################################### source.. = src/ +source.ant_tasks/director-ant.jar=src_ant/ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ + ant_tasks/director-ant.jar,\ about.html,\ plugin.properties src.includes = about.html +jars.compile.order=.,ant_tasks/director-ant.jar +extra.ant_tasks/director-ant.jar = platform:/plugin/org.apache.ant +jars.extra.classpath = platform:/plugin/org.apache.ant/lib/ant.jar diff --git a/bundles/org.eclipse.equinox.p2.director.app/plugin.xml b/bundles/org.eclipse.equinox.p2.director.app/plugin.xml index 9b8a9c1d2..8760c1333 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.director.app/plugin.xml @@ -15,4 +15,16 @@ </product> </extension> + <extension point="org.eclipse.ant.core.antTasks"> + <antTask + library="ant_tasks/director-ant.jar" + name="p2.director" + class="org.eclipse.equinox.p2.director.app.ant.DirectorTask"> + </antTask> + </extension> + + <extension point="org.eclipse.ant.core.extraClasspathEntries"> + <extraClasspathEntry library="ant_tasks/director-ant.jar"/> + </extension> + </plugin> diff --git a/bundles/org.eclipse.equinox.p2.director.app/scripts/buildExtraJAR.xml b/bundles/org.eclipse.equinox.p2.director.app/scripts/buildExtraJAR.xml new file mode 100644 index 000000000..eddf1d9d2 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.director.app/scripts/buildExtraJAR.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="org.eclipse.core.resources" default="main" basedir=".."> + + <target name="main" depends="clean, ant_tasks/director-ant.jar"> + </target> + + <target name="init" depends="properties"> + <property name="plugin" value="org.eclipse.equinox.p2.director.app"/> + <property name="temp.folder" value="${basedir}/temp.folder"/> + <property name="plugin.destination" value="${basedir}"/> + <property name="build.result.folder" value="${basedir}/ant_tasks"/> + <property name="version.suffix" value="_3.1.0"/> + </target> + + <target name="properties" if="eclipse.running"> + <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> + </target> + + <target name="ant_tasks/director-ant.jar" depends="init" unless="ant_tasks/director-ant.jar"> + <property name="destdir" value="${temp.folder}/ant_tasks/director-ant.jar.bin"/> + <delete dir="${temp.folder}/ant_tasks/director-ant.jar.bin"/> + <mkdir dir="${temp.folder}/ant_tasks/director-ant.jar.bin"/> + <!-- compile the source code --> + <javac destdir="${temp.folder}/ant_tasks/director-ant.jar.bin" failonerror="true" verbose="true" debug="on"> + <classpath> + <dirset dir="${basedir}/.."> + <include name="org.eclipse.equinox.p2.director.app/bin"/> + <include name="org.eclipse.osgi/bin"/> + </dirset> + <fileset dir="${eclipse.home}"> + <include name="plugins/org.eclipse.equinox.p2.director.app*.jar"/> + <include name="plugins/org.eclipse.osgi*.jar"/> + </fileset> + </classpath> + <src path="src_ant/"/> + </javac> + <!-- copy necessary resources --> + <copy todir="${temp.folder}/ant_tasks/director-ant.jar.bin"> + <fileset dir="src_ant/" excludes="**/*.java"/> + </copy> + <mkdir dir="${build.result.folder}"/> + <jar jarfile="${build.result.folder}/director-ant.jar" basedir="${temp.folder}/ant_tasks/director-ant.jar.bin"/> + <delete dir="${temp.folder}/ant_tasks/director-ant.jar.bin"/> + <delete dir="${temp.folder}"/> + </target> + + <target name="clean" depends="init"> + <delete file="${build.result.folder}/director-ant.jar"/> + <delete dir="${temp.folder}"/> + </target> +</project>
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java index 71f2b5642..5dfc0e2a3 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Application.java @@ -9,7 +9,8 @@ package org.eclipse.equinox.internal.p2.director.app; import java.net.URL; -import java.util.*; +import java.util.Enumeration; +import java.util.Properties; import org.eclipse.core.runtime.*; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; @@ -52,9 +53,12 @@ public class Application implements IApplication { * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) */ public Object start(IApplicationContext context) throws Exception { + return run((String[]) context.getArguments().get("application.args")); + } + + public Object run(String[] args) throws Exception { long time = -System.currentTimeMillis(); - Map args = context.getArguments(); - initializeFromArguments((String[]) args.get("application.args")); + initializeFromArguments(args); Properties props = new Properties(); props.setProperty(Profile.PROP_INSTALL_FOLDER, destination); diff --git a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java new file mode 100644 index 000000000..fb430c1ee --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * Copyright (c) 2007 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.p2.director.app.ant; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import org.apache.tools.ant.*; +import org.eclipse.equinox.internal.p2.director.app.Application; +import org.osgi.framework.Version; + +/** + * An Ant task to call the p2 Director application. + * + * @since 1.0 + */ +public class DirectorTask extends Task { + + boolean roaming; + String profile, flavor, os, ws, nl, arch, installIU, uninstallIU; + File destination, bundlePool; + URL metadataRepository, artifactRepository; + Version version; + + /* + * (non-Javadoc) + * @see org.apache.tools.ant.Task#execute() + */ + public void execute() throws BuildException { + try { + // collect the arguments and call the application + new Application().run(getArguments()); + } catch (Exception e) { + throw new BuildException("Exception while calling the director task.", e); + } + } + + private String[] getArguments() { + List result = new ArrayList(); + if (roaming) + result.add("-roaming"); + if (profile != null) { + result.add("-profile"); + result.add(profile); + } + if (destination != null) { + result.add("-destination"); + result.add(destination.getAbsolutePath()); + } + if (bundlePool != null) { + result.add("-bundlePool"); + result.add(bundlePool.getAbsolutePath()); + } + if (metadataRepository != null) { + result.add("-metadataRepository"); + result.add(metadataRepository.toExternalForm()); + } + if (artifactRepository != null) { + result.add("-artifactRepository"); + result.add(artifactRepository.toExternalForm()); + } + if (flavor != null) { + result.add("-flavor"); + result.add(flavor); + } + if (version != null) { + result.add("-version"); + result.add(version.toString()); + } + if (os != null) { + result.add("-p2.os"); + result.add(os); + } + if (ws != null) { + result.add("-p2.ws"); + result.add(ws); + } + if (arch != null) { + result.add("-p2.arch"); + result.add(arch); + } + if (nl != null) { + result.add("-p2.nl"); + result.add(nl); + } + if (installIU != null) { + result.add("-installIU"); + result.add(installIU); + } + if (uninstallIU != null) { + result.add("-uninstallIU"); + result.add(uninstallIU); + } + return (String[]) result.toArray(new String[result.size()]); + } + + public void setArch(String value) { + arch = value; + } + + public void setArtifactRepository(String value) { + try { + artifactRepository = new URL(value); + } catch (MalformedURLException e) { + log("Error setting the artifact repository.", e, Project.MSG_ERR); + } + } + + public void setBundlePool(String value) { + bundlePool = new File(value); + } + + public void setDestination(String value) { + destination = new File(value); + } + + public void setFlavor(String value) { + flavor = value; + } + + public void setInstallIU(String value) { + installIU = value; + } + + public void setMetadataRepository(String value) { + try { + metadataRepository = new URL(value); + } catch (MalformedURLException e) { + log("Error setting the metadata repository.", e, Project.MSG_ERR); + } + } + + public void setNl(String value) { + nl = value; + } + + public void setOs(String value) { + os = value; + } + + public void setProfile(String value) { + profile = value; + } + + public void setRoaming(String value) { + roaming = Boolean.valueOf(value).booleanValue(); + } + + public void setUninstallIU(String value) { + uninstallIU = value; + } + + public void setVersion(String value) { + version = new Version(value); + } + + public void setWs(String value) { + ws = value; + } +} |