[Loc] Remove devtools_ui_strings generation scripts
All strings have been migrated to V2, so the scripts to generate V1 grd are no longer needed
Bug: 1136655
Change-Id: I96b776cccfb7017a11ead4983770b58962e272b7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2751608
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Christy Chen <chrche@microsoft.com>
diff --git a/front_end/langpacks/OWNERS b/front_end/langpacks/OWNERS
deleted file mode 100644
index 852d438..0000000
--- a/front_end/langpacks/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-file://COMMON_OWNERS
diff --git a/front_end/langpacks/devtools_ui_strings.grd b/front_end/langpacks/devtools_ui_strings.grd
deleted file mode 100644
index 2af1a8f..0000000
--- a/front_end/langpacks/devtools_ui_strings.grd
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- DevTools-specific strings. -->
-<grit latest_public_release="0" current_release="1" output_all_resource_defines="false" source_lang_id="en">
- <outputs>
- <output filename="devtools_ui_strings.h" type="rc_header">
- <emit emit_type='prepend'></emit>
- </output>
- <output filename="devtools_ui_strings_en-US.pak" type="data_package" lang="en-US" />
- </outputs>
- <translations>
- </translations>
-</grit>
diff --git a/scripts/build/generate_devtools_ui_strings.js b/scripts/build/generate_devtools_ui_strings.js
deleted file mode 100644
index f1aaeba..0000000
--- a/scripts/build/generate_devtools_ui_strings.js
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * This script is called by generate_devtools_ui_strings.py as part of the build process. It
- * parses DevTools frontend .js and module.json files, collects localizable strings, checks
- * if frontend strings are in .grd/.grdp files and reports error if present, and generates
- * {jsonKey, IDS_KEY} mappings if there is no error.
- *
- * Usage:
- * --root_gen_dir The root directory of the output .h and .cc files
- * --output_header Absolute path of the output .h file for the id mappings
- * --output_cc Absolute path of the output .cc file for the id mappings
- */
-
-const checkLocalizedStrings = require('../localization/utils/check_localized_strings');
-const localizationUtils = require('../localization/utils/localization_utils');
-
-const fs = require('fs');
-const path = require('path');
-const {promisify} = require('util');
-const writeFileAsync = promisify(fs.writeFile);
-
-class Arguments {
- constructor(rootGenDir, outputHeaderFilePath, outputCCFilePath) {
- this.rootGenDir = rootGenDir;
- this.outputHeaderFilePath = outputHeaderFilePath;
- this.outputCCFilePath = outputCCFilePath;
- }
-}
-
-function parseArguments(args) {
- const rootGenDirIndex = args.indexOf('--root_gen_dir');
- const outputHeaderIndex = args.indexOf('--output_header');
- const outputCCIndex = args.indexOf('--output_cc');
- return new Arguments(args[rootGenDirIndex + 1], args[outputHeaderIndex + 1], args[outputCCIndex + 1]);
-}
-
-async function main() {
- const args = parseArguments(process.argv);
- let frontendStrings;
- try {
- [frontendStrings, _] = await checkLocalizedStrings.parseLocalizableResourceMaps();
- } catch (e) {
- console.log(e);
- process.exit(1);
- }
-
- const toAddError = checkLocalizedStrings.getAndReportResourcesToAdd();
- const toModifyError = checkLocalizedStrings.getAndReportIDSKeysToModify();
- const toRemoveError = checkLocalizedStrings.getAndReportResourcesToRemove();
- let error = `${toAddError ? `${toAddError}\n` : ''}${toModifyError ? `${toModifyError}\n` : ''}${
- toRemoveError ? `${toRemoveError}\n` : ''}`;
- if (error !== '') {
- error +=
- '\nThe errors are potentially fixable with `node third_party/devtools-frontend/src/scripts/check_localizable_resources.js --autofix`';
- console.log(error);
- }
-
- // Since it's part of the build system, only fail if there are strings to be added to GRD/GRDP files
- // or if there are wrong IDS_ keys.
- if (toAddError || toModifyError) {
- process.exit(1);
- }
-
- try {
- await generateDevToolsLocalizedStrings(args, frontendStrings);
- } catch (e) {
- console.log('Error generating id map files:');
- console.log(e.stack);
- process.exit(1);
- }
-}
-
-// Generates {jsonKey, IDS_KEY} mappings according to frontendStrings
-async function generateDevToolsLocalizedStrings(args, frontendStrings) {
- const promises = [];
- const outputAbsoluteHeaderFilePath = path.join(args.rootGenDir, args.outputHeaderFilePath);
- const outputAbsoluteCCFilePath = path.join(args.rootGenDir, args.outputCCFilePath);
- const doNotEditStr =
- '// This file is automatically generated by //third_party/devtools-frontend/src/scripts/build/generate_devtools_ui_strings.js. Do not edit.';
- const outputHeaderFileContent = `${doNotEditStr}
-
-#ifndef CHROME_BROWSER_UI_WEBUI_DEVTOOLS_UI_STRINGS_H_
-#define CHROME_BROWSER_UI_WEBUI_DEVTOOLS_UI_STRINGS_H_
-
-#include "chrome/browser/ui/webui/localized_string.h"
-
-namespace devtools {
-
-constexpr unsigned int kLocalizedStringsSize = ${frontendStrings.size};
-extern const LocalizedString kLocalizedStrings[kLocalizedStringsSize];
-
-} // namespace devtools
-
-#endif // CHROME_BROWSER_UI_WEBUI_DEVTOOLS_UI_STRINGS_H_
-`;
-
- promises.push(writeFileAsync(outputAbsoluteHeaderFilePath, outputHeaderFileContent));
-
- let mappingsStr = '';
- frontendStrings.forEach((frontendString, idsKey) => {
- mappingsStr += ` {"${localizationUtils.sanitizeStringIntoCppFormat(frontendString.string)}", ${idsKey}},\n`;
- });
-
- const outputCCFileContent = `${doNotEditStr}
-
-#include "${args.outputHeaderFilePath}"
-
-#include "third_party/devtools-frontend/src/front_end/langpacks/devtools_ui_strings.h"
-
-namespace devtools {
-
-const LocalizedString kLocalizedStrings[] = {
-${mappingsStr}};
-
-} // namespace devtools
-`;
-
- promises.push(writeFileAsync(outputAbsoluteCCFilePath, outputCCFileContent));
- return Promise.all(promises);
-}
-
-main();
diff --git a/scripts/build/generate_devtools_ui_strings.py b/scripts/build/generate_devtools_ui_strings.py
deleted file mode 100644
index dd27811..0000000
--- a/scripts/build/generate_devtools_ui_strings.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import optparse
-import os
-import subprocess
-import sys
-
-_HERE_PATH = os.path.abspath(os.path.dirname(__file__))
-_JS_SCRIPT_PATH = os.path.join(_HERE_PATH, 'generate_devtools_ui_strings.js')
-_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..', '..'))
-
-sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node'))
-# pylint: disable=wrong-import-position
-import node # pylint: disable=import-error
-_NODE_PATH = node.GetBinaryPath()
-
-
-def main():
- parser = optparse.OptionParser(description=__doc__)
- parser.add_option(
- '--root_gen_dir',
- action='store',
- metavar='ROOT_GEN_DIR',
- help='The root directory where the header and cc will be generated.')
- parser.add_option('--output_header', action='store', metavar='OUTPUT_HEADER', help='Generated output .h file for pairs of IDs')
- parser.add_option(
- '--output_cc',
- action='store',
- metavar='OUTPUT_CC',
- help='Generated output .cc file that contains pairs of {front-end string key, IDS_ key}')
- options, _ = parser.parse_args()
-
- if not options.root_gen_dir:
- parser.error('--root_gen_dir was not specified.')
- if not options.output_header:
- parser.error('--output_header was not specified.')
- if not options.output_header:
- parser.error('--output_cc was not specified.')
-
- cmd_parts = [
- _NODE_PATH, _JS_SCRIPT_PATH, '--root_gen_dir',
- os.path.abspath(options.root_gen_dir), '--output_header', options.output_header, '--output_cc', options.output_cc
- ]
- process = subprocess.Popen(cmd_parts, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, _ = process.communicate()
- if process.returncode != 0:
- return out
-
-
-if __name__ == '__main__':
- sys.exit(main())