Fixed EDKT102;
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / ModuleBuildFileGenerator.java
CommitLineData
a29c47e0 1/** @file\r
2 \r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 **/\r
12package org.tianocore.build;\r
13\r
14import java.io.File;\r
15import java.util.LinkedHashMap;\r
16import java.util.LinkedHashSet;\r
17import java.util.Map;\r
18import java.util.Set;\r
19\r
20import javax.xml.parsers.DocumentBuilder;\r
21import javax.xml.parsers.DocumentBuilderFactory;\r
22import javax.xml.transform.OutputKeys;\r
23import javax.xml.transform.Result;\r
24import javax.xml.transform.Source;\r
25import javax.xml.transform.Transformer;\r
26import javax.xml.transform.TransformerFactory;\r
27import javax.xml.transform.dom.DOMSource;\r
28import javax.xml.transform.stream.StreamResult;\r
29\r
30import org.apache.tools.ant.BuildException;\r
31import org.apache.tools.ant.Project;\r
32import org.tianocore.build.fpd.FpdParserTask;\r
33import org.tianocore.build.global.GlobalData;\r
34import org.tianocore.build.global.SurfaceAreaQuery;\r
35import org.tianocore.build.id.FpdModuleIdentification;\r
36import org.tianocore.build.id.ModuleIdentification;\r
37import org.tianocore.build.id.PackageIdentification;\r
38import org.w3c.dom.Comment;\r
39import org.w3c.dom.Document;\r
40import org.w3c.dom.Element;\r
41import org.w3c.dom.Node;\r
42\r
43public class ModuleBuildFileGenerator {\r
44\r
45 ///\r
46 /// Pass: TARGET, TOOLCHAIN, ARCH\r
47 /// PACKAGE, PACKAGE_GUID, PACKAGE_VERSION\r
48 ///\r
de4bb9f6 49 String[] inheritProperties = {"ARCH", "MODULE_GUID", "MODULE_VERSION", "PLATFORM_FILE", "PACKAGE_GUID", "PACKAGE_VERSION"};\r
a29c47e0 50\r
51 ///\r
52 /// The information at the header of <em>build.xml</em>.\r
53 ///\r
54 private String info = "DO NOT EDIT \n"\r
55 + "File auto-generated by build utility\n"\r
56 + "\n"\r
57 + "Abstract:\n"\r
58 + "Auto-generated ANT build file for building of EFI Modules/Platforms\n";\r
59\r
60 private FpdModuleIdentification fpdModuleId;\r
61 \r
62 private Project project;\r
63 \r
64 private String ffsKeyword;\r
65 \r
66 public ModuleBuildFileGenerator(Project project, String ffsKeyword, FpdModuleIdentification fpdModuleId) {\r
67 this.project = project;\r
68 this.fpdModuleId = fpdModuleId;\r
69 this.ffsKeyword = ffsKeyword;\r
70 }\r
71 \r
72 /**\r
73 The whole BaseName_build.xml is composed of seven part. \r
74 <ul>\r
75 <li> ANT properties; </li>\r
76 <li> Dependent module (dependent library instances in most case); </li>\r
77 <li> Source files; </li>\r
78 <li> Sections if module is not library; </li>\r
79 <li> Output (different for library module and driver module); </li>\r
80 <li> Clean; </li>\r
81 <li> Clean all. </li>\r
82 </ul>\r
83 \r
84 @throws BuildException\r
85 Error throws during BaseName_build.xml generating. \r
86 **/\r
87 public void genBuildFile(String buildFilename) throws BuildException {\r
88 FfsProcess fp = new FfsProcess();\r
89 DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
90 try {\r
91 DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
92 Document document = dombuilder.newDocument();\r
93 Comment rootComment = document.createComment(info);\r
94 \r
95 //\r
96 // create root element and its attributes\r
97 //\r
98 Element root = document.createElement("project");\r
99 root.setAttribute("name", fpdModuleId.getModule().getName());\r
100 root.setAttribute("default", "all");\r
101 root.setAttribute("basedir", ".");\r
102 \r
103 //\r
104 // element for External ANT tasks\r
105 //\r
106 root.appendChild(document.createComment("Apply external ANT tasks"));\r
107 Element ele = document.createElement("taskdef");\r
108 ele.setAttribute("resource", "frameworktasks.tasks");\r
109 root.appendChild(ele);\r
110 ele = document.createElement("taskdef");\r
111 ele.setAttribute("resource", "cpptasks.tasks");\r
112 root.appendChild(ele);\r
113 ele = document.createElement("typedef");\r
114 ele.setAttribute("resource", "cpptasks.types");\r
115 root.appendChild(ele);\r
116 ele = document.createElement("taskdef");\r
117 ele.setAttribute("resource", "net/sf/antcontrib/antlib.xml");\r
118 root.appendChild(ele);\r
119\r
120 //\r
121 // Generate the default target,\r
122 // which depends on init, sections and output target\r
123 //\r
124 root.appendChild(document.createComment("Default target"));\r
125 ele = document.createElement("target");\r
126 ele.setAttribute("name", "all");\r
127 ele.setAttribute("depends", "libraries, sourcefiles, sections, output");\r
128 root.appendChild(ele);\r
129 \r
130 //\r
131 // compile all source files\r
132 //\r
133 root.appendChild(document.createComment("Compile all dependency Library instances."));\r
134 ele = document.createElement("target");\r
135 ele.setAttribute("name", "libraries");\r
136\r
137 //\r
138 // Parse all sourfiles but files specified in sections\r
139 //\r
140 applyLibraryInstance(document, ele);\r
141 root.appendChild(ele);\r
142\r
143 //\r
144 // compile all source files\r
145 //\r
146 root.appendChild(document.createComment("sourcefiles target"));\r
147 ele = document.createElement("target");\r
148 ele.setAttribute("name", "sourcefiles");\r
149 \r
150 //\r
151 // Parse all sourfiles but files specified in sections\r
152 //\r
153 applyCompileElement(document, ele);\r
154 root.appendChild(ele);\r
155\r
156 //\r
157 // generate the init target\r
158 // main purpose is create all nessary pathes\r
159 // generate the sections target\r
160 //\r
161 root.appendChild(document.createComment("sections target"));\r
162 ele = document.createElement("target");\r
163 ele.setAttribute("name", "sections");\r
164 applySectionsElement(document, ele, fp);\r
165 root.appendChild(ele);\r
166\r
167 //\r
168 // generate the output target\r
169 //\r
170 root.appendChild(document.createComment("output target"));\r
171 ele = document.createElement("target");\r
172 ele.setAttribute("name", "output");\r
173 applyOutputElement(document, ele, fp);\r
174 root.appendChild(ele);\r
175\r
176 \r
177 //\r
178 // generate the clean target\r
179 //\r
180 root.appendChild(document.createComment("clean target"));\r
181 ele = document.createElement("target");\r
182 ele.setAttribute("name", "clean");\r
183 applyCleanElement(document, ele);\r
184 root.appendChild(ele);\r
185 \r
186 //\r
187 // generate the Clean All target\r
188 //\r
189 root.appendChild(document.createComment("Clean All target"));\r
190 ele = document.createElement("target");\r
191 ele.setAttribute("name", "cleanall");\r
192 applyDeepcleanElement(document, ele);\r
193 root.appendChild(ele);\r
194 \r
195 //\r
196 // add the root element to the document\r
197 //\r
198 document.appendChild(rootComment);\r
199 document.appendChild(root);\r
200 //\r
201 // Prepare the DOM document for writing\r
202 //\r
203 Source source = new DOMSource(document);\r
204\r
205 //\r
206 // Prepare the output file\r
207 //\r
208 File file = new File(buildFilename);\r
209\r
210 //\r
211 // generate all directory path\r
212 //\r
213 (new File(file.getParent())).mkdirs();\r
214 Result result = new StreamResult(file);\r
215 \r
216 //\r
217 // Write the DOM document to the file\r
218 //\r
219 Transformer xformer = TransformerFactory.newInstance().newTransformer();\r
220 xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");\r
221 xformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
222 xformer.transform(source, result);\r
223 } catch (Exception ex) {\r
a29c47e0 224 throw new BuildException("Module [" + fpdModuleId.getModule().getName() + "] generating build file failed.\n" + ex.getMessage());\r
225 }\r
226 }\r
227\r
228 /**\r
229 Generate the clean elements for BaseName_build.xml. \r
230 \r
231 @param document current BaseName_build.xml XML document\r
232 @param root Root element for current\r
233 **/\r
234 private void applyCleanElement(Document document, Node root) {\r
235 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
236 for (int i = 0; i < libinstances.length; i++) {\r
237 //\r
238 // Put package file path to module identification\r
239 //\r
240 PackageIdentification packageId = libinstances[i].getPackage();\r
241 \r
242 //\r
243 // Generate ANT script to clean\r
244 //\r
245 Element ele = document.createElement("GenBuild");\r
246 ele.setAttribute("type", "clean");\r
247 \r
248 //\r
249 // Prepare pass down information\r
250 //\r
251 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
252 for (int j = 0; j < inheritProperties.length; j ++){\r
253 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
254 }\r
255 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
256 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
257 \r
258 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
259 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
260 \r
261 for (int j = 0; j < inheritProperties.length; j ++){\r
262 Element property = document.createElement("property");\r
263 property.setAttribute("name", inheritProperties[j]);\r
264 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
265 ele.appendChild(property);\r
266 }\r
267\r
268 root.appendChild(ele);\r
269 }\r
270 //\r
271 // <delete includeemptydirs="true">\r
272 // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
273 // </delete>\r
274 //\r
275 Element deleteEle = document.createElement("delete");\r
276 deleteEle.setAttribute("includeemptydirs", "true");\r
277 Element filesetEle = document.createElement("fileset");\r
278 filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
279 filesetEle.setAttribute("includes", "**/*");\r
280 filesetEle.setAttribute("excludes", "*.xml");\r
281 deleteEle.appendChild(filesetEle);\r
282 root.appendChild(deleteEle);\r
283 }\r
284\r
285 /**\r
286 Generate the cleanall elements for BaseName_build.xml. \r
287 \r
288 @param document current BaseName_build.xml XML document\r
289 @param root Root element for current\r
290 **/\r
291 private void applyDeepcleanElement(Document document, Node root) {\r
292 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
293 for (int i = 0; i < libinstances.length; i++) {\r
294 //\r
295 // Put package file path to module identification\r
296 //\r
297 PackageIdentification packageId = libinstances[i].getPackage();\r
298 \r
299 //\r
300 // Generate ANT script to clean\r
301 //\r
302 Element ele = document.createElement("GenBuild");\r
303 ele.setAttribute("type", "cleanall");\r
304 \r
305 //\r
306 // Prepare pass down information\r
307 //\r
308 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
309 for (int j = 0; j < inheritProperties.length; j ++){\r
310 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
311 }\r
312 \r
313 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
314 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
315 \r
316 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
317 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
318 \r
319 for (int j = 0; j < inheritProperties.length; j ++){\r
320 Element property = document.createElement("property");\r
321 property.setAttribute("name", inheritProperties[j]);\r
322 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
323 ele.appendChild(property);\r
324 }\r
325\r
326 root.appendChild(ele);\r
327 }\r
328 //\r
329 // <delete includeemptydirs="true">\r
330 // <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
331 // </delete>\r
332 //\r
333 Element deleteEle = document.createElement("delete");\r
334 deleteEle.setAttribute("includeemptydirs", "true");\r
335 Element filesetEle = document.createElement("fileset");\r
336 filesetEle.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
337 filesetEle.setAttribute("includes", "**/*");\r
338 filesetEle.setAttribute("excludes", "*.xml");\r
339 deleteEle.appendChild(filesetEle);\r
340 root.appendChild(deleteEle);\r
341 \r
342 //\r
343 // <delete includeemptydirs="true">\r
344 // <fileset dir="${DEST_DIR_DEBUG}" includes="" />\r
345 // </delete>\r
346 //\r
347 deleteEle = document.createElement("delete");\r
348 deleteEle.setAttribute("includeemptydirs", "true");\r
349 filesetEle = document.createElement("fileset");\r
350 filesetEle.setAttribute("dir", "${DEST_DIR_DEBUG}");\r
351 filesetEle.setAttribute("includes", "**/*");\r
352 deleteEle.appendChild(filesetEle);\r
353 root.appendChild(deleteEle);\r
354 }\r
355\r
356 /**\r
357 Generate the dependent library instances elements for BaseName_build.xml. \r
358 \r
359 @param document current BaseName_build.xml XML document\r
360 @param root Root element for current\r
361 **/\r
362 private void applyLibraryInstance(Document document, Node root) {\r
363 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
364// String propertyLibs = "";\r
365 for (int i = 0; i < libinstances.length; i++) {\r
366 //\r
367 // Put package file path to module identification\r
368 //\r
369 PackageIdentification packageId = libinstances[i].getPackage();\r
370 \r
371 //\r
372 // Generate ANT script to build library instances\r
373 //\r
374 Element ele = document.createElement("GenBuild");\r
375 ele.setAttribute("type", "build");\r
376// ele.setAttribute("inheritAll", "false");\r
377 \r
378 //\r
379 // Prepare pass down information\r
380 //\r
381 Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
382 for (int j = 0; j < inheritProperties.length; j ++){\r
383 passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
384 }\r
385 \r
386 passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
387 passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
388 \r
389 passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
390 passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
391 \r
392 for (int j = 0; j < inheritProperties.length; j ++){\r
393 Element property = document.createElement("property");\r
394 property.setAttribute("name", inheritProperties[j]);\r
395 property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
396 ele.appendChild(property);\r
397 }\r
398 \r
399 root.appendChild(ele);\r
400// propertyLibs += " " + project.getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib";\r
401 }\r
402// project.setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));\r
403 }\r
404 \r
405 /**\r
406 Generate the build source files elements for BaseName_build.xml. \r
407 \r
408 @param document current BaseName_build.xml XML document\r
409 @param root Root element for current\r
410 **/\r
411 private void applyCompileElement(Document document, Node root) {\r
412 //\r
413 // Prepare the includes: PackageDependencies and Output debug direactory\r
414 //\r
415 Set<String> includes = new LinkedHashSet<String>();\r
416 \r
417 //\r
418 // WORKSPACE\r
419 //\r
420 includes.add("${WORKSPACE_DIR}");\r
421 \r
422 //\r
423 // Module iteself\r
424 //\r
425 includes.add("${MODULE_DIR}");\r
426 includes.add("${MODULE_DIR}" + File.separatorChar + "${ARCH}");\r
427 \r
428 //\r
429 // Packages in PackageDenpendencies\r
430 //\r
431 PackageIdentification[] packageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());\r
432 for (int i = 0; i < packageDependencies.length; i++) {\r
433 GlobalData.refreshPackageIdentification(packageDependencies[i]);\r
434 File packageFile = packageDependencies[i].getSpdFile();\r
435 includes.add(packageFile.getParent() + File.separatorChar + "Include");\r
436 includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
437 }\r
438\r
439 //\r
440 // All Dependency Library Instance's PackageDependencies\r
441 //\r
442 ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
443 for (int i = 0; i < libinstances.length; i++) {\r
444 SurfaceAreaQuery.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));\r
445 PackageIdentification[] libraryPackageDependencies = SurfaceAreaQuery.getDependencePkg(fpdModuleId.getArch());\r
446 for (int j = 0; j < libraryPackageDependencies.length; j++) {\r
447 GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);\r
448 File packageFile = libraryPackageDependencies[j].getSpdFile();\r
449 includes.add(packageFile.getParent() + File.separatorChar + "Include");\r
450 includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
451 }\r
452 SurfaceAreaQuery.pop();\r
453 }\r
454 \r
455 \r
456 //\r
457 // The package which the module belongs to\r
458 // TBD\r
459 includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");\r
460 includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
461\r
462 //\r
463 // Debug files output directory\r
464 //\r
465 includes.add("${DEST_DIR_DEBUG}");\r
466 \r
467 //\r
468 // sourceFiles[][0] is FileType, [][1] is File name relative to Module_Dir\r
469 //\r
470 String[][] sourceFiles = SurfaceAreaQuery.getSourceFiles(fpdModuleId.getArch());\r
471\r
472 FileProcess fileProcess = new FileProcess();\r
473 fileProcess.init(project, includes, document);\r
474\r
475 String moduleDir = project.getProperty("MODULE_DIR");\r
476 //\r
477 // Parse all Unicode files\r
478 //\r
479 for (int i = 0; i < sourceFiles.length; i++) {\r
480 //\r
481 // Go through all source files. Add MODULE_DIR to preffix\r
482 //\r
483 File sourceFile = new File(moduleDir + File.separatorChar + sourceFiles[i][1]);\r
484 sourceFiles[i][1] = sourceFile.getPath();\r
485 String filetype = sourceFiles[i][0];\r
486 if (filetype != null) {\r
487 fileProcess.parseFile(sourceFiles[i][1], filetype, root, true);\r
488 } else {\r
489 fileProcess.parseFile(sourceFiles[i][1], root, true);\r
490 }\r
491 }\r
492 \r
493 //\r
494 // If exist Unicode file\r
495 //\r
496 if (fileProcess.isUnicodeExist()) {\r
497 Element ele = document.createElement("Build_Unicode_Database");\r
498 ele.setAttribute("FILEPATH", ".");\r
499 ele.setAttribute("FILENAME", "${BASE_NAME}");\r
500 String[] includePaths = includes.toArray(new String[includes.size()]);\r
501 Element includesEle = document.createElement("EXTRA.INC");\r
502 for (int i = 0; i < includePaths.length; i++) {\r
503 Element includeEle = document.createElement("includepath");\r
504 includeEle.setAttribute("path", includePaths[i]);\r
505 includesEle.appendChild(includeEle);\r
506 }\r
507 ele.appendChild(includesEle);\r
508 root.appendChild(ele);\r
509 }\r
510\r
511 //\r
512 // Parse AutoGen.c & AutoGen.h\r
513 //\r
514 if ( ! fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) {\r
515 fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", root, false);\r
516 }\r
517 \r
518 //\r
519 // Parse all source files but Unicode files\r
520 //\r
521 for (int i = 0; i < sourceFiles.length; i++) {\r
522 String filetype = sourceFiles[i][0];\r
523 if (filetype != null) {\r
524 fileProcess.parseFile(sourceFiles[i][1], filetype, root, false);\r
525 } else {\r
526 fileProcess.parseFile(sourceFiles[i][1], root, false);\r
527 }\r
528 }\r
529 \r
530 //\r
531 // Initialize SOURCE_FILES for dependcy check use\r
532 //\r
533 String str = "";\r
534 for (int i = 0; i < sourceFiles.length; i++) {\r
535 str += " " + sourceFiles[i][1];\r
536 }\r
537 project.setProperty("SOURCE_FILES", str.replaceAll("(\\\\)", "/"));\r
538 }\r
539\r
540 /**\r
541 Generate the section elements for BaseName_build.xml. Library module will\r
542 skip this process. \r
543 \r
544 @param document current BaseName_build.xml XML document\r
545 @param root Root element for current\r
546 **/\r
547 private void applySectionsElement(Document document, Node root, FfsProcess fp) {\r
548 if (fpdModuleId.getModule().isLibrary()) {\r
549 return ;\r
550 }\r
551 if (fp.initSections(ffsKeyword, project, fpdModuleId)) {\r
196ad8d7 552 String targetFilename = fpdModuleId.getModule().getGuid() + "-" + "${BASE_NAME}" + FpdParserTask.getSuffix(fpdModuleId.getModule().getModuleType());\r
a29c47e0 553 String[] list = fp.getGenSectionElements(document, "${BASE_NAME}", fpdModuleId.getModule().getGuid(), targetFilename);\r
554\r
555 for (int i = 0; i < list.length; i++) {\r
556 Element ele = document.createElement(list[i]);\r
557 ele.setAttribute("FILEPATH", ".");\r
558 ele.setAttribute("FILENAME", "${BASE_NAME}");\r
559 root.appendChild(ele);\r
560 }\r
561 }\r
562 }\r
563\r
564 /**\r
565 Generate the output elements for BaseName_build.xml. If module is library,\r
566 call the <em>LIB</em> command, else call the <em>GenFfs</em> command. \r
567 \r
568 @param document current BaseName_build.xml XML document\r
569 @param root Root element for current\r
570 **/\r
571 private void applyOutputElement(Document document, Node root, FfsProcess fp) {\r
572 if (fpdModuleId.getModule().isLibrary()) {\r
573 //\r
574 // call Lib command\r
575 //\r
576 Element cc = document.createElement("Build_Library");\r
577 cc.setAttribute("FILENAME", fpdModuleId.getModule().getName());\r
578 root.appendChild(cc);\r
579 }\r
580 //\r
581 // if it is a module but library\r
582 //\r
583 else {\r
584 if (fp.getFfsNode() != null) {\r
585 root.appendChild(fp.getFfsNode());\r
586 }\r
587 }\r
588 }\r
589\r
590}\r