From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F23442194EB75 for ; Thu, 14 Mar 2019 02:54:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2019 02:54:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,478,1544515200"; d="scan'208";a="152261556" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 14 Mar 2019 02:54:25 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Mar 2019 02:54:25 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Mar 2019 02:54:24 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.158]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.134]) with mapi id 14.03.0415.000; Thu, 14 Mar 2019 17:54:22 +0800 From: "Feng, Bob C" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH] BaseTool/Build: Add --disable-include-path-check. Thread-Index: AQHU2emwtUIQdwXu0UmHi4Lh7bs/qKYK45bg Date: Thu, 14 Mar 2019 09:54:21 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D1600AFD1B@SHSMSX101.ccr.corp.intel.com> References: <20190313221054.17132-1-jiewen.yao@intel.com> In-Reply-To: <20190313221054.17132-1-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTool/Build: Add --disable-include-path-check. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2019 09:54:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Yao, Jiewen=20 Sent: Thursday, March 14, 2019 6:11 AM To: edk2-devel@lists.01.org Cc: Feng, Bob C ; Gao, Liming ;= Zhu, Yonghong Subject: [PATCH] BaseTool/Build: Add --disable-include-path-check. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1620 This option is added to disable the include path check for outside of packa= ge. 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 op= erating 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 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiewen Yao --- BaseTools/Source/Python/AutoGen/AutoGen.py | 15 ++++++++------- BaseTools/Source/Python/build/build.py | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index e7dbf66e2f..568d535754 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -3037,13 +3037,14 @@ class ModuleAutoGen(AutoGen): # EDK II modules must not reference header files outside of th= e packages they depend on or # within the module's directory tree. Report error if violatio= n. # - for Path in IncPathList: - if (Path not in self.IncludePathList) and (CommonPath([Pat= h, self.MetaFile.Dir]) !=3D self.MetaFile.Dir): - ErrMsg =3D "The include directory for the EDK II modul= e in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, Fla= gOption) - EdkLogger.error("build", - PARAMETER_INVALID, - ExtraData=3DErrMsg, - File=3Dstr(self.MetaFile)) + if GlobalData.gDisableIncludePathCheck =3D=3D False: + for Path in IncPathList: + if (Path not in self.IncludePathList) and (CommonPath(= [Path, self.MetaFile.Dir]) !=3D self.MetaFile.Dir): + ErrMsg =3D "The include directory for the EDK II m= odule in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool,= FlagOption) + EdkLogger.error("build", + PARAMETER_INVALID, + ExtraData=3DErrMsg, + File=3Dstr(self.MetaFile)) RetVal +=3D IncPathList return RetVal =20 diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 99e79d4dca..de641fb452 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -719,6 +719,7 @@ class Build(): GlobalData.gBinCacheDest =3D BuildOptions.BinCacheDest GlobalData.gBinCacheSource =3D BuildOptions.BinCacheSource GlobalData.gEnableGenfdsMultiThread =3D BuildOptions.GenfdsMultiTh= read + GlobalData.gDisableIncludePathCheck =3D=20 + BuildOptions.DisableIncludePathCheck =20 if GlobalData.gBinCacheDest and not GlobalData.gUseHashCache: EdkLogger.error("build", OPTION_NOT_SUPPORTED, ExtraData=3D"--= binary-destination must be used together with --hash.") @@ -2268,6 +2269,7 = @@ def MyOptionParser(): Parser.add_option("--binary-destination", action=3D"store", type=3D"st= ring", dest=3D"BinCacheDest", help=3D"Generate a cache of binary files in t= he specified directory.") Parser.add_option("--binary-source", action=3D"store", type=3D"string"= , dest=3D"BinCacheSource", help=3D"Consume a cache of binary files from the= specified directory.") Parser.add_option("--genfds-multi-thread", action=3D"store_true", dest= =3D"GenfdsMultiThread", default=3DFalse, help=3D"Enable GenFds multi thread= to generate ffs file.") + Parser.add_option("--disable-include-path-check",=20 + action=3D"store_true", dest=3D"DisableIncludePathCheck", default=3DFalse,= =20 + help=3D"Disable the include path check for outside of package.") (Opt, Args) =3D Parser.parse_args() return (Opt, Args) =20 -- 2.19.2.windows.1