]>
Commit | Line | Data |
---|---|---|
4234283c | 1 | ## @file\r |
f7496d71 LG |
2 | # This file is used to define class objects of INF file [BuildOptions] section.\r |
3 | # It will consumed by InfParser.\r | |
4234283c | 4 | #\r |
f7496d71 | 5 | # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r |
4234283c | 6 | #\r |
f7496d71 LG |
7 | # This program and the accompanying materials are licensed and made available\r |
8 | # under the terms and conditions of the BSD License which accompanies this\r | |
9 | # distribution. The full text of the license may be found at\r | |
4234283c LG |
10 | # http://opensource.org/licenses/bsd-license.php\r |
11 | #\r | |
12 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | '''\r | |
16 | InfBuildOptionObject\r | |
17 | '''\r | |
18 | \r | |
f7496d71 | 19 | from Library import GlobalData\r |
4234283c LG |
20 | \r |
21 | from Object.Parser.InfCommonObject import InfSectionCommonDef\r | |
22 | \r | |
23 | class InfBuildOptionItem():\r | |
24 | def __init__(self):\r | |
25 | self.Content = ''\r | |
26 | self.SupArchList = []\r | |
27 | self.AsBuildList = []\r | |
f7496d71 | 28 | \r |
4234283c LG |
29 | def SetContent(self, Content):\r |
30 | self.Content = Content\r | |
31 | def GetContent(self):\r | |
32 | return self.Content\r | |
f7496d71 | 33 | \r |
4234283c LG |
34 | def SetSupArchList(self, SupArchList):\r |
35 | self.SupArchList = SupArchList\r | |
36 | def GetSupArchList(self):\r | |
37 | return self.SupArchList\r | |
f7496d71 | 38 | \r |
4234283c LG |
39 | #\r |
40 | # AsBuild Information\r | |
41 | #\r | |
42 | def SetAsBuildList(self, AsBuildList):\r | |
43 | self.AsBuildList = AsBuildList\r | |
44 | def GetAsBuildList(self):\r | |
45 | return self.AsBuildList\r | |
f7496d71 LG |
46 | \r |
47 | \r | |
4234283c LG |
48 | ## INF BuildOption section\r |
49 | # Macro define is not permitted for this section.\r | |
50 | #\r | |
f7496d71 | 51 | #\r |
4234283c LG |
52 | class InfBuildOptionsObject(InfSectionCommonDef):\r |
53 | def __init__(self):\r | |
54 | self.BuildOptions = []\r | |
55 | InfSectionCommonDef.__init__(self)\r | |
56 | ## SetBuildOptions function\r | |
57 | #\r | |
58 | # For BuildOptionName, need to validate it's format\r | |
f7496d71 | 59 | # For BuildOptionValue, just ignore it.\r |
4234283c LG |
60 | #\r |
61 | # @param Arch Indicated which arch of build options belong to.\r | |
62 | # @param BuildOptCont A list contain BuildOption related information.\r | |
63 | # The element in the list contain 3 members.\r | |
64 | # BuildOptionName, BuildOptionValue and IsReplace\r | |
65 | # flag.\r | |
f7496d71 | 66 | #\r |
4234283c LG |
67 | # @return True Build options set/validate successfully\r |
68 | # @return False Build options set/validate failed\r | |
69 | #\r | |
70 | def SetBuildOptions(self, BuildOptCont, ArchList = None, SectionContent = ''):\r | |
71 | \r | |
f7496d71 LG |
72 | if not GlobalData.gIS_BINARY_INF:\r |
73 | \r | |
4234283c LG |
74 | if SectionContent.strip() != '':\r |
75 | InfBuildOptionItemObj = InfBuildOptionItem()\r | |
76 | InfBuildOptionItemObj.SetContent(SectionContent)\r | |
77 | InfBuildOptionItemObj.SetSupArchList(ArchList)\r | |
f7496d71 | 78 | \r |
4234283c LG |
79 | self.BuildOptions.append(InfBuildOptionItemObj)\r |
80 | else:\r | |
81 | #\r | |
f7496d71 | 82 | # For AsBuild INF file\r |
4234283c LG |
83 | #\r |
84 | if len(BuildOptCont) >= 1:\r | |
85 | InfBuildOptionItemObj = InfBuildOptionItem()\r | |
86 | InfBuildOptionItemObj.SetAsBuildList(BuildOptCont)\r | |
421ccda3 | 87 | InfBuildOptionItemObj.SetSupArchList(ArchList)\r |
4234283c | 88 | self.BuildOptions.append(InfBuildOptionItemObj)\r |
f7496d71 | 89 | \r |
4234283c | 90 | return True\r |
f7496d71 | 91 | \r |
4234283c | 92 | def GetBuildOptions(self):\r |
f7496d71 | 93 | return self.BuildOptions\r |