[dap] Move dap to third_party

Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Bug: b/286184681
Change-Id: Ic9c56e6b3c95d514cc11e2f9b743ab44af2350ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344020
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Alexander Thomas 2024-01-09 10:45:30 +00:00 committed by Commit Queue
parent 1ccaa12af2
commit bc260f4d73
18 changed files with 89 additions and 52 deletions

View file

@ -1,3 +0,0 @@
This is a package of classes that are generated from the [DAP specifications](https://microsoft.github.io/debug-adapter-protocol/specification) along with their generating code.
More information on Dart support for DAP is available [here](https://github.com/dart-lang/sdk/blob/main/pkg/dds/tool/dap/README.md).

View file

@ -1,23 +0,0 @@
debugAdapterProtocol.json is an unmodified copy of the DAP Specification,
downloaded from:
https://raw.githubusercontent.com/microsoft/debug-adapter-protocol/gh-pages/debugAdapterProtocol.json
The licence for this file is included below. This accompanying file is the
version of the specification that was used to generate a portion of the Dart
code used to support the protocol.
To regenerate the generated code, run the script in "tool/dap/generate_all.dart"
with no arguments. To download the latest version of the specification before
regenerating the code, run the same script with the "--download" argument.
---
Copyright (c) Microsoft Corporation.
All rights reserved.
Distributed under the following terms:
1. Documentation is licensed under the Creative Commons Attribution 3.0 United States License. Code is licensed under the MIT License.
2. This license does not grant you rights to use any trademarks or logos of Microsoft. For Microsofts general trademark guidelines, go to http://go.microsoft.com/fwlink/?LinkID=254653

View file

@ -1,9 +1,8 @@
Copyright 2023, the Dart project authors.
Copyright 2012, the Dart project authors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
@ -25,3 +24,31 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------
Files: debugAdapterProtocol.json
Files: lib/protocol_generated.dart
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

15
third_party/pkg/dap/README.md vendored Normal file
View file

@ -0,0 +1,15 @@
This is a package of classes that are generated from the [DAP specifications](https://microsoft.github.io/debug-adapter-protocol/specification) along with their generating code.
tool/external_dap_spec/debugAdapterProtocol.json is an unmodified copy of the
DAP Specification, downloaded from:
https://raw.githubusercontent.com/microsoft/debug-adapter-protocol/gh-pages/debugAdapterProtocol.json
This accompanying file is the version of the specification that was used to
generate a portion of the Dart code used to support the protocol.
To regenerate the generated code, run the script in "tool/dap/generate_all.dart"
with no arguments. To download the latest version of the specification before
regenerating the code, run the same script with the "--download" argument.
More information on Dart support for DAP is available [here](https://github.com/dart-lang/sdk/blob/main/pkg/dds/tool/dap/README.md).

View file

@ -1,8 +1,28 @@
// Copyright (c) 2023, 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.
// MIT License
//
// Copyright (c) Microsoft Corporation.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE
// This code was auto-generated by tool/dap/generate_all.dart; do not hand-edit!
// This file has been automatically generated. Please do not edit it manually.
// To regenerate the file, use the script
// "tool/generate_all.dart".
// ignore_for_file: prefer_void_to_null

View file

@ -39,12 +39,12 @@ Future<void> main(List<String> arguments) async {
const argDownload = 'download';
const argHelp = 'help';
const codeFileHeader = '''
// Copyright (c) 2023, 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.
final codeFileHeader = '''
$licenseComment
// This code was auto-generated by tool/dap/generate_all.dart; do not hand-edit!
// This file has been automatically generated. Please do not edit it manually.
// To regenerate the file, use the script
// "tool/generate_all.dart".
// ignore_for_file: prefer_void_to_null
@ -59,14 +59,19 @@ final argParser = ArgParser()
help: 'Download latest version of the DAP spec before generating types');
final generatedCodeFile =
path.join(toolFolder, '../lib/src/protocol_generated.dart');
final licenseFile = path.join(specFolder, 'debugAdapterProtocol.license.txt');
final licenseFile = path.join(toolFolder, '../LICENSE');
final specFile = path.join(specFolder, 'debugAdapterProtocol.json');
final specFolder = path.join(toolFolder, 'external_dap_spec');
final specLicenseUri = Uri.parse(
'https://raw.githubusercontent.com/microsoft/debug-adapter-protocol/main/License.txt');
'https://raw.githubusercontent.com/microsoft/debug-adapter-protocol/main/License-code.txt');
final specUri = Uri.parse(
'https://raw.githubusercontent.com/microsoft/debug-adapter-protocol/gh-pages/debugAdapterProtocol.json');
final toolFolder = path.dirname(Platform.script.toFilePath());
final licenseComment = LineSplitter.split(File(licenseFile).readAsStringSync())
.skipWhile((line) => line != 'Files: lib/protocol_generated.dart')
.skip(2)
.map((line) => line.isEmpty ? '//' : '// $line')
.join('\n');
Future<void> downloadSpec() async {
final specResp = await http.get(specUri);
@ -75,23 +80,19 @@ Future<void> downloadSpec() async {
assert(specResp.statusCode == 200);
assert(licenseResp.statusCode == 200);
final licenseHeader = '''
debugAdapterProtocol.json is an unmodified copy of the DAP Specification,
downloaded from:
final String sdkRoot = path.join(toolFolder, '../../../..');
final dartSdkLicense = await File('$sdkRoot/LICENSE').readAsString();
final license = '''
$dartSdkLicense
$specUri
------------------
The licence for this file is included below. This accompanying file is the
version of the specification that was used to generate a portion of the Dart
code used to support the protocol.
Files: debugAdapterProtocol.json
Files: lib/protocol_generated.dart
To regenerate the generated code, run the script in "tool/dap/generate_all.dart"
with no arguments. To download the latest version of the specification before
regenerating the code, run the same script with the "--download" argument.
---
${licenseResp.body}
''';
await File(specFile).writeAsString(specResp.body);
await File(licenseFile).writeAsString('$licenseHeader\n${licenseResp.body}');
await File(licenseFile).writeAsString(license);
}