diff options
author | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-13 06:35:03 +0000 |
---|---|---|
committer | jwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-12-13 06:35:03 +0000 |
commit | 2251a3601382e62e2b947512e51560d1f73dfd05 (patch) | |
tree | 31f36be1c4c4041bb5568d909bf64c181e7e3dac /Tools/Java | |
parent | a96f893c14c9ae144fc41205dcf37d220e10a4b6 (diff) | |
download | edk2-platforms-2251a3601382e62e2b947512e51560d1f73dfd05.tar.xz |
Added support for macro/property in tools_def.txt. Now you can define a property via environment variable and use it in tools_def.txt and target.txt in the form of ${name}
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2094 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java')
4 files changed, 24 insertions, 16 deletions
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java index 84e799d00c..e240150c29 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java @@ -197,7 +197,7 @@ public class FrameworkBuildTask extends Task{ //
File workspacePath = new File(getProject().getProperty("WORKSPACE"));
getProject().setProperty("WORKSPACE_DIR", workspacePath.getPath().replaceAll("(\\\\)", "/"));
- GlobalData.initInfo(dbFilename, workspacePath.getPath(), toolsDefFilename);
+ GlobalData.initInfo(getProject(), dbFilename, workspacePath.getPath(), toolsDefFilename);
//
// If find MSA file and ACTIVE_PLATFORM is set, build the module;
@@ -333,7 +333,7 @@ public class FrameworkBuildTask extends Task{ private void readTargetFile() throws EdkException{
String targetFile = getProject().getProperty("WORKSPACE_DIR") + File.separatorChar + targetFilename;
- String[][] targetFileInfo = ConfigReader.parse(targetFile);
+ String[][] targetFileInfo = ConfigReader.parse(getProject(), targetFile);
//
// Get ToolChain Info from target.txt
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java index 96558876e4..d339043842 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map;
import java.util.Set;
+import org.apache.tools.ant.Project;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
@@ -146,7 +147,7 @@ public class GlobalData { @throws BuildException
Framework Dababase or SPD or MSA file is not valid
**/
- public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir, String toolsDefFilename ) throws EdkException {
+ public synchronized static void initInfo(Project prj, String workspaceDatabaseFile, String workspaceDir, String toolsDefFilename ) throws EdkException {
//
// ensure this method will be revoked only once
//
@@ -169,7 +170,7 @@ public class GlobalData { //
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);
EdkLog.log("Init", EdkLog.EDK_ALWAYS, "Using tool definition file [" + toolsDefFile.getPath() + "].");
- toolsDef = new ToolChainConfig(toolsDefFile);
+ toolsDef = new ToolChainConfig(prj, toolsDefFile);
//
// Parse Framework Database
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java index fa1fc239f4..4275f8eb78 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ConfigReader.java @@ -14,6 +14,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.build.toolchain;
+import org.apache.tools.ant.Project;
+
import org.tianocore.build.exception.GenBuildException;
import java.io.BufferedReader;
@@ -38,8 +40,8 @@ public class ConfigReader { @return String[][] The definition array
**/
- public static synchronized String[][] parse(String filename) throws GenBuildException {
- return parse(new File(filename));
+ public static synchronized String[][] parse(Project prj, String filename) throws GenBuildException {
+ return parse(prj, new File(filename));
}
/**
@@ -53,7 +55,7 @@ public class ConfigReader { @throws GenBuildException
Config file's format is not valid
**/
- public static synchronized String[][] parse(File configFile) throws GenBuildException {
+ public static synchronized String[][] parse(Project prj, File configFile) throws GenBuildException {
List<String> keyList = new ArrayList<String>(256);
List<String> valueList = new ArrayList<String>(256);
int lines = 0;
@@ -87,7 +89,11 @@ public class ConfigReader { // look as line "A = B"
//
keyList.add(str.substring(0, index).trim());
- valueList.add(str.substring(index + 1).trim());
+ if (prj != null) {
+ valueList.add(prj.replaceProperties(str.substring(index + 1).trim()));
+ } else {
+ valueList.add(str.substring(index + 1).trim());
+ }
}
} catch (Exception ex) {
GenBuildException e = new GenBuildException("ERROR Processing file ["
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java index f78d49f507..9989ab65f8 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/toolchain/ToolChainConfig.java @@ -15,14 +15,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.build.toolchain;
-import org.tianocore.build.exception.GenBuildException;
-import org.tianocore.build.toolchain.ToolChainKey;
-import org.tianocore.build.toolchain.ToolChainMap;
-
import java.io.File;
import java.util.Iterator;
import java.util.Set;
+import org.apache.tools.ant.Project;
+import org.tianocore.build.exception.GenBuildException;
+import org.tianocore.build.toolchain.ToolChainKey;
+import org.tianocore.build.toolchain.ToolChainMap;
+
/**
@@ -44,8 +45,8 @@ public class ToolChainConfig { @param toolChainFile File object representing the tool chain configuration file
**/
- public ToolChainConfig (File toolChainFile) throws GenBuildException {
- config = getToolChainConfig(toolChainFile);
+ public ToolChainConfig (Project prj, File toolChainFile) throws GenBuildException {
+ config = getToolChainConfig(prj, toolChainFile);
parseToolChainDefKey(config.keySet());
}
@@ -57,9 +58,9 @@ public class ToolChainConfig { @return ToolChainMap
**/
- private ToolChainMap getToolChainConfig(File ConfigFile) throws GenBuildException {
+ private ToolChainMap getToolChainConfig(Project prj, File ConfigFile) throws GenBuildException {
ToolChainMap map = new ToolChainMap();
- String[][] toolChainDef = ConfigReader.parse(ConfigFile);
+ String[][] toolChainDef = ConfigReader.parse(prj, ConfigFile);
for (int i = 0; i < toolChainDef[0].length; ++i) {
map.put(toolChainDef[0][i], toolChainDef[1][i]);
|