import org.tianocore.PlatformSurfaceAreaDocument;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
+import org.tianocore.frameworkwizard.toolchain.ToolChainId;\r
\r
import javax.swing.JCheckBox;\r
import javax.swing.JOptionPane;\r
\r
public class FpdPlatformDefs extends IInternalFrame {\r
\r
+ private static boolean Debug = false;\r
+\r
private final int dialogWidth = 600;\r
\r
private final int oneRowHeight = 20;\r
\r
private final int twoRowHeight = 40;\r
\r
-// private final int threeRowHeight = 60;\r
+ // private final int threeRowHeight = 60;\r
\r
private final int fourRowHeight = 80;\r
\r
private final int sepHeight = 6;\r
\r
-// private final int sepWidth = 10;\r
+ // private final int sepWidth = 10;\r
\r
private final int buttonWidth = 90;\r
\r
private final int rowOne = 12;\r
\r
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;\r
+ private final int rowTwo = rowOne + oneRowHeight + sepHeight * 3;\r
\r
private final int rowThree = rowTwo + oneRowHeight + sepHeight;\r
\r
private final int rowFour = rowThree + oneRowHeight + sepHeight;\r
\r
- private final int rowFive = rowFour + fourRowHeight + sepHeight;\r
+ private final int rowFive = rowFour + fourRowHeight + sepHeight * 3;\r
\r
private final int rowSix = rowFive + oneRowHeight + sepHeight;\r
\r
\r
private final int rowNine = rowEight + oneRowHeight + sepHeight;\r
\r
- private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight;\r
+ private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight * 3;\r
\r
private final int rowEleven = rowTen + oneRowHeight + sepHeight;\r
\r
\r
private final int tableWidth = valueWidth;\r
\r
- /**\r
- * \r
- */\r
- private static final long serialVersionUID = 1L;\r
-\r
static JFrame frame;\r
\r
private JPanel jContentPane = null;\r
\r
private JComboBox jComboBoxInterDir = null;\r
\r
+ private JComboBox jBuildTargetComboBox = null;\r
+\r
private JTable jTableBuildTargets = null;\r
\r
private JPanel jArchitectureSelections = null;\r
\r
private JLabel jLabelBuildTargets = null;\r
\r
- private JTextField jTextFieldBuildTarget = null;\r
+ // private JTextField jTextFieldBuildTarget = null;\r
\r
private JButton jButtonAddBuildTarget = null;\r
\r
\r
private int selectedRow = -1;\r
\r
+ /**\r
+ * The following are not used by the UI \r
+ */\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ private ToolChainId tid = new ToolChainId();\r
+\r
public FpdPlatformDefs() {\r
super();\r
initialize();\r
jPanelGeneralContainer.add(getArchitectureSelections(), null);\r
\r
jPanelGeneralContainer.add(jLabelBuildTargets, null);\r
- jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);\r
+ // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);\r
+ jPanelGeneralContainer.add(getJBuildTargetComboBox(), null);\r
+\r
jPanelGeneralContainer.add(getJButtonAddBuildTarget(), null);\r
jPanelGeneralContainer.add(getJButtonDelBuildTarget(), null);\r
jPanelGeneralContainer.add(getJScrollPaneBuildTargets(), null);\r
jArchitectureSelections.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));\r
jArchitectureSelections.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r
jArchitectureSelections.setLocation(new java.awt.Point(valueColumn, rowOne));\r
+ jArchitectureSelections.setToolTipText("<html>A Platform may support one or more architectures," \r
+ + "<br>at least one architecture must be selected!</html>");\r
}\r
return jArchitectureSelections;\r
}\r
}\r
\r
/**\r
- * This method initializes jTextField1 \r
- * \r
- * @return javax.swing.JTextField \r
+ * Use a ComboBox for BuildTargets\r
+ * \r
+ * @return javax.swing.JComboBox jBuildTargetComboBox\r
*/\r
- private JTextField getJTextFieldBuildTarget() {\r
- if (jTextFieldBuildTarget == null) {\r
- jTextFieldBuildTarget = new JTextField();\r
- jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r
- jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));\r
- jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));\r
+ private JComboBox getJBuildTargetComboBox() {\r
+ if (jBuildTargetComboBox == null) {\r
+ String toolBt = null;\r
+ if (tid.getToolsDefTargetNames() == null)\r
+ toolBt = "DEBUG RELEASE";\r
+ else\r
+ toolBt = tid.getToolsDefTargetNames().trim();\r
+\r
+ if ((toolBt.contains("*")) || (toolBt.length() < 1)) {\r
+ toolBt = "DEBUG RELEASE";\r
+ }\r
+ if (Debug)\r
+ System.out.println("Using Build Targets: " + toolBt.trim());\r
+\r
+ toolBt = toolBt.replaceAll(" ", ":");\r
+ toolBt = " :" + toolBt;\r
+ if (Debug)\r
+ System.out.println("Using Build Targets: " + toolBt.trim());\r
+ String[] buildTargets = toolBt.trim().split(":");\r
+\r
+ jBuildTargetComboBox = new JComboBox(buildTargets);\r
+ jBuildTargetComboBox.setEditable(true);\r
+ jBuildTargetComboBox.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r
+ jBuildTargetComboBox.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));\r
+ jBuildTargetComboBox.setLocation(new java.awt.Point(valueColumn, rowTwo));\r
+ jBuildTargetComboBox.setToolTipText("<html>Select a defined Target and then click Add,<br>"\r
+ + "or enter a new, one word TargetName and then click Add.<br>"\r
+ + "Remember to define the Targetname in the tool defintion file."\r
+ + "</html>");\r
+\r
}\r
- return jTextFieldBuildTarget;\r
+ return jBuildTargetComboBox;\r
}\r
\r
+ /**\r
+ * This method initializes jTextField1 \r
+ * \r
+ * @return javax.swing.JTextField \r
+ */\r
+ // private JTextField getJTextFieldBuildTarget() {\r
+ // if (jTextFieldBuildTarget == null) {\r
+ // jTextFieldBuildTarget = new JTextField();\r
+ // jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r
+ // jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));\r
+ // jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));\r
+ // }\r
+ // return jTextFieldBuildTarget;\r
+ // }\r
/**\r
* This method initializes jButton2 \r
* \r
\r
jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(java.awt.event.ActionEvent e) {\r
- if (jTextFieldBuildTarget.getText().length() > 0) {\r
- String[] row = { jTextFieldBuildTarget.getText() };\r
- jTextFieldBuildTarget.setText("");\r
+ // Used with Text Field\r
+ // if (jTextFieldBuildTarget.getText().length() > 0) {\r
+ // String[] row = { jTextFieldBuildTarget.getText() };\r
+ // jTextFieldBuildTarget.setText("");\r
+ // buildTargetTableModel.addRow(row);\r
+ // Vector<Object> v = new Vector<Object>();\r
+ // for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {\r
+ // v.add(buildTargetTableModel.getValueAt(i, 0));\r
+ // }\r
+ // docConsole.setSaved(false);\r
+ // ffc.setPlatformDefsBuildTargets(v);\r
+ // }\r
+ // Use with ComboBox\r
+ if (jBuildTargetComboBox.getSelectedItem().toString().length() > 0) {\r
+ String[] row = { jBuildTargetComboBox.getSelectedItem().toString() };\r
buildTargetTableModel.addRow(row);\r
Vector<Object> v = new Vector<Object>();\r
for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {\r
v.add(buildTargetTableModel.getValueAt(i, 0));\r
}\r
- docConsole.setSaved(false);\r
- ffc.setPlatformDefsBuildTargets(v);\r
}\r
}\r
});\r
jTableBuildTargets = new JTable(buildTargetTableModel);\r
jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
jTableBuildTargets.setRowHeight(oneRowHeight);\r
+ jTableBuildTargets.setToolTipText("<html>Select one of the Targets from the table and<br>"\r
+ + "click Delete to remove the target from the platform.</html>");\r
buildTargetTableModel.addColumn("Build Target");\r
\r
jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {\r
jTextFieldSkuId.setPreferredSize(new Dimension(40, oneRowHeight));\r
jTextFieldSkuId.setBounds(new java.awt.Rectangle(valueColumn, rowSix, 40, oneRowHeight));\r
jTextFieldSkuId.setLocation(new java.awt.Point(valueColumn, rowSix));\r
+ jTextFieldSkuId.setToolTipText("Enter a unique integer value.");\r
}\r
return jTextFieldSkuId;\r
}\r
jTextFieldSkuName.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r
jTextFieldSkuName.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));\r
jTextFieldSkuName.setLocation(new java.awt.Point(valueColumn, rowSeven));\r
+ jTextFieldSkuName.setToolTipText("<html>Enter a name to help identify this SKU.<br>"\r
+ + "This entry is not used by the build system, it is<br>"\r
+ + "used only by this user interface.</html>");\r
}\r
return jTextFieldSkuName;\r
}\r
jScrollPaneSkuInfo.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));\r
jScrollPaneSkuInfo.setBounds(new java.awt.Rectangle(valueColumn, rowNine, tableWidth - 5, tableHeight - 5));\r
jScrollPaneSkuInfo.setLocation(new java.awt.Point(valueColumn, rowNine));\r
- jScrollPaneSkuInfo.setBorder(null);\r
+\r
+ jScrollPaneSkuInfo\r
+ .setBorder(javax.swing.BorderFactory\r
+ .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));\r
\r
jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());\r
}\r
skuInfoTableModel.addColumn("SKU ID");\r
skuInfoTableModel.addColumn("Name");\r
jTableSkuInfo = new JTable(skuInfoTableModel);\r
+ jTableSkuInfo.setToolTipText("<html>SKU ID 0 must always be defined as the default.<br>"\r
+ + "0 can mean either SKU disabled, or it can be the<br>"\r
+ + "default value if more than one SKU is defined, and the<br>"\r
+ + "platform is not jumpered to use one of the other SKU values.</html>");\r
\r
jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
\r
jComboBoxInterDir.addItem("UNIFIED");\r
jComboBoxInterDir.addItem("MODULE");\r
jComboBoxInterDir.setSelectedIndex(0);\r
+ jComboBoxInterDir.setToolTipText("<html>Select UNIFIED to generate intermediate directories under<br>"\r
+ + "under platform directory tree.<br>"\r
+ + "Select MODULE to generate intermediate directories under the<br>"\r
+ + "individual module directories.</html>");\r
jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {\r
public void itemStateChanged(java.awt.event.ItemEvent e) {\r
if (docConsole != null) {\r
jTextFieldOutputDir.setBounds(new java.awt.Rectangle(valueColumn + 30, rowTwelve, valueWidth - 30,\r
oneRowHeight));\r
jTextFieldOutputDir.setLocation(new java.awt.Point(valueColumn + 30, rowTwelve));\r
+ jTextFieldOutputDir.setToolTipText("Select the name or URL for the output directory tree.");\r
jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {\r
public void focusLost(java.awt.event.FocusEvent e) {\r
docConsole.setSaved(false);\r
--- /dev/null
+/** @file
+
+ This file is used to init tool chain and tool preference data
+ Copyright (c) 2006, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ **/
+
+package org.tianocore.frameworkwizard.toolchain;
+
+import java.io.*;
+import java.io.File;
+import java.lang.Integer;
+import java.util.ArrayList;
+
+import javax.swing.JOptionPane;
+
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.Tools;
+import org.tianocore.frameworkwizard.common.Log;
+import org.tianocore.frameworkwizard.workspace.Workspace;
+
+public class ToolChainId {
+ //
+ // Define class members
+ //
+
+ private final boolean Debug = false;
+
+ private String toolDefinitionFile = null;
+
+ private final int toolDefFieldCount = 5;
+
+ private String toolsDefIdentifier = null;
+
+ private String toolsDefTargetNames = null;
+
+ private final int toolsDefTargetNameField = 0;
+
+ private String toolsDefTagNames = null;
+
+ private final int toolsDefTagNameField = 1;
+
+ private String toolsDefArchNames = null;
+
+ private final int toolsDefArchNameField = 2;
+
+ private final int toolsDefToolArgumentField = 4;
+
+ private String toolCommandCodes = null;
+
+ private final int toolsDefCmdCodeArgumentField = 3;
+
+
+ private String activePlatform = null;
+
+ private String targetArchs = null;
+
+ private String tagNames = null;
+
+ private String buildTargets = null;
+
+ private String toolFamilies = null;
+
+ private ArrayList<String> toolDefinitionContents = new ArrayList<String>(50);
+
+ private static boolean threadEnabled = false;
+
+ private static int maxThreadCount = 0;
+
+ private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools"
+ + System.getProperty("file.separator") + "Conf";
+
+ private String strTargetFile = toolsDir + DataType.FILE_SEPARATOR + "target.txt";
+
+ private String defaultToolsConf = toolsDir + DataType.FILE_SEPARATOR + "tools_def.txt";
+
+ public void init() {
+ readTargetTxtFile();
+ readToolDefinitionFile();
+ }
+
+ public ToolChainId() {
+ super();
+ init();
+ }
+
+ public String getToolDefinitionFile() {
+ return toolDefinitionFile;
+ }
+
+ public String getActivePlatform() {
+ return activePlatform;
+ }
+
+ public String getBuildTargets() {
+ return buildTargets;
+ }
+
+ public String getTagNames() {
+ return tagNames;
+ }
+
+ public String getTargetArchitectures() {
+ return targetArchs;
+ }
+
+ public boolean getThreadEnabled() {
+ return threadEnabled;
+ }
+
+ public int getMaxThreadCount() {
+ return maxThreadCount;
+ }
+
+ public String getToolFamilies() {
+ return toolFamilies;
+ }
+
+ public String getToolDefinitionIdentifier() {
+ return toolsDefIdentifier;
+ }
+
+ public ArrayList<String> getToolDefinitionStatements() {
+ return toolDefinitionContents;
+ }
+
+ public String getToolsDefTagNames() {
+ return toolsDefTagNames;
+ }
+
+ public String getToolsDefTargetNames() {
+ return toolsDefTargetNames;
+ }
+
+ public String getToolsDefCommandCodes() {
+ return toolCommandCodes;
+ }
+
+ private void readTargetTxtFile() {
+ File tFile = new File(strTargetFile);
+
+ if (tFile.exists()) {
+ try {
+ FileReader fileReader = new FileReader(strTargetFile);
+ BufferedReader reader = new BufferedReader(fileReader);
+ String rLine = null;
+ String inLine[] = new String[2];
+ while ((rLine = reader.readLine()) != null) {
+ if ((rLine.startsWith("ACTIVE_PLATFORM")) && (activePlatform == null)) {
+ // Only one active platform is permitted!
+ inLine = rLine.trim().split("=");
+ activePlatform = inLine[1].trim();
+ }
+ if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))
+ || (rLine.startsWith("TARGET="))) {
+ // Handle multiple Target Names
+ if (rLine.contains(",")) {
+ inLine = rLine.trim().split("=");
+ buildTargets = inLine[1].trim().replaceAll(",", " ");
+ } else {
+ inLine = rLine.trim().split("=");
+ buildTargets = inLine[1].trim();
+ }
+ }
+ if (rLine.startsWith("TARGET_ARCH")) {
+ // Handle multiple Target Architectures
+ if (rLine.contains(",")) {
+ inLine = rLine.trim().split("=");
+ targetArchs = inLine[1].trim().replaceAll(",", " ");
+ } else {
+ inLine = rLine.trim().split("=");
+ targetArchs = inLine[1].trim();
+ }
+ }
+ if (rLine.startsWith("TOOL_CHAIN_CONF")) {
+ // Only one file is permitted
+ inLine = rLine.trim().split("=");
+ toolDefinitionFile = inLine[1].trim();
+ }
+
+ if (rLine.startsWith("TOOL_CHAIN_TAG")) {
+ // Handle multiple Tool TagNames
+ if (rLine.contains(",")) {
+ inLine = rLine.trim().split("=");
+ tagNames = inLine[1].trim().replaceAll(",", " ");
+ } else {
+ inLine = rLine.trim().split("=");
+ tagNames = inLine[1].trim();
+ }
+ }
+
+ if (rLine.startsWith("MULTIPLE_THREAD")) {
+ // Handle Thread Enable flag
+ if ((rLine.trim().toLowerCase().contains("enabled"))
+ || (rLine.trim().toLowerCase().contains("true"))) {
+ threadEnabled = true;
+ } else {
+ threadEnabled = false;
+ }
+ }
+
+ if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) {
+ // Handle Thread Enable flag
+ inLine = rLine.trim().split("=");
+ maxThreadCount = Integer.valueOf(inLine[1].trim());
+ }
+ }
+ reader.close();
+ } catch (IOException e) {
+ Log.log(this.strTargetFile + " Read Error ", e.getMessage());
+ e.printStackTrace();
+ }
+ } else {
+ JOptionPane.showMessageDialog(null, "<html>" + "Tool Preferences file: <br>" + strTargetFile
+ + "<br>does not exist!</html>");
+ }
+ }
+
+ private void readToolDefinitionFile() {
+
+ // Parse the tool definition file looking for targets and architectures
+ String toolsConfFile = null;
+ if (toolDefinitionFile != null) {
+ String resString = (Tools.convertPathToCurrentOsType(toolDefinitionFile)).trim();
+ toolsConfFile = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + resString.trim();
+ File toolsDefFile = new File(toolsConfFile);
+ if (!toolsDefFile.exists()) {
+ JOptionPane.showMessageDialog(null, "<html>" + "Tool Definition file, " + toolDefinitionFile
+ + "<br>specified in the target.txt file does not exist!"
+ + "<br>Using the default Tool Definition File:<br>"
+ + defaultToolsConf);
+ toolsConfFile = defaultToolsConf;
+ }
+ } else {
+ toolsConfFile = defaultToolsConf;
+ }
+ String[] toolsDefFields = new String[toolDefFieldCount];
+ for (int i = 0; i < toolDefFieldCount; i++)
+ toolsDefFields[i] = null;
+ File toolDefFile = new File(toolsConfFile);
+ if (toolDefFile.exists()) {
+ try {
+ FileReader fileReader = new FileReader(toolDefFile);
+ BufferedReader reader = new BufferedReader(fileReader);
+ String rLine = null;
+ String result[];
+ while ((rLine = reader.readLine()) != null) {
+ if ((rLine.startsWith("IDENTIFIER")) && (toolsDefIdentifier == null)) {
+ result = rLine.split("=");
+ toolsDefIdentifier = (result[1]).trim();
+ } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) {
+ result = rLine.split("=");
+ toolsDefFields = ((result[0]).trim()).split("_");
+ if (toolsDefTargetNames == null) {
+ toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " ";
+ } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim())) {
+ toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " ";
+ }
+ if (toolsDefTagNames == null) {
+ toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).toUpperCase().toUpperCase().trim() + " ";
+ } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).toUpperCase().trim())) {
+ toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).toUpperCase().trim() + " ";
+ }
+ if (toolsDefArchNames == null) {
+ toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " ";
+ } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).toUpperCase().trim())) {
+ toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " ";
+ }
+ if ((toolFamilies == null) && (rLine.trim().contains("FAMILY"))) {
+ toolFamilies = (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " ";
+ } else if ((rLine.trim().contains("FAMILY"))
+ && (!toolFamilies.contains((toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim()))) {
+ toolFamilies += (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " ";
+ }
+ if ((toolCommandCodes == null)) {
+ toolCommandCodes = (toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim() + " ";
+ } else if ((!toolCommandCodes.contains((toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim()))) {
+ toolCommandCodes += (toolsDefFields[toolsDefCmdCodeArgumentField].toUpperCase().trim()) + " ";
+ }
+
+ toolDefinitionContents.add(rLine.trim().replaceAll(" ", ""));
+ }
+ }
+ reader.close();
+ if (!toolsDefTargetNames.matches("[A-Z]+")) {
+ toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();
+ if (Debug)
+ System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames
+ + "'");
+ }
+ } catch (IOException e) {
+ Log.log(toolsConfFile + " Read Error ", e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+
+}