diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml index 626222175fb..9a1a1d862a6 100644 --- a/sdk/lib/libraries.yaml +++ b/sdk/lib/libraries.yaml @@ -5,7 +5,7 @@ # Note: if you edit this file, you must also generate libraries.json in this # directory: # -# python3 ./tools/yaml2json.py sdk/lib/libraries.yaml sdk/lib/libraries.json +# dart tools/yaml2json.dart sdk/lib/libraries.yaml sdk/lib/libraries.json # # We currently have several different files that needs to be updated when # changing libraries, sources, and patch files. See diff --git a/sdk/lib/vmservice_libraries.yaml b/sdk/lib/vmservice_libraries.yaml index 40015c3f00d..d5e049c9583 100644 --- a/sdk/lib/vmservice_libraries.yaml +++ b/sdk/lib/vmservice_libraries.yaml @@ -5,7 +5,7 @@ # Note: if you edit this file, you must also generate libraries.json in this # directory: # -# python3 ./tools/yaml2json.py sdk/lib/vmservice_libraries.yaml sdk/lib/vmservice_libraries.json +# dart tools/yaml2json.dart sdk/lib/vmservice_libraries.yaml sdk/lib/vmservice_libraries.json # # We currently have several different files that needs to be updated when # changing libraries, sources, and patch files. See diff --git a/tools/yaml2json.dart b/tools/yaml2json.dart index 8ce490716b2..e8b6a07809c 100644 --- a/tools/yaml2json.dart +++ b/tools/yaml2json.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart = 2.9 - import 'dart:io' show File, exit, stderr; import 'dart:isolate' show RawReceivePort; @@ -12,7 +10,7 @@ import 'dart:convert' show JsonEncoder; import 'package:yaml/yaml.dart' show loadYaml; -main(List arguments) async { +main(List arguments) { var port = new RawReceivePort(); if (arguments.length != 2) { stderr.writeln("Usage: yaml2json.dart input.yaml output.json"); @@ -20,7 +18,7 @@ main(List arguments) async { } Uri input = Uri.base.resolve(arguments[0]); Uri output = Uri.base.resolve(arguments[1]); - Map yaml = loadYaml(await new File.fromUri(input).readAsString()); + Map yaml = loadYaml(new File.fromUri(input).readAsStringSync()); Map result = new Map(); result["comment:0"] = "NOTE: THIS FILE IS GENERATED. DO NOT EDIT."; result["comment:1"] = @@ -29,6 +27,6 @@ main(List arguments) async { result[key] = yaml[key]; } File file = new File.fromUri(output); - await file.writeAsString(const JsonEncoder.withIndent(" ").convert(result)); + file.writeAsStringSync(const JsonEncoder.withIndent(" ").convert(result)); port.close(); } diff --git a/tools/yaml2json.py b/tools/yaml2json.py deleted file mode 100755 index 251f65708a4..00000000000 --- a/tools/yaml2json.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -import os -import subprocess -import sys - -import utils - - -def Main(): - args = sys.argv[1:] - yaml2json_dart = os.path.relpath( - os.path.join(os.path.dirname(__file__), "yaml2json.dart")) - command = [utils.CheckedInSdkExecutable(), yaml2json_dart] + args - - with utils.CoreDumpArchiver(args): - exit_code = subprocess.call(command) - - utils.DiagnoseExitCode(exit_code, command) - return exit_code - - -if __name__ == '__main__': - sys.exit(Main())