Auto-update cmakelists on protocol sync, update to 1.59.0 (#93)
* CMake: Fix target options * update CMake package version after protocol sync * Update protocol to 1.59.0 * protocol_gen: change OneOf to `object` type The DAP spec introduces ambiguities with its particular uses of OneOf, which means that we can't deserialize the variants generated from it. Just set OneOf to an `object` type, like godap does.
This commit is contained in:
parent
0a340c6d71
commit
d9041149a8
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
project(cppdap VERSION 1.58.0 LANGUAGES CXX C)
|
project(cppdap VERSION 1.59.0 LANGUAGES CXX C)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ function(cppdap_set_target_options target)
|
|||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||||
)
|
)
|
||||||
cppdap_set_json_links(${target})
|
cppdap_set_json_links(${target})
|
||||||
target_link_libraries(cppdap PRIVATE ${CPPDAP_OS_LIBS})
|
target_link_libraries(${target} PRIVATE ${CPPDAP_OS_LIBS})
|
||||||
endfunction(cppdap_set_target_options)
|
endfunction(cppdap_set_target_options)
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
@ -334,7 +334,7 @@ if(CPPDAP_BUILD_EXAMPLES)
|
|||||||
FOLDER "Examples"
|
FOLDER "Examples"
|
||||||
)
|
)
|
||||||
cppdap_set_target_options(${target})
|
cppdap_set_target_options(${target})
|
||||||
target_link_libraries(${target} cppdap "${CPPDAP_OS_LIBS}")
|
target_link_libraries(${target} PRIVATE cppdap)
|
||||||
|
|
||||||
if(CPPDAP_INSTALL_VSCODE_EXAMPLES)
|
if(CPPDAP_INSTALL_VSCODE_EXAMPLES)
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// Generated with protocol_gen.go -- do not edit this file.
|
// Generated with protocol_gen.go -- do not edit this file.
|
||||||
// go run scripts/protocol_gen/protocol_gen.go
|
// go run scripts/protocol_gen/protocol_gen.go
|
||||||
//
|
//
|
||||||
// DAP version 1.58.0
|
// DAP version 1.59.0
|
||||||
|
|
||||||
#ifndef dap_protocol_h
|
#ifndef dap_protocol_h
|
||||||
#define dap_protocol_h
|
#define dap_protocol_h
|
||||||
@ -593,11 +593,17 @@ DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpointInfoResponse);
|
|||||||
// corresponding capability `supportsDataBreakpoints` is true.
|
// corresponding capability `supportsDataBreakpoints` is true.
|
||||||
struct DataBreakpointInfoRequest : public Request {
|
struct DataBreakpointInfoRequest : public Request {
|
||||||
using Response = DataBreakpointInfoResponse;
|
using Response = DataBreakpointInfoResponse;
|
||||||
|
// When `name` is an expression, evaluate it in the scope of this stack frame.
|
||||||
|
// If not specified, the expression is evaluated in the global scope. When
|
||||||
|
// `variablesReference` is specified, this property has no effect.
|
||||||
|
optional<integer> frameId;
|
||||||
// The name of the variable's child to obtain data breakpoint information for.
|
// The name of the variable's child to obtain data breakpoint information for.
|
||||||
// If `variablesReference` isn't specified, this can be an expression.
|
// If `variablesReference` isn't specified, this can be an expression.
|
||||||
string name;
|
string name;
|
||||||
// Reference to the variable container if the data breakpoint is requested for
|
// Reference to the variable container if the data breakpoint is requested for
|
||||||
// a child of the container.
|
// a child of the container. The `variablesReference` must have been obtained
|
||||||
|
// in the current suspended state. See 'Lifetime of Object References' in the
|
||||||
|
// Overview section for details.
|
||||||
optional<integer> variablesReference;
|
optional<integer> variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -709,7 +715,11 @@ struct Message {
|
|||||||
// If variable name starts with an underscore character, the variable does not
|
// If variable name starts with an underscore character, the variable does not
|
||||||
// contain user data (PII) and can be safely used for telemetry purposes.
|
// contain user data (PII) and can be safely used for telemetry purposes.
|
||||||
string format;
|
string format;
|
||||||
// Unique identifier for the message.
|
// Unique (within a debug adapter implementation) identifier for the message.
|
||||||
|
// The purpose of these error IDs is to help extension authors that have the
|
||||||
|
// requirement that every user visible error message needs a corresponding
|
||||||
|
// error number, so that users or customer support can find information about
|
||||||
|
// the specific error more easily.
|
||||||
integer id;
|
integer id;
|
||||||
// If true send to telemetry.
|
// If true send to telemetry.
|
||||||
optional<boolean> sendTelemetry;
|
optional<boolean> sendTelemetry;
|
||||||
@ -795,8 +805,8 @@ struct EvaluateResponse : public Response {
|
|||||||
optional<string> type;
|
optional<string> type;
|
||||||
// If `variablesReference` is > 0, the evaluate result is structured and its
|
// If `variablesReference` is > 0, the evaluate result is structured and its
|
||||||
// children can be retrieved by passing `variablesReference` to the
|
// children can be retrieved by passing `variablesReference` to the
|
||||||
// `variables` request. The value should be less than or equal to 2147483647
|
// `variables` request as long as execution remains suspended. See 'Lifetime
|
||||||
// (2^31-1).
|
// of Object References' in the Overview section for details.
|
||||||
integer variablesReference;
|
integer variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -817,7 +827,7 @@ struct EvaluateRequest : public Request {
|
|||||||
// The context in which the evaluate request is used.
|
// The context in which the evaluate request is used.
|
||||||
//
|
//
|
||||||
// May be one of the following enumeration values:
|
// May be one of the following enumeration values:
|
||||||
// 'variables', 'watch', 'repl', 'hover', 'clipboard'
|
// 'watch', 'repl', 'hover', 'clipboard', 'variables'
|
||||||
optional<string> context;
|
optional<string> context;
|
||||||
// The expression to evaluate.
|
// The expression to evaluate.
|
||||||
string expression;
|
string expression;
|
||||||
@ -1390,8 +1400,9 @@ struct OutputEvent : public Event {
|
|||||||
optional<Source> source;
|
optional<Source> source;
|
||||||
// If an attribute `variablesReference` exists and its value is > 0, the
|
// If an attribute `variablesReference` exists and its value is > 0, the
|
||||||
// output contains objects which can be retrieved by passing
|
// output contains objects which can be retrieved by passing
|
||||||
// `variablesReference` to the `variables` request. The value should be less
|
// `variablesReference` to the `variables` request as long as execution
|
||||||
// than or equal to 2147483647 (2^31-1).
|
// remains suspended. See 'Lifetime of Object References' in the Overview
|
||||||
|
// section for details.
|
||||||
optional<integer> variablesReference;
|
optional<integer> variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1507,7 +1518,10 @@ struct ReadMemoryResponse : public Response {
|
|||||||
// Treated as a hex value if prefixed with `0x`, or as a decimal value
|
// Treated as a hex value if prefixed with `0x`, or as a decimal value
|
||||||
// otherwise.
|
// otherwise.
|
||||||
string address;
|
string address;
|
||||||
// The bytes read from memory, encoded using base64.
|
// The bytes read from memory, encoded using base64. If the decoded length of
|
||||||
|
// `data` is less than the requested `count` in the original `readMemory`
|
||||||
|
// request, and `unreadableBytes` is zero or omitted, then the client should
|
||||||
|
// assume it's reached the end of readable memory.
|
||||||
optional<string> data;
|
optional<string> data;
|
||||||
// The number of unreadable bytes encountered after the last successfully read
|
// The number of unreadable bytes encountered after the last successfully read
|
||||||
// byte. This can be used to determine the number of bytes that should be
|
// byte. This can be used to determine the number of bytes that should be
|
||||||
@ -1539,13 +1553,15 @@ struct RestartFrameResponse : public Response {};
|
|||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(RestartFrameResponse);
|
DAP_DECLARE_STRUCT_TYPEINFO(RestartFrameResponse);
|
||||||
|
|
||||||
// The request restarts execution of the specified stackframe.
|
// The request restarts execution of the specified stack frame.
|
||||||
// The debug adapter first sends the response and then a `stopped` event (with
|
// The debug adapter first sends the response and then a `stopped` event (with
|
||||||
// reason `restart`) after the restart has completed. Clients should only call
|
// reason `restart`) after the restart has completed. Clients should only call
|
||||||
// this request if the corresponding capability `supportsRestartFrame` is true.
|
// this request if the corresponding capability `supportsRestartFrame` is true.
|
||||||
struct RestartFrameRequest : public Request {
|
struct RestartFrameRequest : public Request {
|
||||||
using Response = RestartFrameResponse;
|
using Response = RestartFrameResponse;
|
||||||
// Restart this stackframe.
|
// Restart the stack frame identified by `frameId`. The `frameId` must have
|
||||||
|
// been obtained in the current suspended state. See 'Lifetime of Object
|
||||||
|
// References' in the Overview section for details.
|
||||||
integer frameId;
|
integer frameId;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1557,33 +1573,6 @@ struct RestartResponse : public Response {};
|
|||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(RestartResponse);
|
DAP_DECLARE_STRUCT_TYPEINFO(RestartResponse);
|
||||||
|
|
||||||
// Arguments for `launch` request. Additional attributes are implementation
|
|
||||||
// specific.
|
|
||||||
struct LaunchRequestArguments {
|
|
||||||
// Arbitrary data from the previous, restarted session.
|
|
||||||
// The data is sent as the `restart` attribute of the `terminated` event.
|
|
||||||
// The client should leave the data intact.
|
|
||||||
optional<variant<array<any>, boolean, integer, null, number, object, string>>
|
|
||||||
restart;
|
|
||||||
// If true, the launch request should launch the program without enabling
|
|
||||||
// debugging.
|
|
||||||
optional<boolean> noDebug;
|
|
||||||
};
|
|
||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(LaunchRequestArguments);
|
|
||||||
|
|
||||||
// Arguments for `attach` request. Additional attributes are implementation
|
|
||||||
// specific.
|
|
||||||
struct AttachRequestArguments {
|
|
||||||
// Arbitrary data from the previous, restarted session.
|
|
||||||
// The data is sent as the `restart` attribute of the `terminated` event.
|
|
||||||
// The client should leave the data intact.
|
|
||||||
optional<variant<array<any>, boolean, integer, null, number, object, string>>
|
|
||||||
restart;
|
|
||||||
};
|
|
||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(AttachRequestArguments);
|
|
||||||
|
|
||||||
// Restarts a debug session. Clients should only call this request if the
|
// Restarts a debug session. Clients should only call this request if the
|
||||||
// corresponding capability `supportsRestartRequest` is true. If the capability
|
// corresponding capability `supportsRestartRequest` is true. If the capability
|
||||||
// is missing or has the value false, a typical client emulates `restart` by
|
// is missing or has the value false, a typical client emulates `restart` by
|
||||||
@ -1591,7 +1580,7 @@ DAP_DECLARE_STRUCT_TYPEINFO(AttachRequestArguments);
|
|||||||
struct RestartRequest : public Request {
|
struct RestartRequest : public Request {
|
||||||
using Response = RestartResponse;
|
using Response = RestartResponse;
|
||||||
// The latest version of the `launch` or `attach` configuration.
|
// The latest version of the `launch` or `attach` configuration.
|
||||||
optional<variant<LaunchRequestArguments, AttachRequestArguments>> arguments;
|
optional<object> arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(RestartRequest);
|
DAP_DECLARE_STRUCT_TYPEINFO(RestartRequest);
|
||||||
@ -1666,7 +1655,7 @@ struct RunInTerminalRequest : public Request {
|
|||||||
// Environment key-value pairs that are added to or removed from the default
|
// Environment key-value pairs that are added to or removed from the default
|
||||||
// environment.
|
// environment.
|
||||||
optional<object> env;
|
optional<object> env;
|
||||||
// What kind of terminal to launch.
|
// What kind of terminal to launch. Defaults to `integrated` if not specified.
|
||||||
//
|
//
|
||||||
// Must be one of the following enumeration values:
|
// Must be one of the following enumeration values:
|
||||||
// 'integrated', 'external'
|
// 'integrated', 'external'
|
||||||
@ -1715,7 +1704,9 @@ struct Scope {
|
|||||||
// The source for this scope.
|
// The source for this scope.
|
||||||
optional<Source> source;
|
optional<Source> source;
|
||||||
// The variables of this scope can be retrieved by passing the value of
|
// The variables of this scope can be retrieved by passing the value of
|
||||||
// `variablesReference` to the `variables` request.
|
// `variablesReference` to the `variables` request as long as execution
|
||||||
|
// remains suspended. See 'Lifetime of Object References' in the Overview
|
||||||
|
// section for details.
|
||||||
integer variablesReference;
|
integer variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1723,17 +1714,19 @@ DAP_DECLARE_STRUCT_TYPEINFO(Scope);
|
|||||||
|
|
||||||
// Response to `scopes` request.
|
// Response to `scopes` request.
|
||||||
struct ScopesResponse : public Response {
|
struct ScopesResponse : public Response {
|
||||||
// The scopes of the stackframe. If the array has length zero, there are no
|
// The scopes of the stack frame. If the array has length zero, there are no
|
||||||
// scopes available.
|
// scopes available.
|
||||||
array<Scope> scopes;
|
array<Scope> scopes;
|
||||||
};
|
};
|
||||||
|
|
||||||
DAP_DECLARE_STRUCT_TYPEINFO(ScopesResponse);
|
DAP_DECLARE_STRUCT_TYPEINFO(ScopesResponse);
|
||||||
|
|
||||||
// The request returns the variable scopes for a given stackframe ID.
|
// The request returns the variable scopes for a given stack frame ID.
|
||||||
struct ScopesRequest : public Request {
|
struct ScopesRequest : public Request {
|
||||||
using Response = ScopesResponse;
|
using Response = ScopesResponse;
|
||||||
// Retrieve the scopes for this stackframe.
|
// Retrieve the scopes for the stack frame identified by `frameId`. The
|
||||||
|
// `frameId` must have been obtained in the current suspended state. See
|
||||||
|
// 'Lifetime of Object References' in the Overview section for details.
|
||||||
integer frameId;
|
integer frameId;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1767,14 +1760,19 @@ struct SourceBreakpoint {
|
|||||||
// The expression that controls how many hits of the breakpoint are ignored.
|
// The expression that controls how many hits of the breakpoint are ignored.
|
||||||
// The debug adapter is expected to interpret the expression as needed.
|
// The debug adapter is expected to interpret the expression as needed.
|
||||||
// The attribute is only honored by a debug adapter if the corresponding
|
// The attribute is only honored by a debug adapter if the corresponding
|
||||||
// capability `supportsHitConditionalBreakpoints` is true.
|
// capability `supportsHitConditionalBreakpoints` is true. If both this
|
||||||
|
// property and `condition` are specified, `hitCondition` should be evaluated
|
||||||
|
// only if the `condition` is met, and the debug adapter should stop only if
|
||||||
|
// both conditions are met.
|
||||||
optional<string> hitCondition;
|
optional<string> hitCondition;
|
||||||
// The source line of the breakpoint or logpoint.
|
// The source line of the breakpoint or logpoint.
|
||||||
integer line;
|
integer line;
|
||||||
// If this attribute exists and is non-empty, the debug adapter must not
|
// If this attribute exists and is non-empty, the debug adapter must not
|
||||||
// 'break' (stop) but log the message instead. Expressions within `{}` are
|
// 'break' (stop) but log the message instead. Expressions within `{}` are
|
||||||
// interpolated. The attribute is only honored by a debug adapter if the
|
// interpolated. The attribute is only honored by a debug adapter if the
|
||||||
// corresponding capability `supportsLogPoints` is true.
|
// corresponding capability `supportsLogPoints` is true. If either
|
||||||
|
// `hitCondition` or `condition` is specified, then the message should only be
|
||||||
|
// logged if those conditions are met.
|
||||||
optional<string> logMessage;
|
optional<string> logMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1953,9 +1951,10 @@ struct SetExpressionResponse : public Response {
|
|||||||
optional<string> type;
|
optional<string> type;
|
||||||
// The new value of the expression.
|
// The new value of the expression.
|
||||||
string value;
|
string value;
|
||||||
// If `variablesReference` is > 0, the value is structured and its children
|
// If `variablesReference` is > 0, the evaluate result is structured and its
|
||||||
// can be retrieved by passing `variablesReference` to the `variables`
|
// children can be retrieved by passing `variablesReference` to the
|
||||||
// request. The value should be less than or equal to 2147483647 (2^31-1).
|
// `variables` request as long as execution remains suspended. See 'Lifetime
|
||||||
|
// of Object References' in the Overview section for details.
|
||||||
optional<integer> variablesReference;
|
optional<integer> variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2088,8 +2087,8 @@ struct SetVariableResponse : public Response {
|
|||||||
string value;
|
string value;
|
||||||
// If `variablesReference` is > 0, the new value is structured and its
|
// If `variablesReference` is > 0, the new value is structured and its
|
||||||
// children can be retrieved by passing `variablesReference` to the
|
// children can be retrieved by passing `variablesReference` to the
|
||||||
// `variables` request. The value should be less than or equal to 2147483647
|
// `variables` request as long as execution remains suspended. See 'Lifetime
|
||||||
// (2^31-1).
|
// of Object References' in the Overview section for details.
|
||||||
optional<integer> variablesReference;
|
optional<integer> variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2108,7 +2107,9 @@ struct SetVariableRequest : public Request {
|
|||||||
string name;
|
string name;
|
||||||
// The value of the variable.
|
// The value of the variable.
|
||||||
string value;
|
string value;
|
||||||
// The reference of the variable container.
|
// The reference of the variable container. The `variablesReference` must have
|
||||||
|
// been obtained in the current suspended state. See 'Lifetime of Object
|
||||||
|
// References' in the Overview section for details.
|
||||||
integer variablesReference;
|
integer variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2143,6 +2144,8 @@ struct StackFrame {
|
|||||||
// Indicates whether this frame can be restarted with the `restart` request.
|
// Indicates whether this frame can be restarted with the `restart` request.
|
||||||
// Clients should only use this if the debug adapter supports the `restart`
|
// Clients should only use this if the debug adapter supports the `restart`
|
||||||
// request and the corresponding capability `supportsRestartRequest` is true.
|
// request and the corresponding capability `supportsRestartRequest` is true.
|
||||||
|
// If a debug adapter has this capability, then `canRestart` defaults to
|
||||||
|
// `true` if the property is absent.
|
||||||
optional<boolean> canRestart;
|
optional<boolean> canRestart;
|
||||||
// Start position of the range covered by the stack frame. It is measured in
|
// Start position of the range covered by the stack frame. It is measured in
|
||||||
// UTF-16 code units and the client capability `columnsStartAt1` determines
|
// UTF-16 code units and the client capability `columnsStartAt1` determines
|
||||||
@ -2157,7 +2160,7 @@ struct StackFrame {
|
|||||||
optional<integer> endLine;
|
optional<integer> endLine;
|
||||||
// An identifier for the stack frame. It must be unique across all threads.
|
// An identifier for the stack frame. It must be unique across all threads.
|
||||||
// This id can be used to retrieve the scopes of the frame with the `scopes`
|
// This id can be used to retrieve the scopes of the frame with the `scopes`
|
||||||
// request or to restart the execution of a stackframe.
|
// request or to restart the execution of a stack frame.
|
||||||
integer id;
|
integer id;
|
||||||
// A memory reference for the current instruction pointer in this frame.
|
// A memory reference for the current instruction pointer in this frame.
|
||||||
optional<string> instructionPointerReference;
|
optional<string> instructionPointerReference;
|
||||||
@ -2184,8 +2187,8 @@ DAP_DECLARE_STRUCT_TYPEINFO(StackFrame);
|
|||||||
|
|
||||||
// Response to `stackTrace` request.
|
// Response to `stackTrace` request.
|
||||||
struct StackTraceResponse : public Response {
|
struct StackTraceResponse : public Response {
|
||||||
// The frames of the stackframe. If the array has length zero, there are no
|
// The frames of the stack frame. If the array has length zero, there are no
|
||||||
// stackframes available. This means that there is no location information
|
// stack frames available. This means that there is no location information
|
||||||
// available.
|
// available.
|
||||||
array<StackFrame> stackFrames;
|
array<StackFrame> stackFrames;
|
||||||
// The total number of frames available in the stack. If omitted or if
|
// The total number of frames available in the stack. If omitted or if
|
||||||
@ -2591,8 +2594,9 @@ struct Variable {
|
|||||||
// should be shown in the UI.
|
// should be shown in the UI.
|
||||||
string value;
|
string value;
|
||||||
// If `variablesReference` is > 0, the variable is structured and its children
|
// If `variablesReference` is > 0, the variable is structured and its children
|
||||||
// can be retrieved by passing `variablesReference` to the `variables`
|
// can be retrieved by passing `variablesReference` to the `variables` request
|
||||||
// request.
|
// as long as execution remains suspended. See 'Lifetime of Object References'
|
||||||
|
// in the Overview section for details.
|
||||||
integer variablesReference;
|
integer variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2626,7 +2630,9 @@ struct VariablesRequest : public Request {
|
|||||||
optional<ValueFormat> format;
|
optional<ValueFormat> format;
|
||||||
// The index of the first variable to return; if omitted children start at 0.
|
// The index of the first variable to return; if omitted children start at 0.
|
||||||
optional<integer> start;
|
optional<integer> start;
|
||||||
// The Variable reference.
|
// The variable for which to retrieve its children. The `variablesReference`
|
||||||
|
// must have been obtained in the current suspended state. See 'Lifetime of
|
||||||
|
// Object References' in the Overview section for details.
|
||||||
integer variablesReference;
|
integer variablesReference;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// Generated with protocol_gen.go -- do not edit this file.
|
// Generated with protocol_gen.go -- do not edit this file.
|
||||||
// go run scripts/protocol_gen/protocol_gen.go
|
// go run scripts/protocol_gen/protocol_gen.go
|
||||||
//
|
//
|
||||||
// DAP version 1.58.0
|
// DAP version 1.59.0
|
||||||
|
|
||||||
#include "dap/protocol.h"
|
#include "dap/protocol.h"
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// Generated with protocol_gen.go -- do not edit this file.
|
// Generated with protocol_gen.go -- do not edit this file.
|
||||||
// go run scripts/protocol_gen/protocol_gen.go
|
// go run scripts/protocol_gen/protocol_gen.go
|
||||||
//
|
//
|
||||||
// DAP version 1.58.0
|
// DAP version 1.59.0
|
||||||
|
|
||||||
#include "dap/protocol.h"
|
#include "dap/protocol.h"
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(ContinueRequest,
|
|||||||
|
|
||||||
DAP_IMPLEMENT_STRUCT_TYPEINFO(DataBreakpointInfoRequest,
|
DAP_IMPLEMENT_STRUCT_TYPEINFO(DataBreakpointInfoRequest,
|
||||||
"dataBreakpointInfo",
|
"dataBreakpointInfo",
|
||||||
|
DAP_FIELD(frameId, "frameId"),
|
||||||
DAP_FIELD(name, "name"),
|
DAP_FIELD(name, "name"),
|
||||||
DAP_FIELD(variablesReference,
|
DAP_FIELD(variablesReference,
|
||||||
"variablesReference"));
|
"variablesReference"));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// Generated with protocol_gen.go -- do not edit this file.
|
// Generated with protocol_gen.go -- do not edit this file.
|
||||||
// go run scripts/protocol_gen/protocol_gen.go
|
// go run scripts/protocol_gen/protocol_gen.go
|
||||||
//
|
//
|
||||||
// DAP version 1.58.0
|
// DAP version 1.59.0
|
||||||
|
|
||||||
#include "dap/protocol.h"
|
#include "dap/protocol.h"
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// Generated with protocol_gen.go -- do not edit this file.
|
// Generated with protocol_gen.go -- do not edit this file.
|
||||||
// go run scripts/protocol_gen/protocol_gen.go
|
// go run scripts/protocol_gen/protocol_gen.go
|
||||||
//
|
//
|
||||||
// DAP version 1.58.0
|
// DAP version 1.59.0
|
||||||
|
|
||||||
#include "dap/protocol.h"
|
#include "dap/protocol.h"
|
||||||
|
|
||||||
@ -202,15 +202,6 @@ DAP_IMPLEMENT_STRUCT_TYPEINFO(Module,
|
|||||||
DAP_FIELD(symbolStatus, "symbolStatus"),
|
DAP_FIELD(symbolStatus, "symbolStatus"),
|
||||||
DAP_FIELD(version, "version"));
|
DAP_FIELD(version, "version"));
|
||||||
|
|
||||||
DAP_IMPLEMENT_STRUCT_TYPEINFO(LaunchRequestArguments,
|
|
||||||
"",
|
|
||||||
DAP_FIELD(restart, "__restart"),
|
|
||||||
DAP_FIELD(noDebug, "noDebug"));
|
|
||||||
|
|
||||||
DAP_IMPLEMENT_STRUCT_TYPEINFO(AttachRequestArguments,
|
|
||||||
"",
|
|
||||||
DAP_FIELD(restart, "__restart"));
|
|
||||||
|
|
||||||
DAP_IMPLEMENT_STRUCT_TYPEINFO(Scope,
|
DAP_IMPLEMENT_STRUCT_TYPEINFO(Scope,
|
||||||
"",
|
"",
|
||||||
DAP_FIELD(column, "column"),
|
DAP_FIELD(column, "column"),
|
||||||
|
@ -487,8 +487,8 @@ func (r *root) getType(def *definition) (builtType cppType, err error) {
|
|||||||
return ref.def.cppType, nil
|
return ref.def.cppType, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The DAP spec introduces ambiguities with its particular uses of OneOf, just set to object
|
||||||
if len(def.OneOf) != 0 {
|
if len(def.OneOf) != 0 {
|
||||||
args := make([]string, len(def.OneOf))
|
|
||||||
deps := make([]cppType, len(def.OneOf))
|
deps := make([]cppType, len(def.OneOf))
|
||||||
for i, oneOf := range def.OneOf {
|
for i, oneOf := range def.OneOf {
|
||||||
if oneOf == nil {
|
if oneOf == nil {
|
||||||
@ -499,10 +499,9 @@ func (r *root) getType(def *definition) (builtType cppType, err error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
deps[i] = elTy
|
deps[i] = elTy
|
||||||
args[i] = elTy.Name()
|
|
||||||
}
|
}
|
||||||
return &cppBasicType{
|
return &cppBasicType{
|
||||||
name: "variant<" + strings.Join(args, ", ") + ">",
|
name: "object",
|
||||||
desc: def.Description,
|
desc: def.Description,
|
||||||
deps: deps,
|
deps: deps,
|
||||||
}, nil
|
}, nil
|
||||||
@ -681,11 +680,15 @@ func run() error {
|
|||||||
return fmt.Errorf("Failed to load JSON file from '%v': %w", protocolURL, err)
|
return fmt.Errorf("Failed to load JSON file from '%v': %w", protocolURL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
hPath, cppPaths := outputPaths()
|
hPath, cppPaths, cMakeListsPath := outputPaths()
|
||||||
if err := emitFiles(&protocol, hPath, cppPaths, pkg.Version); err != nil {
|
if err := emitFiles(&protocol, hPath, cppPaths, pkg.Version); err != nil {
|
||||||
return fmt.Errorf("Failed to emit files: %w", err)
|
return fmt.Errorf("Failed to emit files: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := updateCMakePackageVersion(cMakeListsPath, pkg.Version); err != nil {
|
||||||
|
return fmt.Errorf("Failed to update CMakeLists.txt: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
if clangfmt, err := exec.LookPath("clang-format"); err == nil {
|
if clangfmt, err := exec.LookPath("clang-format"); err == nil {
|
||||||
if out, err := exec.Command(clangfmt, "-i", hPath).CombinedOutput(); err != nil {
|
if out, err := exec.Command(clangfmt, "-i", hPath).CombinedOutput(); err != nil {
|
||||||
return fmt.Errorf("Failed to run clang-format on '%v':\n%v\n%w", hPath, string(out), err)
|
return fmt.Errorf("Failed to run clang-format on '%v':\n%v\n%w", hPath, string(out), err)
|
||||||
@ -702,6 +705,23 @@ func run() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Updates package version in CMakeLists.txt to current
|
||||||
|
func updateCMakePackageVersion(cMakeListsPath string, version string) error {
|
||||||
|
text, err := os.ReadFile(cMakeListsPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
lines := strings.Split(string(text), "\n")
|
||||||
|
for i, line := range lines {
|
||||||
|
if strings.Contains(line, "project(cppdap") {
|
||||||
|
lines[i] = "project(cppdap VERSION " + version + " LANGUAGES CXX C)"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output := strings.Join(lines, "\n")
|
||||||
|
return os.WriteFile(cMakeListsPath, []byte(output), 0644)
|
||||||
|
}
|
||||||
|
|
||||||
// emitFiles() opens each of the C++ files, generates the cppType definitions
|
// emitFiles() opens each of the C++ files, generates the cppType definitions
|
||||||
// from the schema root, then writes the types to the C++ files in dependency
|
// from the schema root, then writes the types to the C++ files in dependency
|
||||||
// order.
|
// order.
|
||||||
@ -790,8 +810,8 @@ func loadJSONFile(url string, obj interface{}) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// outputPaths() returns a path to the target C++ .h file and .cpp files
|
// outputPaths() returns a path to the target C++ .h file and .cpp files, and the CMakeLists.txt
|
||||||
func outputPaths() (string, cppTargetFilePaths) {
|
func outputPaths() (string, cppTargetFilePaths, string) {
|
||||||
_, thisFile, _, _ := runtime.Caller(1)
|
_, thisFile, _, _ := runtime.Caller(1)
|
||||||
thisDir := path.Dir(thisFile)
|
thisDir := path.Dir(thisFile)
|
||||||
h := path.Join(thisDir, "../../include/dap/protocol.h")
|
h := path.Join(thisDir, "../../include/dap/protocol.h")
|
||||||
@ -801,5 +821,6 @@ func outputPaths() (string, cppTargetFilePaths) {
|
|||||||
event: path.Join(thisDir, "../../src/protocol_events.cpp"),
|
event: path.Join(thisDir, "../../src/protocol_events.cpp"),
|
||||||
types: path.Join(thisDir, "../../src/protocol_types.cpp"),
|
types: path.Join(thisDir, "../../src/protocol_types.cpp"),
|
||||||
}
|
}
|
||||||
return h, cpp
|
CMakeLists := path.Join(thisDir, "../../CMakeLists.txt")
|
||||||
|
return h, cpp, CMakeLists
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user