]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTool/Build: Add --disable-include-path-check.
authorJiewen Yao <jiewen.yao@intel.com>
Wed, 13 Mar 2019 22:10:54 +0000 (06:10 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Fri, 15 Mar 2019 05:29:29 +0000 (13:29 +0800)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1620

This option is added to disable the include path check
for outside of package.
The original purpose of thie check is to make sure EDK II
modules must not reference header files outside of the packages
they depend on or within the module's directory tree.

However, we do see the usage to build EDKII as executable running
in the operating system which requires include path to outside.
For example, EmulatorPkg. The current solution (soft link) is
weird hack - EmulatorPkg\Unix\Host\X11IncludeHack.

With this solution, this can be supported easily.

The patch is validated with and without --disable-include-path-check.
If user does not use --disable-include-path-check, the build will fail
with outside path in the include path.
If user uses --disable-include-path-check, the build will pass
with outside path in the include path.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/build/build.py

index e7dbf66e2f2582154cff312d3775eda9e898267e..568d535754692512e8704f7617d309c3efe2a723 100644 (file)
@@ -3037,13 +3037,14 @@ class ModuleAutoGen(AutoGen):
             # EDK II modules must not reference header files outside of the packages they depend on or\r
             # within the module's directory tree. Report error if violation.\r
             #\r
-            for Path in IncPathList:\r
-                if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):\r
-                    ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)\r
-                    EdkLogger.error("build",\r
-                                    PARAMETER_INVALID,\r
-                                    ExtraData=ErrMsg,\r
-                                    File=str(self.MetaFile))\r
+            if GlobalData.gDisableIncludePathCheck == False:\r
+                for Path in IncPathList:\r
+                    if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):\r
+                        ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)\r
+                        EdkLogger.error("build",\r
+                                        PARAMETER_INVALID,\r
+                                        ExtraData=ErrMsg,\r
+                                        File=str(self.MetaFile))\r
             RetVal += IncPathList\r
         return RetVal\r
 \r
index 99e79d4dca768e0850abbe6e76108eb4108bf337..de641fb452fc63e1a788f581ed620ac139e19dcf 100644 (file)
@@ -719,6 +719,7 @@ class Build():
         GlobalData.gBinCacheDest   = BuildOptions.BinCacheDest\r
         GlobalData.gBinCacheSource = BuildOptions.BinCacheSource\r
         GlobalData.gEnableGenfdsMultiThread = BuildOptions.GenfdsMultiThread\r
+        GlobalData.gDisableIncludePathCheck = BuildOptions.DisableIncludePathCheck\r
 \r
         if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache:\r
             EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData="--binary-destination must be used together with --hash.")\r
@@ -2268,6 +2269,7 @@ def MyOptionParser():
     Parser.add_option("--binary-destination", action="store", type="string", dest="BinCacheDest", help="Generate a cache of binary files in the specified directory.")\r
     Parser.add_option("--binary-source", action="store", type="string", dest="BinCacheSource", help="Consume a cache of binary files from the specified directory.")\r
     Parser.add_option("--genfds-multi-thread", action="store_true", dest="GenfdsMultiThread", default=False, help="Enable GenFds multi thread to generate ffs file.")\r
+    Parser.add_option("--disable-include-path-check", action="store_true", dest="DisableIncludePathCheck", default=False, help="Disable the include path check for outside of package.")\r
     (Opt, Args) = Parser.parse_args()\r
     return (Opt, Args)\r
 \r