diff options
| author | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
|---|---|---|
| committer | kx <kx@radix.pro> | 2024-06-04 06:43:08 +0300 |
| commit | 7e2ccccace24636f29ddc210b94606abd4c7e42b (patch) | |
| tree | 545d43ea12671048956cafeb12303e84d601e571 /BaseTools/Plugin/BuildToolsReport | |
| parent | 27b044605cd5f6b33a3d231576003850b3fe305b (diff) | |
| download | edk2-trunk.tar.xz | |
Renormalized end-of-lines from master@27b044605cd5f6b33a3d231576003850b3fe305btrunk
Diffstat (limited to 'BaseTools/Plugin/BuildToolsReport')
3 files changed, 207 insertions, 207 deletions
diff --git a/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py b/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py index 9f86b1c358..9d94c25273 100644 --- a/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py +++ b/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator.py @@ -1,69 +1,69 @@ -##
-# Copyright (c) Microsoft Corporation.
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-##
-import os
-import logging
-import json
-
-try:
- from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin
-
- class BuildToolsReportGenerator(IUefiBuildPlugin):
- def do_report(self, thebuilder):
- try:
- from edk2toolext.environment import version_aggregator
- except ImportError:
- logging.critical("Loading BuildToolsReportGenerator failed, please update your Edk2-PyTool-Extensions")
- return 0
-
- OutputReport = os.path.join(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), "BUILD_TOOLS_REPORT")
- OutputReport = os.path.normpath(OutputReport)
- if not os.path.isdir(os.path.dirname(OutputReport)):
- os.makedirs(os.path.dirname(OutputReport))
-
- Report = BuildToolsReport()
- Report.MakeReport(version_aggregator.GetVersionAggregator().GetAggregatedVersionInformation(), OutputReport=OutputReport)
-
- def do_pre_build(self, thebuilder):
- self.do_report(thebuilder)
- return 0
-
- def do_post_build(self, thebuilder):
- self.do_report(thebuilder)
- return 0
-
-except ImportError:
- pass
-
-
-class BuildToolsReport(object):
- MY_FOLDER = os.path.dirname(os.path.realpath(__file__))
- VERSION = "1.00"
-
- def __init__(self):
- pass
-
- def MakeReport(self, BuildTools, OutputReport="BuildToolsReport"):
- logging.info("Writing BuildToolsReports to {0}".format(OutputReport))
- versions_list = []
- for key, value in BuildTools.items():
- versions_list.append(value)
- versions_list = sorted(versions_list, key=lambda k: k['type'])
- json_dict = {"modules": versions_list,
- "PluginVersion": BuildToolsReport.VERSION}
-
- htmlfile = open(OutputReport + ".html", "w")
- jsonfile = open(OutputReport + ".json", "w")
- template = open(os.path.join(BuildToolsReport.MY_FOLDER, "BuildToolsReport_Template.html"), "r")
-
- for line in template.readlines():
- if "%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%" in line:
- line = line.replace("%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%", json.dumps(json_dict))
- htmlfile.write(line)
-
- jsonfile.write(json.dumps(versions_list, indent=4))
-
- jsonfile.close()
- template.close()
- htmlfile.close()
+## +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +import os +import logging +import json + +try: + from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin + + class BuildToolsReportGenerator(IUefiBuildPlugin): + def do_report(self, thebuilder): + try: + from edk2toolext.environment import version_aggregator + except ImportError: + logging.critical("Loading BuildToolsReportGenerator failed, please update your Edk2-PyTool-Extensions") + return 0 + + OutputReport = os.path.join(thebuilder.env.GetValue("BUILD_OUTPUT_BASE"), "BUILD_TOOLS_REPORT") + OutputReport = os.path.normpath(OutputReport) + if not os.path.isdir(os.path.dirname(OutputReport)): + os.makedirs(os.path.dirname(OutputReport)) + + Report = BuildToolsReport() + Report.MakeReport(version_aggregator.GetVersionAggregator().GetAggregatedVersionInformation(), OutputReport=OutputReport) + + def do_pre_build(self, thebuilder): + self.do_report(thebuilder) + return 0 + + def do_post_build(self, thebuilder): + self.do_report(thebuilder) + return 0 + +except ImportError: + pass + + +class BuildToolsReport(object): + MY_FOLDER = os.path.dirname(os.path.realpath(__file__)) + VERSION = "1.00" + + def __init__(self): + pass + + def MakeReport(self, BuildTools, OutputReport="BuildToolsReport"): + logging.info("Writing BuildToolsReports to {0}".format(OutputReport)) + versions_list = [] + for key, value in BuildTools.items(): + versions_list.append(value) + versions_list = sorted(versions_list, key=lambda k: k['type']) + json_dict = {"modules": versions_list, + "PluginVersion": BuildToolsReport.VERSION} + + htmlfile = open(OutputReport + ".html", "w") + jsonfile = open(OutputReport + ".json", "w") + template = open(os.path.join(BuildToolsReport.MY_FOLDER, "BuildToolsReport_Template.html"), "r") + + for line in template.readlines(): + if "%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%" in line: + line = line.replace("%TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%", json.dumps(json_dict)) + htmlfile.write(line) + + jsonfile.write(json.dumps(versions_list, indent=4)) + + jsonfile.close() + template.close() + htmlfile.close() diff --git a/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml b/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml index 8933535729..8656a49708 100644 --- a/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml +++ b/BaseTools/Plugin/BuildToolsReport/BuildToolsReportGenerator_plug_in.yaml @@ -1,12 +1,12 @@ -## @file
-# Build Plugin used to output html report of all versions collected
-# during the build
-#
-# Copyright (c) Microsoft Corporation.
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-##
-{
- "scope": "global",
- "name": "Build Tools Report Generator",
- "module": "BuildToolsReportGenerator"
-}
+## @file +# Build Plugin used to output html report of all versions collected +# during the build +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + "scope": "global", + "name": "Build Tools Report Generator", + "module": "BuildToolsReportGenerator" +} diff --git a/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html b/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html index 8273fdee49..a93c960ce3 100644 --- a/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html +++ b/BaseTools/Plugin/BuildToolsReport/BuildToolsReport_Template.html @@ -1,126 +1,126 @@ -<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible">
- <title>Build Tools Report</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" />
- <style>
- div.attribution {
- border: 1px solid #ddd;
- background-color: #bbb;
- padding-left: 20px;
- }
- </style>
-</head>
-<body>
- <div class="container-fluid">
- <h1>Build Tools Report</h1>
- <ul class="nav nav-tabs">
- <li class="active"><a data-toggle="tab" href="#tabs-1">Tools</a></li>
- <li><a data-toggle="tab" href="#tabs-2">About</a></li>
- </ul>
- <div class="tab-content">
- <div id="tabs-1" class="tab-pane fade in active">
- <table id="modinfo" class="table table-striped table-bordered table-hover" cellspacing="0">
- <thead>
- <tr>
- <th>Key</th>
- <th>Value</th>
- <th>Type</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
- </div>
- <div id="tabs-2" class="tab-pane">
- <div class="row">
- <div class="col-xs-7">
- <p></p>
- <p>
- Build Tools Report Template Version: <span id="ReportTemplateVersion">1.00</span><br />
- Build Tools Report Plugin Version: <span id='ReportToolVersion'></span><br />
- </p>
- <h3>License</h3>
- <hr />
- <div id="ToolLicenseContent">
- <p>
- <span class="copyright">Copyright (c) Microsoft Corporation.</span><br />
- <span class="license">
- SPDX-License-Identifier: BSD-2-Clause-Patent
- </span>
- </p>
- </div>
- </div>
- <div id="AttributionListWrapper" class="col-xs-5">
- <h3>External Licenses</h3>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Javascript libraries -->
- <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
- <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
- <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"></script>
- <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
-
- <script>
- var EmbeddedJd = %TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%;
- </script>
- <!-- Add javascript here -->
- <script>
- var MODULE_TABLE_OFFSET = 350; //Space needed for other stuff besides the Table
- $(document).ready(function () {
- $('span#ReportToolVersion').text(EmbeddedJd.PluginVersion);
- //To support tabs and correct column width we need this change
- $('a[data-toggle="tab"][href="#tabs-1"]').on('shown.bs.tab', function (e) {
- $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
- });
- //table for modules
- var mTable = $('table#modinfo').dataTable({
- "aaData": EmbeddedJd.modules,
- "paginate": false,
- "autoWidth": false,
- "scrollY": ($(window).height() - MODULE_TABLE_OFFSET) + "px",
- "aaSorting": [[2, "asc"]],
- "aoColumnDefs": [
- {
- "mData": "name",
- "aTargets": [0]
- },
-
- {
- "mData": "version",
- "aTargets": [1]
- },
- {
- "mData": "type",
- "aTargets": [2],
- }
- ] //end of column def
- }); //end of modules table
-
- //
- // Create Attribution List for all external libraries used
- //
- [
- { Title: "JQuery", Copyright: "Copyright 2017 The jQuery Foundation", Version: $.fn.jquery, LicenseType: "MIT", LicenseLink: "https://jquery.org/license/" },
- { Title: "DataTables", Copyright: "DataTables designed and created by SpryMedia Ltd Copyright 2007-2017", Version: $.fn.dataTable.version, LicenseType: "MIT", LicenseLink: "https://datatables.net/license/mit" },
- { Title: "BootStrap", Copyright: "Code and documentation copyright 2011-2017 the Bootstrap Authors and Twitter, Inc.", Version: "3.3.7", LicenseType: "MIT", LicenseLink: "https://github.com/twbs/bootstrap/blob/master/LICENSE" }
- ].forEach(function (element) {
- $("<div class='attribution'><h4>" + element.Title + "</h4><p>Version: <span class='version'>" + element.Version + "</span><br /><span class='copyright'>" +
- element.Copyright + "</span><br />License: <a class='license' href='" + element.LicenseLink + "'>" + element.LicenseType + "</a></p></div>").appendTo("div#AttributionListWrapper");
- });
- });
- $(window).resize(function() {
- $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust();
- });
-
-
- </script>
-</body>
-</html>
+<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible"> + <title>Build Tools Report</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css" /> + <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" /> + <style> + div.attribution { + border: 1px solid #ddd; + background-color: #bbb; + padding-left: 20px; + } + </style> +</head> +<body> + <div class="container-fluid"> + <h1>Build Tools Report</h1> + <ul class="nav nav-tabs"> + <li class="active"><a data-toggle="tab" href="#tabs-1">Tools</a></li> + <li><a data-toggle="tab" href="#tabs-2">About</a></li> + </ul> + <div class="tab-content"> + <div id="tabs-1" class="tab-pane fade in active"> + <table id="modinfo" class="table table-striped table-bordered table-hover" cellspacing="0"> + <thead> + <tr> + <th>Key</th> + <th>Value</th> + <th>Type</th> + </tr> + </thead> + <tbody></tbody> + </table> + </div> + <div id="tabs-2" class="tab-pane"> + <div class="row"> + <div class="col-xs-7"> + <p></p> + <p> + Build Tools Report Template Version: <span id="ReportTemplateVersion">1.00</span><br /> + Build Tools Report Plugin Version: <span id='ReportToolVersion'></span><br /> + </p> + <h3>License</h3> + <hr /> + <div id="ToolLicenseContent"> + <p> + <span class="copyright">Copyright (c) Microsoft Corporation.</span><br /> + <span class="license"> + SPDX-License-Identifier: BSD-2-Clause-Patent + </span> + </p> + </div> + </div> + <div id="AttributionListWrapper" class="col-xs-5"> + <h3>External Licenses</h3> + </div> + </div> + </div> + </div> + </div> + + <!-- Javascript libraries --> + <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script> + <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> + <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"></script> + <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script> + + <script> + var EmbeddedJd = %TO_BE_FILLED_IN_BY_PYTHON_SCRIPT%; + </script> + <!-- Add javascript here --> + <script> + var MODULE_TABLE_OFFSET = 350; //Space needed for other stuff besides the Table + $(document).ready(function () { + $('span#ReportToolVersion').text(EmbeddedJd.PluginVersion); + //To support tabs and correct column width we need this change + $('a[data-toggle="tab"][href="#tabs-1"]').on('shown.bs.tab', function (e) { + $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); + }); + //table for modules + var mTable = $('table#modinfo').dataTable({ + "aaData": EmbeddedJd.modules, + "paginate": false, + "autoWidth": false, + "scrollY": ($(window).height() - MODULE_TABLE_OFFSET) + "px", + "aaSorting": [[2, "asc"]], + "aoColumnDefs": [ + { + "mData": "name", + "aTargets": [0] + }, + + { + "mData": "version", + "aTargets": [1] + }, + { + "mData": "type", + "aTargets": [2], + } + ] //end of column def + }); //end of modules table + + // + // Create Attribution List for all external libraries used + // + [ + { Title: "JQuery", Copyright: "Copyright 2017 The jQuery Foundation", Version: $.fn.jquery, LicenseType: "MIT", LicenseLink: "https://jquery.org/license/" }, + { Title: "DataTables", Copyright: "DataTables designed and created by SpryMedia Ltd Copyright 2007-2017", Version: $.fn.dataTable.version, LicenseType: "MIT", LicenseLink: "https://datatables.net/license/mit" }, + { Title: "BootStrap", Copyright: "Code and documentation copyright 2011-2017 the Bootstrap Authors and Twitter, Inc.", Version: "3.3.7", LicenseType: "MIT", LicenseLink: "https://github.com/twbs/bootstrap/blob/master/LICENSE" } + ].forEach(function (element) { + $("<div class='attribution'><h4>" + element.Title + "</h4><p>Version: <span class='version'>" + element.Version + "</span><br /><span class='copyright'>" + + element.Copyright + "</span><br />License: <a class='license' href='" + element.LicenseLink + "'>" + element.LicenseType + "</a></p></div>").appendTo("div#AttributionListWrapper"); + }); + }); + $(window).resize(function() { + $.fn.dataTable.tables({ visible: true, api: true }).columns.adjust(); + }); + + + </script> +</body> +</html> |
