]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
ff225cbb | 2 | This file is ANT task GenBuild.\r |
3 | \r | |
4 | The file is used to parse a specified Module, and generate its build time\r | |
878ddf1f | 5 | ANT script build.xml, then call the the ANT script to build the module.\r |
ff225cbb | 6 | \r |
878ddf1f | 7 | Copyright (c) 2006, Intel Corporation\r |
8 | All rights reserved. This program and the accompanying materials\r | |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | **/\r | |
16 | package org.tianocore.build;\r | |
17 | \r | |
18 | import java.io.File;\r | |
aca6c736 | 19 | import java.util.Hashtable;\r |
878ddf1f | 20 | import java.util.Iterator;\r |
21 | import java.util.LinkedHashSet;\r | |
22 | import java.util.List;\r | |
23 | import java.util.Map;\r | |
24 | import java.util.Set;\r | |
25 | import java.util.Vector;\r | |
26 | import java.util.regex.Matcher;\r | |
27 | import java.util.regex.Pattern;\r | |
28 | \r | |
878ddf1f | 29 | import org.apache.tools.ant.BuildException;\r |
aca6c736 | 30 | import org.apache.tools.ant.BuildListener;\r |
31 | import org.apache.tools.ant.Project;\r | |
878ddf1f | 32 | import org.apache.tools.ant.taskdefs.Ant;\r |
a29c47e0 | 33 | import org.apache.tools.ant.taskdefs.Property;\r |
878ddf1f | 34 | import org.apache.xmlbeans.XmlObject;\r |
878ddf1f | 35 | \r |
4a6a5026 | 36 | import org.tianocore.common.definitions.ToolDefinitions;\r |
ff225cbb | 37 | import org.tianocore.common.exception.EdkException;\r |
d965d1f6 | 38 | import org.tianocore.common.logger.EdkLog;\r |
136adffc | 39 | import org.tianocore.build.autogen.AutoGen;\r |
892b0e7a | 40 | import org.tianocore.build.exception.AutoGenException;\r |
41 | import org.tianocore.build.exception.GenBuildException;\r | |
42 | import org.tianocore.build.exception.PcdAutogenException;\r | |
43 | import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r | |
878ddf1f | 44 | import org.tianocore.build.fpd.FpdParserTask;\r |
45 | import org.tianocore.build.global.GlobalData;\r | |
46 | import org.tianocore.build.global.OutputManager;\r | |
47 | import org.tianocore.build.global.SurfaceAreaQuery;\r | |
a29c47e0 | 48 | import org.tianocore.build.id.FpdModuleIdentification;\r |
49 | import org.tianocore.build.id.ModuleIdentification;\r | |
50 | import org.tianocore.build.id.PackageIdentification;\r | |
51 | import org.tianocore.build.id.PlatformIdentification;\r | |
52 | import org.tianocore.build.tools.ModuleItem;\r | |
878ddf1f | 53 | \r |
54 | /**\r | |
55 | <p>\r | |
56 | <code>GenBuildTask</code> is an ANT task that can be used in ANT build\r | |
4a6a5026 | 57 | system. \r |
58 | \r | |
59 | <p>The main function of this task is to parse module's surface area (MSA),\r | |
878ddf1f | 60 | then generate the corresponding <em>BaseName_build.xml</em> (the real ANT\r |
a29c47e0 | 61 | build script) and call this to build the module. The whole process including:\r |
4b5f5549 | 62 | \r |
2d16dcec | 63 | <pre>\r |
4a6a5026 | 64 | 1. generate AutoGen.c and AutoGen.h; \r |
65 | 2. build all dependent library instances;\r | |
66 | 3. build all source files inlcude AutoGen.c; \r | |
67 | 4. generate sections;\r | |
ff225cbb | 68 | 5. generate FFS file if it is driver module while LIB file if it is Library module.\r |
2d16dcec | 69 | </pre>\r |
70 | \r | |
ff225cbb | 71 | \r |
878ddf1f | 72 | <p>\r |
73 | The usage is (take module <em>HelloWorld</em> for example):\r | |
74 | </p>\r | |
ff225cbb | 75 | \r |
878ddf1f | 76 | <pre>\r |
4b5f5549 | 77 | <GenBuild \r |
78 | msaFile="${PACKAGE_DIR}/Application/HelloWorld/HelloWorld.msa"\r | |
79 | type="cleanall" />\r | |
878ddf1f | 80 | </pre>\r |
ff225cbb | 81 | \r |
878ddf1f | 82 | <p>\r |
83 | This task calls <code>AutoGen</code> to generate <em>AutoGen.c</em> and\r | |
4b5f5549 | 84 | <em>AutoGen.h</em>. \r |
878ddf1f | 85 | </p>\r |
ff225cbb | 86 | \r |
4b5f5549 | 87 | <p>\r |
88 | This task will also set properties for current module, such as PACKAGE, \r | |
89 | PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR \r | |
90 | (relative to Workspace), MODULE or BASE_NAME, GUID, VERSION, MODULE_DIR, \r | |
91 | MODULE_RELATIVE_DIR (relative to Package), CONFIG_DIR, BIN_DIR, \r | |
92 | DEST_DIR_DEBUG, DEST_DIR_OUTPUT, TARGET, ARCH, TOOLCHAIN, TOOLCHAIN_FAMILY, \r | |
93 | SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH, all compiler command related \r | |
94 | properties (CC, CC_FLAGS, CC_DPATH, CC_SPATH, CC_FAMILY, CC_EXT). \r | |
95 | </p>\r | |
96 | \r | |
878ddf1f | 97 | @since GenBuild 1.0\r |
98 | **/\r | |
a29c47e0 | 99 | public class GenBuildTask extends Ant {\r |
ff225cbb | 100 | \r |
878ddf1f | 101 | ///\r |
102 | /// Module surface area file.\r | |
103 | ///\r | |
a29c47e0 | 104 | File msaFile;\r |
19bf6b15 | 105 | \r |
106 | public ModuleIdentification parentId;\r | |
107 | \r | |
82516887 | 108 | private String type = "all"; \r |
109 | \r | |
878ddf1f | 110 | ///\r |
a29c47e0 | 111 | /// Module's Identification.\r |
878ddf1f | 112 | ///\r |
a29c47e0 | 113 | private ModuleIdentification moduleId;\r |
878ddf1f | 114 | \r |
a29c47e0 | 115 | private Vector<Property> properties = new Vector<Property>();\r |
de4bb9f6 | 116 | \r |
de4bb9f6 | 117 | private boolean isSingleModuleBuild = false;\r |
83fba802 | 118 | \r |
119 | private SurfaceAreaQuery saq = null;\r | |
ff225cbb | 120 | \r |
878ddf1f | 121 | /**\r |
122 | Public construct method. It is necessary for ANT task.\r | |
123 | **/\r | |
124 | public GenBuildTask() {\r | |
125 | }\r | |
126 | \r | |
127 | /**\r | |
ff225cbb | 128 | \r |
878ddf1f | 129 | @throws BuildException\r |
130 | From module build, exception from module surface area invalid.\r | |
131 | **/\r | |
132 | public void execute() throws BuildException {\r | |
89e1408f | 133 | this.setTaskName("GenBuild");\r |
892b0e7a | 134 | try {\r |
135 | processGenBuild();\r | |
136 | } catch (PcdAutogenException e) {\r | |
47412835 | 137 | BuildException buildException = new BuildException(e.getMessage());\r |
138 | buildException.setStackTrace(e.getStackTrace());\r | |
139 | throw buildException;\r | |
892b0e7a | 140 | } catch (AutoGenException e) {\r |
47412835 | 141 | BuildException buildException = new BuildException(e.getMessage());\r |
142 | buildException.setStackTrace(e.getStackTrace());\r | |
143 | throw buildException;\r | |
892b0e7a | 144 | } catch (PlatformPcdPreprocessBuildException e) {\r |
47412835 | 145 | BuildException buildException = new BuildException(e.getMessage());\r |
146 | buildException.setStackTrace(e.getStackTrace());\r | |
147 | throw buildException;\r | |
892b0e7a | 148 | } catch (GenBuildException e) {\r |
47412835 | 149 | BuildException buildException = new BuildException(e.getMessage());\r |
150 | buildException.setStackTrace(e.getStackTrace());\r | |
151 | throw buildException;\r | |
892b0e7a | 152 | } catch (EdkException e) {\r |
47412835 | 153 | BuildException buildException = new BuildException(e.getMessage());\r |
154 | buildException.setStackTrace(e.getStackTrace());\r | |
155 | throw buildException;\r | |
892b0e7a | 156 | }\r |
157 | }\r | |
158 | \r | |
159 | private void processGenBuild() throws EdkException, BuildException, GenBuildException, AutoGenException, PcdAutogenException, PlatformPcdPreprocessBuildException {\r | |
aca6c736 | 160 | if (!FrameworkBuildTask.multithread) {\r |
161 | cleanupProperties();\r | |
162 | }\r | |
82516887 | 163 | \r |
878ddf1f | 164 | //\r |
a29c47e0 | 165 | // Enable all specified properties\r |
878ddf1f | 166 | //\r |
a29c47e0 | 167 | Iterator<Property> iter = properties.iterator();\r |
168 | while (iter.hasNext()) {\r | |
169 | Property item = iter.next();\r | |
aca6c736 | 170 | getProject().setProperty(item.getName(), item.getValue());\r |
878ddf1f | 171 | }\r |
ff225cbb | 172 | \r |
878ddf1f | 173 | //\r |
a29c47e0 | 174 | // GenBuild should specify either msaFile or moduleGuid & packageGuid\r |
878ddf1f | 175 | //\r |
a29c47e0 | 176 | if (msaFile == null ) {\r |
177 | String moduleGuid = getProject().getProperty("MODULE_GUID");\r | |
178 | String moduleVersion = getProject().getProperty("MODULE_VERSION");\r | |
179 | String packageGuid = getProject().getProperty("PACKAGE_GUID");\r | |
180 | String packageVersion = getProject().getProperty("PACKAGE_VERSION");\r | |
892b0e7a | 181 | //\r |
182 | // If one of module Guid or package Guid is not specified, report error\r | |
183 | //\r | |
a29c47e0 | 184 | if (moduleGuid == null || packageGuid == null) {\r |
391dbbb1 | 185 | throw new BuildException("GenBuild parameter error.");\r |
878ddf1f | 186 | }\r |
892b0e7a | 187 | \r |
a29c47e0 | 188 | PackageIdentification packageId = new PackageIdentification(packageGuid, packageVersion);\r |
892b0e7a | 189 | GlobalData.refreshPackageIdentification(packageId);\r |
a29c47e0 | 190 | moduleId = new ModuleIdentification(moduleGuid, moduleVersion);\r |
191 | moduleId.setPackage(packageId);\r | |
892b0e7a | 192 | GlobalData.refreshModuleIdentification(moduleId);\r |
a29c47e0 | 193 | Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);\r |
83fba802 | 194 | saq = new SurfaceAreaQuery(doc);\r |
82516887 | 195 | } else {\r |
a29c47e0 | 196 | Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);\r |
83fba802 | 197 | saq = new SurfaceAreaQuery(doc);\r |
198 | moduleId = saq.getMsaHeader();\r | |
89e1408f | 199 | moduleId.setMsaFile(msaFile);\r |
878ddf1f | 200 | }\r |
892b0e7a | 201 | \r |
83fba802 | 202 | String[] producedLibraryClasses = saq.getLibraryClasses("ALWAYS_PRODUCED",null);\r |
a29c47e0 | 203 | if (producedLibraryClasses.length == 0) {\r |
204 | moduleId.setLibrary(false);\r | |
82516887 | 205 | } else {\r |
a29c47e0 | 206 | moduleId.setLibrary(true);\r |
878ddf1f | 207 | }\r |
ff225cbb | 208 | \r |
878ddf1f | 209 | //\r |
a29c47e0 | 210 | // Judge whether it is single module build or not\r |
878ddf1f | 211 | //\r |
de4bb9f6 | 212 | if (isSingleModuleBuild) {\r |
878ddf1f | 213 | //\r |
a29c47e0 | 214 | // Single Module build\r |
878ddf1f | 215 | //\r |
a29c47e0 | 216 | prepareSingleModuleBuild();\r |
878ddf1f | 217 | }\r |
ff225cbb | 218 | \r |
a29c47e0 | 219 | //\r |
82516887 | 220 | // If single module : get arch from pass down, otherwise intersection MSA \r |
221 | // supported ARCHs and tools def\r | |
a29c47e0 | 222 | //\r |
ff225cbb | 223 | Set<String> archListSupByToolChain = new LinkedHashSet<String>();\r |
224 | String[] archs = GlobalData.getToolChainInfo().getArchs();\r | |
225 | \r | |
3c696250 | 226 | for (int i = 0; i < archs.length; i ++) {\r |
227 | archListSupByToolChain.add(archs[i]);\r | |
228 | }\r | |
ff225cbb | 229 | \r |
3c696250 | 230 | Set<String> archSet = new LinkedHashSet<String>();\r |
ff225cbb | 231 | \r |
3c696250 | 232 | if ( getProject().getProperty("ARCH") != null) {\r |
233 | String[] fpdArchList = getProject().getProperty("ARCH").split(" ");\r | |
ff225cbb | 234 | \r |
3c696250 | 235 | for (int i = 0; i < fpdArchList.length; i++) {\r |
236 | if (archListSupByToolChain.contains(fpdArchList[i])) {\r | |
237 | archSet.add(fpdArchList[i]);\r | |
238 | }\r | |
239 | }\r | |
82516887 | 240 | } else {\r |
241 | archSet = archListSupByToolChain; \r | |
3c696250 | 242 | }\r |
ff225cbb | 243 | \r |
3c696250 | 244 | String[] archList = archSet.toArray(new String[archSet.size()]);\r |
ff225cbb | 245 | \r |
a29c47e0 | 246 | //\r |
247 | // Judge if arch is all supported by current module. If not, throw Exception.\r | |
248 | //\r | |
83fba802 | 249 | List moduleSupportedArchs = saq.getModuleSupportedArchs();\r |
a29c47e0 | 250 | if (moduleSupportedArchs != null) {\r |
251 | for (int k = 0; k < archList.length; k++) {\r | |
252 | if ( ! moduleSupportedArchs.contains(archList[k])) {\r | |
391dbbb1 | 253 | throw new BuildException("Specified architecture [" + archList[k] + "] is not supported by " + moduleId + ". The module " + moduleId + " only supports [" + moduleSupportedArchs + "] architectures.");\r |
a29c47e0 | 254 | }\r |
255 | }\r | |
878ddf1f | 256 | }\r |
ff225cbb | 257 | \r |
a29c47e0 | 258 | for (int k = 0; k < archList.length; k++) {\r |
ff225cbb | 259 | \r |
aca6c736 | 260 | getProject().setProperty("ARCH", archList[k]);\r |
ff225cbb | 261 | \r |
a29c47e0 | 262 | FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);\r |
ff225cbb | 263 | \r |
878ddf1f | 264 | //\r |
a29c47e0 | 265 | // Whether the module is built before\r |
878ddf1f | 266 | //\r |
34281092 | 267 | if (moduleId.isLibrary() == false && GlobalData.hasFpdModuleSA(fpdModuleId) == false) {\r |
d965d1f6 | 268 | EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");\r |
34281092 | 269 | continue;\r |
270 | } else if (GlobalData.isModuleBuilt(fpdModuleId)) {\r | |
1fa1cb75 | 271 | break;\r |
34281092 | 272 | } else {\r |
a29c47e0 | 273 | GlobalData.registerBuiltModule(fpdModuleId);\r |
274 | }\r | |
ff225cbb | 275 | \r |
878ddf1f | 276 | //\r |
a29c47e0 | 277 | // For Every TOOLCHAIN, TARGET\r |
278 | //\r | |
279 | String[] targetList = GlobalData.getToolChainInfo().getTargets();\r | |
280 | for (int i = 0; i < targetList.length; i ++){\r | |
281 | //\r | |
282 | // Prepare for target related common properties\r | |
283 | // TARGET\r | |
284 | //\r | |
aca6c736 | 285 | getProject().setProperty("TARGET", targetList[i]);\r |
a29c47e0 | 286 | String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();\r |
287 | for(int j = 0; j < toolchainList.length; j ++){\r | |
c773bec0 | 288 | //\r |
289 | // check if any tool is defined for current target + toolchain + arch\r | |
290 | // don't do anything if no tools found\r | |
ff225cbb | 291 | //\r |
c773bec0 | 292 | if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {\r |
fd6c41f5 | 293 | EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: No build issued. No tools found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");\r |
c773bec0 | 294 | continue;\r |
295 | }\r | |
296 | \r | |
a29c47e0 | 297 | //\r |
298 | // Prepare for toolchain related common properties\r | |
299 | // TOOLCHAIN\r | |
300 | //\r | |
aca6c736 | 301 | getProject().setProperty("TOOLCHAIN", toolchainList[j]);\r |
a29c47e0 | 302 | \r |
d965d1f6 | 303 | EdkLog.log(this, "Build " + moduleId + " start >>>");\r |
304 | EdkLog.log(this, "Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);\r | |
83fba802 | 305 | saq.push(GlobalData.getDoc(fpdModuleId));\r |
ff225cbb | 306 | \r |
a29c47e0 | 307 | //\r |
308 | // Prepare for all other common properties\r | |
309 | // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR\r | |
310 | // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE\r | |
311 | // MODULE_DIR, MODULE_RELATIVE_DIR\r | |
312 | // SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH\r | |
a29c47e0 | 313 | //\r |
314 | setModuleCommonProperties(archList[k]);\r | |
ff225cbb | 315 | \r |
a29c47e0 | 316 | //\r |
ff225cbb | 317 | // OutputManage prepare for\r |
a29c47e0 | 318 | // BIN_DIR, DEST_DIR_DEBUG, DEST_DIR_OUTPUT, BUILD_DIR, FV_DIR\r |
319 | //\r | |
320 | OutputManager.getInstance().update(getProject());\r | |
ff225cbb | 321 | \r |
a29c47e0 | 322 | if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {\r |
323 | applyBuild(targetList[i], toolchainList[j], fpdModuleId);\r | |
82516887 | 324 | } else if (type.equalsIgnoreCase("clean")) {\r |
a29c47e0 | 325 | applyClean(fpdModuleId);\r |
82516887 | 326 | } else if (type.equalsIgnoreCase("cleanall")) {\r |
a29c47e0 | 327 | applyCleanall(fpdModuleId);\r |
328 | }\r | |
329 | }\r | |
330 | }\r | |
878ddf1f | 331 | }\r |
878ddf1f | 332 | }\r |
333 | \r | |
334 | /**\r | |
ff225cbb | 335 | This method is used to prepare Platform-related information.\r |
336 | \r | |
a29c47e0 | 337 | <p>In Single Module Build mode, platform-related information is not ready.\r |
ff225cbb | 338 | The method read the system environment variable <code>ACTIVE_PLATFORM</code>\r |
a29c47e0 | 339 | and search in the Framework Database. Note that platform name in the Framework\r |
340 | Database must be unique. </p>\r | |
ff225cbb | 341 | \r |
878ddf1f | 342 | **/\r |
892b0e7a | 343 | private void prepareSingleModuleBuild() throws EdkException {\r |
878ddf1f | 344 | //\r |
a29c47e0 | 345 | // Find out the package which the module belongs to\r |
878ddf1f | 346 | //\r |
a29c47e0 | 347 | PackageIdentification packageId = GlobalData.getPackageForModule(moduleId);\r |
892b0e7a | 348 | GlobalData.refreshPackageIdentification(packageId);\r |
a29c47e0 | 349 | moduleId.setPackage(packageId);\r |
892b0e7a | 350 | GlobalData.refreshModuleIdentification(moduleId);\r |
ff225cbb | 351 | \r |
878ddf1f | 352 | //\r |
82516887 | 353 | // Read ACTIVE_PLATFORM's FPD file \r |
878ddf1f | 354 | //\r |
de4bb9f6 | 355 | String filename = getProject().getProperty("PLATFORM_FILE");\r |
ff225cbb | 356 | \r |
de4bb9f6 | 357 | if (filename == null){\r |
391dbbb1 | 358 | throw new BuildException("Please set ACTIVE_PLATFORM in the file: Tools/Conf/target.txt if you want to build a single module!");\r |
878ddf1f | 359 | }\r |
ff225cbb | 360 | \r |
de4bb9f6 | 361 | PlatformIdentification platformId = GlobalData.getPlatform(filename);\r |
ff225cbb | 362 | \r |
878ddf1f | 363 | //\r |
82516887 | 364 | // Read FPD file (Call FpdParserTask's method)\r |
878ddf1f | 365 | //\r |
a29c47e0 | 366 | FpdParserTask fpdParser = new FpdParserTask();\r |
367 | fpdParser.setProject(getProject());\r | |
07193171 | 368 | fpdParser.parseFpdFile(platformId.getFpdFile());\r |
aca6c736 | 369 | getProject().setProperty("ARCH", fpdParser.getAllArchForModule(moduleId));\r |
878ddf1f | 370 | }\r |
371 | \r | |
aca6c736 | 372 | private void cleanupProperties() {\r |
373 | Project newProject = new Project();\r | |
374 | \r | |
375 | Hashtable<String, String> passdownProperties = FrameworkBuildTask.originalProperties;\r | |
376 | Iterator<String> iter = passdownProperties.keySet().iterator();\r | |
377 | while (iter.hasNext()) {\r | |
378 | String item = iter.next();\r | |
379 | newProject.setProperty(item, passdownProperties.get(item));\r | |
380 | }\r | |
381 | \r | |
382 | newProject.setInputHandler(getProject().getInputHandler());\r | |
383 | \r | |
384 | Iterator listenerIter = getProject().getBuildListeners().iterator();\r | |
385 | while (listenerIter.hasNext()) {\r | |
386 | newProject.addBuildListener((BuildListener) listenerIter.next());\r | |
387 | }\r | |
388 | \r | |
389 | getProject().initSubProject(newProject);\r | |
390 | \r | |
391 | setProject(newProject);\r | |
392 | }\r | |
878ddf1f | 393 | \r |
394 | /**\r | |
a29c47e0 | 395 | Set Module-Related information to properties.\r |
82516887 | 396 | \r |
397 | @param arch current build ARCH\r | |
878ddf1f | 398 | **/\r |
a29c47e0 | 399 | private void setModuleCommonProperties(String arch) {\r |
878ddf1f | 400 | //\r |
a29c47e0 | 401 | // Prepare for all other common properties\r |
402 | // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR\r | |
878ddf1f | 403 | //\r |
a29c47e0 | 404 | PackageIdentification packageId = moduleId.getPackage();\r |
aca6c736 | 405 | getProject().setProperty("PACKAGE", packageId.getName());\r |
406 | getProject().setProperty("PACKAGE_GUID", packageId.getGuid());\r | |
407 | getProject().setProperty("PACKAGE_VERSION", packageId.getVersion());\r | |
408 | getProject().setProperty("PACKAGE_DIR", packageId.getPackageDir().replaceAll("(\\\\)", "/"));\r | |
409 | getProject().setProperty("PACKAGE_RELATIVE_DIR", packageId.getPackageRelativeDir().replaceAll("(\\\\)", "/"));\r | |
ff225cbb | 410 | \r |
a29c47e0 | 411 | //\r |
412 | // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, MODULE_TYPE\r | |
413 | // MODULE_DIR, MODULE_RELATIVE_DIR\r | |
414 | //\r | |
aca6c736 | 415 | getProject().setProperty("MODULE", moduleId.getName());\r |
83fba802 | 416 | String baseName = saq.getModuleOutputFileBasename();\r |
a29c47e0 | 417 | if (baseName == null) {\r |
aca6c736 | 418 | getProject().setProperty("BASE_NAME", moduleId.getName());\r |
82516887 | 419 | } else {\r |
aca6c736 | 420 | getProject().setProperty("BASE_NAME", baseName);\r |
a29c47e0 | 421 | }\r |
aca6c736 | 422 | getProject().setProperty("GUID", moduleId.getGuid());\r |
423 | getProject().setProperty("FILE_GUID", moduleId.getGuid());\r | |
424 | getProject().setProperty("VERSION", moduleId.getVersion());\r | |
425 | getProject().setProperty("MODULE_TYPE", moduleId.getModuleType());\r | |
426 | getProject().setProperty("MODULE_DIR", moduleId.getMsaFile().getParent().replaceAll("(\\\\)", "/"));\r | |
427 | getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/"));\r | |
ff225cbb | 428 | \r |
a29c47e0 | 429 | //\r |
430 | // SUBSYSTEM\r | |
431 | //\r | |
432 | String[][] subsystemMap = { { "BASE", "EFI_BOOT_SERVICE_DRIVER"},\r | |
ff225cbb | 433 | { "SEC", "EFI_BOOT_SERVICE_DRIVER" },\r |
434 | { "PEI_CORE", "EFI_BOOT_SERVICE_DRIVER" },\r | |
435 | { "PEIM", "EFI_BOOT_SERVICE_DRIVER" },\r | |
a29c47e0 | 436 | { "DXE_CORE", "EFI_BOOT_SERVICE_DRIVER" },\r |
ff225cbb | 437 | { "DXE_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },\r |
438 | { "DXE_RUNTIME_DRIVER", "EFI_RUNTIME_DRIVER" },\r | |
439 | { "DXE_SAL_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },\r | |
440 | { "DXE_SMM_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },\r | |
441 | { "TOOL", "EFI_BOOT_SERVICE_DRIVER" },\r | |
a29c47e0 | 442 | { "UEFI_DRIVER", "EFI_BOOT_SERVICE_DRIVER" },\r |
ff225cbb | 443 | { "UEFI_APPLICATION", "EFI_APPLICATION" },\r |
444 | { "USER_DEFINED", "EFI_BOOT_SERVICE_DRIVER"} };\r | |
445 | \r | |
a29c47e0 | 446 | String subsystem = "EFI_BOOT_SERVICE_DRIVER";\r |
447 | for (int i = 0; i < subsystemMap.length; i++) {\r | |
448 | if (moduleId.getModuleType().equalsIgnoreCase(subsystemMap[i][0])) {\r | |
449 | subsystem = subsystemMap[i][1];\r | |
450 | break ;\r | |
878ddf1f | 451 | }\r |
452 | }\r | |
aca6c736 | 453 | getProject().setProperty("SUBSYSTEM", subsystem);\r |
ff225cbb | 454 | \r |
a29c47e0 | 455 | //\r |
456 | // ENTRYPOINT\r | |
457 | //\r | |
458 | if (arch.equalsIgnoreCase("EBC")) {\r | |
aca6c736 | 459 | getProject().setProperty("ENTRYPOINT", "EfiStart");\r |
82516887 | 460 | } else {\r |
aca6c736 | 461 | getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");\r |
878ddf1f | 462 | }\r |
ff225cbb | 463 | \r |
aca6c736 | 464 | getProject().setProperty("OBJECTS", "");\r |
878ddf1f | 465 | }\r |
466 | \r | |
a29c47e0 | 467 | private void getCompilerFlags(String target, String toolchain, FpdModuleIdentification fpdModuleId) throws EdkException {\r |
468 | String[] cmd = GlobalData.getToolChainInfo().getCommands();\r | |
469 | for ( int m = 0; m < cmd.length; m++) {\r | |
878ddf1f | 470 | //\r |
a29c47e0 | 471 | // Set cmd, like CC, DLINK\r |
878ddf1f | 472 | //\r |
a29c47e0 | 473 | String[] key = new String[]{target, toolchain, fpdModuleId.getArch(), cmd[m], null};\r |
4a6a5026 | 474 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_PATH;\r |
a29c47e0 | 475 | String cmdPath = GlobalData.getCommandSetting(key, fpdModuleId);\r |
4a6a5026 | 476 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_NAME;\r |
a29c47e0 | 477 | String cmdName = GlobalData.getCommandSetting(key, fpdModuleId);\r |
1549f516 | 478 | if (cmdName.length() == 0) {\r |
fd6c41f5 | 479 | EdkLog.log(this, EdkLog.EDK_VERBOSE, "Warning: " + cmd[m] + " hasn't been defined!");\r |
480 | getProject().setProperty(cmd[m], "");\r | |
1549f516 | 481 | continue;\r |
482 | }\r | |
a29c47e0 | 483 | File cmdFile = new File(cmdPath + File.separatorChar + cmdName);\r |
aca6c736 | 484 | getProject().setProperty(cmd[m], cmdFile.getPath().replaceAll("(\\\\)", "/"));\r |
ff225cbb | 485 | \r |
878ddf1f | 486 | //\r |
a29c47e0 | 487 | // set CC_FLAGS\r |
878ddf1f | 488 | //\r |
4a6a5026 | 489 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FLAGS;\r |
a29c47e0 | 490 | String cmdFlags = GlobalData.getCommandSetting(key, fpdModuleId);\r |
e04a8a9a | 491 | if (cmdFlags != null) \r |
492 | {\r | |
493 | // Set<String> addset = new LinkedHashSet<String>();\r | |
494 | // Set<String> subset = new LinkedHashSet<String>();\r | |
495 | // putFlagsToSet(addset, cmdFlags);\r | |
496 | // getProject().setProperty(cmd[m] + "_FLAGS", getProject().replaceProperties(getFlags(addset, subset)));\r | |
497 | getProject().setProperty(cmd[m] + "_FLAGS", cmdFlags);\r | |
498 | } \r | |
499 | else \r | |
500 | {\r | |
501 | getProject().setProperty(cmd[m] + "_FLAGS", "");\r | |
502 | }\r | |
503 | \r | |
ff225cbb | 504 | \r |
878ddf1f | 505 | //\r |
a29c47e0 | 506 | // Set CC_EXT\r |
878ddf1f | 507 | //\r |
4a6a5026 | 508 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_EXT;\r |
a29c47e0 | 509 | String extName = GlobalData.getCommandSetting(key, fpdModuleId);\r |
a29c47e0 | 510 | if ( extName != null && ! extName.equalsIgnoreCase("")) {\r |
aca6c736 | 511 | getProject().setProperty(cmd[m] + "_EXT", extName);\r |
82516887 | 512 | } else {\r |
aca6c736 | 513 | getProject().setProperty(cmd[m] + "_EXT", "");\r |
878ddf1f | 514 | }\r |
ff225cbb | 515 | \r |
878ddf1f | 516 | //\r |
a29c47e0 | 517 | // set CC_FAMILY\r |
878ddf1f | 518 | //\r |
4a6a5026 | 519 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_FAMILY;\r |
a29c47e0 | 520 | String toolChainFamily = GlobalData.getCommandSetting(key, fpdModuleId);\r |
a29c47e0 | 521 | if (toolChainFamily != null) {\r |
aca6c736 | 522 | getProject().setProperty(cmd[m] + "_FAMILY", toolChainFamily);\r |
878ddf1f | 523 | }\r |
ff225cbb | 524 | \r |
878ddf1f | 525 | //\r |
a29c47e0 | 526 | // set CC_SPATH\r |
878ddf1f | 527 | //\r |
4a6a5026 | 528 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_SPATH;\r |
a29c47e0 | 529 | String spath = GlobalData.getCommandSetting(key, fpdModuleId);\r |
a29c47e0 | 530 | if (spath != null) {\r |
aca6c736 | 531 | getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));\r |
82516887 | 532 | } else {\r |
aca6c736 | 533 | getProject().setProperty(cmd[m] + "_SPATH", "");\r |
878ddf1f | 534 | }\r |
ff225cbb | 535 | \r |
878ddf1f | 536 | //\r |
a29c47e0 | 537 | // set CC_DPATH\r |
878ddf1f | 538 | //\r |
4a6a5026 | 539 | key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_DPATH;\r |
a29c47e0 | 540 | String dpath = GlobalData.getCommandSetting(key, fpdModuleId);\r |
a29c47e0 | 541 | if (dpath != null) {\r |
aca6c736 | 542 | getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));\r |
82516887 | 543 | } else {\r |
aca6c736 | 544 | getProject().setProperty(cmd[m] + "_DPATH", "");\r |
878ddf1f | 545 | }\r |
546 | }\r | |
a29c47e0 | 547 | }\r |
ff225cbb | 548 | \r |
a29c47e0 | 549 | public void setMsaFile(File msaFile) {\r |
550 | this.msaFile = msaFile;\r | |
878ddf1f | 551 | }\r |
552 | \r | |
553 | /**\r | |
ff225cbb | 554 | Method is for ANT to initialize MSA file.\r |
555 | \r | |
a29c47e0 | 556 | @param msaFilename MSA file name\r |
878ddf1f | 557 | **/\r |
a29c47e0 | 558 | public void setMsaFile(String msaFilename) {\r |
559 | String moduleDir = getProject().getProperty("MODULE_DIR");\r | |
ff225cbb | 560 | \r |
a29c47e0 | 561 | //\r |
562 | // If is Single Module Build, then use the Base Dir defined in build.xml\r | |
563 | //\r | |
564 | if (moduleDir == null) {\r | |
565 | moduleDir = getProject().getBaseDir().getPath();\r | |
878ddf1f | 566 | }\r |
a29c47e0 | 567 | msaFile = new File(moduleDir + File.separatorChar + msaFilename);\r |
568 | }\r | |
ff225cbb | 569 | \r |
a29c47e0 | 570 | public void addConfiguredModuleItem(ModuleItem moduleItem) {\r |
571 | PackageIdentification packageId = new PackageIdentification(moduleItem.getPackageGuid(), moduleItem.getPackageVersion());\r | |
572 | ModuleIdentification moduleId = new ModuleIdentification(moduleItem.getModuleGuid(), moduleItem.getModuleVersion());\r | |
573 | moduleId.setPackage(packageId);\r | |
574 | this.moduleId = moduleId;\r | |
575 | }\r | |
ff225cbb | 576 | \r |
a29c47e0 | 577 | /**\r |
ff225cbb | 578 | Add a property.\r |
579 | \r | |
a29c47e0 | 580 | @param p property\r |
581 | **/\r | |
582 | public void addProperty(Property p) {\r | |
583 | properties.addElement(p);\r | |
584 | }\r | |
585 | \r | |
586 | public void setType(String type) {\r | |
587 | this.type = type;\r | |
588 | }\r | |
ff225cbb | 589 | \r |
892b0e7a | 590 | private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException {\r |
a29c47e0 | 591 | //\r |
83fba802 | 592 | // Call AutoGen to generate AutoGen.c and AutoGen.h\r |
a29c47e0 | 593 | //\r |
2eb7d78d | 594 | AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch(), saq, parentId);\r |
136adffc | 595 | autogen.genAutogen();\r |
ff225cbb | 596 | \r |
a29c47e0 | 597 | //\r |
598 | // Get compiler flags\r | |
599 | //\r | |
82516887 | 600 | try {\r |
601 | getCompilerFlags(buildTarget, buildTagname, fpdModuleId);\r | |
602 | }\r | |
603 | catch (EdkException ee) {\r | |
604 | throw new BuildException(ee.getMessage());\r | |
605 | }\r | |
606 | \r | |
a29c47e0 | 607 | //\r |
608 | // Prepare LIBS\r | |
609 | //\r | |
83fba802 | 610 | ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());\r |
a29c47e0 | 611 | String propertyLibs = "";\r |
612 | for (int i = 0; i < libinstances.length; i++) {\r | |
498e9021 | 613 | propertyLibs += getProject().getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib" + " ";\r |
878ddf1f | 614 | }\r |
aca6c736 | 615 | getProject().setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));\r |
ff225cbb | 616 | \r |
bf3a7173 | 617 | //\r |
618 | // Get all includepath and set to INCLUDE_PATHS\r | |
619 | //\r | |
620 | String[] includes = prepareIncludePaths(fpdModuleId);\r | |
621 | \r | |
a29c47e0 | 622 | //\r |
623 | // if it is CUSTOM_BUILD\r | |
624 | // then call the exist BaseName_build.xml directly.\r | |
625 | //\r | |
626 | if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r | |
d965d1f6 | 627 | EdkLog.log(this, "Call user-defined " + moduleId.getName() + "_build.xml");\r |
82516887 | 628 | \r |
629 | String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r | |
630 | antCall(antFilename, null);\r | |
631 | \r | |
a29c47e0 | 632 | return ;\r |
878ddf1f | 633 | }\r |
ff225cbb | 634 | \r |
878ddf1f | 635 | //\r |
a29c47e0 | 636 | // Generate ${BASE_NAME}_build.xml\r |
637 | // TBD\r | |
878ddf1f | 638 | //\r |
83fba802 | 639 | String ffsKeyword = saq.getModuleFfsKeyword();\r |
640 | ModuleBuildFileGenerator fileGenerator = new ModuleBuildFileGenerator(getProject(), ffsKeyword, fpdModuleId, includes, saq);\r | |
a29c47e0 | 641 | String buildFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r |
642 | fileGenerator.genBuildFile(buildFilename);\r | |
ff225cbb | 643 | \r |
a29c47e0 | 644 | //\r |
645 | // Ant call ${BASE_NAME}_build.xml\r | |
646 | //\r | |
82516887 | 647 | String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r |
648 | antCall(antFilename, null);\r | |
a29c47e0 | 649 | }\r |
ff225cbb | 650 | \r |
a29c47e0 | 651 | private void applyClean(FpdModuleIdentification fpdModuleId){\r |
652 | //\r | |
653 | // if it is CUSTOM_BUILD\r | |
654 | // then call the exist BaseName_build.xml directly.\r | |
655 | //\r | |
656 | if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r | |
d965d1f6 | 657 | EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");\r |
82516887 | 658 | \r |
659 | String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r | |
660 | antCall(antFilename, "clean");\r | |
661 | \r | |
a29c47e0 | 662 | return ;\r |
878ddf1f | 663 | }\r |
ff225cbb | 664 | \r |
82516887 | 665 | String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r |
666 | antCall(antFilename, "clean");\r | |
a29c47e0 | 667 | }\r |
ff225cbb | 668 | \r |
a29c47e0 | 669 | private void applyCleanall(FpdModuleIdentification fpdModuleId){\r |
670 | //\r | |
671 | // if it is CUSTOM_BUILD\r | |
672 | // then call the exist BaseName_build.xml directly.\r | |
673 | //\r | |
674 | if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r | |
d965d1f6 | 675 | EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");\r |
82516887 | 676 | \r |
677 | String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r | |
678 | antCall(antFilename, "cleanall");\r | |
679 | \r | |
a29c47e0 | 680 | return ;\r |
878ddf1f | 681 | }\r |
82516887 | 682 | \r |
683 | String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r | |
684 | antCall(antFilename, "cleanall");\r | |
685 | }\r | |
ff225cbb | 686 | \r |
82516887 | 687 | private void antCall(String antFilename, String target) {\r |
a29c47e0 | 688 | Ant ant = new Ant();\r |
689 | ant.setProject(getProject());\r | |
82516887 | 690 | ant.setAntfile(antFilename);\r |
691 | if (target != null) {\r | |
692 | ant.setTarget(target);\r | |
693 | }\r | |
a29c47e0 | 694 | ant.setInheritAll(true);\r |
695 | ant.init();\r | |
696 | ant.execute();\r | |
878ddf1f | 697 | }\r |
698 | \r | |
a29c47e0 | 699 | \r |
878ddf1f | 700 | /**\r |
701 | Separate the string and instore in set.\r | |
ff225cbb | 702 | \r |
703 | <p> String is separated by Java Regulation Expression\r | |
878ddf1f | 704 | "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+". </p>\r |
ff225cbb | 705 | \r |
878ddf1f | 706 | <p>For example: </p>\r |
ff225cbb | 707 | \r |
878ddf1f | 708 | <pre>\r |
709 | "/nologo", "/W3", "/WX"\r | |
710 | "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""\r | |
711 | </pre>\r | |
ff225cbb | 712 | \r |
878ddf1f | 713 | @param set store the separated string\r |
714 | @param str string to separate\r | |
715 | **/\r | |
716 | private void putFlagsToSet(Set<String> set, String str) {\r | |
a29c47e0 | 717 | if (str == null || str.length() == 0) {\r |
718 | return;\r | |
719 | }\r | |
720 | \r | |
878ddf1f | 721 | Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+");\r |
722 | Matcher matcher = myPattern.matcher(str + " ");\r | |
723 | while (matcher.find()) {\r | |
724 | String item = str.substring(matcher.start(1), matcher.end(1));\r | |
a29c47e0 | 725 | set.add(item);\r |
878ddf1f | 726 | }\r |
727 | }\r | |
ff225cbb | 728 | \r |
878ddf1f | 729 | /**\r |
ff225cbb | 730 | Generate the final flags string will be used by compile command.\r |
731 | \r | |
878ddf1f | 732 | @param add the add flags set\r |
733 | @param sub the sub flags set\r | |
734 | @return final flags after add set substract sub set\r | |
735 | **/\r | |
736 | private String getFlags(Set<String> add, Set<String> sub) {\r | |
737 | String result = "";\r | |
738 | add.removeAll(sub);\r | |
739 | Iterator iter = add.iterator();\r | |
740 | while (iter.hasNext()) {\r | |
a29c47e0 | 741 | String str = (String) iter.next();\r |
878ddf1f | 742 | result += str.substring(1, str.length() - 1) + " ";\r |
743 | }\r | |
744 | return result;\r | |
745 | }\r | |
746 | \r | |
de4bb9f6 | 747 | public void setSingleModuleBuild(boolean isSingleModuleBuild) {\r |
748 | this.isSingleModuleBuild = isSingleModuleBuild;\r | |
749 | }\r | |
bf3a7173 | 750 | \r |
892b0e7a | 751 | private String[] prepareIncludePaths(FpdModuleIdentification fpdModuleId) throws EdkException{\r |
bf3a7173 | 752 | //\r |
753 | // Prepare the includes: PackageDependencies and Output debug direactory\r | |
754 | //\r | |
755 | Set<String> includes = new LinkedHashSet<String>();\r | |
756 | String arch = fpdModuleId.getArch();\r | |
757 | \r | |
758 | //\r | |
759 | // WORKSPACE\r | |
760 | //\r | |
761 | includes.add("${WORKSPACE_DIR}" + File.separatorChar);\r | |
762 | \r | |
763 | //\r | |
764 | // Module iteself\r | |
765 | //\r | |
766 | includes.add("${MODULE_DIR}");\r | |
767 | includes.add("${MODULE_DIR}" + File.separatorChar + archDir(arch));\r | |
768 | \r | |
769 | //\r | |
770 | // Packages in PackageDenpendencies\r | |
771 | //\r | |
83fba802 | 772 | PackageIdentification[] packageDependencies = saq.getDependencePkg(fpdModuleId.getArch());\r |
bf3a7173 | 773 | for (int i = 0; i < packageDependencies.length; i++) {\r |
774 | GlobalData.refreshPackageIdentification(packageDependencies[i]);\r | |
775 | File packageFile = packageDependencies[i].getSpdFile();\r | |
776 | includes.add(packageFile.getParent() + File.separatorChar + "Include");\r | |
777 | includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));\r | |
778 | }\r | |
779 | \r | |
780 | //\r | |
781 | // All Dependency Library Instance's PackageDependencies\r | |
782 | //\r | |
83fba802 | 783 | ModuleIdentification[] libinstances = saq.getLibraryInstance(fpdModuleId.getArch());\r |
bf3a7173 | 784 | for (int i = 0; i < libinstances.length; i++) {\r |
83fba802 | 785 | saq.push(GlobalData.getDoc(libinstances[i], fpdModuleId.getArch()));\r |
786 | PackageIdentification[] libraryPackageDependencies = saq.getDependencePkg(fpdModuleId.getArch());\r | |
bf3a7173 | 787 | for (int j = 0; j < libraryPackageDependencies.length; j++) {\r |
788 | GlobalData.refreshPackageIdentification(libraryPackageDependencies[j]);\r | |
789 | File packageFile = libraryPackageDependencies[j].getSpdFile();\r | |
790 | includes.add(packageFile.getParent() + File.separatorChar + "Include");\r | |
791 | includes.add(packageFile.getParent() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));\r | |
792 | }\r | |
83fba802 | 793 | saq.pop();\r |
bf3a7173 | 794 | }\r |
795 | \r | |
796 | \r | |
797 | //\r | |
798 | // The package which the module belongs to\r | |
799 | // TBD\r | |
800 | includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include");\r | |
801 | includes.add(fpdModuleId.getModule().getPackage().getPackageDir() + File.separatorChar + "Include" + File.separatorChar + archDir(arch));\r | |
802 | \r | |
803 | //\r | |
804 | // Debug files output directory\r | |
805 | //\r | |
806 | includes.add("${DEST_DIR_DEBUG}");\r | |
807 | \r | |
808 | //\r | |
809 | // set to INCLUDE_PATHS property\r | |
810 | //\r | |
811 | Iterator<String> iter = includes.iterator();\r | |
812 | StringBuffer includePaths = new StringBuffer();\r | |
813 | while (iter.hasNext()) {\r | |
814 | includePaths.append(iter.next());\r | |
815 | includePaths.append("; ");\r | |
816 | }\r | |
aca6c736 | 817 | getProject().setProperty("INCLUDE_PATHS", getProject().replaceProperties(includePaths.toString()).replaceAll("(\\\\)", "/"));\r |
bf3a7173 | 818 | \r |
819 | return includes.toArray(new String[includes.size()]);\r | |
820 | }\r | |
821 | \r | |
822 | /**\r | |
823 | Return the name of the directory that corresponds to the architecture.\r | |
824 | This is a translation from the XML Schema tag to a directory that\r | |
825 | corresponds to our directory name coding convention.\r | |
826 | \r | |
827 | **/\r | |
828 | private String archDir(String arch) {\r | |
829 | return arch.replaceFirst("X64", "x64")\r | |
830 | .replaceFirst("IPF", "Ipf")\r | |
831 | .replaceFirst("IA32", "Ia32")\r | |
832 | .replaceFirst("ARM", "Arm")\r | |
833 | .replaceFirst("EBC", "Ebc");\r | |
19bf6b15 | 834 | }\r |
835 | \r | |
836 | \r | |
837 | public void setExternalProperties(Vector<Property> v) {\r | |
838 | this.properties = v;\r | |
839 | }\r | |
878ddf1f | 840 | }\r |