diff options
author | Markus Knauer | 2008-04-03 13:20:20 +0000 |
---|---|---|
committer | Markus Knauer | 2008-04-03 13:20:20 +0000 |
commit | f95a3e70be0af36d5afd27d95c5f2aed9dd66a32 (patch) | |
tree | fa34f7345a72d7a4cf61e9070f3fb356a70f1f1f | |
parent | 197f787440f52bb116d3d7006dedea0dbd288d15 (diff) | |
download | org.eclipse.epp.packages-f95a3e70be0af36d5afd27d95c5f2aed9dd66a32.tar.gz org.eclipse.epp.packages-f95a3e70be0af36d5afd27d95c5f2aed9dd66a32.tar.xz org.eclipse.epp.packages-f95a3e70be0af36d5afd27d95c5f2aed9dd66a32.zip |
fixed bundle path resolving error
5 files changed, 33 insertions, 62 deletions
diff --git a/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF index 84542103..36e0862e 100644 --- a/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.ant.core, org.eclipse.update.core, org.eclipse.pde.build, - org.apache.ant + org.apache.ant, + org.eclipse.core.resources Export-Package: org.eclipse.epp.packaging.core, org.eclipse.epp.packaging.core.assembly, org.eclipse.epp.packaging.core.configuration, diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java index 3045076a..317d0111 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Innoopract Informationssysteme GmbH + * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH * 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 @@ -156,7 +156,7 @@ public class EclipsePackager implements IPackager { } } - public void packApplication() throws CoreException, IOException { + public void packApplication() throws CoreException, IOException, URISyntaxException { MessageLogger.getInstance().logBeginProcess( "EclipsePackager.Running" ); //$NON-NLS-1$ this.runner.packApplication(); MessageLogger.getInstance().logEndProcess(); diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/IPackager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/IPackager.java index 8a982d62..17dc8afb 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/IPackager.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/IPackager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Innoopract Informationssysteme GmbH + * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH * 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 @@ -11,6 +11,7 @@ package org.eclipse.epp.packaging.core.assembly; import java.io.IOException; +import java.net.URISyntaxException; import org.eclipse.core.runtime.CoreException; @@ -24,6 +25,7 @@ public interface IPackager { * TODO mknauer missing doc * @throws CoreException * @throws IOException + * @throws URISyntaxException */ - public void packApplication() throws CoreException, IOException; + public void packApplication() throws CoreException, IOException, URISyntaxException; }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagerRunner.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagerRunner.java index 8976e658..08cc8299 100644 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagerRunner.java +++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagerRunner.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Innoopract Informationssysteme GmbH + * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH * 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 @@ -10,12 +10,17 @@ *******************************************************************************/ package org.eclipse.epp.packaging.core.assembly; +import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; import java.util.ArrayList; import java.util.List; import org.eclipse.ant.core.AntRunner; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; /** * An IPackager based on the PDE Build packager. Locates, configures and @@ -33,10 +38,12 @@ public class PackagerRunner implements IPackager { private final List<String> platforms = new ArrayList<String>(); private final List<String> formats = new ArrayList<String>(); - public void packApplication() throws CoreException, IOException { + public void packApplication() + throws CoreException, IOException, URISyntaxException + { AntRunner runner = new AntRunner(); - String scriptLocation = PluginUtils.getPluginPath( PDE_BUILD_PLUGIN_ID ) - + "/scripts/package.xml";//$NON-NLS-1$ + String scriptLocation + = getScriptPath( PDE_BUILD_PLUGIN_ID, "scripts/package.xml" );//$NON-NLS-1$ runner.setBuildFileLocation( scriptLocation ); addFeatureListToArguments(); addPlatformListToArguments(); @@ -94,7 +101,9 @@ public class PackagerRunner implements IPackager { setArgument( ARGUMENT_CONFIGURATION_FOLDER, folder ); } - /** Sets the working directory for the PDE packager. + /** + * Sets the working directory for the PDE packager. + * * @param folder directory name of the base directory */ public void setBaseDirectory( final String folder ) { @@ -133,4 +142,15 @@ public class PackagerRunner implements IPackager { public void setArchiveFormat( final String platform, final String format ) { this.formats.add( platform + '-' + format ); } + + // helping methods + // //////////////// + private String getScriptPath( final String pluginId, final String path ) + throws IOException, URISyntaxException + { + URI uri = new URI( "platform:/plugin/" + pluginId ); //$NON-NLS-1$ + URL fileUrl = FileLocator.toFileURL( uri.toURL() ); + File file = new File( fileUrl.toURI() ); + return file.getAbsolutePath() + File.separator + path; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PluginUtils.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PluginUtils.java deleted file mode 100644 index 39448ace..00000000 --- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PluginUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Innoopract Informationssysteme GmbH - * 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: - * Innoopract - initial API and implementation - *******************************************************************************/ -package org.eclipse.epp.packaging.core.assembly; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.osgi.service.datalocation.Location; - -/** - * Utility class for Plugin-related tasks. - */ -public class PluginUtils { - - /** Locates the given plugin in the install location. - * - * TODO mknauer missing doc - * @param pluginId - * @return plugin path - * @throws IOException - */ - // This could be done via SiteManager and featurereferences, if the - // application was feature-based, not plugin-based. - public static String getPluginPath( final String pluginId ) throws IOException { - Location installLocation = Platform.getInstallLocation(); - String locationFile = installLocation.getURL().getFile(); - File file = new File( locationFile, "plugins" ); //$NON-NLS-1$ - String result = null; - for( File pluginFile : file.listFiles() ) { - if( pluginFile.getName().startsWith( pluginId ) ) { - result = pluginFile.getCanonicalPath(); - } - } - if( result == null ) { - throw new IllegalStateException( "Required plug-in " //$NON-NLS-1$ - + pluginId - + " not found in folder " //$NON-NLS-1$ - + locationFile - + "plugins." ); //$NON-NLS-1$ - } - return result; - } -}
\ No newline at end of file |