|
Lines 14-19
Link Here
|
| 14 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 15 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
15 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
| 16 |
|
16 |
|
|
|
17 |
import java.io.File; |
| 17 |
import java.io.FileNotFoundException; |
18 |
import java.io.FileNotFoundException; |
| 18 |
import java.io.IOException; |
19 |
import java.io.IOException; |
| 19 |
import java.util.ArrayList; |
20 |
import java.util.ArrayList; |
|
Lines 162-167
Link Here
|
| 162 |
} |
163 |
} |
| 163 |
|
164 |
|
| 164 |
return result; |
165 |
return result; |
|
|
166 |
} |
| 167 |
|
| 168 |
protected File GetRelativePath(File actualDir, File baseDir) { |
| 169 |
java.nio.file.Path basePath= baseDir.toPath(); |
| 170 |
java.nio.file.Path path= actualDir.toPath(); |
| 171 |
|
| 172 |
return basePath.relativize(path).toFile(); |
| 165 |
} |
173 |
} |
| 166 |
|
174 |
|
| 167 |
/** |
175 |
/** |
|
Lines 56-62
Link Here
|
| 56 |
@Override |
56 |
@Override |
| 57 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws FileNotFoundException, IOException { |
57 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws FileNotFoundException, IOException { |
| 58 |
File antScriptFile= antScriptLocation.toFile(); |
58 |
File antScriptFile= antScriptLocation.toFile(); |
| 59 |
buildANTScript(new FileOutputStream(antScriptFile), projectName, absJarfile, mainClass, sourceInfos); |
59 |
buildANTScript(antScriptFile, projectName, absJarfile, mainClass, sourceInfos); |
| 60 |
copyJarInJarLoader(new File(antScriptFile.getParentFile(), FatJarRsrcUrlBuilder.JAR_RSRC_LOADER_ZIP)); |
60 |
copyJarInJarLoader(new File(antScriptFile.getParentFile(), FatJarRsrcUrlBuilder.JAR_RSRC_LOADER_ZIP)); |
| 61 |
} |
61 |
} |
| 62 |
|
62 |
|
|
Lines 74-176
Link Here
|
| 74 |
is.close(); |
74 |
is.close(); |
| 75 |
} |
75 |
} |
| 76 |
|
76 |
|
| 77 |
protected void buildANTScript(OutputStream outputStream, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
77 |
protected void buildANTScript(File antScriptFile, String projectName, IPath jarFileLocation, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
| 78 |
|
78 |
OutputStream outputStream= null; |
| 79 |
String absJarname= absJarfile.toString(); |
79 |
|
| 80 |
|
|
|
| 81 |
DocumentBuilder docBuilder= null; |
| 82 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
| 83 |
factory.setValidating(false); |
| 84 |
try { |
80 |
try { |
| 85 |
docBuilder= factory.newDocumentBuilder(); |
81 |
outputStream= new FileOutputStream(antScriptFile); |
| 86 |
} catch (ParserConfigurationException ex) { |
82 |
File antScriptFolder= antScriptFile.getParentFile(); |
| 87 |
throw new IOException(FatJarPackagerMessages.FatJarPackageAntScript_error_couldNotGetXmlBuilder); |
83 |
|
| 88 |
} |
84 |
File jarFile= GetRelativePath(jarFileLocation.toFile(), antScriptFolder); |
| 89 |
Document document= docBuilder.newDocument(); |
85 |
|
| 90 |
|
86 |
DocumentBuilder docBuilder= null; |
| 91 |
Node comment; |
87 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
| 92 |
|
88 |
factory.setValidating(false); |
| 93 |
// Create the document |
89 |
try { |
| 94 |
Element project= document.createElement("project"); //$NON-NLS-1$ |
90 |
docBuilder= factory.newDocumentBuilder(); |
| 95 |
project.setAttribute("name", "Create Runnable Jar for Project " + projectName + " with Jar-in-Jar Loader"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
91 |
} catch (ParserConfigurationException ex) { |
| 96 |
project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
92 |
throw new IOException(FatJarPackagerMessages.FatJarPackageAntScript_error_couldNotGetXmlBuilder); |
| 97 |
comment= document.createComment("this file was created by Eclipse Runnable JAR Export Wizard"); //$NON-NLS-1$ |
|
|
| 98 |
project.appendChild(comment); |
| 99 |
comment= document.createComment("ANT 1.7 is required "); //$NON-NLS-1$ |
| 100 |
project.appendChild(comment); |
| 101 |
document.appendChild(project); |
| 102 |
|
| 103 |
Element target= document.createElement("target"); //$NON-NLS-1$ |
| 104 |
target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 105 |
project.appendChild(target); |
| 106 |
|
| 107 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
| 108 |
jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s |
| 109 |
target.appendChild(jar); |
| 110 |
|
| 111 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
| 112 |
jar.appendChild(manifest); |
| 113 |
|
| 114 |
Element attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 115 |
attribute.setAttribute("name", "Main-Class"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 116 |
attribute.setAttribute("value", JIJConstants.LOADER_MAIN_CLASS); //$NON-NLS-1$ |
| 117 |
manifest.appendChild(attribute); |
| 118 |
|
| 119 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 120 |
attribute.setAttribute("name", JIJConstants.REDIRECTED_MAIN_CLASS_MANIFEST_NAME); //$NON-NLS-1$ |
| 121 |
attribute.setAttribute("value", mainClass); //$NON-NLS-1$ |
| 122 |
manifest.appendChild(attribute); |
| 123 |
|
| 124 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 125 |
attribute.setAttribute("name", "Class-Path"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 126 |
attribute.setAttribute("value", "."); //$NON-NLS-1$ //$NON-NLS-2$ |
| 127 |
manifest.appendChild(attribute); |
| 128 |
|
| 129 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 130 |
attribute.setAttribute("name", JIJConstants.REDIRECTED_CLASS_PATH_MANIFEST_NAME); //$NON-NLS-1$ |
| 131 |
StringBuffer rsrcClassPath= new StringBuffer(); |
| 132 |
rsrcClassPath.append(JIJConstants.CURRENT_DIR); |
| 133 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 134 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 135 |
if (sourceInfo.isJar) { |
| 136 |
rsrcClassPath.append(" ") //$NON-NLS-1$ |
| 137 |
.append(new File(sourceInfo.absPath).getName()); |
| 138 |
} |
93 |
} |
| 139 |
} |
94 |
Document document= docBuilder.newDocument(); |
| 140 |
attribute.setAttribute("value", rsrcClassPath.toString()); //$NON-NLS-1$ |
95 |
|
| 141 |
manifest.appendChild(attribute); |
96 |
Node comment; |
| 142 |
|
97 |
|
| 143 |
Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
98 |
// Create the document |
| 144 |
zipfileset.setAttribute("src", FatJarRsrcUrlBuilder.JAR_RSRC_LOADER_ZIP); //$NON-NLS-1$ |
99 |
Element project= document.createElement("project"); //$NON-NLS-1$ |
| 145 |
jar.appendChild(zipfileset); |
100 |
project.setAttribute("name", "Create Runnable Jar for Project " + projectName + " with Jar-in-Jar Loader"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 146 |
|
101 |
project.setAttribute("default", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 147 |
for (int i= 0; i < sourceInfos.length; i++) { |
102 |
comment= document.createComment("this file was created by Eclipse Runnable JAR Export Wizard"); //$NON-NLS-1$ |
| 148 |
SourceInfo sourceInfo= sourceInfos[i]; |
103 |
project.appendChild(comment); |
| 149 |
if (sourceInfo.isJar) { |
104 |
comment= document.createComment("ANT 1.7 is required "); //$NON-NLS-1$ |
| 150 |
File jarFile= new File(sourceInfo.absPath); |
105 |
project.appendChild(comment); |
| 151 |
Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
106 |
document.appendChild(project); |
| 152 |
fileset.setAttribute("dir", jarFile.getParent()); //$NON-NLS-1$ |
107 |
|
| 153 |
fileset.setAttribute("includes", jarFile.getName()); //$NON-NLS-1$ |
108 |
Element target= document.createElement("target"); //$NON-NLS-1$ |
| 154 |
jar.appendChild(fileset); |
109 |
target.setAttribute("name", "create_run_jar"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 155 |
} else { |
110 |
project.appendChild(target); |
| 156 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
111 |
|
| 157 |
fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$ |
112 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
| 158 |
jar.appendChild(fileset); |
113 |
jar.setAttribute("destfile", jarFile.toString()); //$NON-NLS-1$s |
|
|
114 |
target.appendChild(jar); |
| 115 |
|
| 116 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
| 117 |
jar.appendChild(manifest); |
| 118 |
|
| 119 |
Element attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 120 |
attribute.setAttribute("name", "Main-Class"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 121 |
attribute.setAttribute("value", JIJConstants.LOADER_MAIN_CLASS); //$NON-NLS-1$ |
| 122 |
manifest.appendChild(attribute); |
| 123 |
|
| 124 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 125 |
attribute.setAttribute("name", JIJConstants.REDIRECTED_MAIN_CLASS_MANIFEST_NAME); //$NON-NLS-1$ |
| 126 |
attribute.setAttribute("value", mainClass); //$NON-NLS-1$ |
| 127 |
manifest.appendChild(attribute); |
| 128 |
|
| 129 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 130 |
attribute.setAttribute("name", "Class-Path"); //$NON-NLS-1$ //$NON-NLS-2$s |
| 131 |
attribute.setAttribute("value", "."); //$NON-NLS-1$ //$NON-NLS-2$ |
| 132 |
manifest.appendChild(attribute); |
| 133 |
|
| 134 |
attribute= document.createElement("attribute"); //$NON-NLS-1$ |
| 135 |
attribute.setAttribute("name", JIJConstants.REDIRECTED_CLASS_PATH_MANIFEST_NAME); //$NON-NLS-1$ |
| 136 |
StringBuffer rsrcClassPath= new StringBuffer(); |
| 137 |
rsrcClassPath.append(JIJConstants.CURRENT_DIR); |
| 138 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 139 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 140 |
if (sourceInfo.isJar) { |
| 141 |
rsrcClassPath.append(" ") //$NON-NLS-1$ |
| 142 |
.append(new File(sourceInfo.absPath).getName()); |
| 143 |
} |
| 144 |
} |
| 145 |
attribute.setAttribute("value", rsrcClassPath.toString()); //$NON-NLS-1$ |
| 146 |
manifest.appendChild(attribute); |
| 147 |
|
| 148 |
Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
| 149 |
zipfileset.setAttribute("src", FatJarRsrcUrlBuilder.JAR_RSRC_LOADER_ZIP); //$NON-NLS-1$ |
| 150 |
jar.appendChild(zipfileset); |
| 151 |
|
| 152 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 153 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 154 |
File sourceFile = new File(sourceInfo.absPath); |
| 155 |
String relativeParent= GetRelativePath(sourceFile.getParentFile(), antScriptFolder).toString(); |
| 156 |
String relativeName= GetRelativePath(sourceFile, antScriptFolder).toString(); |
| 157 |
|
| 158 |
if (sourceInfo.isJar) { |
| 159 |
Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
| 160 |
fileset.setAttribute("dir", relativeParent); //$NON-NLS-1$ |
| 161 |
fileset.setAttribute("includes", relativeName); //$NON-NLS-1$ |
| 162 |
jar.appendChild(fileset); |
| 163 |
} else { |
| 164 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
| 165 |
fileset.setAttribute("dir", relativeName); //$NON-NLS-1$ |
| 166 |
jar.appendChild(fileset); |
| 167 |
} |
| 168 |
} |
| 169 |
|
| 170 |
try { |
| 171 |
// Write the document to the stream |
| 172 |
Transformer transformer= TransformerFactory.newInstance().newTransformer(); |
| 173 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
| 174 |
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ |
| 175 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
| 176 |
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 177 |
DOMSource source= new DOMSource(document); |
| 178 |
StreamResult result= new StreamResult(outputStream); |
| 179 |
transformer.transform(source, result); |
| 180 |
} catch (TransformerException e) { |
| 181 |
throw new IOException(FatJarPackagerMessages.FatJarPackageAntScript_error_couldNotTransformToXML); |
| 182 |
} |
| 183 |
} finally { |
| 184 |
if (outputStream != null) { |
| 185 |
outputStream.close(); |
| 159 |
} |
186 |
} |
| 160 |
} |
|
|
| 161 |
|
| 162 |
try { |
| 163 |
// Write the document to the stream |
| 164 |
Transformer transformer= TransformerFactory.newInstance().newTransformer(); |
| 165 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
| 166 |
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ |
| 167 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
| 168 |
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 169 |
DOMSource source= new DOMSource(document); |
| 170 |
StreamResult result= new StreamResult(outputStream); |
| 171 |
transformer.transform(source, result); |
| 172 |
} catch (TransformerException e) { |
| 173 |
throw new IOException(FatJarPackagerMessages.FatJarPackageAntScript_error_couldNotTransformToXML); |
| 174 |
} |
187 |
} |
| 175 |
} |
188 |
} |
| 176 |
|
189 |
|
|
Lines 13-18
Link Here
|
| 13 |
*******************************************************************************/ |
13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
14 |
package org.eclipse.jdt.internal.ui.jarpackagerfat; |
| 15 |
|
15 |
|
|
|
16 |
import java.io.File; |
| 16 |
import java.io.FileOutputStream; |
17 |
import java.io.FileOutputStream; |
| 17 |
import java.io.IOException; |
18 |
import java.io.IOException; |
| 18 |
import java.io.OutputStream; |
19 |
import java.io.OutputStream; |
|
Lines 45-55
Link Here
|
| 45 |
} |
46 |
} |
| 46 |
|
47 |
|
| 47 |
@Override |
48 |
@Override |
| 48 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
49 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath jarFileLocation, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
| 49 |
OutputStream outputStream= null; |
50 |
OutputStream outputStream= null; |
|
|
51 |
|
| 50 |
try { |
52 |
try { |
| 51 |
outputStream= new FileOutputStream(antScriptLocation.toFile()); |
53 |
File antScriptFile= antScriptLocation.toFile(); |
| 52 |
String absJarname= absJarfile.toString(); |
54 |
File antScriptFolder= antScriptFile.getParentFile(); |
|
|
55 |
outputStream= new FileOutputStream(antScriptFile); |
| 56 |
|
| 57 |
File jarFile= GetRelativePath(jarFileLocation.toFile(), antScriptFolder); |
| 53 |
|
58 |
|
| 54 |
DocumentBuilder docBuilder= null; |
59 |
DocumentBuilder docBuilder= null; |
| 55 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
60 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
|
Lines 78-84
Link Here
|
| 78 |
project.appendChild(target); |
83 |
project.appendChild(target); |
| 79 |
|
84 |
|
| 80 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
85 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
| 81 |
jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s |
86 |
jar.setAttribute("destfile", jarFile.toString()); //$NON-NLS-1$s |
| 82 |
jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$ |
87 |
jar.setAttribute("filesetmanifest", "mergewithoutmain"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 83 |
target.appendChild(jar); |
88 |
target.appendChild(jar); |
| 84 |
|
89 |
|
|
Lines 97-110
Link Here
|
| 97 |
|
102 |
|
| 98 |
for (int i= 0; i < sourceInfos.length; i++) { |
103 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 99 |
SourceInfo sourceInfo= sourceInfos[i]; |
104 |
SourceInfo sourceInfo= sourceInfos[i]; |
|
|
105 |
File sourceFile = new File(sourceInfo.absPath); |
| 106 |
String relativeName= GetRelativePath(sourceFile, antScriptFolder).toString(); |
| 107 |
|
| 100 |
if (sourceInfo.isJar) { |
108 |
if (sourceInfo.isJar) { |
| 101 |
Element zipfileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
109 |
Element fileset= document.createElement("zipfileset"); //$NON-NLS-1$ |
| 102 |
zipfileset.setAttribute("src", sourceInfo.absPath); //$NON-NLS-1$ |
110 |
fileset.setAttribute("src", relativeName); //$NON-NLS-1$ |
| 103 |
zipfileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$ |
111 |
fileset.setAttribute("excludes", "META-INF/*.SF"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 104 |
jar.appendChild(zipfileset); |
112 |
jar.appendChild(fileset); |
| 105 |
} else { |
113 |
} else { |
| 106 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
114 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
| 107 |
fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$ |
115 |
fileset.setAttribute("dir", relativeName); //$NON-NLS-1$ |
| 108 |
jar.appendChild(fileset); |
116 |
jar.appendChild(fileset); |
| 109 |
} |
117 |
} |
| 110 |
} |
118 |
} |
|
Lines 35-40
Link Here
|
| 35 |
import org.eclipse.core.runtime.IPath; |
35 |
import org.eclipse.core.runtime.IPath; |
| 36 |
|
36 |
|
| 37 |
import org.eclipse.debug.core.ILaunchConfiguration; |
37 |
import org.eclipse.debug.core.ILaunchConfiguration; |
|
|
38 |
import org.eclipse.jdt.internal.ui.jarpackagerfat.FatJarAntExporter.SourceInfo; |
| 38 |
|
39 |
|
| 39 |
/** |
40 |
/** |
| 40 |
* Create an ANT script for a runnable JAR wit libraries in a sub-folder. The script is generated |
41 |
* Create an ANT script for a runnable JAR wit libraries in a sub-folder. The script is generated |
|
Lines 49-61
Link Here
|
| 49 |
} |
50 |
} |
| 50 |
|
51 |
|
| 51 |
@Override |
52 |
@Override |
| 52 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath absJarfile, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
53 |
protected void buildANTScript(IPath antScriptLocation, String projectName, IPath jarFileLocation, String mainClass, SourceInfo[] sourceInfos) throws IOException { |
| 53 |
OutputStream outputStream= null; |
54 |
OutputStream outputStream= null; |
| 54 |
try { |
55 |
try { |
| 55 |
outputStream= new FileOutputStream(antScriptLocation.toFile()); |
56 |
File antScriptFile= antScriptLocation.toFile(); |
| 56 |
String absJarname= absJarfile.toString(); |
57 |
File antScriptFolder= antScriptFile.getParentFile(); |
| 57 |
String subfolder= absJarfile.removeFileExtension().lastSegment() + "_lib"; //$NON-NLS-1$ |
58 |
outputStream= new FileOutputStream(antScriptFile); |
| 58 |
String absSubfolder= absJarfile.removeLastSegments(1).append(subfolder).toString(); |
59 |
|
|
|
60 |
File jarFile= GetRelativePath(jarFileLocation.toFile(), antScriptFolder); |
| 61 |
File jarSubfolder= GetRelativePath(new File(jarFileLocation.removeFileExtension() + "_lib"), antScriptFolder); |
| 59 |
|
62 |
|
| 60 |
DocumentBuilder docBuilder= null; |
63 |
DocumentBuilder docBuilder= null; |
| 61 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
64 |
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance(); |
|
Lines 84-90
Link Here
|
| 84 |
project.appendChild(target); |
87 |
project.appendChild(target); |
| 85 |
|
88 |
|
| 86 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
89 |
Element jar= document.createElement("jar"); //$NON-NLS-1$ |
| 87 |
jar.setAttribute("destfile", absJarname); //$NON-NLS-1$s |
90 |
jar.setAttribute("destfile", jarFile.toString()); //$NON-NLS-1$s |
| 88 |
target.appendChild(jar); |
91 |
target.appendChild(jar); |
| 89 |
|
92 |
|
| 90 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
93 |
Element manifest= document.createElement("manifest"); //$NON-NLS-1$ |
|
Lines 102-108
Link Here
|
| 102 |
for (int i= 0; i < sourceInfos.length; i++) { |
105 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 103 |
SourceInfo sourceInfo= sourceInfos[i]; |
106 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 104 |
if (sourceInfo.isJar) { |
107 |
if (sourceInfo.isJar) { |
| 105 |
classPath.append(" ").append(subfolder).append("/") //$NON-NLS-1$ //$NON-NLS-2$ |
108 |
classPath.append(" ").append(jarSubfolder).append("/") //$NON-NLS-1$ //$NON-NLS-2$ |
| 106 |
.append(new File(sourceInfo.absPath).getName()); |
109 |
.append(new File(sourceInfo.absPath).getName()); |
| 107 |
} |
110 |
} |
| 108 |
} |
111 |
} |
|
Lines 112-140
Link Here
|
| 112 |
// add folders |
115 |
// add folders |
| 113 |
for (int i= 0; i < sourceInfos.length; i++) { |
116 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 114 |
SourceInfo sourceInfo= sourceInfos[i]; |
117 |
SourceInfo sourceInfo= sourceInfos[i]; |
|
|
118 |
|
| 115 |
if (!sourceInfo.isJar) { |
119 |
if (!sourceInfo.isJar) { |
|
|
120 |
File sourceFile= new File(sourceInfo.absPath); |
| 121 |
String relativeName= GetRelativePath(sourceFile, antScriptFolder).toString(); |
| 122 |
|
| 116 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
123 |
Element fileset= document.createElement("fileset"); //$NON-NLS-1$ |
| 117 |
fileset.setAttribute("dir", sourceInfo.absPath); //$NON-NLS-1$ |
124 |
fileset.setAttribute("dir", relativeName); //$NON-NLS-1$ |
| 118 |
jar.appendChild(fileset); |
125 |
jar.appendChild(fileset); |
| 119 |
} |
126 |
} |
| 120 |
} |
127 |
} |
| 121 |
|
128 |
|
| 122 |
|
129 |
|
| 123 |
Element delete= document.createElement("delete"); //$NON-NLS-1$ |
130 |
Element delete= document.createElement("delete"); //$NON-NLS-1$ |
| 124 |
delete.setAttribute("dir", absSubfolder); //$NON-NLS-1$s |
131 |
delete.setAttribute("dir", jarSubfolder.toString()); //$NON-NLS-1$s |
| 125 |
target.appendChild(delete); |
132 |
target.appendChild(delete); |
| 126 |
|
133 |
|
| 127 |
Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$ |
134 |
Element mkdir= document.createElement("mkdir"); //$NON-NLS-1$ |
| 128 |
mkdir.setAttribute("dir", absSubfolder); //$NON-NLS-1$s |
135 |
mkdir.setAttribute("dir", jarSubfolder.toString()); //$NON-NLS-1$s |
| 129 |
target.appendChild(mkdir); |
136 |
target.appendChild(mkdir); |
| 130 |
|
137 |
|
| 131 |
// add libraries |
138 |
// add libraries |
| 132 |
for (int i= 0; i < sourceInfos.length; i++) { |
139 |
for (int i= 0; i < sourceInfos.length; i++) { |
| 133 |
SourceInfo sourceInfo= sourceInfos[i]; |
140 |
SourceInfo sourceInfo= sourceInfos[i]; |
| 134 |
if (sourceInfo.isJar) { |
141 |
if (sourceInfo.isJar) { |
|
|
142 |
File sourceFile= new File(sourceInfo.absPath); |
| 135 |
Element copy= document.createElement("copy"); //$NON-NLS-1$ |
143 |
Element copy= document.createElement("copy"); //$NON-NLS-1$ |
| 136 |
copy.setAttribute("file", sourceInfo.absPath); //$NON-NLS-1$ |
144 |
copy.setAttribute("file", GetRelativePath(sourceFile, antScriptFolder).toString()); //$NON-NLS-1$ |
| 137 |
copy.setAttribute("todir", absSubfolder); //$NON-NLS-1$ |
145 |
copy.setAttribute("todir", jarSubfolder.toString()); //$NON-NLS-1$ |
| 138 |
target.appendChild(copy); |
146 |
target.appendChild(copy); |
| 139 |
} |
147 |
} |
| 140 |
} |
148 |
} |