|
Lines 10-15
Link Here
|
| 10 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option |
10 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 219530 [jar application] add Jar-in-Jar ClassLoader option |
| 11 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip |
11 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262766 [jar exporter] ANT file for Jar-in-Jar option contains relative path to jar-rsrc-loader.zip |
| 12 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter |
12 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 262763 [jar exporter] remove Built-By attribute in ANT files from Fat JAR Exporter |
|
|
13 |
* Ferenc Hechler, ferenc_hechler@users.sourceforge.net - 269201 [jar exporter] ant file produced by Export runnable jar contains absolut paths instead of relative to workspace |
| 13 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 14 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
15 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
| 15 |
|
16 |
|
|
Lines 50-58
Link Here
|
| 50 |
|
51 |
|
| 51 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
52 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
| 52 |
OutputStream outputStream = new FileOutputStream(antScriptLocation.toFile()); |
53 |
OutputStream outputStream = new FileOutputStream(antScriptLocation.toFile()); |
| 53 |
String absJarname= absJarfile.toString(); |
54 |
|
| 54 |
String subfolder= absJarfile.removeFileExtension().lastSegment() + "_lib"; //$NON-NLS-1$ |
55 |
String destDir= makeWorkspaceRelativePath(absJarfile.toFile().getParent()); |
| 55 |
String absSubfolder= absJarfile.removeLastSegments(1).append(subfolder).toString(); |
56 |
String destName= absJarfile.removeFileExtension().lastSegment(); |
| 56 |
|
57 |
|
| 57 |
DocumentBuilder docBuilder= null; |
58 |
DocumentBuilder docBuilder= null; |
| 58 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
59 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
|
Lines 76-87
Link Here
|
| 76 |
project.appendChild(comment); |
77 |
project.appendChild(comment); |
| 77 |
document.appendChild(project); |
78 |
document.appendChild(project); |
| 78 |
|
79 |
|
|
|
80 |
// <property name="workspace" location="C:/eclipse/workspace-runnableJar" /> |
| 81 |
Element property= document.createElement("property"); //$NON-NLS-1$ |
| 82 |
property.setAttribute("name", "workspace"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 83 |
property.setAttribute("location", getWorkspaceDir()); //$NON-NLS-1$ |
| 84 |
project.appendChild(property); |
| 85 |
|
| 86 |
// <property name="destdir" location="c:/xx" /> |
| 87 |
property= document.createElement("property"); //$NON-NLS-1$ |
| 88 |
property.setAttribute("name", "destdir"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 89 |
property.setAttribute("location", destDir); //$NON-NLS-1$ |
| 90 |
project.appendChild(property); |
| 91 |
|
| 92 |
// <property name="destname" value="runnableJarOutput" /> |
| 93 |
property= document.createElement("property"); //$NON-NLS-1$ |
| 94 |
property.setAttribute("name", "destname"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 95 |
property.setAttribute("value", destName); //$NON-NLS-1$ |
| 96 |
project.appendChild(property); |
| 97 |
|
| 98 |
// <property name="destjar" location="${destdir}/${destname}.jar" /> |
| 99 |
property= document.createElement("property"); //$NON-NLS-1$ |
| 100 |
property.setAttribute("name", "destjar"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 101 |
property.setAttribute("location", "${destdir}" + File.separator + "${destname}.jar"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 102 |
project.appendChild(property); |
| 103 |
|
| 104 |
// <property name="subdirname" value="${destname}_lib" /> |
| 105 |
property= document.createElement("property"); //$NON-NLS-1$ |
| 106 |
property.setAttribute("name", "subdirname"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 107 |
property.setAttribute("value", "${destname}_lib"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 108 |
project.appendChild(property); |
| 109 |
|
| 110 |
// <property name="subdir" location="${destdir}/${subdirname}" /> |
| 111 |
property= document.createElement("property"); //$NON-NLS-1$ |
| 112 |
property.setAttribute("name", "subdir"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 113 |
property.setAttribute("location", "${destdir}" + File.separator + "${subdirname}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 114 |
project.appendChild(property); |
| 115 |
|
| 79 |
Element target= document.createElement("target"); //$NON-NLS-1$ |
116 |
Element target= document.createElement("target"); //$NON-NLS-1$ |
| 80 |
target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
117 |
target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 81 |
project.appendChild(target); |
118 |
project.appendChild(target); |
| 82 |
|
119 |
|
|
|
120 |
// <mkdir dir="${destdir}" /> |
| 121 |
Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$ |
| 122 |
mkdir.setAttribute("dir", "${destdir}"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 123 |
project.appendChild(mkdir); |
| 124 |
|
| 83 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
125 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
| 84 |
jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s |
126 |
jar.setAttribute("destfile", "${destjar}"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 85 |
target.appendChild(jar); |
127 |
target.appendChild(jar); |
| 86 |
|
128 |
|
| 87 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
129 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
|
Lines 99-105
Link Here
|
| 99 |
for (int i= 0; i < sourceInfos.length; i++) { |
141 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 100 |
SourceInfo sourceInfo= sourceInfos[i]; |
142 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 101 |
if (sourceInfo.isJar) { |
143 |
if (sourceInfo.isJar) { |
| 102 |
classPath.append(" ").append(subfolder).append("/") //$NON-NLS-1$ //$NON-NLS-2$ |
144 |
classPath.append(" ").append("${subdirname}").append("/") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 103 |
.append(new File(sourceInfo.absPath).getName()); |
145 |
.append(new File(sourceInfo.absPath).getName()); |
| 104 |
} |
146 |
} |
| 105 |
} |
147 |
} |
|
Lines 111-128
Link Here
|
| 111 |
SourceInfo sourceInfo= sourceInfos[i]; |
153 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 112 |
if (!sourceInfo.isJar) { |
154 |
if (!sourceInfo.isJar) { |
| 113 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
155 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
| 114 |
fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$ |
156 |
fileset.setAttribute("dir", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$ |
| 115 |
jar.appendChild(fileset); |
157 |
jar.appendChild(fileset); |
| 116 |
} |
158 |
} |
| 117 |
} |
159 |
} |
| 118 |
|
160 |
|
| 119 |
|
|
|
| 120 |
Element delete= document.createElement("delete"); //$NON-NLS-1$ |
161 |
Element delete= document.createElement("delete"); //$NON-NLS-1$ |
| 121 |
delete.setAttribute("dir", absSubfolder); //$NON-NLS-1$s |
162 |
delete.setAttribute("dir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 122 |
target.appendChild(delete); |
163 |
target.appendChild(delete); |
| 123 |
|
164 |
|
| 124 |
Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$ |
165 |
mkdir= document.createElement("mkdir"); //$NON-NLS-1$ |
| 125 |
mkdir.setAttribute("dir", absSubfolder); //$NON-NLS-1$s |
166 |
mkdir.setAttribute("dir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 126 |
target.appendChild(mkdir); |
167 |
target.appendChild(mkdir); |
| 127 |
|
168 |
|
| 128 |
// add libraries |
169 |
// add libraries |
|
Lines 130-137
Link Here
|
| 130 |
SourceInfo sourceInfo= sourceInfos[i]; |
171 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 131 |
if (sourceInfo.isJar) { |
172 |
if (sourceInfo.isJar) { |
| 132 |
Element copy= document.createElement("copy"); //$NON-NLS-1$ |
173 |
Element copy= document.createElement("copy"); //$NON-NLS-1$ |
| 133 |
copy.setAttribute("file", sourceInfo.absPath); //$NON-NLS-1$ |
174 |
copy.setAttribute("file", makeWorkspaceRelativePath(sourceInfo.absPath)); //$NON-NLS-1$ |
| 134 |
copy.setAttribute("todir", absSubfolder); //$NON-NLS-1$ |
175 |
copy.setAttribute("todir", "${subdir}"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 135 |
target.appendChild(copy); |
176 |
target.appendChild(copy); |
| 136 |
} |
177 |
} |
| 137 |
} |
178 |
} |