diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index ac14c3d..0000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -5.1.1 diff --git a/BUILD b/BUILD deleted file mode 100644 index 491c9dd..0000000 --- a/BUILD +++ /dev/null @@ -1,47 +0,0 @@ -alias( - name = "XCBBuildServiceProxyKit", - actual = "//Sources/XCBBuildServiceProxyKit", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol", - actual = "//Sources/XCBProtocol", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_11_3", - actual = "//Sources/XCBProtocol_11_3", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_11_4", - actual = "//Sources/XCBProtocol_11_4", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_12_0", - actual = "//Sources/XCBProtocol_12_0", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_12_5", - actual = "//Sources/XCBProtocol_12_5", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_13_0", - actual = "//Sources/XCBProtocol_13_0", - visibility = ["//visibility:public"], -) - -alias( - name = "XCBProtocol_13_3", - actual = "//Sources/XCBProtocol_13_3", - visibility = ["//visibility:public"], -) diff --git a/Docs/UPDATING.md b/Docs/UPDATING.md deleted file mode 100644 index 4484538..0000000 --- a/Docs/UPDATING.md +++ /dev/null @@ -1,73 +0,0 @@ -# How to support new version of Xcode - -When Xcode updates, it might change the format of its messages to XCBBuildService. This requires changes to the proxy to support. - -There are two ways to debug: reading logs, and debugging using Xcode. Both have their own benefits and drawbacks, and it's likely you'll lean on both when working to update the library. - -## Logs - -This project makes thorough use of [swift-logging](https://github.com/apple/swift-log), so to see what's wrong, look in the logs! - -You can start recording logs by executing `write_shim.sh`. You'll need your built `BazelXCBBuildService` and the path to where Xcode is expecting `XCBBuildService`. You also pass in the Xcode version, so your logs will be split based on the Xcode version. - -The `XCBBuildService` lives here: `$(XCODE_DIR)/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService` - -`write_shim.sh` will create a fake `XCBBuildService` that simply calls the `BazelXCBBuildService` while redirecting `STDERR` to a log file in `/tmp/Bazel-trace/`. - -### Prepping for a new version of Xcode: - -* Create a new module inside `/Sources` following the established pattern. (e.g. `XCBProtocol_14_0`). -* You'll notice we make use of symlinks to old versions of the files. Rather than copying every single file into the new `XCBProtocol` version, only copy files you need to change. For the rest, create a symlink to the previous version of the file (which may be a symlink itself). You'll see lots of symlinks pointing all the way back to the Xcode 11.4 versions! -* Update `Examples/BazelXCBBuildService/BUILD.bazel` and `Examples/BazelXCBBuildService/Packge.swift` to point at that new module. -* Update `Examples/BazelXCBBuildService/Sources/RequestHandler.swift` to assign the appropriate `RequestPayload` and `ResponsePayload` types to the `BazelXCBBuildServiceRequestPayload` and `BazelXCBBuildServiceResponsePayload` typealiases. -* Rename the original `XCBBuildService` in the Xcode bundle to `XCBBuildService.original`, just in case you want it again. - -### Development loop: - -* Rebuild with `bazel build BazelXCBBuildService`. -* Move it into the proper folder: `My-New-Xcode.app/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/BazelXCBBuildService`. -* Run `write_shim.sh` to set up logging into `/tmp/Bazel-trace/`. -* Restart Xcode. -* Do some actions in Xcode, then view the logs. Are there any errors? -* Make a change in the project fixing an error or adding extra logs you deem necessary. -* Repeat as necessary. - -## Xcode Debugger - -To debug `BazelXCBBuildService` while it is being used by Xcode, you will need to have two instances of Xcode running: - -- "Main" Xcode: An instance of Xcode that uses our XCBBuildServiceProxyKit. This version will be used to build and run your app. -- "Debugging" Xcode: An instance of Xcode that uses the original XCBBuildService shipped with Xcode. This version will be used to debug the "main" instance of Xcode. - -Getting two instances of Xcode going can be done a couple of ways: - -- Use two separate versions of Xcode (e.g. 12.5.0 and 13.0.0). -- Modify the `XCBBUILDSERVICE_PATH` environment variable, and launch two instances of the same Xcode version. - - Xcode looks to see if `XCBBUILDSERVICE_PATH` is set. If it is, it will use that instead of `Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService`. So after launching your "main" instance of Xcode, you can launch a "debugging" instance of Xcode that uses the original XCBBuildService by using the following command: - ```shell - env XCBBUILDSERVICE_PATH=/Application/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService.original /Application/Xcode.app/Contents/MacOS/Xcode` - ``` - -To set up `BazelXCBBuildService` for debugging: - -1. Remove `BazelXCBBuildService` from the "debugging" Xcode if it is installed. In the "debugging" Xcode, we want to use the official XCBBuildService, not our custom one. - 1. To see if it is installed, open this folder inside Xcode: - ```sh - open /Applications/Xcode-.app/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/ - ``` - 1. If there are three files (`XCBBuildService.original`, `XCBBuildService`, and `BazelXCBBuildService`), `BazelXCBBuildService` is installed in that version of Xcode. To uninstall it, delete `XCBBuildService` and `BazelXCBBuildService`, and rename `XCBBuildService.original` to `XCBBuildService`. -1. Open `tools/BazelXCBBuildService` in the "debugging" Xcode and build a debug version of BazelXCBBuildService. -1. Copy the built, debug version of `BazelXCBBuildService` from the DerivedData folder into the "main" version of Xcode: - ```sh - FOLDER=$(ls ~/Library/Developer/Xcode/DerivedData | grep BazelXCBBuildService) - cp ~/Library/Developer/Xcode/DerivedData/$FOLDER/Build/Products/Debug/BazelXCBBuildService \ - /Applications/Xcode-.app/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/ - ``` -1. Prepare the debugger to attach to the service. - 1. Open the scheme for this build, and navigate to the "Run" section on the left-hand sidebar. - 1. In the "Info" tab, for the "Launch" option, select "Wait for the executable to be launched". -1. Set some breakpoints if desired -1. Build and run as normal, Xcode will wait for the binary to be launched and automatically attache its debugger -1. Start the "main" Xcode (Note: it may freeze if breakpoints are hit in `BazelXCBBuildService`) -1. Check that the "debugging" Xcode has attached to `BazelXCBBuildService` -1. Perform build actions in the "main" Xcode and debug `BazelXCBBuildService` using the "debugging" Xcode 🎉 diff --git a/Examples/.bazelrc b/Examples/.bazelrc deleted file mode 100644 index 8d0884f..0000000 --- a/Examples/.bazelrc +++ /dev/null @@ -1 +0,0 @@ -build --use_top_level_targets_for_symlinks diff --git a/Examples/.bazelversion b/Examples/.bazelversion deleted file mode 100644 index ac14c3d..0000000 --- a/Examples/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -5.1.1 diff --git a/Examples/.gitignore b/Examples/.gitignore deleted file mode 100644 index a6ef824..0000000 --- a/Examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bazel-* diff --git a/Examples/BazelXCBBuildService/BEP/BUILD b/Examples/BazelXCBBuildService/BEP/BUILD deleted file mode 100644 index ac251ec..0000000 --- a/Examples/BazelXCBBuildService/BEP/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -load( - "@build_bazel_rules_swift//swift:swift.bzl", - "swift_proto_library", -) - -# protos -proto_library( - name = "build_event_stream_proto", - srcs = ["build_event_stream.proto"], - deps = [ - ":command_line_proto", - ":failure_details_proto", - ":invocation_policy_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -proto_library( - name = "command_line_proto", - srcs = ["command_line.proto"], - deps = [ - ":option_filters_proto", - ], -) - -proto_library( - name = "failure_details_proto", - srcs = ["failure_details.proto"], - deps = [ - "@com_google_protobuf//:descriptor_proto", - ], -) - -proto_library( - name = "invocation_policy_proto", - srcs = ["invocation_policy.proto"], -) - -proto_library( - name = "option_filters_proto", - srcs = ["option_filters.proto"], -) - -# swift_protobuf - -swift_proto_library( - name = "BEP", - visibility = ["//BazelXCBBuildService:__subpackages__"], - deps = [":build_event_stream_proto"], -) diff --git a/Examples/BazelXCBBuildService/BEP/build_event_stream.proto b/Examples/BazelXCBBuildService/BEP/build_event_stream.proto deleted file mode 100644 index 3ff0d12..0000000 --- a/Examples/BazelXCBBuildService/BEP/build_event_stream.proto +++ /dev/null @@ -1,1122 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package build_event_stream; - -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "BazelXCBBuildService/BEP/command_line.proto"; -import "BazelXCBBuildService/BEP/failure_details.proto"; -import "BazelXCBBuildService/BEP/invocation_policy.proto"; - -option java_package = "com.google.devtools.build.lib.buildeventstream"; -option java_outer_classname = "BuildEventStreamProtos"; - -// Identifier for a build event. It is deliberately structured to also provide -// information about which build target etc the event is related to. -// -// Events are chained via the event id as follows: each event has an id and a -// set of ids of children events such that apart from the initial event each -// event has an id that is mentioned as child id in an earlier event and a build -// invocation is complete if and only if all direct and indirect children of the -// initial event have been posted. -message BuildEventId { - // Generic identifier for a build event. This is the default type of - // BuildEventId, but should not be used outside testing; nevertheless, - // tools should handle build events with this kind of id gracefully. - message UnknownBuildEventId { - string details = 1; - } - - // Identifier of an event reporting progress. Those events are also used to - // chain in events that come early. - message ProgressId { - // Unique identifier. No assumption should be made about how the ids are - // assigned; the only meaningful operation on this field is test for - // equality. - int32 opaque_count = 1; - } - - // Identifier of an event indicating the beginning of a build; this will - // normally be the first event. - message BuildStartedId {} - - // Identifier on an event indicating the original commandline received by - // the bazel server. - message UnstructuredCommandLineId {} - - // Identifier on an event describing the commandline received by Bazel. - message StructuredCommandLineId { - // A title for this command line value, as there may be multiple. - // For example, a single invocation may wish to report both the literal and - // canonical command lines, and this label would be used to differentiate - // between both versions. - string command_line_label = 1; - } - - // Identifier of an event indicating the workspace status. - message WorkspaceStatusId {} - - // Identifier on an event reporting on the options included in the command - // line, both explicitly and implicitly. - message OptionsParsedId {} - - // Identifier of an event reporting that an external resource was fetched - // from. - message FetchId { - // The external resource that was fetched from. - string url = 1; - } - - // Identifier of an event indicating that a target pattern has been expanded - // further. - // Messages of this shape are also used to describe parts of a pattern that - // have been skipped for some reason, if the actual expansion was still - // carried out (e.g., if keep_going is set). In this case, the - // pattern_skipped choice in the id field is to be made. - message PatternExpandedId { - repeated string pattern = 1; - } - - message WorkspaceConfigId {} - - message BuildMetadataId {} - - // Identifier of an event indicating that a target has been expanded by - // identifying for which configurations it should be build. - message TargetConfiguredId { - string label = 1; - - // If empty, the id refers to the expansion of the target. If not-empty, - // the id refers to the expansion of an aspect applied to the (already - // expanded) target. - // - // For example, when building an apple_binary that depends on proto_library - // "//:foo_proto", there will be two TargetConfigured events for - // "//:foo_proto": - // - // 1. An event with an empty aspect, corresponding to actions producing - // language-agnostic outputs from the proto_library; and - // 2. An event with aspect "ObjcProtoAspect", corresponding to Objective-C - // code generation. - string aspect = 2; - } - - // Identifier of an event introducing a named set of files (usually artifacts) - // to be referred to in later messages. - message NamedSetOfFilesId { - // Identifier of the file set; this is an opaque string valid only for the - // particular instance of the event stream. - string id = 1; - } - - // Identifier of an event introducing a configuration. - message ConfigurationId { - // Identifier of the configuration; users of the protocol should not make - // any assumptions about it having any structure, or equality of the - // identifier between different streams. - string id = 1; - } - - // Identifier of an event indicating that a target was built completely; this - // does not include running the test if the target is a test target. - message TargetCompletedId { - string label = 1; - - // The configuration for which the target was built. - ConfigurationId configuration = 3; - - // If empty, the id refers to the completion of the target. If not-empty, - // the id refers to the completion of an aspect applied to the (already - // completed) target. - // - // For example, when building an apple_binary that depends on proto_library - // "//:foo_proto", there will be two TargetCompleted events for - // "//:foo_proto": - // - // 1. An event with an empty aspect, corresponding to actions producing - // language-agnostic outputs from the proto_library; and - // 2. An event with aspect "ObjcProtoAspect", corresponding to Objective-C - // code generation. - string aspect = 2; - } - - // Identifier of an event reporting that an action was completed (not all - // actions are reported, only the ones that can be considered important; - // this includes all failed actions). - message ActionCompletedId { - string primary_output = 1; - // Optional, the label of the owner of the action, for reference. - string label = 2; - // Optional, the id of the configuration of the action owner. - ConfigurationId configuration = 3; - } - - // Identifier of an event reporting an event associated with an unconfigured - // label. Usually, this indicates a failure due to a missing input file. In - // any case, it will report some form of error (i.e., the payload will be an - // Aborted event); there are no regular events using this identifier. The - // purpose of those events is to serve as the root cause of a failed target. - message UnconfiguredLabelId { - string label = 1; - } - - // Identifier of an event reporting an event associated with a configured - // label, usually a visibility error. In any case, an event with such an - // id will always report some form of error (i.e., the payload will be an - // Aborted event); there are no regular events using this identifier. - message ConfiguredLabelId { - string label = 1; - ConfigurationId configuration = 2; - } - - // Identifier of an event reporting on an individual test run. The label - // identifies the test that is reported about, the remaining fields are - // in such a way as to uniquely identify the action within a build. In fact, - // attempts for the same test, run, shard triple are counted sequentially, - // starting with 1. - message TestResultId { - string label = 1; - ConfigurationId configuration = 5; - int32 run = 2; - int32 shard = 3; - int32 attempt = 4; - } - - // Identifier of an event reporting the summary of a test. - message TestSummaryId { - string label = 1; - ConfigurationId configuration = 2; - } - - // Identifier of an event reporting the summary of a target. - message TargetSummaryId { - string label = 1; - ConfigurationId configuration = 2; - } - - // Identifier of the BuildFinished event, indicating the end of a build. - message BuildFinishedId {} - - // Identifier of an event providing additional logs/statistics after - // completion of the build. - message BuildToolLogsId {} - - // Identifier of an event providing build metrics after completion - // of the build. - message BuildMetricsId {} - - // Identifier of an event providing convenience symlinks information. - message ConvenienceSymlinksIdentifiedId {} - - oneof id { - UnknownBuildEventId unknown = 1; - ProgressId progress = 2; - BuildStartedId started = 3; - UnstructuredCommandLineId unstructured_command_line = 11; - StructuredCommandLineId structured_command_line = 18; - WorkspaceStatusId workspace_status = 14; - OptionsParsedId options_parsed = 12; - FetchId fetch = 17; - ConfigurationId configuration = 15; - TargetConfiguredId target_configured = 16; - PatternExpandedId pattern = 4; - PatternExpandedId pattern_skipped = 10; - NamedSetOfFilesId named_set = 13; - TargetCompletedId target_completed = 5; - ActionCompletedId action_completed = 6; - UnconfiguredLabelId unconfigured_label = 19; - ConfiguredLabelId configured_label = 21; - TestResultId test_result = 8; - TestSummaryId test_summary = 7; - TargetSummaryId target_summary = 26; - BuildFinishedId build_finished = 9; - BuildToolLogsId build_tool_logs = 20; - BuildMetricsId build_metrics = 22; - WorkspaceConfigId workspace = 23; - BuildMetadataId build_metadata = 24; - ConvenienceSymlinksIdentifiedId convenience_symlinks_identified = 25; - } -} - -// Payload of an event summarizing the progress of the build so far. Those -// events are also used to be parents of events where the more logical parent -// event cannot be posted yet as the needed information is not yet complete. -message Progress { - // The next chunk of stdout that bazel produced since the last progress event - // or the beginning of the build. - string stdout = 1; - - // The next chunk of stderr that bazel produced since the last progress event - // or the beginning of the build. - string stderr = 2; -} - -// Payload of an event indicating that an expected event will not come, as -// the build is aborted prematurely for some reason. -message Aborted { - enum AbortReason { - UNKNOWN = 0; - - // The user requested the build to be aborted (e.g., by hitting Ctl-C). - USER_INTERRUPTED = 1; - - // The user requested that no analysis be performed. - NO_ANALYZE = 8; - - // The user requested that no build be carried out. - NO_BUILD = 9; - - // The build or target was aborted as a timeout was exceeded. - TIME_OUT = 2; - - // The build or target was aborted as some remote environment (e.g., for - // remote execution of actions) was not available in the expected way. - REMOTE_ENVIRONMENT_FAILURE = 3; - - // Failure due to reasons entirely internal to the build tool, i.e. an - // unexpected crash due to programmer error. - INTERNAL = 4; - - // A Failure occurred in the loading phase of a target. - LOADING_FAILURE = 5; - - // A Failure occurred in the analysis phase of a target. - ANALYSIS_FAILURE = 6; - - // Target build was skipped (e.g. due to incompatible CPU constraints). - SKIPPED = 7; - - // Build incomplete due to an earlier build failure (e.g. --keep_going was - // set to false causing the build be ended upon failure). - INCOMPLETE = 10; - - // The build tool ran out of memory and crashed. - OUT_OF_MEMORY = 11; - } - AbortReason reason = 1; - - // A human readable description with more details about there reason, where - // available and useful. - string description = 2; -} - -// Payload of an event indicating the beginning of a new build. Usually, events -// of those type start a new build-event stream. The target pattern requested -// to be build is contained in one of the announced child events; it is an -// invariant that precisely one of the announced child events has a non-empty -// target pattern. -message BuildStarted { - string uuid = 1; - - // Start of the build in ms since the epoch. - // - // Deprecated, use `start_time` instead. - // - // TODO(yannic): Remove. - int64 start_time_millis = 2 [deprecated = true]; - - // Start of the build. - google.protobuf.Timestamp start_time = 9; - - // Version of the build tool that is running. - string build_tool_version = 3; - - // A human-readable description of all the non-default option settings - string options_description = 4; - - // The name of the command that the user invoked. - string command = 5; - - // The working directory from which the build tool was invoked. - string working_directory = 6; - - // The directory of the workspace. - string workspace_directory = 7; - - // The process ID of the Bazel server. - int64 server_pid = 8; -} - -// Configuration related to the blaze workspace and output tree. -message WorkspaceConfig { - // The root of the local blaze exec root. All output files live underneath - // this at "blaze-out/". - string local_exec_root = 1; -} - -// Payload of an event reporting the command-line of the invocation as -// originally received by the server. Note that this is not the command-line -// given by the user, as the client adds information about the invocation, -// like name and relevant entries of rc-files and client environment variables. -// However, it does contain enough information to reproduce the build -// invocation. -message UnstructuredCommandLine { - repeated string args = 1; -} - -// Payload of an event reporting on the parsed options, grouped in various ways. -message OptionsParsed { - repeated string startup_options = 1; - repeated string explicit_startup_options = 2; - repeated string cmd_line = 3; - repeated string explicit_cmd_line = 4; - blaze.invocation_policy.InvocationPolicy invocation_policy = 5; - string tool_tag = 6; -} - -// Payload of an event indicating that an external resource was fetched. This -// event will only occur in streams where an actual fetch happened, not in ones -// where a cached copy of the entity to be fetched was used. -message Fetch { - bool success = 1; -} - -// Payload of an event reporting the workspace status. Key-value pairs can be -// provided by specifying the workspace_status_command to an executable that -// returns one key-value pair per line of output (key and value separated by a -// space). -message WorkspaceStatus { - message Item { - string key = 1; - string value = 2; - } - repeated Item item = 1; -} - -// Payload of an event reporting custom key-value metadata associated with the -// build. -message BuildMetadata { - // Custom metadata for the build. - map metadata = 1; -} - -// Payload of an event reporting details of a given configuration. -message Configuration { - string mnemonic = 1; - string platform_name = 2; - string cpu = 3; - map make_variable = 4; -} - -// Payload of the event indicating the expansion of a target pattern. -// The main information is in the chaining part: the id will contain the -// target pattern that was expanded and the children id will contain the -// target or target pattern it was expanded to. -message PatternExpanded { - // Represents a test_suite target and the tests that it expanded to. Nested - // test suites are recursively expanded. The test labels only contain the - // final test targets, not any nested suites. - message TestSuiteExpansion { - // The label of the test_suite rule. - string suite_label = 1; - // Labels of the test targets included in the suite. Includes all tests in - // the suite regardless of any filters or negative patterns which may result - // in the test not actually being run. - repeated string test_labels = 2; - } - - // All test suites requested via top-level target patterns. Does not include - // test suites whose label matched a negative pattern. - repeated TestSuiteExpansion test_suite_expansions = 1; -} - -// Enumeration type characterizing the size of a test, as specified by the -// test rule. -enum TestSize { - UNKNOWN = 0; - SMALL = 1; - MEDIUM = 2; - LARGE = 3; - ENORMOUS = 4; -} - -// Payload of the event indicating that the configurations for a target have -// been identified. As with pattern expansion the main information is in the -// chaining part: the id will contain the target that was configured and the -// children id will contain the configured targets it was configured to. -message TargetConfigured { - // The kind of target (e.g., e.g. "cc_library rule", "source file", - // "generated file") where the completion is reported. - string target_kind = 1; - - // The size of the test, if the target is a test target. Unset otherwise. - TestSize test_size = 2; - - // List of all tags associated with this target (for all possible - // configurations). - repeated string tag = 3; -} - -message File { - // A sequence of prefixes to apply to the file name to construct a full path. - // In most but not all cases, there will be 3 entries: - // 1. A root output directory, eg "bazel-out" - // 2. A configuration mnemonic, eg "k8-fastbuild" - // 3. An output category, eg "genfiles" - repeated string path_prefix = 4; - - // identifier indicating the nature of the file (e.g., "stdout", "stderr") - string name = 1; - - oneof file { - // A location where the contents of the file can be found. The string is - // encoded according to RFC2396. - string uri = 2; - // The contents of the file, if they are guaranteed to be short. - bytes contents = 3; - } -} - -// Payload of a message to describe a set of files, usually build artifacts, to -// be referred to later by their name. In this way, files that occur identically -// as outputs of several targets have to be named only once. -message NamedSetOfFiles { - // Files that belong to this named set of files. - repeated File files = 1; - - // Other named sets whose members also belong to this set. - repeated BuildEventId.NamedSetOfFilesId file_sets = 2; -} - -// Payload of the event indicating the completion of an action. The main purpose -// of posting those events is to provide details on the root cause for a target -// failing; however, consumers of the build-event protocol must not assume -// that only failed actions are posted. -message ActionExecuted { - bool success = 1; - - // The mnemonic of the action that was executed - string type = 8; - - // The exit code of the action, if it is available. - int32 exit_code = 2; - - // Location where to find the standard output of the action - // (e.g., a file path). - File stdout = 3; - - // Location where to find the standard error of the action - // (e.g., a file path). - File stderr = 4; - - // Deprecated. This field is now present on ActionCompletedId. - string label = 5 [deprecated = true]; - - // Deprecated. This field is now present on ActionCompletedId. - BuildEventId.ConfigurationId configuration = 7 [deprecated = true]; - - // Primary output; only provided for successful actions. - File primary_output = 6; - - // The command-line of the action, if the action is a command. - repeated string command_line = 9; - - // List of paths to log files - repeated File action_metadata_logs = 10; - - // Only populated if success = false, and sometimes not even then. - failure_details.FailureDetail failure_detail = 11; -} - -// Collection of all output files belonging to that output group. -message OutputGroup { - // Ids of fields that have been removed. - reserved 2; - - // Name of the output group - string name = 1; - - // List of file sets that belong to this output group as well. - repeated BuildEventId.NamedSetOfFilesId file_sets = 3; - - // Indicates that one or more of the output group's files were not built - // successfully (the generating action failed). - bool incomplete = 4; -} - -// Payload of the event indicating the completion of a target. The target is -// specified in the id. If the target failed the root causes are provided as -// children events. -message TargetComplete { - bool success = 1; - - // The kind of target (e.g., e.g. "cc_library rule", "source file", - // "generated file") where the completion is reported. - // Deprecated: use the target_kind field in TargetConfigured instead. - string target_kind = 5 [deprecated = true]; - - // The size of the test, if the target is a test target. Unset otherwise. - // Deprecated: use the test_size field in TargetConfigured instead. - TestSize test_size = 6 [deprecated = true]; - - // The output files are arranged by their output group. If an output file - // is part of multiple output groups, it appears once in each output - // group. - repeated OutputGroup output_group = 2; - - // Temporarily, also report the important outputs directly. This is only to - // allow existing clients help transition to the deduplicated representation; - // new clients should not use it. - repeated File important_output = 4 [deprecated = true]; - - // Report output artifacts (referenced transitively via output_group) which - // emit directories instead of singleton files. These directory_output entries - // will never include a uri. - repeated File directory_output = 8; - - // List of tags associated with this configured target. - repeated string tag = 3; - - // The timeout specified for test actions under this configured target. - // - // Deprecated, use `test_timeout` instead. - // - // TODO(yannic): Remove. - int64 test_timeout_seconds = 7 [deprecated = true]; - - // The timeout specified for test actions under this configured target. - google.protobuf.Duration test_timeout = 10; - - // Failure information about the target, only populated if success is false, - // and sometimes not even then. Equal to one of the ActionExecuted - // failure_detail fields for one of the root cause ActionExecuted events. - failure_details.FailureDetail failure_detail = 9; -} - -enum TestStatus { - NO_STATUS = 0; - PASSED = 1; - FLAKY = 2; - TIMEOUT = 3; - FAILED = 4; - INCOMPLETE = 5; - REMOTE_FAILURE = 6; - FAILED_TO_BUILD = 7; - TOOL_HALTED_BEFORE_TESTING = 8; -} - -// Payload on events reporting about individual test action. -message TestResult { - reserved 1; - - // The status of this test. - TestStatus status = 5; - - // Additional details about the status of the test. This is intended for - // user display and must not be parsed. - string status_details = 9; - - // True, if the reported attempt is taken from the tool's local cache. - bool cached_locally = 4; - - // Time in milliseconds since the epoch at which the test attempt was started. - // Note: for cached test results, this is time can be before the start of the - // build. - // - // Deprecated, use `test_attempt_start` instead. - // - // TODO(yannic): Remove. - int64 test_attempt_start_millis_epoch = 6 [deprecated = true]; - - // Time at which the test attempt was started. - // Note: for cached test results, this is time can be before the start of the - // build. - google.protobuf.Timestamp test_attempt_start = 10; - - // Time the test took to run. For locally cached results, this is the time - // the cached invocation took when it was invoked. - // - // Deprecated, use `test_attempt_duration` instead. - // - // TODO(yannic): Remove. - int64 test_attempt_duration_millis = 3 [deprecated = true]; - - // Time the test took to run. For locally cached results, this is the time - // the cached invocation took when it was invoked. - google.protobuf.Duration test_attempt_duration = 11; - - // Files (logs, test.xml, undeclared outputs, etc) generated by that test - // action. - repeated File test_action_output = 2; - - // Warnings generated by that test action. - repeated string warning = 7; - - // Message providing optional meta data on the execution of the test action, - // if available. - message ExecutionInfo { - // Deprecated, use TargetComplete.test_timeout instead. - int32 timeout_seconds = 1 [deprecated = true]; - - // Name of the strategy to execute this test action (e.g., "local", - // "remote") - string strategy = 2; - - // True, if the reported attempt was a cache hit in a remote cache. - bool cached_remotely = 6; - - // The exit code of the test action. - int32 exit_code = 7; - - // The hostname of the machine where the test action was executed (in case - // of remote execution), if known. - string hostname = 3; - - // Represents a hierarchical timing breakdown of an activity. - // The top level time should be the total time of the activity. - // Invariant: `time` >= sum of `time`s of all direct children. - message TimingBreakdown { - repeated TimingBreakdown child = 1; - string name = 2; - // Deprecated, use `time` instead. - // - // TODO(yannic): Remove. - int64 time_millis = 3 [deprecated = true]; - google.protobuf.Duration time = 4; - } - TimingBreakdown timing_breakdown = 4; - - message ResourceUsage { - string name = 1; - int64 value = 2; - } - repeated ResourceUsage resource_usage = 5; - } - ExecutionInfo execution_info = 8; -} - -// Payload of the event summarizing a test. -message TestSummary { - // Wrapper around BlazeTestStatus to support importing that enum to proto3. - // Overall status of test, accumulated over all runs, shards, and attempts. - TestStatus overall_status = 5; - - // Total number of shard attempts. - // E.g., if a target has 4 runs, 3 shards, each with 2 attempts, - // then total_run_count will be 4*3*2 = 24. - int32 total_run_count = 1; - - // Value of runs_per_test for the test. - int32 run_count = 10; - - // Number of attempts. - // If there are a different number of attempts per shard, the highest attempt - // count across all shards for each run is used. - int32 attempt_count = 15; - - // Number of shards. - int32 shard_count = 11; - - // Path to logs of passed runs. - repeated File passed = 3; - - // Path to logs of failed runs; - repeated File failed = 4; - - // Total number of cached test actions - int32 total_num_cached = 6; - - // When the test first started running. - // - // Deprecated, use `first_start_time` instead. - // - // TODO(yannic): Remove. - int64 first_start_time_millis = 7 [deprecated = true]; - - // When the test first started running. - google.protobuf.Timestamp first_start_time = 13; - - // When the last test action completed. - // - // Deprecated, use `last_stop_time` instead. - // - // TODO(yannic): Remove. - int64 last_stop_time_millis = 8 [deprecated = true]; - - // When the test first started running. - google.protobuf.Timestamp last_stop_time = 14; - - // The total runtime of the test. - // - // Deprecated, use `total_run` instead. - // - // TODO(yannic): Remove. - int64 total_run_duration_millis = 9 [deprecated = true]; - - // The total runtime of the test. - google.protobuf.Duration total_run_duration = 12; -} - -// Payload of the event summarizing a target (test or non-test). -message TargetSummary { - // Conjunction of TargetComplete events for this target, including aspects. - bool overall_build_success = 1; - - // Repeats TestSummary's overall_status if available. - TestStatus overall_test_status = 2; -} - -// Event indicating the end of a build. -message BuildFinished { - // Exit code of a build. The possible values correspond to the predefined - // codes in bazel's lib.ExitCode class, as well as any custom exit code a - // module might define. The predefined exit codes are subject to change (but - // rarely do) and are not part of the public API. - // - // A build was successful iff ExitCode.code equals 0. - message ExitCode { - // The name of the exit code. - string name = 1; - - // The exit code. - int32 code = 2; - } - - // Things that happened during the build that could be of interest. - message AnomalyReport { - // Was the build suspended at any time during the build. - // Examples of suspensions are SIGSTOP, or the hardware being put to sleep. - // If was_suspended is true, then most of the timings for this build are - // suspect. - // NOTE: This is no longer set and is deprecated. - bool was_suspended = 1; - } - - // If the build succeeded or failed. - bool overall_success = 1 [deprecated = true]; - - // The overall status of the build. A build was successful iff - // ExitCode.code equals 0. - ExitCode exit_code = 3; - - // End of the build in ms since the epoch. - // - // Deprecated, use `finish_time` instead. - // - // TODO(yannic): Remove. - int64 finish_time_millis = 2 [deprecated = true]; - - // End of the build. - google.protobuf.Timestamp finish_time = 5; - - AnomalyReport anomaly_report = 4 [deprecated = true]; -} - -message BuildMetrics { - message ActionSummary { - // The total number of actions created and registered during the build, - // including both aspects and configured targets. This metric includes - // unused actions that were constructed but not executed during this build. - // It does not include actions that were created on prior builds that are - // still valid, even if those actions had to be re-executed on this build. - // For the total number of actions that would be created if this invocation - // were "clean", see BuildGraphMetrics below. - int64 actions_created = 1; - - // The total number of actions created this build just by configured - // targets. Used mainly to allow consumers of actions_created, which used to - // not include aspects' actions, to normalize across the Blaze release that - // switched actions_created to include all created actions. - int64 actions_created_not_including_aspects = 3; - - // The total number of actions executed during the build. This includes any - // remote cache hits, but excludes local action cache hits. - int64 actions_executed = 2; - - message ActionData { - string mnemonic = 1; - - // The total number of actions of this type executed during the build. As - // above, includes remote cache hits but excludes local action cache hits. - int64 actions_executed = 2; - - // When the first action of this type started being executed, in - // milliseconds from the epoch. - int64 first_started_ms = 3; - - // When the last action of this type ended being executed, in - // milliseconds from the epoch. - int64 last_ended_ms = 4; - } - // Contains the top N actions by number of actions executed. - repeated ActionData action_data = 4; - - // Deprecated. The total number of remote cache hits. - int64 remote_cache_hits = 5 [deprecated = true]; - - message RunnerCount { - string name = 1; - int32 count = 2; - } - repeated RunnerCount runner_count = 6; - } - ActionSummary action_summary = 1; - - message MemoryMetrics { - // Size of the JVM heap post build in bytes. This is only collected if - // --memory_profile is set, since it forces a full GC. - int64 used_heap_size_post_build = 1; - - // Size of the peak JVM heap size in bytes post GC. Note that this reports 0 - // if there was no major GC during the build. - int64 peak_post_gc_heap_size = 2; - - message GarbageMetrics { - // Type of garbage collected, e.g. G1 Old Gen. - string type = 1; - // Number of bytes of garbage of the given type collected during this - // invocation. - int64 garbage_collected = 2; - } - - repeated GarbageMetrics garbage_metrics = 3; - } - MemoryMetrics memory_metrics = 2; - - message TargetMetrics { - // DEPRECATED - // No longer populated. It never measured what it was supposed to (targets - // loaded): it counted targets that were analyzed even if the underlying - // package had not changed. - // TODO(janakr): rename and remove. - int64 targets_loaded = 1; - - // Number of targets/aspects configured during this build. Does not include - // targets/aspects that were configured on prior builds on this server and - // were cached. See BuildGraphMetrics below if you need that. - int64 targets_configured = 2; - - // Number of configured targets analyzed during this build. Does not include - // aspects. Used mainly to allow consumers of targets_configured, which used - // to not include aspects, to normalize across the Blaze release that - // switched targets_configured to include aspects. - int64 targets_configured_not_including_aspects = 3; - } - TargetMetrics target_metrics = 3; - - message PackageMetrics { - // Number of BUILD files (aka packages) loaded during this build. - int64 packages_loaded = 1; - } - PackageMetrics package_metrics = 4; - - message TimingMetrics { - // The CPU time in milliseconds consumed during this build. - int64 cpu_time_in_ms = 1; - // The elapsed wall time in milliseconds during this build. - int64 wall_time_in_ms = 2; - // The elapsed wall time in milliseconds during the analysis phase. - int64 analysis_phase_time_in_ms = 3; - } - TimingMetrics timing_metrics = 5; - - message CumulativeMetrics { - // One-indexed number of "analyses" the server has run, including the - // current one. Will be incremented for every build/test/cquery/etc. command - // that reaches the analysis phase. - int32 num_analyses = 11; - // One-indexed number of "builds" the server has run, including the current - // one. Will be incremented for every build/test/run/etc. command that - // reaches the execution phase. - int32 num_builds = 12; - } - - CumulativeMetrics cumulative_metrics = 6; - - message ArtifactMetrics { - reserved 1; - - message FilesMetric { - int64 size_in_bytes = 1; - int32 count = 2; - } - - // Measures all source files newly read this build. Does not include - // unchanged sources on incremental builds. - FilesMetric source_artifacts_read = 2; - // Measures all output artifacts from executed actions. This includes - // actions that were cached locally (via the action cache) or remotely (via - // a remote cache or executor), but does *not* include outputs of actions - // that were cached internally in Skyframe. - FilesMetric output_artifacts_seen = 3; - // Measures all output artifacts from actions that were cached locally - // via the action cache. These artifacts were already present on disk at the - // start of the build. Does not include Skyframe-cached actions' outputs. - FilesMetric output_artifacts_from_action_cache = 4; - // Measures all artifacts that belong to a top-level output group. Does not - // deduplicate, so if there are two top-level targets in this build that - // share an artifact, it will be counted twice. - FilesMetric top_level_artifacts = 5; - } - - ArtifactMetrics artifact_metrics = 7; - - // Information about the size and shape of the build graph. Some fields may - // not be populated if Bazel was able to skip steps due to caching. - message BuildGraphMetrics { - // How many configured targets/aspects were in this build, including any - // that were analyzed on a prior build and are still valid. May not be - // populated if analysis phase was fully cached. Note: for historical - // reasons this includes input/output files and other configured targets - // that do not actually have associated actions. - int32 action_lookup_value_count = 1; - // How many configured targets alone were in this build: always at most - // action_lookup_value_count. Useful mainly for historical comparisons to - // TargetMetrics.targets_configured, which used to not count aspects. This - // also includes configured targets that do not have associated actions. - int32 action_lookup_value_count_not_including_aspects = 5; - // How many actions belonged to the configured targets/aspects above. It may - // not be necessary to execute all of these actions to build the requested - // targets. May not be populated if analysis phase was fully cached. - int32 action_count = 2; - // How many actions belonged to configured targets: always at most - // action_count. Useful mainly for historical comparisons to - // ActionMetrics.actions_created, which used to not count aspects' actions. - int32 action_count_not_including_aspects = 6; - // How many "input file" configured targets there were: one per source file. - // Should agree with artifact_metrics.source_artifacts_read.count above, - int32 input_file_configured_target_count = 7; - // How many "output file" configured targets there were: output files that - // are targets (not implicit outputs). - int32 output_file_configured_target_count = 8; - // How many "other" configured targets there were (like alias, - // package_group, and other non-rule non-file configured targets). - int32 other_configured_target_count = 9; - // How many artifacts are outputs of the above actions. May not be populated - // if analysis phase was fully cached. - int32 output_artifact_count = 3; - // How many Skyframe nodes there are in memory at the end of the build. This - // may underestimate the number of nodes when running with memory-saving - // settings or with Skybuild, and may overestimate if there are nodes from - // prior evaluations still in the cache. - int32 post_invocation_skyframe_node_count = 4; - } - - BuildGraphMetrics build_graph_metrics = 8; - - // Information about all workers that were alive during the invocation. - message WorkerMetrics { - // Unique id of worker. - int32 worker_id = 1; - // Worker process id. If there is no process for worker, equals to zero. - uint32 process_id = 2; - // Mnemonic of running worker. - string mnemonic = 3; - // Multiplex or singleplex worker. - bool is_multiplex = 4; - // Using worker sandbox file system or not. - bool is_sandbox = 5; - // Shows is worker stats measured at the end of invocation. - bool is_measurable = 6; - - // Information collected from worker at some point. - message WorkerStats { - // Epoch unix time of collection of metrics. - int64 collect_time_in_ms = 1; - // RSS size of worker process. - int32 worker_memory_in_kb = 2; - } - - // Combined workers statistics. - repeated WorkerStats worker_stats = 7; - } - - repeated WorkerMetrics worker_metrics = 9; -} - -// Event providing additional statistics/logs after completion of the build. -message BuildToolLogs { - repeated File log = 1; -} - -// Event describing all convenience symlinks (i.e., workspace symlinks) to be -// created or deleted once the execution phase has begun. Note that this event -// does not say anything about whether or not the build tool actually executed -// these filesystem operations; it only says what logical operations should be -// performed. This event is emitted exactly once per build; if no symlinks are -// to be modified, the event is still emitted with empty contents. -message ConvenienceSymlinksIdentified { - repeated ConvenienceSymlink convenience_symlinks = 1; -} - -// The message that contains what type of action to perform on a given path and -// target of a symlink. -message ConvenienceSymlink { - enum Action { - UNKNOWN = 0; - - // Indicates a symlink should be created, or overwritten if it already - // exists. - CREATE = 1; - - // Indicates a symlink should be deleted if it already exists. - DELETE = 2; - } - - // The path of the symlink to be created or deleted, absolute or relative to - // the workspace, creating any directories necessary. If a symlink already - // exists at that location, then it should be replaced by a symlink pointing - // to the new target. - string path = 1; - - // The operation we are performing on the symlink. - Action action = 2; - - // If action is CREATE, this is the target path that the symlink should point - // to. If the path points underneath the output base, it is relative to the - // output base; otherwise it is absolute. - // - // If action is DELETE, this field is not set. - string target = 3; -} - -// Message describing a build event. Events will have an identifier that -// is unique within a given build invocation; they also announce follow-up -// events as children. More details, which are specific to the kind of event -// that is observed, is provided in the payload. More options for the payload -// might be added in the future. -message BuildEvent { - reserved 11, 19; - BuildEventId id = 1; - repeated BuildEventId children = 2; - bool last_message = 20; - oneof payload { - Progress progress = 3; - Aborted aborted = 4; - BuildStarted started = 5; - UnstructuredCommandLine unstructured_command_line = 12; - command_line.CommandLine structured_command_line = 22; - OptionsParsed options_parsed = 13; - WorkspaceStatus workspace_status = 16; - Fetch fetch = 21; - Configuration configuration = 17; - PatternExpanded expanded = 6; - TargetConfigured configured = 18; - ActionExecuted action = 7; - NamedSetOfFiles named_set_of_files = 15; - TargetComplete completed = 8; - TestResult test_result = 10; - TestSummary test_summary = 9; - TargetSummary target_summary = 28; - BuildFinished finished = 14; - BuildToolLogs build_tool_logs = 23; - BuildMetrics build_metrics = 24; - WorkspaceConfig workspace_info = 25; - BuildMetadata build_metadata = 26; - ConvenienceSymlinksIdentified convenience_symlinks_identified = 27; - } -} diff --git a/Examples/BazelXCBBuildService/BEP/command_line.proto b/Examples/BazelXCBBuildService/BEP/command_line.proto deleted file mode 100644 index c924888..0000000 --- a/Examples/BazelXCBBuildService/BEP/command_line.proto +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package command_line; - -// option java_api_version = 2; -option java_package = "com.google.devtools.build.lib.runtime.proto"; - -import "BazelXCBBuildService/BEP/option_filters.proto"; - -// Representation of a Bazel command line. -message CommandLine { - // A title for this command line value, to differentiate it from others. - // In particular, a single invocation may wish to report both the literal and - // canonical command lines, and this label would be used to differentiate - // between both versions. This is a string for flexibility. - string command_line_label = 1; - - // A Bazel command line is made of distinct parts. For example, - // `bazel --nomaster_bazelrc test --nocache_test_results //foo:aTest` - // has the executable "bazel", a startup flag, a command "test", a command - // flag, and a test target. There could be many more flags and targets, or - // none (`bazel info` for example), but the basic structure is there. The - // command line should be broken down into these logical sections here. - repeated CommandLineSection sections = 2; -} - -// A section of the Bazel command line. -message CommandLineSection { - // The name of this section, such as "startup_option" or "command". - string section_label = 1; - - oneof section_type { - // Sections with non-options, such as the list of targets or the command, - // should use simple string chunks. - ChunkList chunk_list = 2; - - // Startup and command options are lists of options and belong here. - OptionList option_list = 3; - } -} - -// Wrapper to allow a list of strings in the "oneof" section_type. -message ChunkList { - repeated string chunk = 1; -} - -// Wrapper to allow a list of options in the "oneof" section_type. -message OptionList { - repeated Option option = 1; -} - -// A single command line option. -// -// This represents the option itself, but does not take into account the type of -// option or how the parser interpreted it. If this option is part of a command -// line that represents the actual input that Bazel received, it would, for -// example, include expansion flags as they are. However, if this option -// represents the canonical form of the command line, with the values as Bazel -// understands them, then the expansion flag, which has no value, would not -// appear, and the flags it expands to would. -message Option { - // How the option looks with the option and its value combined. Depending on - // the purpose of this command line report, this could be the canonical - // form, or the way that the flag was set. - // - // Some examples: this might be `--foo=bar` form, or `--foo bar` with a space; - // for boolean flags, `--nobaz` is accepted on top of `--baz=false` and other - // negating values, or for a positive value, the unqualified `--baz` form - // is also accepted. This could also be a short `-b`, if the flag has an - // abbreviated form. - string combined_form = 1; - - // The canonical name of the option, without the preceding dashes. - string option_name = 2; - - // The value of the flag, or unset for flags that do not take values. - // Especially for boolean flags, this should be in canonical form, the - // combined_form field above gives room for showing the flag as it was set - // if that is preferred. - string option_value = 3; - - // This flag's tagged effects. See OptionEffectTag's java documentation for - // details. - repeated options.OptionEffectTag effect_tags = 4; - - // Metadata about the flag. See OptionMetadataTag's java documentation for - // details. - repeated options.OptionMetadataTag metadata_tags = 5; -} diff --git a/Examples/BazelXCBBuildService/BEP/failure_details.proto b/Examples/BazelXCBBuildService/BEP/failure_details.proto deleted file mode 100644 index 3855e27..0000000 --- a/Examples/BazelXCBBuildService/BEP/failure_details.proto +++ /dev/null @@ -1,1272 +0,0 @@ -// Copyright 2020 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file's messages describe any failure(s) that occurred during Bazel's -// handling of a request. The intent is to provide more detail to a Bazel client -// than is conveyed with an exit code, to help those clients decide how to -// respond to, or classify, a failure. - -syntax = "proto3"; - -package failure_details; - -option java_package = "com.google.devtools.build.lib.server"; - -import "google/protobuf/descriptor.proto"; - -message FailureDetailMetadata { - uint32 exit_code = 1; -} - -extend google.protobuf.EnumValueOptions { - FailureDetailMetadata metadata = 1078; -} - -// The FailureDetail message type is designed such that consumers can extract a -// basic classification of a FailureDetail message even if the consumer was -// built with a stale definition. This forward compatibility is implemented via -// conventions on FailureDetail and its submessage types, as follows. -// -// *** FailureDetail field numbers -// -// Field numbers 1 through 100 (inclusive) are reserved for generally applicable -// values. Any number of these fields may be set on a FailureDetail message. -// -// Field numbers 101 through 10,000 (inclusive) are reserved for use inside the -// "oneof" structure. Only one of these values should be set on a FailureDetail -// message. -// -// Additional fields numbers are unlikely to be needed, but, for extreme future- -// proofing purposes, field numbers 10,001 through 1,000,000 (inclusive; -// excluding protobuf's reserved range 19000 through 19999) are reserved for -// additional generally applicable values. -// -// *** FailureDetail's "oneof" submessages -// -// Each field in the "oneof" structure is a submessage corresponding to a -// category of failure. -// -// In each of these submessage types, field number 1 is an enum whose values -// correspond to a subcategory of the failure. Generally, the enum's constant -// which maps to 0 should be interpreted as "unspecified", though this is not -// required. -// -// *** Recommended forward compatibility strategy -// -// The recommended forward compatibility strategy is to reduce a FailureDetail -// message to a pair of integers. -// -// The first integer corresponds to the field number of the submessage set -// inside FailureDetail's "oneof", which corresponds with the failure's -// category. -// -// The second integer corresponds to the value of the enum at field number 1 -// within that submessage, which corresponds with the failure's subcategory. -// -// WARNING: This functionality is experimental and should not be relied on at -// this time. -// TODO(mschaller): remove experimental warning -message FailureDetail { - // A short human-readable message describing the failure, for debugging. - // - // This value is *not* intended to be used algorithmically. - string message = 1; - - // Reserved for future generally applicable values. Any of these may be set. - reserved 2 to 100; - - oneof category { - Interrupted interrupted = 101; - ExternalRepository external_repository = 103; - BuildProgress build_progress = 104; - RemoteOptions remote_options = 106; - ClientEnvironment client_environment = 107; - Crash crash = 108; - SymlinkForest symlink_forest = 110; - PackageOptions package_options = 114; - RemoteExecution remote_execution = 115; - Execution execution = 116; - Workspaces workspaces = 117; - CrashOptions crash_options = 118; - Filesystem filesystem = 119; - ExecutionOptions execution_options = 121; - Command command = 122; - Spawn spawn = 123; - GrpcServer grpc_server = 124; - CanonicalizeFlags canonicalize_flags = 125; - BuildConfiguration build_configuration = 126; - InfoCommand info_command = 127; - MemoryOptions memory_options = 129; - Query query = 130; - LocalExecution local_execution = 132; - ActionCache action_cache = 134; - FetchCommand fetch_command = 135; - SyncCommand sync_command = 136; - Sandbox sandbox = 137; - IncludeScanning include_scanning = 139; - TestCommand test_command = 140; - ActionQuery action_query = 141; - TargetPatterns target_patterns = 142; - CleanCommand clean_command = 144; - ConfigCommand config_command = 145; - ConfigurableQuery configurable_query = 146; - DumpCommand dump_command = 147; - HelpCommand help_command = 148; - MobileInstall mobile_install = 150; - ProfileCommand profile_command = 151; - RunCommand run_command = 152; - VersionCommand version_command = 153; - PrintActionCommand print_action_command = 154; - WorkspaceStatus workspace_status = 158; - JavaCompile java_compile = 159; - ActionRewinding action_rewinding = 160; - CppCompile cpp_compile = 161; - StarlarkAction starlark_action = 162; - NinjaAction ninja_action = 163; - DynamicExecution dynamic_execution = 164; - FailAction fail_action = 166; - SymlinkAction symlink_action = 167; - CppLink cpp_link = 168; - LtoAction lto_action = 169; - TestAction test_action = 172; - Worker worker = 173; - Analysis analysis = 174; - PackageLoading package_loading = 175; - Toolchain toolchain = 177; - StarlarkLoading starlark_loading = 179; - ExternalDeps external_deps = 181; - DiffAwareness diff_awareness = 182; - } - - reserved 102; // For internal use - reserved 105; // For internal use - reserved 109; // For internal use - reserved 111 to 113; // For internal use - reserved 120; // For internal use - reserved 128; // For internal use - reserved 131; // For internal use - reserved 133; // For internal use - reserved 138; // For internal use - reserved 143; // For internal use - reserved 149; // For internal use - reserved 155 to 157; // For internal use - reserved 165; // For internal use - reserved 170 to 171; // For internal use - reserved 176; // For internal use - reserved 178; // For internal use - reserved 180; // For internal use -} - -message Interrupted { - enum Code { - // Unknown interrupt. Avoid using this code, instead use INTERRUPTED. - INTERRUPTED_UNKNOWN = 0 [(metadata) = { exit_code: 8 }]; - - // Command was interrupted (cancelled). - INTERRUPTED = 28 [(metadata) = { exit_code: 8 }]; - - // The following more specific interrupt codes have been deprecated and - // consolidated into INTERRUPTED. - DEPRECATED_BUILD = 4 [(metadata) = { exit_code: 8 }]; - DEPRECATED_BUILD_COMPLETION = 5 [(metadata) = { exit_code: 8 }]; - DEPRECATED_PACKAGE_LOADING_SYNC = 6 [(metadata) = { exit_code: 8 }]; - DEPRECATED_EXECUTOR_COMPLETION = 7 [(metadata) = { exit_code: 8 }]; - DEPRECATED_COMMAND_DISPATCH = 8 [(metadata) = { exit_code: 8 }]; - DEPRECATED_INFO_ITEM = 9 [(metadata) = { exit_code: 8 }]; - DEPRECATED_AFTER_QUERY = 10 [(metadata) = { exit_code: 8 }]; - DEPRECATED_FETCH_COMMAND = 17 [(metadata) = { exit_code: 8 }]; - DEPRECATED_SYNC_COMMAND = 18 [(metadata) = { exit_code: 8 }]; - DEPRECATED_CLEAN_COMMAND = 20 [(metadata) = { exit_code: 8 }]; - DEPRECATED_MOBILE_INSTALL_COMMAND = 21 [(metadata) = { exit_code: 8 }]; - DEPRECATED_QUERY = 22 [(metadata) = { exit_code: 8 }]; - DEPRECATED_RUN_COMMAND = 23 [(metadata) = { exit_code: 8 }]; - DEPRECATED_OPTIONS_PARSING = 27 [(metadata) = { exit_code: 8 }]; - - reserved 1 to 3; // For internal use - reserved 11 to 16; // For internal use - reserved 19; // For internal use - reserved 24 to 26; // For internal use - } - - Code code = 1; -} - -message Spawn { - enum Code { - SPAWN_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - // See the SpawnResult.Status Java enum for definitions of the following - // Spawn failure codes. - NON_ZERO_EXIT = 1 [(metadata) = { exit_code: 1 }]; - TIMEOUT = 2 [(metadata) = { exit_code: 1 }]; - // Note: Spawn OUT_OF_MEMORY leads to a BUILD_FAILURE exit_code because the - // build tool itself did not run out of memory. - OUT_OF_MEMORY = 3 [(metadata) = { exit_code: 1 }]; - EXECUTION_FAILED = 4 [(metadata) = { exit_code: 34 }]; - EXECUTION_DENIED = 5 [(metadata) = { exit_code: 1 }]; - REMOTE_CACHE_FAILED = 6 [(metadata) = { exit_code: 34 }]; - COMMAND_LINE_EXPANSION_FAILURE = 7 [(metadata) = { exit_code: 1 }]; - EXEC_IO_EXCEPTION = 8 [(metadata) = { exit_code: 36 }]; - INVALID_TIMEOUT = 9 [(metadata) = { exit_code: 1 }]; - INVALID_REMOTE_EXECUTION_PROPERTIES = 10 [(metadata) = { exit_code: 1 }]; - NO_USABLE_STRATEGY_FOUND = 11 [(metadata) = { exit_code: 1 }]; - // TODO(b/138456686): this code should be deprecated when SpawnResult is - // refactored to prohibit undetailed failures - UNSPECIFIED_EXECUTION_FAILURE = 12 [(metadata) = { exit_code: 1 }]; - FORBIDDEN_INPUT = 13 [(metadata) = { exit_code: 1 }]; - } - Code code = 1; - - // For Codes describing generic failure to spawn (eg. EXECUTION_FAILED and - // EXECUTION_DENIED) the `catastrophic` field may be set to true indicating a - // failure that immediately terminated the entire build tool. - bool catastrophic = 2; - - // If Code is NON_ZERO_EXIT, the `spawn_exit_code` field may be set to the - // non-zero exit code returned by the spawned process to the OS. - // - // NOTE: This field must not be confused with the build tool's overall - // exit code. - int32 spawn_exit_code = 3; -} - -message ExternalRepository { - enum Code { - EXTERNAL_REPOSITORY_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - OVERRIDE_DISALLOWED_MANAGED_DIRECTORIES = 1 [(metadata) = { exit_code: 2 }]; - BAD_DOWNLOADER_CONFIG = 2 [(metadata) = { exit_code: 2 }]; - } - Code code = 1; - // Additional data could include external repository names. -} - -message BuildProgress { - enum Code { - BUILD_PROGRESS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - OUTPUT_INITIALIZATION = 3 [(metadata) = { exit_code: 36 }]; - BES_RUNS_PER_TEST_LIMIT_UNSUPPORTED = 4 [(metadata) = { exit_code: 2 }]; - BES_LOCAL_WRITE_ERROR = 5 [(metadata) = { exit_code: 36 }]; - BES_INITIALIZATION_ERROR = 6 [(metadata) = { exit_code: 36 }]; - BES_UPLOAD_TIMEOUT_ERROR = 7 [(metadata) = { exit_code: 38 }]; - BES_FILE_WRITE_TIMEOUT = 8 [(metadata) = { exit_code: 38 }]; - BES_FILE_WRITE_IO_ERROR = 9 [(metadata) = { exit_code: 38 }]; - BES_FILE_WRITE_INTERRUPTED = 10 [(metadata) = { exit_code: 38 }]; - BES_FILE_WRITE_CANCELED = 11 [(metadata) = { exit_code: 38 }]; - BES_FILE_WRITE_UNKNOWN_ERROR = 12 [(metadata) = { exit_code: 38 }]; - BES_UPLOAD_LOCAL_FILE_ERROR = 13 [(metadata) = { exit_code: 38 }]; - BES_STREAM_NOT_RETRYING_FAILURE = 14 [(metadata) = { exit_code: 45 }]; - BES_STREAM_COMPLETED_WITH_UNACK_EVENTS_ERROR = 15 - [(metadata) = { exit_code: 45 }]; - BES_STREAM_COMPLETED_WITH_UNSENT_EVENTS_ERROR = 16 - [(metadata) = { exit_code: 45 }]; - BES_STREAM_COMPLETED_WITH_REMOTE_ERROR = 19 - [(metadata) = { exit_code: 45 }]; - BES_UPLOAD_RETRY_LIMIT_EXCEEDED_FAILURE = 17 - [(metadata) = { exit_code: 38 }]; - reserved 1, 2, 18; // For internal use - } - Code code = 1; - // Additional data could include the build progress upload endpoint. -} - -message RemoteOptions { - enum Code { - REMOTE_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - REMOTE_DEFAULT_EXEC_PROPERTIES_LOGIC_ERROR = 1 - [(metadata) = { exit_code: 2 }]; - // Credentials could not be read from the requested file/socket/process/etc. - CREDENTIALS_READ_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - // Credentials could not be written to a shared, temporary file. - CREDENTIALS_WRITE_FAILURE = 3 [(metadata) = { exit_code: 36 }]; - DOWNLOADER_WITHOUT_GRPC_CACHE = 4 [(metadata) = { exit_code: 2 }]; - EXECUTION_WITH_INVALID_CACHE = 5 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message ClientEnvironment { - enum Code { - CLIENT_ENVIRONMENT_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - CLIENT_CWD_MALFORMED = 1 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message Crash { - enum Code { - CRASH_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - CRASH_OOM = 1 [(metadata) = { exit_code: 33 }]; - } - - Code code = 1; - - // The cause chain of the crash, with the outermost throwable first. Limited - // to the outermost exception and at most 4 nested causes (so, max size of 5). - repeated Throwable causes = 2; -} - -message Throwable { - // The class name of the java.lang.Throwable. - string throwable_class = 1; - // The throwable's message. - string message = 2; - // The result of calling toString on the deepest (i.e. closest to the - // throwable's construction site) 1000 (or fewer) StackTraceElements. - // Unstructured to simplify string matching. - repeated string stack_trace = 3; -} - -message SymlinkForest { - enum Code { - SYMLINK_FOREST_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - TOPLEVEL_OUTDIR_PACKAGE_PATH_CONFLICT = 1 [(metadata) = { exit_code: 2 }]; - TOPLEVEL_OUTDIR_USED_AS_SOURCE = 2 [(metadata) = { exit_code: 2 }]; - CREATION_FAILED = 3 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message PackageOptions { - enum Code { - reserved 2, 3; // For internal use - - PACKAGE_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - PACKAGE_PATH_INVALID = 1 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message RemoteExecution { - // The association of some of these options with exit code 2, "command line - // error", seems sketchy. Especially worth reconsidering are the channel init - // failure modes, which can correspond to failures occurring in gRPC setup. - // These all correspond with current Bazel behavior. - enum Code { - REMOTE_EXECUTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - CAPABILITIES_QUERY_FAILURE = 1 [(metadata) = { exit_code: 34 }]; - CREDENTIALS_INIT_FAILURE = 2 [(metadata) = { exit_code: 2 }]; - CACHE_INIT_FAILURE = 3 [(metadata) = { exit_code: 2 }]; - RPC_LOG_FAILURE = 4 [(metadata) = { exit_code: 2 }]; - EXEC_CHANNEL_INIT_FAILURE = 5 [(metadata) = { exit_code: 2 }]; - CACHE_CHANNEL_INIT_FAILURE = 6 [(metadata) = { exit_code: 2 }]; - DOWNLOADER_CHANNEL_INIT_FAILURE = 7 [(metadata) = { exit_code: 2 }]; - LOG_DIR_CLEANUP_FAILURE = 8 [(metadata) = { exit_code: 36 }]; - CLIENT_SERVER_INCOMPATIBLE = 9 [(metadata) = { exit_code: 34 }]; - DOWNLOADED_INPUTS_DELETION_FAILURE = 10 [(metadata) = { exit_code: 34 }]; - REMOTE_DOWNLOAD_OUTPUTS_MINIMAL_WITHOUT_INMEMORY_DOTD = 11 - [(metadata) = { exit_code: 2 }]; - REMOTE_DOWNLOAD_OUTPUTS_MINIMAL_WITHOUT_INMEMORY_JDEPS = 12 - [(metadata) = { exit_code: 2 }]; - INCOMPLETE_OUTPUT_DOWNLOAD_CLEANUP_FAILURE = 13 - [(metadata) = { exit_code: 36 }]; - REMOTE_DEFAULT_PLATFORM_PROPERTIES_PARSE_FAILURE = 14 - [(metadata) = { exit_code: 1 }]; - ILLEGAL_OUTPUT = 15 [(metadata) = { exit_code: 1 }]; - INVALID_EXEC_AND_PLATFORM_PROPERTIES = 16 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message Execution { - enum Code { - EXECUTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - EXECUTION_LOG_INITIALIZATION_FAILURE = 1 [(metadata) = { exit_code: 2 }]; - EXECUTION_LOG_WRITE_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - EXECROOT_CREATION_FAILURE = 3 [(metadata) = { exit_code: 36 }]; - TEMP_ACTION_OUTPUT_DIRECTORY_DELETION_FAILURE = 4 - [(metadata) = { exit_code: 36 }]; - TEMP_ACTION_OUTPUT_DIRECTORY_CREATION_FAILURE = 5 - [(metadata) = { exit_code: 36 }]; - PERSISTENT_ACTION_OUTPUT_DIRECTORY_CREATION_FAILURE = 6 - [(metadata) = { exit_code: 36 }]; - LOCAL_OUTPUT_DIRECTORY_SYMLINK_FAILURE = 7 [(metadata) = { exit_code: 36 }]; - reserved 8; // was ACTION_INPUT_FILES_MISSING, now mostly - // SOURCE_INPUT_MISSING - LOCAL_TEMPLATE_EXPANSION_FAILURE = 9 [(metadata) = { exit_code: 36 }]; - INPUT_DIRECTORY_CHECK_IO_EXCEPTION = 10 [(metadata) = { exit_code: 36 }]; - EXTRA_ACTION_OUTPUT_CREATION_FAILURE = 11 [(metadata) = { exit_code: 36 }]; - TEST_RUNNER_IO_EXCEPTION = 12 [(metadata) = { exit_code: 36 }]; - FILE_WRITE_IO_EXCEPTION = 13 [(metadata) = { exit_code: 36 }]; - TEST_OUT_ERR_IO_EXCEPTION = 14 [(metadata) = { exit_code: 36 }]; - SYMLINK_TREE_MANIFEST_COPY_IO_EXCEPTION = 15 - [(metadata) = { exit_code: 36 }]; - SYMLINK_TREE_MANIFEST_LINK_IO_EXCEPTION = 16 - [(metadata) = { exit_code: 36 }]; - SYMLINK_TREE_CREATION_IO_EXCEPTION = 17 [(metadata) = { exit_code: 36 }]; - SYMLINK_TREE_CREATION_COMMAND_EXCEPTION = 18 - [(metadata) = { exit_code: 36 }]; - ACTION_INPUT_READ_IO_EXCEPTION = 19 [(metadata) = { exit_code: 36 }]; - ACTION_NOT_UP_TO_DATE = 20 [(metadata) = { exit_code: 1 }]; - PSEUDO_ACTION_EXECUTION_PROHIBITED = 21 [(metadata) = { exit_code: 1 }]; - DISCOVERED_INPUT_DOES_NOT_EXIST = 22 [(metadata) = { exit_code: 36 }]; - ACTION_OUTPUTS_DELETION_FAILURE = 23 [(metadata) = { exit_code: 1 }]; - ACTION_OUTPUTS_NOT_CREATED = 24 [(metadata) = { exit_code: 1 }]; - ACTION_FINALIZATION_FAILURE = 25 [(metadata) = { exit_code: 1 }]; - ACTION_INPUT_LOST = 26 [(metadata) = { exit_code: 1 }]; - FILESYSTEM_CONTEXT_UPDATE_FAILURE = 27 [(metadata) = { exit_code: 1 }]; - ACTION_OUTPUT_CLOSE_FAILURE = 28 [(metadata) = { exit_code: 1 }]; - INPUT_DISCOVERY_IO_EXCEPTION = 29 [(metadata) = { exit_code: 1 }]; - TREE_ARTIFACT_DIRECTORY_CREATION_FAILURE = 30 - [(metadata) = { exit_code: 1 }]; - ACTION_OUTPUT_DIRECTORY_CREATION_FAILURE = 31 - [(metadata) = { exit_code: 1 }]; - ACTION_FS_OUTPUT_DIRECTORY_CREATION_FAILURE = 32 - [(metadata) = { exit_code: 1 }]; - ACTION_FS_OUT_ERR_DIRECTORY_CREATION_FAILURE = 33 - [(metadata) = { exit_code: 1 }]; - NON_ACTION_EXECUTION_FAILURE = 34 [(metadata) = { exit_code: 1 }]; - CYCLE = 35 [(metadata) = { exit_code: 1 }]; - SOURCE_INPUT_MISSING = 36 [(metadata) = { exit_code: 1 }]; - UNEXPECTED_EXCEPTION = 37 [(metadata) = { exit_code: 1 }]; - reserved 38; - SOURCE_INPUT_IO_EXCEPTION = 39 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -// Failure details about Bazel's WORKSPACE features. -message Workspaces { - enum Code { - WORKSPACES_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - WORKSPACES_LOG_INITIALIZATION_FAILURE = 1 [(metadata) = { exit_code: 2 }]; - WORKSPACES_LOG_WRITE_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - - // See `managed_directories` in - // https://docs.bazel.build/versions/main/skylark/lib/globals.html#workspace. - ILLEGAL_WORKSPACE_FILE_SYMLINK_WITH_MANAGED_DIRECTORIES = 3 - [(metadata) = { exit_code: 1 }]; - WORKSPACE_FILE_READ_FAILURE_WITH_MANAGED_DIRECTORIES = 4 - [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message CrashOptions { - enum Code { - CRASH_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - reserved 1; // For internal use - } - - Code code = 1; -} - -message Filesystem { - enum Code { - FILESYSTEM_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - reserved 1; - reserved 2; - EMBEDDED_BINARIES_ENUMERATION_FAILURE = 3 [(metadata) = { exit_code: 36 }]; - SERVER_PID_TXT_FILE_READ_FAILURE = 4 [(metadata) = { exit_code: 36 }]; - SERVER_FILE_WRITE_FAILURE = 5 [(metadata) = { exit_code: 36 }]; - DEFAULT_DIGEST_HASH_FUNCTION_INVALID_VALUE = 6 - [(metadata) = { exit_code: 2 }]; - - reserved 7; // For internal use - } - - Code code = 1; -} - -message ExecutionOptions { - // All numerical exit code associations correspond to pre-existing Bazel - // behavior. These associations are suspicious: - // - REQUESTED_STRATEGY_INCOMPATIBLE_WITH_SANDBOXING (instead: 2?) - // - DEPRECATED_LOCAL_RESOURCES_USED (instead: 2?) - // TODO(b/138456686): Revise these after the (intentionally non-breaking) - // initial rollout of FailureDetail-based encoding. - enum Code { - EXECUTION_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INVALID_STRATEGY = 3 [(metadata) = { exit_code: 2 }]; - REQUESTED_STRATEGY_INCOMPATIBLE_WITH_SANDBOXING = 4 - [(metadata) = { exit_code: 36 }]; - DEPRECATED_LOCAL_RESOURCES_USED = 5 [(metadata) = { exit_code: 36 }]; - INVALID_CYCLIC_DYNAMIC_STRATEGY = 6 [(metadata) = { exit_code: 36 }]; - RESTRICTION_UNMATCHED_TO_ACTION_CONTEXT = 7 [(metadata) = { exit_code: 2 }]; - REMOTE_FALLBACK_STRATEGY_NOT_ABSTRACT_SPAWN = 8 - [(metadata) = { exit_code: 2 }]; - STRATEGY_NOT_FOUND = 9 [(metadata) = { exit_code: 2 }]; - DYNAMIC_STRATEGY_NOT_SANDBOXED = 10 [(metadata) = { exit_code: 2 }]; - - reserved 1, 2; // For internal use - } - - Code code = 1; -} - -message Command { - enum Code { - // The name "COMMAND_UNKNOWN" might reasonably be interpreted as "command - // not found". The enum's default value should represent a lack of knowledge - // about the failure instead. - COMMAND_FAILURE_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - COMMAND_NOT_FOUND = 1 [(metadata) = { exit_code: 2 }]; - ANOTHER_COMMAND_RUNNING = 2 [(metadata) = { exit_code: 9 }]; - PREVIOUSLY_SHUTDOWN = 3 [(metadata) = { exit_code: 36 }]; - STARLARK_CPU_PROFILE_FILE_INITIALIZATION_FAILURE = 4 - [(metadata) = { exit_code: 36 }]; - STARLARK_CPU_PROFILING_INITIALIZATION_FAILURE = 5 - [(metadata) = { exit_code: 36 }]; - STARLARK_CPU_PROFILE_FILE_WRITE_FAILURE = 6 - [(metadata) = { exit_code: 36 }]; - INVOCATION_POLICY_PARSE_FAILURE = 7 [(metadata) = { exit_code: 2 }]; - INVOCATION_POLICY_INVALID = 8 [(metadata) = { exit_code: 2 }]; - OPTIONS_PARSE_FAILURE = 9 [(metadata) = { exit_code: 2 }]; - STARLARK_OPTIONS_PARSE_FAILURE = 10 [(metadata) = { exit_code: 2 }]; - ARGUMENTS_NOT_RECOGNIZED = 11 [(metadata) = { exit_code: 2 }]; - NOT_IN_WORKSPACE = 12 [(metadata) = { exit_code: 2 }]; - SPACES_IN_WORKSPACE_PATH = 13 [(metadata) = { exit_code: 36 }]; - IN_OUTPUT_DIRECTORY = 14 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message GrpcServer { - enum Code { - GRPC_SERVER_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - GRPC_SERVER_NOT_COMPILED_IN = 1 [(metadata) = { exit_code: 37 }]; - SERVER_BIND_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - BAD_COOKIE = 3 [(metadata) = { exit_code: 36 }]; - NO_CLIENT_DESCRIPTION = 4 [(metadata) = { exit_code: 36 }]; - reserved 5; // For internal use - } - - Code code = 1; -} - -message CanonicalizeFlags { - enum Code { - CANONICALIZE_FLAGS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - FOR_COMMAND_INVALID = 1 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -// Failure modes described by this category pertain to the Bazel invocation -// configuration consumed by Bazel's analysis phase. This category is not -// intended as a grab-bag for all Bazel flag value constraint violations, which -// instead generally belong in the category for the subsystem whose flag values -// participate in the constraint. -message BuildConfiguration { - enum Code { - BUILD_CONFIGURATION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - PLATFORM_MAPPING_EVALUATION_FAILURE = 1 [(metadata) = { exit_code: 2 }]; - PLATFORM_MAPPINGS_FILE_IS_DIRECTORY = 2 [(metadata) = { exit_code: 1 }]; - PLATFORM_MAPPINGS_FILE_NOT_FOUND = 3 [(metadata) = { exit_code: 1 }]; - TOP_LEVEL_CONFIGURATION_CREATION_FAILURE = 4 - [(metadata) = { exit_code: 1 }]; - INVALID_CONFIGURATION = 5 [(metadata) = { exit_code: 2 }]; - INVALID_BUILD_OPTIONS = 6 [(metadata) = { exit_code: 2 }]; - MULTI_CPU_PREREQ_UNMET = 7 [(metadata) = { exit_code: 2 }]; - HEURISTIC_INSTRUMENTATION_FILTER_INVALID = 8 - [(metadata) = { exit_code: 2 }]; - CYCLE = 9 [(metadata) = { exit_code: 2 }]; - CONFLICTING_CONFIGURATIONS = 10 [(metadata) = { exit_code: 2 }]; - // This can come from either an invalid user-specified option or a - // configuration transition. There's no sure-fire way to distinguish the two - // possibilities in Bazel, so we go with the more straightforward - // command-line error exit code 2. - INVALID_OUTPUT_DIRECTORY_MNEMONIC = 11 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message InfoCommand { - // The distinction between a failure to write a single info item and a failure - // to write them all seems sketchy. Why do they have different exit codes? - // This reflects current Bazel behavior, but deserves more thought. - enum Code { - INFO_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - TOO_MANY_KEYS = 1 [(metadata) = { exit_code: 2 }]; - KEY_NOT_RECOGNIZED = 2 [(metadata) = { exit_code: 2 }]; - INFO_BLOCK_WRITE_FAILURE = 3 [(metadata) = { exit_code: 7 }]; - ALL_INFO_WRITE_FAILURE = 4 [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} - -message MemoryOptions { - enum Code { - MEMORY_OPTIONS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - EXPERIMENTAL_OOM_MORE_EAGERLY_THRESHOLD_INVALID_VALUE = 1 - [(metadata) = { exit_code: 2 }]; - EXPERIMENTAL_OOM_MORE_EAGERLY_NO_TENURED_COLLECTORS_FOUND = 2 - [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message Query { - enum Code { - QUERY_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - QUERY_FILE_WITH_COMMAND_LINE_EXPRESSION = 1 [(metadata) = { exit_code: 2 }]; - QUERY_FILE_READ_FAILURE = 2 [(metadata) = { exit_code: 2 }]; - COMMAND_LINE_EXPRESSION_MISSING = 3 [(metadata) = { exit_code: 2 }]; - OUTPUT_FORMAT_INVALID = 4 [(metadata) = { exit_code: 2 }]; - GRAPHLESS_PREREQ_UNMET = 5 [(metadata) = { exit_code: 2 }]; - QUERY_OUTPUT_WRITE_FAILURE = 6 [(metadata) = { exit_code: 36 }]; - QUERY_STDOUT_FLUSH_FAILURE = 13 [(metadata) = { exit_code: 36 }]; - ANALYSIS_QUERY_PREREQ_UNMET = 14 [(metadata) = { exit_code: 2 }]; - QUERY_RESULTS_FLUSH_FAILURE = 15 [(metadata) = { exit_code: 36 }]; - // Deprecated - folded into SYNTAX_ERROR. - DEPRECATED_UNCLOSED_QUOTATION_EXPRESSION_ERROR = 16 - [(metadata) = { exit_code: 2 }]; - VARIABLE_NAME_INVALID = 17 [(metadata) = { exit_code: 7 }]; - VARIABLE_UNDEFINED = 18 [(metadata) = { exit_code: 7 }]; - BUILDFILES_AND_LOADFILES_CANNOT_USE_OUTPUT_LOCATION_ERROR = 19 - [(metadata) = { exit_code: 2 }]; - BUILD_FILE_ERROR = 20 [(metadata) = { exit_code: 7 }]; - CYCLE = 21 [(metadata) = { exit_code: 7 }]; - UNIQUE_SKYKEY_THRESHOLD_EXCEEDED = 22 [(metadata) = { exit_code: 7 }]; - TARGET_NOT_IN_UNIVERSE_SCOPE = 23 [(metadata) = { exit_code: 2 }]; - INVALID_FULL_UNIVERSE_EXPRESSION = 24 [(metadata) = { exit_code: 7 }]; - UNIVERSE_SCOPE_LIMIT_EXCEEDED = 25 [(metadata) = { exit_code: 7 }]; - INVALIDATION_LIMIT_EXCEEDED = 26 [(metadata) = { exit_code: 7 }]; - OUTPUT_FORMAT_PREREQ_UNMET = 27 [(metadata) = { exit_code: 2 }]; - ARGUMENTS_MISSING = 28 [(metadata) = { exit_code: 7 }]; - RBUILDFILES_FUNCTION_REQUIRES_SKYQUERY = 29 [(metadata) = { exit_code: 7 }]; - FULL_TARGETS_NOT_SUPPORTED = 30 [(metadata) = { exit_code: 7 }]; - // Deprecated - folded into SYNTAX_ERROR. - DEPRECATED_UNEXPECTED_TOKEN_ERROR = 31 [(metadata) = { exit_code: 2 }]; - // Deprecated - folded into SYNTAX_ERROR. - DEPRECATED_INTEGER_LITERAL_MISSING = 32 [(metadata) = { exit_code: 2 }]; - // Deprecated - folded into SYNTAX_ERROR. - DEPRECATED_INVALID_STARTING_CHARACTER_ERROR = 33 - [(metadata) = { exit_code: 2 }]; - // Deprecated - folded into SYNTAX_ERROR. - DEPRECATED_PREMATURE_END_OF_INPUT_ERROR = 34 - [(metadata) = { exit_code: 2 }]; - // Indicates the user specified invalid query syntax. - SYNTAX_ERROR = 35 [(metadata) = { exit_code: 2 }]; - OUTPUT_FORMATTER_IO_EXCEPTION = 36 [(metadata) = { exit_code: 36 }]; - SKYQUERY_TRANSITIVE_TARGET_ERROR = 37 [(metadata) = { exit_code: 7 }]; - SKYQUERY_TARGET_EXCEPTION = 38 [(metadata) = { exit_code: 7 }]; - INVALID_LABEL_IN_TEST_SUITE = 39 [(metadata) = { exit_code: 7 }]; - // Indicates any usage of flags that must not be combined. - ILLEGAL_FLAG_COMBINATION = 40 [(metadata) = { exit_code: 2 }]; - - reserved 7 to 12; // For internal use - } - - Code code = 1; -} - -message LocalExecution { - enum Code { - LOCAL_EXECUTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - LOCKFREE_OUTPUT_PREREQ_UNMET = 1 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message ActionCache { - enum Code { - ACTION_CACHE_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INITIALIZATION_FAILURE = 1 [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} - -message FetchCommand { - enum Code { - FETCH_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - EXPRESSION_MISSING = 1 [(metadata) = { exit_code: 2 }]; - OPTIONS_INVALID = 2 [(metadata) = { exit_code: 2 }]; - QUERY_PARSE_ERROR = 3 [(metadata) = { exit_code: 2 }]; - QUERY_EVALUATION_ERROR = 4 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message SyncCommand { - enum Code { - SYNC_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - PACKAGE_LOOKUP_ERROR = 1 [(metadata) = { exit_code: 7 }]; - WORKSPACE_EVALUATION_ERROR = 2 [(metadata) = { exit_code: 7 }]; - REPOSITORY_FETCH_ERRORS = 3 [(metadata) = { exit_code: 7 }]; - REPOSITORY_NAME_INVALID = 4 [(metadata) = { exit_code: 7 }]; - } - - Code code = 1; -} - -message Sandbox { - enum Code { - SANDBOX_FAILURE_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INITIALIZATION_FAILURE = 1 [(metadata) = { exit_code: 36 }]; - EXECUTION_IO_EXCEPTION = 2 [(metadata) = { exit_code: 36 }]; - DOCKER_COMMAND_FAILURE = 3 [(metadata) = { exit_code: 1 }]; - NO_DOCKER_IMAGE = 4 [(metadata) = { exit_code: 1 }]; - DOCKER_IMAGE_PREPARATION_FAILURE = 5 [(metadata) = { exit_code: 1 }]; - BIND_MOUNT_ANALYSIS_FAILURE = 6 [(metadata) = { exit_code: 1 }]; - MOUNT_SOURCE_DOES_NOT_EXIST = 7 [(metadata) = { exit_code: 1 }]; - MOUNT_SOURCE_TARGET_TYPE_MISMATCH = 8 [(metadata) = { exit_code: 1 }]; - MOUNT_TARGET_DOES_NOT_EXIST = 9 [(metadata) = { exit_code: 1 }]; - SUBPROCESS_START_FAILED = 10 [(metadata) = { exit_code: 36 }]; - FORBIDDEN_INPUT = 11 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message IncludeScanning { - enum Code { - INCLUDE_SCANNING_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INITIALIZE_INCLUDE_HINTS_ERROR = 1 [(metadata) = { exit_code: 36 }]; - SCANNING_IO_EXCEPTION = 2 [(metadata) = { exit_code: 36 }]; - INCLUDE_HINTS_FILE_NOT_IN_PACKAGE = 3 [(metadata) = { exit_code: 36 }]; - INCLUDE_HINTS_READ_FAILURE = 4 [(metadata) = { exit_code: 36 }]; - ILLEGAL_ABSOLUTE_PATH = 5 [(metadata) = { exit_code: 1 }]; - // TODO(b/166268889): this code should be deprecated in favor of more finely - // resolved loading-phase codes. - PACKAGE_LOAD_FAILURE = 6 [(metadata) = { exit_code: 1 }]; - USER_PACKAGE_LOAD_FAILURE = 7 [(metadata) = { exit_code: 1 }]; - SYSTEM_PACKAGE_LOAD_FAILURE = 8 [(metadata) = { exit_code: 36 }]; - UNDIFFERENTIATED_PACKAGE_LOAD_FAILURE = 9 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; - PackageLoading.Code package_loading_code = 2; -} - -message TestCommand { - enum Code { - TEST_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NO_TEST_TARGETS = 1 [(metadata) = { exit_code: 4 }]; - TEST_WITH_NOANALYZE = 2 [(metadata) = { exit_code: 1 }]; - TESTS_FAILED = 3 [(metadata) = { exit_code: 3 }]; - } - - Code code = 1; -} - -message ActionQuery { - // All numerical exit code associations correspond to pre-existing Bazel - // behavior. These associations are suspicious: - // - COMMAND_LINE_EXPANSION_FAILURE: this is associated with 2, the numerical - // exit code for "bad Bazel command line", but is generated when an - // action's command line fails to expand, which sounds similar but is - // completely different. - // - OUTPUT_FAILURE: this is associated with 6, an undocumented exit code. - // - INVALID_AQUERY_EXPRESSION: this is associate with 1, which is not - // documented for (a)query. - // TODO(b/138456686): Revise these after the (intentionally non-breaking) - // initial rollout of FailureDetail-based encoding. - enum Code { - ACTION_QUERY_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - COMMAND_LINE_EXPANSION_FAILURE = 1 [(metadata) = { exit_code: 2 }]; - OUTPUT_FAILURE = 2 [(metadata) = { exit_code: 6 }]; - COMMAND_LINE_EXPRESSION_MISSING = 3 [(metadata) = { exit_code: 2 }]; - EXPRESSION_PARSE_FAILURE = 4 [(metadata) = { exit_code: 2 }]; - SKYFRAME_STATE_WITH_COMMAND_LINE_EXPRESSION = 5 - [(metadata) = { exit_code: 2 }]; - INVALID_AQUERY_EXPRESSION = 6 [(metadata) = { exit_code: 1 }]; - SKYFRAME_STATE_PREREQ_UNMET = 7 [(metadata) = { exit_code: 2 }]; - AQUERY_OUTPUT_TOO_BIG = 8 [(metadata) = { exit_code: 7 }]; - ILLEGAL_PATTERN_SYNTAX = 9 [(metadata) = { exit_code: 2 }]; - INCORRECT_ARGUMENTS = 10 [(metadata) = { exit_code: 2 }]; - TOP_LEVEL_TARGETS_WITH_SKYFRAME_STATE_NOT_SUPPORTED = 11 - [(metadata) = { exit_code: 2 }]; - SKYFRAME_STATE_AFTER_EXECUTION = 12 [(metadata) = { exit_code: 1 }]; - LABELS_FUNCTION_NOT_SUPPORTED = 13 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message TargetPatterns { - enum Code { - TARGET_PATTERNS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - TARGET_PATTERN_FILE_WITH_COMMAND_LINE_PATTERN = 1 - [(metadata) = { exit_code: 2 }]; - TARGET_PATTERN_FILE_READ_FAILURE = 2 [(metadata) = { exit_code: 2 }]; - TARGET_PATTERN_PARSE_FAILURE = 3 [(metadata) = { exit_code: 1 }]; - PACKAGE_NOT_FOUND = 4 [(metadata) = { exit_code: 1 }]; - TARGET_FORMAT_INVALID = 5 [(metadata) = { exit_code: 1 }]; - ABSOLUTE_TARGET_PATTERN_INVALID = 6 [(metadata) = { exit_code: 1 }]; - CANNOT_DETERMINE_TARGET_FROM_FILENAME = 7 [(metadata) = { exit_code: 1 }]; - LABEL_SYNTAX_ERROR = 8 [(metadata) = { exit_code: 1 }]; - TARGET_CANNOT_BE_EMPTY_STRING = 9 [(metadata) = { exit_code: 1 }]; - PACKAGE_PART_CANNOT_END_IN_SLASH = 10 [(metadata) = { exit_code: 1 }]; - CYCLE = 11 [(metadata) = { exit_code: 1 }]; - CANNOT_PRELOAD_TARGET = 12 [(metadata) = { exit_code: 1 }]; - TARGETS_MISSING = 13 [(metadata) = { exit_code: 1 }]; - RECURSIVE_TARGET_PATTERNS_NOT_ALLOWED = 14 [(metadata) = { exit_code: 1 }]; - UP_LEVEL_REFERENCES_NOT_ALLOWED = 15 [(metadata) = { exit_code: 1 }]; - NEGATIVE_TARGET_PATTERN_NOT_ALLOWED = 16 [(metadata) = { exit_code: 1 }]; - TARGET_MUST_BE_A_FILE = 17 [(metadata) = { exit_code: 1 }]; - DEPENDENCY_NOT_FOUND = 18 [(metadata) = { exit_code: 1 }]; - PACKAGE_NAME_INVALID = 19 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message CleanCommand { - enum Code { - CLEAN_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - OUTPUT_SERVICE_CLEAN_FAILURE = 1 [(metadata) = { exit_code: 6 }]; - ACTION_CACHE_CLEAN_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - OUT_ERR_CLOSE_FAILURE = 3 [(metadata) = { exit_code: 36 }]; - OUTPUT_BASE_DELETE_FAILURE = 4 [(metadata) = { exit_code: 36 }]; - OUTPUT_BASE_TEMP_MOVE_FAILURE = 5 [(metadata) = { exit_code: 36 }]; - ASYNC_OUTPUT_BASE_DELETE_FAILURE = 6 [(metadata) = { exit_code: 6 }]; - EXECROOT_DELETE_FAILURE = 7 [(metadata) = { exit_code: 36 }]; - EXECROOT_TEMP_MOVE_FAILURE = 8 [(metadata) = { exit_code: 36 }]; - ASYNC_EXECROOT_DELETE_FAILURE = 9 [(metadata) = { exit_code: 6 }]; - ARGUMENTS_NOT_RECOGNIZED = 10 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message ConfigCommand { - enum Code { - CONFIG_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - TOO_MANY_CONFIG_IDS = 1 [(metadata) = { exit_code: 2 }]; - CONFIGURATION_NOT_FOUND = 2 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message ConfigurableQuery { - enum Code { - CONFIGURABLE_QUERY_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - COMMAND_LINE_EXPRESSION_MISSING = 1 [(metadata) = { exit_code: 2 }]; - EXPRESSION_PARSE_FAILURE = 2 [(metadata) = { exit_code: 2 }]; - FILTERS_NOT_SUPPORTED = 3 [(metadata) = { exit_code: 2 }]; - BUILDFILES_FUNCTION_NOT_SUPPORTED = 4 [(metadata) = { exit_code: 2 }]; - SIBLINGS_FUNCTION_NOT_SUPPORTED = 5 [(metadata) = { exit_code: 2 }]; - VISIBLE_FUNCTION_NOT_SUPPORTED = 6 [(metadata) = { exit_code: 2 }]; - ATTRIBUTE_MISSING = 7 [(metadata) = { exit_code: 2 }]; - INCORRECT_CONFIG_ARGUMENT_ERROR = 8 [(metadata) = { exit_code: 2 }]; - TARGET_MISSING = 9 [(metadata) = { exit_code: 2 }]; - STARLARK_SYNTAX_ERROR = 10 [(metadata) = { exit_code: 2 }]; - STARLARK_EVAL_ERROR = 11 [(metadata) = { exit_code: 2 }]; - // Indicates failure to correctly define a format function - FORMAT_FUNCTION_ERROR = 12 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message DumpCommand { - enum Code { - DUMP_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NO_OUTPUT_SPECIFIED = 1 [(metadata) = { exit_code: 7 }]; - ACTION_CACHE_DUMP_FAILED = 2 [(metadata) = { exit_code: 7 }]; - COMMAND_LINE_EXPANSION_FAILURE = 3 [(metadata) = { exit_code: 7 }]; - ACTION_GRAPH_DUMP_FAILED = 4 [(metadata) = { exit_code: 7 }]; - STARLARK_HEAP_DUMP_FAILED = 5 [(metadata) = { exit_code: 8 }]; - reserved 6; // For internal use - } - - Code code = 1; -} - -message HelpCommand { - enum Code { - HELP_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - MISSING_ARGUMENT = 1 [(metadata) = { exit_code: 2 }]; - COMMAND_NOT_FOUND = 2 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message MobileInstall { - enum Code { - MOBILE_INSTALL_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - CLASSIC_UNSUPPORTED = 1 [(metadata) = { exit_code: 2 }]; - NO_TARGET_SPECIFIED = 2 [(metadata) = { exit_code: 2 }]; - MULTIPLE_TARGETS_SPECIFIED = 3 [(metadata) = { exit_code: 2 }]; - TARGET_TYPE_INVALID = 4 [(metadata) = { exit_code: 6 }]; - NON_ZERO_EXIT = 5 [(metadata) = { exit_code: 6 }]; - ERROR_RUNNING_PROGRAM = 6 [(metadata) = { exit_code: 6 }]; - } - - Code code = 1; -} - -message ProfileCommand { - enum Code { - PROFILE_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - OLD_BINARY_FORMAT_UNSUPPORTED = 1 [(metadata) = { exit_code: 1 }]; - FILE_READ_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message RunCommand { - enum Code { - RUN_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NO_TARGET_SPECIFIED = 1 [(metadata) = { exit_code: 2 }]; - TOO_MANY_TARGETS_SPECIFIED = 2 [(metadata) = { exit_code: 2 }]; - TARGET_NOT_EXECUTABLE = 3 [(metadata) = { exit_code: 2 }]; - TARGET_BUILT_BUT_PATH_NOT_EXECUTABLE = 4 [(metadata) = { exit_code: 1 }]; - TARGET_BUILT_BUT_PATH_VALIDATION_FAILED = 5 - [(metadata) = { exit_code: 36 }]; - RUN_UNDER_TARGET_NOT_BUILT = 6 [(metadata) = { exit_code: 2 }]; - RUN_PREREQ_UNMET = 7 [(metadata) = { exit_code: 2 }]; - TOO_MANY_TEST_SHARDS_OR_RUNS = 8 [(metadata) = { exit_code: 2 }]; - TEST_ENVIRONMENT_SETUP_FAILURE = 9 [(metadata) = { exit_code: 36 }]; - COMMAND_LINE_EXPANSION_FAILURE = 10 [(metadata) = { exit_code: 36 }]; - NO_SHELL_SPECIFIED = 11 [(metadata) = { exit_code: 2 }]; - SCRIPT_WRITE_FAILURE = 12 [(metadata) = { exit_code: 6 }]; - RUNFILES_DIRECTORIES_CREATION_FAILURE = 13 [(metadata) = { exit_code: 36 }]; - RUNFILES_SYMLINKS_CREATION_FAILURE = 14 [(metadata) = { exit_code: 36 }]; - TEST_ENVIRONMENT_SETUP_INTERRUPTED = 15 [(metadata) = { exit_code: 8 }]; - } - - Code code = 1; -} - -message VersionCommand { - enum Code { - VERSION_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NOT_AVAILABLE = 1 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message PrintActionCommand { - enum Code { - PRINT_ACTION_COMMAND_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - TARGET_NOT_FOUND = 1 [(metadata) = { exit_code: 1 }]; - COMMAND_LINE_EXPANSION_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - TARGET_KIND_UNSUPPORTED = 3 [(metadata) = { exit_code: 1 }]; - ACTIONS_NOT_FOUND = 4 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message WorkspaceStatus { - enum Code { - WORKSPACE_STATUS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NON_ZERO_EXIT = 1 [(metadata) = { exit_code: 1 }]; - ABNORMAL_TERMINATION = 2 [(metadata) = { exit_code: 1 }]; - EXEC_FAILED = 3 [(metadata) = { exit_code: 1 }]; - PARSE_FAILURE = 4 [(metadata) = { exit_code: 36 }]; - VALIDATION_FAILURE = 5 [(metadata) = { exit_code: 1 }]; - CONTENT_UPDATE_IO_EXCEPTION = 6 [(metadata) = { exit_code: 1 }]; - STDERR_IO_EXCEPTION = 7 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message JavaCompile { - enum Code { - JAVA_COMPILE_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - REDUCED_CLASSPATH_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - COMMAND_LINE_EXPANSION_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - JDEPS_READ_IO_EXCEPTION = 3 [(metadata) = { exit_code: 36 }]; - REDUCED_CLASSPATH_FALLBACK_CLEANUP_FAILURE = 4 - [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} - -message ActionRewinding { - enum Code { - ACTION_REWINDING_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - LOST_INPUT_TOO_MANY_TIMES = 1 [(metadata) = { exit_code: 1 }]; - LOST_INPUT_IS_SOURCE = 2 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message CppCompile { - enum Code { - CPP_COMPILE_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - FIND_USED_HEADERS_IO_EXCEPTION = 1 [(metadata) = { exit_code: 36 }]; - COPY_OUT_ERR_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - D_FILE_READ_FAILURE = 3 [(metadata) = { exit_code: 36 }]; - COMMAND_GENERATION_FAILURE = 4 [(metadata) = { exit_code: 1 }]; - MODULE_EXPANSION_TIMEOUT = 5 [(metadata) = { exit_code: 1 }]; - INCLUDE_PATH_OUTSIDE_EXEC_ROOT = 6 [(metadata) = { exit_code: 1 }]; - FAKE_COMMAND_GENERATION_FAILURE = 7 [(metadata) = { exit_code: 1 }]; - UNDECLARED_INCLUSIONS = 8 [(metadata) = { exit_code: 1 }]; - D_FILE_PARSE_FAILURE = 9 [(metadata) = { exit_code: 1 }]; - COVERAGE_NOTES_CREATION_FAILURE = 10 [(metadata) = { exit_code: 1 }]; - MODULE_EXPANSION_MISSING_DATA = 11 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message StarlarkAction { - enum Code { - STARLARK_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - UNUSED_INPUT_LIST_READ_FAILURE = 1 [(metadata) = { exit_code: 36 }]; - UNUSED_INPUT_LIST_FILE_NOT_FOUND = 2 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message NinjaAction { - enum Code { - NINJA_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INVALID_DEPFILE_DECLARED_DEPENDENCY = 1 [(metadata) = { exit_code: 36 }]; - D_FILE_PARSE_FAILURE = 2 [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} - -message DynamicExecution { - enum Code { - DYNAMIC_EXECUTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - XCODE_RELATED_PREREQ_UNMET = 1 [(metadata) = { exit_code: 36 }]; - ACTION_LOG_MOVE_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - RUN_FAILURE = 3 [(metadata) = { exit_code: 1 }]; - NO_USABLE_STRATEGY_FOUND = 4 [(metadata) = { exit_code: 2 }]; - } - - Code code = 1; -} - -message FailAction { - enum Code { - FAIL_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INTENTIONAL_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - INCORRECT_PYTHON_VERSION = 2 [(metadata) = { exit_code: 1 }]; - PROGUARD_SPECS_MISSING = 3 [(metadata) = { exit_code: 1 }]; - DYNAMIC_LINKING_NOT_SUPPORTED = 4 [(metadata) = { exit_code: 1 }]; - SOURCE_FILES_MISSING = 5 [(metadata) = { exit_code: 1 }]; - INCORRECT_TOOLCHAIN = 6 [(metadata) = { exit_code: 1 }]; - FRAGMENT_CLASS_MISSING = 7 [(metadata) = { exit_code: 1 }]; - reserved 8, 9; // For internal use - CANT_BUILD_INCOMPATIBLE_TARGET = 10 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message SymlinkAction { - enum Code { - SYMLINK_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - EXECUTABLE_INPUT_NOT_FILE = 1 [(metadata) = { exit_code: 1 }]; - EXECUTABLE_INPUT_IS_NOT = 2 [(metadata) = { exit_code: 1 }]; - EXECUTABLE_INPUT_CHECK_IO_EXCEPTION = 3 [(metadata) = { exit_code: 1 }]; - LINK_CREATION_IO_EXCEPTION = 4 [(metadata) = { exit_code: 1 }]; - LINK_TOUCH_IO_EXCEPTION = 5 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message CppLink { - enum Code { - CPP_LINK_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - COMMAND_GENERATION_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - FAKE_COMMAND_GENERATION_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message LtoAction { - enum Code { - LTO_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - INVALID_ABSOLUTE_PATH_IN_IMPORTS = 1 [(metadata) = { exit_code: 1 }]; - MISSING_BITCODE_FILES = 2 [(metadata) = { exit_code: 1 }]; - IMPORTS_READ_IO_EXCEPTION = 3 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message TestAction { - enum Code { - TEST_ACTION_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - NO_KEEP_GOING_TEST_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - LOCAL_TEST_PREREQ_UNMET = 2 [(metadata) = { exit_code: 1 }]; - COMMAND_LINE_EXPANSION_FAILURE = 3 [(metadata) = { exit_code: 1 }]; - DUPLICATE_CPU_TAGS = 4 [(metadata) = { exit_code: 1 }]; - INVALID_CPU_TAG = 5 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message Worker { - enum Code { - WORKER_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - MULTIPLEXER_INSTANCE_REMOVAL_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - MULTIPLEXER_DOES_NOT_EXIST = 2 [(metadata) = { exit_code: 1 }]; - NO_TOOLS = 3 [(metadata) = { exit_code: 1 }]; - NO_FLAGFILE = 4 [(metadata) = { exit_code: 1 }]; - VIRTUAL_INPUT_MATERIALIZATION_FAILURE = 5 [(metadata) = { exit_code: 1 }]; - BORROW_FAILURE = 6 [(metadata) = { exit_code: 1 }]; - PREFETCH_FAILURE = 7 [(metadata) = { exit_code: 36 }]; - PREPARE_FAILURE = 8 [(metadata) = { exit_code: 1 }]; - REQUEST_FAILURE = 9 [(metadata) = { exit_code: 1 }]; - PARSE_RESPONSE_FAILURE = 10 [(metadata) = { exit_code: 1 }]; - NO_RESPONSE = 11 [(metadata) = { exit_code: 1 }]; - FINISH_FAILURE = 12 [(metadata) = { exit_code: 1 }]; - FORBIDDEN_INPUT = 13 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message Analysis { - enum Code { - ANALYSIS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - LOAD_FAILURE = 1 [(metadata) = { exit_code: 1 }]; - // TODO(b/138456686): this code should be deprecated in favor of more finely - // resolved loading-phase codes. - GENERIC_LOADING_PHASE_FAILURE = 2 [(metadata) = { exit_code: 1 }]; - NOT_ALL_TARGETS_ANALYZED = 3 [(metadata) = { exit_code: 1 }]; - CYCLE = 4 [(metadata) = { exit_code: 1 }]; - PARAMETERIZED_TOP_LEVEL_ASPECT_INVALID = 5 [(metadata) = { exit_code: 1 }]; - ASPECT_LABEL_SYNTAX_ERROR = 6 [(metadata) = { exit_code: 1 }]; - ASPECT_PREREQ_UNMET = 7 [(metadata) = { exit_code: 1 }]; - ASPECT_NOT_FOUND = 8 [(metadata) = { exit_code: 1 }]; - ACTION_CONFLICT = 9 [(metadata) = { exit_code: 1 }]; - ARTIFACT_PREFIX_CONFLICT = 10 [(metadata) = { exit_code: 1 }]; - UNEXPECTED_ANALYSIS_EXCEPTION = 11 [(metadata) = { exit_code: 1 }]; - TARGETS_MISSING_ENVIRONMENTS = 12 [(metadata) = { exit_code: 1 }]; - INVALID_ENVIRONMENT = 13 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_MISSING_FROM_GROUPS = 14 [(metadata) = { exit_code: 1 }]; - EXEC_GROUP_MISSING = 15 [(metadata) = { exit_code: 1 }]; - INVALID_EXECUTION_PLATFORM = 16 [(metadata) = { exit_code: 1 }]; - ASPECT_CREATION_FAILED = 17 [(metadata) = { exit_code: 1 }]; - CONFIGURED_VALUE_CREATION_FAILED = 18 [(metadata) = { exit_code: 1 }]; - INCOMPATIBLE_TARGET_REQUESTED = 19 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message PackageLoading { - enum Code { - PACKAGE_LOADING_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - WORKSPACE_FILE_ERROR = 1 [(metadata) = { exit_code: 1 }]; - MAX_COMPUTATION_STEPS_EXCEEDED = 2 [(metadata) = { exit_code: 1 }]; - BUILD_FILE_MISSING = 3 [(metadata) = { exit_code: 1 }]; - REPOSITORY_MISSING = 4 [(metadata) = { exit_code: 1 }]; - PERSISTENT_INCONSISTENT_FILESYSTEM_ERROR = 5 - [(metadata) = { exit_code: 36 }]; - TRANSIENT_INCONSISTENT_FILESYSTEM_ERROR = 6 - [(metadata) = { exit_code: 36 }]; - INVALID_NAME = 7 [(metadata) = { exit_code: 1 }]; - // was: PRELUDE_FILE_READ_ERROR. Replaced by IMPORT_STARLARK_FILE_ERROR - // when the prelude was changed to be loaded as a Starlark module. - reserved 8; - EVAL_GLOBS_SYMLINK_ERROR = 9 [(metadata) = { exit_code: 1 }]; - IMPORT_STARLARK_FILE_ERROR = 10 [(metadata) = { exit_code: 1 }]; - PACKAGE_MISSING = 11 [(metadata) = { exit_code: 1 }]; - TARGET_MISSING = 12 [(metadata) = { exit_code: 1 }]; - NO_SUCH_THING = 13 [(metadata) = { exit_code: 1 }]; - GLOB_IO_EXCEPTION = 14 [(metadata) = { exit_code: 36 }]; - DUPLICATE_LABEL = 15 [(metadata) = { exit_code: 1 }]; - INVALID_PACKAGE_SPECIFICATION = 16 [(metadata) = { exit_code: 1 }]; - SYNTAX_ERROR = 17 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_IN_DIFFERENT_PACKAGE = 18 [(metadata) = { exit_code: 1 }]; - DEFAULT_ENVIRONMENT_UNDECLARED = 19 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_IN_MULTIPLE_GROUPS = 20 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_DOES_NOT_EXIST = 21 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_INVALID = 22 [(metadata) = { exit_code: 1 }]; - ENVIRONMENT_NOT_IN_GROUP = 23 [(metadata) = { exit_code: 1 }]; - PACKAGE_NAME_INVALID = 24 [(metadata) = { exit_code: 1 }]; - STARLARK_EVAL_ERROR = 25 [(metadata) = { exit_code: 1 }]; - LICENSE_PARSE_FAILURE = 26 [(metadata) = { exit_code: 1 }]; - DISTRIBUTIONS_PARSE_FAILURE = 27 [(metadata) = { exit_code: 1 }]; - LABEL_CROSSES_PACKAGE_BOUNDARY = 28 [(metadata) = { exit_code: 1 }]; - // Failure while evaluating or applying @_builtins injection. Since the - // builtins .bzl files are always packaged with Blaze in production, a - // failure here generally indicates a bug in Blaze. - BUILTINS_INJECTION_FAILURE = 29 [(metadata) = { exit_code: 1 }]; - SYMLINK_CYCLE_OR_INFINITE_EXPANSION = 30 [(metadata) = { exit_code: 1 }]; - OTHER_IO_EXCEPTION = 31 [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} - -message Toolchain { - enum Code { - TOOLCHAIN_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - MISSING_PROVIDER = 1 [(metadata) = { exit_code: 1 }]; - INVALID_CONSTRAINT_VALUE = 2 [(metadata) = { exit_code: 1 }]; - INVALID_PLATFORM_VALUE = 3 [(metadata) = { exit_code: 1 }]; - INVALID_TOOLCHAIN = 4 [(metadata) = { exit_code: 1 }]; - NO_MATCHING_EXECUTION_PLATFORM = 5 [(metadata) = { exit_code: 1 }]; - NO_MATCHING_TOOLCHAIN = 6 [(metadata) = { exit_code: 1 }]; - INVALID_TOOLCHAIN_TYPE = 7 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message StarlarkLoading { - enum Code { - STARLARK_LOADING_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - CYCLE = 1 [(metadata) = { exit_code: 1 }]; - COMPILE_ERROR = 2 [(metadata) = { exit_code: 1 }]; - PARSE_ERROR = 3 [(metadata) = { exit_code: 1 }]; - EVAL_ERROR = 4 [(metadata) = { exit_code: 1 }]; - CONTAINING_PACKAGE_NOT_FOUND = 5 [(metadata) = { exit_code: 1 }]; - PACKAGE_NOT_FOUND = 6 [(metadata) = { exit_code: 1 }]; - IO_ERROR = 7 [(metadata) = { exit_code: 1 }]; - LABEL_CROSSES_PACKAGE_BOUNDARY = 8 [(metadata) = { exit_code: 1 }]; - BUILTINS_ERROR = 9 [(metadata) = { exit_code: 1 }]; - } - - Code code = 1; -} - -message ExternalDeps { - enum Code { - EXTERNAL_DEPS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - MODULE_NOT_FOUND = 1 [(metadata) = { exit_code: 48 }]; - BAD_MODULE = 2 [(metadata) = { exit_code: 48 }]; - VERSION_RESOLUTION_ERROR = 3 [(metadata) = { exit_code: 48 }]; - INVALID_REGISTRY_URL = 4 [(metadata) = { exit_code: 48 }]; - ERROR_ACCESSING_REGISTRY = 5 [(metadata) = { exit_code: 32 }]; - } - - Code code = 1; -} - -message DiffAwareness { - enum Code { - DIFF_AWARENESS_UNKNOWN = 0 [(metadata) = { exit_code: 37 }]; - DIFF_STAT_FAILED = 1 [(metadata) = { exit_code: 36 }]; - } - - Code code = 1; -} diff --git a/Examples/BazelXCBBuildService/BEP/invocation_policy.proto b/Examples/BazelXCBBuildService/BEP/invocation_policy.proto deleted file mode 100644 index 599b955..0000000 --- a/Examples/BazelXCBBuildService/BEP/invocation_policy.proto +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2015 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; -package blaze.invocation_policy; - -option go_package = "invocation_policy"; -// option java_api_version = 2; -option java_package = "com.google.devtools.build.lib.runtime.proto"; - -// The --invocation_policy flag takes a base64-encoded binary-serialized or text -// formatted InvocationPolicy message. -message InvocationPolicy { - // Order matters. - // After expanding policies on expansion flags or flags with implicit - // requirements, only the final policy on a specific flag will be enforced - // onto the user's command line. - repeated FlagPolicy flag_policies = 1; -} - -// A policy for controlling the value of a flag. -message FlagPolicy { - // The name of the flag to enforce this policy on. - // - // Note that this should be the full name of the flag, not the abbreviated - // name of the flag. If the user specifies the abbreviated name of a flag, - // that flag will be matched using its full name. - // - // The "no" prefix will not be parsed, so for boolean flags, use - // the flag's full name and explicitly set it to true or false. - optional string flag_name = 1; - - // If set, this flag policy is applied only if one of the given commands or a - // command that inherits from one of the given commands is being run. For - // instance, if "build" is one of the commands here, then this policy will - // apply to any command that inherits from build, such as info, coverage, or - // test. If empty, this flag policy is applied for all commands. This allows - // the policy setter to add all policies to the proto without having to - // determine which Bazel command the user is actually running. Additionally, - // Bazel allows multiple flags to be defined by the same name, and the - // specific flag definition is determined by the command. - repeated string commands = 2; - - oneof operation { - SetValue set_value = 3; - UseDefault use_default = 4; - DisallowValues disallow_values = 5; - AllowValues allow_values = 6; - } -} - -message SetValue { - // Use this value for the specified flag, overriding any default or user-set - // value (unless append is set to true for repeatable flags). - // - // This field is repeated for repeatable flags. It is an error to set - // multiple values for a flag that is not actually a repeatable flag. - // This requires at least 1 value, if even the empty string. - // - // If the flag allows multiple values, all of its values are replaced with the - // value or values from the policy (i.e., no diffing or merging is performed), - // unless the append field (see below) is set to true. - // - // Note that some flags are tricky. For example, some flags look like boolean - // flags, but are actually Void expansion flags that expand into other flags. - // The Bazel flag parser will accept "--void_flag=false", but because - // the flag is Void, the "=false" is ignored. It can get even trickier, like - // "--novoid_flag" which is also an expansion flag with the type Void whose - // name is explicitly "novoid_flag" and which expands into other flags that - // are the opposite of "--void_flag". For expansion flags, it's best to - // explicitly override the flags they expand into. - // - // Other flags may be differently tricky: A flag could have a converter that - // converts some string to a list of values, but that flag may not itself have - // allowMultiple set to true. - // - // An example is "--test_tag_filters": this flag sets its converter to - // CommaSeparatedOptionListConverter, but does not set allowMultiple to true. - // So "--test_tag_filters=foo,bar" results in ["foo", "bar"], however - // "--test_tag_filters=foo --test_tag_filters=bar" results in just ["bar"] - // since the 2nd value overrides the 1st. - // - // Similarly, "--test_tag_filters=foo,bar --test_tag_filters=baz,qux" results - // in ["baz", "qux"]. For flags like these, the policy should specify - // "foo,bar" instead of separately specifying "foo" and "bar" so that the - // converter is appropriately invoked. - // - // Note that the opposite is not necessarily - // true: for a flag that specifies allowMultiple=true, "--flag=foo,bar" - // may fail to parse or result in an unexpected value. - repeated string flag_value = 1; - - // Whether to allow this policy to be overridden by user-specified values. - // When set, if the user specified a value for this flag, use the value - // from the user, otherwise use the value specified in this policy. - optional bool overridable = 2; - - // If true, and if the flag named in the policy is a repeatable flag, then - // the values listed in flag_value do not replace all the user-set or default - // values of the flag, but instead append to them. If the flag is not - // repeatable, then this has no effect. - optional bool append = 3; -} - -message UseDefault { - // Use the default value of the flag, as defined by Bazel (or equivalently, do - // not allow the user to set this flag). - // - // Note on implementation: UseDefault sets the default by clearing the flag, - // so that when the value is requested and no flag is found, the flag parser - // returns the default. This is mostly relevant for expansion flags: it will - // erase user values in *all* flags that the expansion flag expands to. Only - // use this on expansion flags if this is acceptable behavior. Since the last - // policy wins, later policies on this same flag will still remove the - // expanded UseDefault, so there is a way around, but it's really best not to - // use this on expansion flags at all. -} - -message DisallowValues { - // Obsolete new_default_value field. - reserved 2; - - // It is an error for the user to use any of these values (that is, the Bazel - // command will fail), unless new_value or use_default is set. - // - // For repeatable flags, if any one of the values in the flag matches a value - // in the list of disallowed values, an error is thrown. - // - // Care must be taken for flags with complicated converters. For example, - // it's possible for a repeated flag to be of type List>, so that - // "--foo=a,b --foo=c,d" results in foo=[["a","b"], ["c", "d"]]. In this case, - // it is not possible to disallow just "b", nor will ["b", "a"] match, nor - // will ["b", "c"] (but ["a", "b"] will still match). - repeated string disallowed_values = 1; - - oneof replacement_value { - // If set and if the value of the flag is disallowed (including the default - // value of the flag if the user doesn't specify a value), use this value as - // the value of the flag instead of raising an error. This does not apply to - // repeatable flags and is ignored if the flag is a repeatable flag. - string new_value = 3; - - // If set and if the value of the flag is disallowed, use the default value - // of the flag instead of raising an error. Unlike new_value, this works for - // repeatable flags, but note that the default value for repeatable flags is - // always empty. - // - // Note that it is an error to disallow the default value of the flag and - // to set use_default, unless the flag is a repeatable flag where the - // default value is always the empty list. - UseDefault use_default = 4; - } -} - -message AllowValues { - // Obsolete new_default_value field. - reserved 2; - - // It is an error for the user to use any value not in this list, unless - // new_value or use_default is set. - repeated string allowed_values = 1; - - oneof replacement_value { - // If set and if the value of the flag is disallowed (including the default - // value of the flag if the user doesn't specify a value), use this value as - // the value of the flag instead of raising an error. This does not apply to - // repeatable flags and is ignored if the flag is a repeatable flag. - string new_value = 3; - - // If set and if the value of the flag is disallowed, use the default value - // of the flag instead of raising an error. Unlike new_value, this works for - // repeatable flags, but note that the default value for repeatable flags is - // always empty. - // - // Note that it is an error to disallow the default value of the flag and - // to set use_default, unless the flag is a repeatable flag where the - // default value is always the empty list. - UseDefault use_default = 4; - } -} diff --git a/Examples/BazelXCBBuildService/BEP/option_filters.proto b/Examples/BazelXCBBuildService/BEP/option_filters.proto deleted file mode 100644 index e3edf7a..0000000 --- a/Examples/BazelXCBBuildService/BEP/option_filters.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2017 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -syntax = "proto3"; -package options; - -option go_package = "option_filters"; -// option java_api_version = 2; -option java_package = "com.google.devtools.common.options.proto"; - -// IMPORTANT NOTE: These two enums must be kept in sync with their Java -// equivalents in src/main/java/com/google/devtools/common/options. -// Changing this proto has specific compatibility requirements, please see the -// Java documentation for details. - -// Docs in java enum. -enum OptionEffectTag { - // This option's effect or intent is unknown. - UNKNOWN = 0; - - // This flag has literally no effect. - NO_OP = 1; - - LOSES_INCREMENTAL_STATE = 2; - CHANGES_INPUTS = 3; - AFFECTS_OUTPUTS = 4; - BUILD_FILE_SEMANTICS = 5; - BAZEL_INTERNAL_CONFIGURATION = 6; - LOADING_AND_ANALYSIS = 7; - EXECUTION = 8; - HOST_MACHINE_RESOURCE_OPTIMIZATIONS = 9; - EAGERNESS_TO_EXIT = 10; - BAZEL_MONITORING = 11; - TERMINAL_OUTPUT = 12; - ACTION_COMMAND_LINES = 13; - TEST_RUNNER = 14; -} - -// Docs in java enum. -enum OptionMetadataTag { - EXPERIMENTAL = 0; - INCOMPATIBLE_CHANGE = 1; - DEPRECATED = 2; - HIDDEN = 3; - INTERNAL = 4; - TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES = 5; -} diff --git a/Examples/BazelXCBBuildService/BUILD b/Examples/BazelXCBBuildService/BUILD deleted file mode 100644 index 5e8d281..0000000 --- a/Examples/BazelXCBBuildService/BUILD +++ /dev/null @@ -1,61 +0,0 @@ -load( - "@build_bazel_rules_apple//apple:macos.bzl", - "macos_command_line_application", -) -load( - "@build_bazel_rules_swift//swift:swift.bzl", - "swift_library", -) -load( - "@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:xcodeproj.bzl", - "xcodeproj", -) - -swift_library( - name = "BazelXCBBuildService.library", - module_name = "BazelXCBBuildService", - srcs = glob(["Sources/**/*.swift"]), - deps = [ - "//BazelXCBBuildService/BEP", - "@com_github_apple_swift_log//:Logging", - "@com_github_apple_swift_nio//:NIO", - "@com_github_mobilenativefoundation_xcbbuildserviceproxykit//:XCBBuildServiceProxyKit", - "@com_github_mobilenativefoundation_xcbbuildserviceproxykit//:XCBProtocol", - "@com_github_mobilenativefoundation_xcbbuildserviceproxykit//:XCBProtocol_12_0", - ], -) - -macos_command_line_application( - name = "BazelXCBBuildService", - minimum_os_version = "11.0", - deps = [":BazelXCBBuildService.library"], -) - -xcodeproj( - name = "xcodeproj", - project_name = "BazelXCBuildService", - targets = [ - ":BazelXCBBuildService", - ], - tags = ["manual"], -) - -sh_test( - name = "BazelXCBBuildServiceIntegrationTests", - size = "small", - srcs = ["integration_tests.sh"], - data = [ - ":BazelXCBBuildService", - ], - deps = ["@bazel_tools//tools/bash/runfiles"], -) - -sh_test( - name = "write_shim_tests", - size = "small", - srcs = ["write_shim_tests.sh"], - data = [ - "write_shim.sh", - ], - deps = ["@bazel_tools//tools/bash/runfiles"], -) diff --git a/Examples/BazelXCBBuildService/Sources/BazelBuild.swift b/Examples/BazelXCBBuildService/Sources/BazelBuild.swift deleted file mode 100644 index 1ff01e4..0000000 --- a/Examples/BazelXCBBuildService/Sources/BazelBuild.swift +++ /dev/null @@ -1,979 +0,0 @@ -import Foundation -import XCBBuildServiceProxyKit -import XCBProtocol - -// swiftformat:disable braces - -final class BazelBuild { - static let standardArchitectures = ["arm64"] - - struct Target { - let name: String - let xcodeGUID: String - let project: Project - let productTypeIdentifier: String? - let buildConfigurations: [String: [String: BuildSetting]] - var parameters: BuildParameters? - } - - // Value semantics, but class because of massive reuse with `Target`. - final class Project { - let name: String - let path: String - let projectDirectory: String - let isPackage: Bool - let buildConfigurations: [String: [String: BuildSetting]] - - init( - name: String, - path: String, - projectDirectory: String, - isPackage: Bool, - buildConfigurations: [String: [String: BuildSetting]] - ) { - self.name = name - self.path = path - self.projectDirectory = projectDirectory - self.isPackage = isPackage - self.buildConfigurations = buildConfigurations - } - } - - private let buildContext: BuildContext - private let buildProcess: BazelBuildProcess - - private let baseEnvironment: [String: String] - private let xcodeBuildVersion: String - private let developerDir: String - private let buildRequest: BuildRequest - - private var buildProgress: Double = -1.0 - private var initialActionCount: Int = 0 - - private let bazelTargets: [(target: Target, label: String, xcodeLabel: String)] - private let nonBazelTargets: [Target] - - private static let diagnosticsRegex = try! NSRegularExpression( - pattern: #"^(?:(.*?):(\d+):(\d+):\s+)?(error|warning|note):\s*(.*)$"#, - options: [.caseInsensitive] - ) - - /// This regex is used to minimally remove the timestamp at the start of our messages. - /// After that we try to parse out the execution progress - /// (see https://github.com/bazelbuild/bazel/blob/9bea69aee3acf18b780b397c8c441ac5715d03ae/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionProgressReceiver.java#L150-L157 ). - /// Finally we throw away any " ... (8 actions running)" like messages (see https://github.com/bazelbuild/bazel/blob/4f0b710e2b935b4249e0bbf633f43628bbf93d7b/src/main/java/com/google/devtools/build/lib/runtime/UiStateTracker.java#L1158 ). - private static let progressRegex = try! NSRegularExpression( - pattern: #"^(?:\(\d{1,2}:\d{1,2}:\d{1,2}\) )?(?:\[(\d{1,3}(,\d{3})*) \/ (\d{1,3}(,\d{3})*)\] )?(?:(?:INFO|ERROR|WARNING): )?(.*?)(?: \.\.\. \(.*\))?$"# - ) - - init( - buildContext: BuildContext, - environment: [String: String], - xcodeBuildVersion: String, - developerDir: String, - buildRequest: BuildRequest, - targets: [Target] - ) throws { - guard !targets.isEmpty else { - throw BazelBuildError.noTargets - } - - let targetsList = targets.map(\.name).joined(separator: ", ") - let targetsWording = targets.count == 1 ? "target" : "targets" - logger.info("Creating a Bazel build for \(targetsWording): \(targetsList)") - - self.baseEnvironment = environment - self.xcodeBuildVersion = xcodeBuildVersion - self.developerDir = developerDir - self.buildRequest = buildRequest - - self.buildContext = buildContext - - switch buildRequest.buildCommand { - case .cleanBuildFolder: - self.buildProcess = CleanBuildFolderProcess( - buildProductsPath: buildRequest.parameters.arenaInfo.buildProductsPath, - buildIntermediatesPath: buildRequest.parameters.arenaInfo.buildIntermediatesPath - ) - self.bazelTargets = [] - self.nonBazelTargets = [] - - default: - self.buildProcess = BazelClient() - (self.bazelTargets, self.nonBazelTargets) = targets.bazelTargets( - for: buildRequest.parameters.configuration - ) - } - } - - /// - Returns: `true` if at least one of the desired targets should be built with Bazel. - static func shouldBuild(targets: [Target], buildRequest: BuildRequest) -> Bool { - return targets.contains { $0.shouldBuildWithBazel(configuration: buildRequest.parameters.configuration) } - } - - /// - Returns: `true` if the target shouldn't be build for the `buildRequest`. - /// e.g. test targets are set in Xcode 11.3 for SwiftUI previews, even though we don't need to build them. - static func shouldSkipTarget(_ target: Target, buildRequest: BuildRequest) -> Bool { - guard buildRequest.buildCommand == .preview else { return false } - - return target.name.hasSuffix("Testing") - || target.name == "TestingCore" - || [ - "com.apple.product-type.bundle.unit-test", - "com.apple.product-type.bundle.ui-testing", - ].contains(target.productTypeIdentifier) - } - - static func previewInfo( - _ request: PreviewInfoRequest, - targets: [String: Target], - baseEnvironment: [String: String], - xcodeBuildVersion: String - ) throws -> PreviewInfoResponse { - let targetGUID = request.targetGUID - - guard let target = targets[targetGUID] else { - throw BazelBuildError.targetNotFound(guid: targetGUID) - } - - let buildRequest = request.buildRequest - - guard shouldBuild(targets: [target], buildRequest: buildRequest) else { - throw BazelBuildError.dontBuildWithBazel - } - - let parameters = target.parameters ?? buildRequest.parameters - let developerDir = baseEnvironment["DEVELOPER_DIR"]! - let platformDir = "\(developerDir)/Platforms/\(parameters.activeRunDestination.platform.directoryName)" - let platformDeveloperDir = "\(platformDir)/Developer" - let sdkRoot = "\(platformDeveloperDir)/SDKs/\(parameters.activeRunDestination.sdkVariant.directoryName)" - - let environment = Self.generateEnvironment( - baseEnvironment: baseEnvironment, - buildRequest: buildRequest, - xcodeBuildVersion: xcodeBuildVersion, - developerDir: developerDir, - platformDir: platformDir, - platformDeveloperDir: platformDeveloperDir, - sdkRoot: sdkRoot, - target: target - ) - - let configuration = parameters.configuration - - guard case let .string(rawLabel) = target.buildSetting(Target.bazelLabelBuildSetting, for: configuration) else { - throw BazelBuildError.bazelLabelNotSet(targetName: target.name) - } - - // Our modules use the wrapper suffix, which we need to strip off - let label = rawLabel.deletingSuffix(".${SWIFT_PLATFORM_TARGET_PREFIX}_wrapper") - - // Convert the label into a directory - let directory = label.deletingPrefix("//").substringBefore(":") - - let package = String(directory.split(separator: "/").last!) - let sourceIdentifier = String(request.sourceFile.split(separator: "/").last!).deletingSuffix(".swift") - let thunkVariantSuffix = request.thunkVariantSuffix - - let workingDirectory = target.project.projectDirectory - let flavor = ["Release", "Profile"].contains(configuration) ? "opt" : "dbg" - - let activeRunDestination = parameters.activeRunDestination - let architecture = activeRunDestination.targetArchitecture - let os = activeRunDestination.platform.swiftPlatformTargetPrefix - - // We require that IPHONEOS_DEPLOYMENT_TARGET (or the like) is set - guard let minOSVersion = environment[activeRunDestination.platform.deploymentTargetClangEnvName] else { - throw BazelBuildError.deploymentTargetNotSet(targetName: target.name) - } - - #if EXPERIMENTAL_XCODE - let shouldBuildForExperimentXcode = "true" - #else - let shouldBuildForExperimentXcode = "false" - #endif - - return PreviewInfoResponse( - targetGUID: targetGUID, - infos: [ - PreviewInfo( - sdkVariant: activeRunDestination.sdkVariant, - buildVariant: "normal", - architecture: architecture, - // After the first command Xcode inserts arbitrary commands. Our script has to account for that. - compileCommandLine: [ - "\(workingDirectory)/bazel/swiftui-previews.sh", - "---", - label, - sourceIdentifier, - thunkVariantSuffix, - environment["HOME"]!, - os, - configuration, - workingDirectory, - shouldBuildForExperimentXcode, - ], - // Must not be empty - linkCommandLine: ["/usr/bin/true"], - // Must be absolute - thunkSourceFile: "\(workingDirectory)/\(directory)/.PreviewReplacement/\(sourceIdentifier).\(thunkVariantSuffix).preview-thunk.swift", - // Doesn't seem to be used? - thunkObjectFile: "", - // Must be absolute - thunkLibrary: "\(workingDirectory)/bazel-out/\(os)-\(architecture)-min\(minOSVersion)-applebin_\(os)-\(os)_\(architecture)-\(flavor)/bin/\(directory)/\(package).\(sourceIdentifier).\(thunkVariantSuffix).\(os)_previewthunk_bin", - pifGUID: targetGUID - ), - ] - ) - } - - private static func generateEnvironment( - baseEnvironment: [String: String], - buildRequest: BuildRequest, - xcodeBuildVersion: String, - developerDir: String, - platformDir: String, - platformDeveloperDir: String, - sdkRoot: String, - target: Target - ) -> [String: String] { - let project = target.project - let parameters = target.parameters ?? buildRequest.parameters - let configuration = parameters.configuration - - let projectBuildSettings = project.buildConfigurations[configuration] ?? [:] - let targetBuildSettings = target.buildConfigurations[configuration] ?? [:] - - let productName: String - if case let .string(theProductName) = targetBuildSettings["PRODUCT_NAME"] { - productName = theProductName - } else { - logger.error("PRODUCT_NAME must be explicitly set on \(target.name) for Bazel integration") - productName = "" - } - - let activeRunDestination = parameters.activeRunDestination - - let effectiveConfiguration = "\(configuration)\(activeRunDestination.platform.effectivePlatform ?? "")" - let symRoot = parameters.overrides.synthesized["SYMROOT"] ?? - parameters.arenaInfo.buildProductsPath - let builtProductsDir = "\(symRoot)/\(effectiveConfiguration)" - let configurationTempDir = "/\(project.name).build/\(effectiveConfiguration)" - - let targetBuildDir: String - if case let .string(testHost) = targetBuildSettings["TEST_HOST"] { - // TODO: Parse build settings better - // "$(BUILT_PRODUCTS_DIR)/Example.app/Example" -> "\(buildProductsDir)/Example.app/Example" - let parsedTestHost = testHost - .replacingOccurrences(of: "$(BUILT_PRODUCTS_DIR)", with: builtProductsDir) - .replacingOccurrences(of: "${BUILT_PRODUCTS_DIR}", with: builtProductsDir) - // "\(buildProductsDir)/Example.app/Example" -> "\(buildProductsDir)/Example.app/PlugIns" - targetBuildDir = "\((parsedTestHost as NSString).deletingLastPathComponent)/PlugIns" - } else if targetBuildSettings["TEST_TARGET_NAME"] != nil { - targetBuildDir = "\(builtProductsDir)/\(productName)-Runner.app/PlugIns" - } else { - targetBuildDir = builtProductsDir - } - - // TODO: Handle custom toolchains - // (look in "/Library/Developer/Toolchains/" for a toolchain that matches `buildRequest.toolchainOverride`) - let xcodeToolchainDir = "\(developerDir)/Toolchains/XcodeDefault.xctoolchain" - let toolchainDir = xcodeToolchainDir - let toolchains = ["com.apple.dt.toolchain.XcodeDefault"] - - let validArchitectures = activeRunDestination.supportedArchitectures - .filter { standardArchitectures.contains($0) } - let architecture = validArchitectures.first ?? activeRunDestination.targetArchitecture - - let paths = [ - "\(toolchainDir)/usr/bin", - "\(toolchainDir)/usr/local/bin", - "\(toolchainDir)/usr/libexec", - "\(platformDir)/usr/bin", - "\(platformDir)/usr/local/bin", - "\(platformDeveloperDir)/usr/bin", - "\(platformDeveloperDir)/usr/local/bin", - "\(developerDir)/usr/bin", - "\(developerDir)/usr/local/bin", - "/usr/local/bin", - "/usr/bin", - "/bin", - "/usr/sbin", - "/sbin", - ] - - var defaultBuildSettings = [ - "ACTION": parameters.action, - "ARCHS": architecture, - "BUILD_DIR": symRoot, - "BUILT_PRODUCTS_DIR": builtProductsDir, - "CONFIGURATION": configuration, - "CONFIGURATION_TEMP_DIR": configurationTempDir, - "DEVELOPER_SDK_DIR": sdkRoot, - "DEPLOYMENT_TARGET_CLANG_ENV_NAME": activeRunDestination.platform.deploymentTargetClangEnvName, - "DT_TOOLCHAIN_DIR": xcodeToolchainDir, - "LLVM_TARGET_TRIPLE_VENDOR": "apple", - "PATH": paths.joined(separator: ":"), - "PRODUCT_TYPE": target.productTypeIdentifier ?? "", - "SRCROOT": project.projectDirectory, - "SWIFT_PLATFORM_TARGET_PREFIX": activeRunDestination.platform.swiftPlatformTargetPrefix, - "TARGET_BUILD_DIR": targetBuildDir, - "TOOLCHAIN_DIR": toolchainDir, - "TOOLCHAINS": toolchains.joined(separator: " "), - ] - - defaultBuildSettings["LLVM_TARGET_TRIPLE_SUFFIX"] = activeRunDestination.platform.llvmTargetTripleSuffix - - if let wrapperExtension = target.productTypeIdentifier.flatMap(wrapperExtension) { - let fullProductName = "\(productName).\(wrapperExtension)" - defaultBuildSettings["WRAPPER_EXTENSION"] = wrapperExtension - defaultBuildSettings["WRAPPER_SUFFIX"] = ".\(wrapperExtension)" - defaultBuildSettings["WRAPPER_NAME"] = fullProductName - defaultBuildSettings["FULL_PRODUCT_NAME"] = fullProductName - } - - var environment = mergeBuildSettings([ - baseEnvironment, - defaultBuildSettings, - parameters.overrides.synthesized, - projectBuildSettings.asStrings(), - targetBuildSettings.asStrings(), - ]) - - environment["BAZEL_XCODE_PLATFORM_DEVELOPER_DIR"] = platformDeveloperDir - environment["XCODE_PRODUCT_BUILD_VERSION"] = xcodeBuildVersion - - if buildRequest.continueBuildingAfterErrors { - environment["NBS_CONTINUE_BUILDING_AFTER_ERRORS"] = "YES" - } - - return environment - } - - private static func wrapperExtension(for productTypeIdentifier: String) -> String? { - switch productTypeIdentifier { - case "com.apple.product-type.application", - "com.apple.product-type.application.messages", - "com.apple.product-type.application.watchapp", - "com.apple.product-type.application.watchapp2", - "com.apple.product-type.application.watchapp2-container": - return "app" - - case "com.apple.product-type.framework": - return "framework" - - case "com.apple.product-type.bundle": - return "bundle" - - case "com.apple.product-type.bundle.unit-test", - "com.apple.product-type.bundle.ui-testing": - return "xctest" - - case "com.apple.product-type.app-extension", - "com.apple.product-type.app-extension.messages", - "com.apple.product-type.app-extension.messages-sticker-pack", - "com.apple.product-type.tv-app-extension", - "com.apple.product-type.watchkit-extension", - "com.apple.product-type.watchkit2-extension": - return "appex" - - case "com.apple.product-type.xpc-service": - return "xpc" - - default: - return nil - } - } - - private static func mergeBuildSettings(_ buildSettings: [[String: String]]) -> [String: String] { - return buildSettings.reduce(into: [:]) { buildSettings, additionalBuildSettings in - buildSettings.merge(additionalBuildSettings) { _, new in new } - } - } - - func start(startedHandler: @escaping () -> Void) throws { - guard nonBazelTargets.isEmpty else { - startedHandler() - buildContext.buildStarted() - buildContext.diagnostic( - "Some targets are set to build with Bazel, but \(Target.shouldBuildWithBazelBuildSetting) and/or \(Target.bazelLabelBuildSetting) is not set for the following targets: \(nonBazelTargets.map(\.name).joined(separator: ", ")). All, or none of, the targets need to be setup to build with Bazel.", - kind: .error, - appendToOutputStream: true - ) - buildContext.buildEnded(cancelled: false) - return - } - - // This works for now since we only have a single project, but will break if we spread between multiple in the future - let workingDirectory = bazelTargets.last?.target.project.projectDirectory ?? "" - - var uniquedActions = false - - try buildProcess.start( - startedHandler: { [buildContext, baseEnvironment, xcodeBuildVersion, developerDir, buildRequest, bazelTargets] uniqueTargetsHandler, startProcessHandler in - startedHandler() - - let actualLabels = bazelTargets.map(\.label) - let actualTargetPatterns = actualLabels.joined(separator: " ") - - buildContext.planningStarted() - buildContext.progressUpdate("Building with Bazel", percentComplete: -1.0, showInLog: true) - if !bazelTargets.isEmpty { - buildContext.progressUpdate( - "Preparing build for \(actualLabels.count == 1 ? "label" : "labels"): \(actualTargetPatterns)", - percentComplete: -1.0, - showInLog: true - ) - } - - let finishStartup = { (buildLabelsResult: Result<[String], Error>) in - let uniqueActualLabels: [String] - switch buildLabelsResult { - case let .failure(error): - buildContext.diagnostic( - "Failed to find unique labels: \(error).\nUsing original label set instead.", - kind: .warning - ) - uniqueActualLabels = actualLabels - - case let .success(newActualLabels): - uniqueActualLabels = newActualLabels - } - - if uniquedActions { - buildContext.progressUpdate( - "Actually building \(uniqueActualLabels.count == 1 ? "label" : "labels"): \(uniqueActualLabels.joined(separator: " "))", - percentComplete: -1.0, - showInLog: true - ) - } - - let uniqueBazelTargets = uniqueActualLabels.compactMap { label in bazelTargets.first { $0.label == label } } - let target = uniqueBazelTargets.last - let installTarget = target?.target - - if uniqueBazelTargets.count > 1, let lastLabel = target?.label { - // Warn that we are only installing the last target - buildContext.diagnostic( - "More than one target was specified. Currently only the last target (\(lastLabel)) will be installed and runnable.", - kind: .info - ) - } - buildContext.planningEnded() - - buildContext.buildStarted() - - let parameters = installTarget?.parameters ?? buildRequest.parameters - let platformDir = "\(developerDir)/Platforms/\(parameters.activeRunDestination.platform.directoryName)" - let platformDeveloperDir = "\(platformDir)/Developer" - let sdkRoot = "\(platformDeveloperDir)/SDKs/\(parameters.activeRunDestination.sdkVariant.directoryName)" - let configuration = parameters.configuration - - let commandLineString = startProcessHandler( - uniqueBazelTargets.map(\.xcodeLabel).joined(separator: " "), - workingDirectory, - installTarget.flatMap { - Self.generateEnvironment( - baseEnvironment: baseEnvironment, - buildRequest: buildRequest, - xcodeBuildVersion: xcodeBuildVersion, - developerDir: developerDir, - platformDir: platformDir, - platformDeveloperDir: platformDeveloperDir, - sdkRoot: sdkRoot, - target: $0 - ) - } ?? baseEnvironment - ) - - if let installTarget = installTarget { - buildContext.targetStarted( - id: 0, - guid: installTarget.xcodeGUID, - targetInfo: BuildOperationTargetInfo( - name: installTarget.name, - typeName: "Native", - projectInfo: BuildOperationProjectInfo(installTarget.project), - configurationName: configuration, - configurationIsDefault: false, - sdkRoot: sdkRoot - ) - ) - buildContext.taskStarted( - id: 1, - targetID: 0, - taskDetails: BuildOperationTaskStarted.TaskDetails( - taskName: "Shell Script Invocation", - signature: Data(), - ruleInfo: "PhaseScriptExecution Bazel\\ build xcode.sh", - executionDescription: "Run custom shell script ‘Bazel build’", - commandLineDisplayString: commandLineString.indent(), - interestingPath: nil, - serializedDiagnosticsPaths: [] - ) - ) - } - } - - if bazelTargets.count > 1 { - buildContext.progressUpdate( - "Determining unique targets", - percentComplete: -1.0, - showInLog: true - ) - - uniquedActions = true - - uniqueTargetsHandler(actualTargetPatterns, workingDirectory, baseEnvironment, finishStartup) - } else { - finishStartup(.success(actualLabels)) - } - }, - outputHandler: { [buildContext] output in - buildContext.consoleOutput(output, taskID: 1) - - if let stringOutput = String(data: output, encoding: .utf8) { - stringOutput.split(separator: "\n").forEach { message in - let message = String(message) - - let kind: BuildOperationDiagnosticKind - let location: BuildOperationDiagnosticLocation - let finalMessage: String - if - let match = Self.diagnosticsRegex.firstMatch( - in: message, - options: [], - range: NSRange(message.startIndex ..< message.endIndex, in: message) - ), - match.numberOfRanges == 6, - let kindRange = Range(match.range(at: 4), in: message), - let finalMessageRange = Range(match.range(at: 5), in: message) - { - switch message[kindRange].lowercased() { - case "error": kind = .error - case "warning": kind = .warning - default: kind = .info - } - - finalMessage = String(message[finalMessageRange]).capitalizingFirstLetter() - - if - let fileNameRange = Range(match.range(at: 1), in: message), - let lineRange = Range(match.range(at: 2), in: message), - let columnRange = Range(match.range(at: 3), in: message) - { - // TODO: Generate this properly. It might be incorrect for external/generated. - let rawFileName = String(message[fileNameRange]) - let fileName = rawFileName.hasPrefix(workingDirectory) ? rawFileName : "\(workingDirectory)/\(rawFileName)" - let line = Int64(message[lineRange]) ?? 0 - let column = Int64(message[columnRange]) ?? 0 - location = .locationContext(file: fileName, line: line, column: column) - } else { - location = .alternativeMessage("") - } - } else { - kind = .info - finalMessage = message - location = .alternativeMessage("") - } - - buildContext.diagnostic( - finalMessage, - kind: kind, - location: location, - component: .task(taskID: 1, targetID: 0) - ) - } - } - }, - bepHandler: { [buildContext] event in - var progressMessage: String? - event.progress.stderr.split(separator: "\n").forEach { message in - guard !message.isEmpty else { return } - - let message = String(message) - - if - let match = Self.progressRegex.firstMatch( - in: message, - options: [], - range: NSRange(message.startIndex ..< message.endIndex, in: message) - ), - match.numberOfRanges == 6, - let finalMessageRange = Range(match.range(at: 5), in: message), - let completedActionsRange = Range(match.range(at: 1), in: message), - let totalActionsRange = Range(match.range(at: 3), in: message) - { - progressMessage = String(message[finalMessageRange]) - - let completedActionsString = message[completedActionsRange] - .replacingOccurrences(of: ",", with: "") - let totalActionsString = message[totalActionsRange] - .replacingOccurrences(of: ",", with: "") - - if - let completedActions = Int(completedActionsString), - let totalActions = Int(totalActionsString) - { - if self.initialActionCount == 0, completedActions > 0, completedActions != totalActions { - self.initialActionCount = completedActions - } - - self.buildProgress = 100 * Double(completedActions - self.initialActionCount) / Double(totalActions - self.initialActionCount) - } else { - logger.error("Failed to parse progress out of BEP message: \(message)") - } - } - } - - if event.lastMessage { - progressMessage = progressMessage ?? "Compilation complete" - self.buildProgress = 100 - } - - // Take the last message in the case of multiple lines, as well as the most recent `buildProgress` - if let message = progressMessage { - buildContext.progressUpdate(message, percentComplete: self.buildProgress) - } - }, - terminationHandler: { [buildContext, bazelTargets] exitCode, cancelled in - logger.info("\(cancelled ? "Cancelled Bazel" : "Bazel") build exited with status code: \(exitCode)") - - let succeeded = cancelled || exitCode == 0 - - if !bazelTargets.isEmpty { - buildContext.taskEnded(id: 1, succeeded: succeeded) - if succeeded { - buildContext.targetEnded(id: 0) - } - } - - buildContext.buildEnded(cancelled: cancelled) - } - ) - } - - func cancel() { - buildProcess.stop() - } -} - -enum BazelBuildError: Error { - case noTargets - case dontBuildWithBazel - case productNameRequired(targetName: String) - case bazelLabelNotSet(targetName: String) - case deploymentTargetNotSet(targetName: String) - case targetNotFound(guid: String) -} - -private extension BuildContext where ResponsePayload == BazelXCBBuildServiceResponsePayload { - func planningStarted() { - sendResponseMessage(PlanningOperationWillStart(sessionHandle: session, guid: "")) - } - - func planningEnded() { - sendResponseMessage(PlanningOperationDidFinish(sessionHandle: session, guid: "")) - } - - func buildStarted() { - sendResponseMessage(BuildOperationPreparationCompleted()) - sendResponseMessage(BuildOperationStarted(buildNumber: buildNumber)) - sendResponseMessage(BuildOperationReportPathMap()) - } - - func progressUpdate(_ message: String, percentComplete: Double, showInLog: Bool = false) { - sendResponseMessage( - BuildOperationProgressUpdated( - targetName: nil, - statusMessage: message, - percentComplete: percentComplete, - showInLog: showInLog - ) - ) - } - - func buildEnded(cancelled: Bool) { - sendResponseMessage(BuildOperationEnded(buildNumber: buildNumber, status: cancelled ? .cancelled : .succeeded)) - } - - func targetUpToDate(guid: String) { - sendResponseMessage(BuildOperationTargetUpToDate(guid: guid)) - } - - func targetStarted(id: Int64, guid: String, targetInfo: BuildOperationTargetInfo) { - sendResponseMessage(BuildOperationTargetStarted(targetID: id, guid: guid, targetInfo: targetInfo)) - } - - func targetEnded(id: Int64) { - sendResponseMessage(BuildOperationTargetEnded(targetID: id)) - } - - func taskStarted(id: Int64, targetID: Int64, taskDetails: BuildOperationTaskStarted.TaskDetails) { - sendResponseMessage( - BuildOperationTaskStarted( - taskID: id, - targetID: targetID, - parentTaskID: nil, - taskDetails: taskDetails - ) - ) - } - - func consoleOutput(_ data: Data, taskID: Int64) { - sendResponseMessage( - BuildOperationConsoleOutputEmitted( - taskID: taskID, - output: data - ) - ) - } - - func diagnostic( - _ message: String, - kind: BuildOperationDiagnosticKind, - location: BuildOperationDiagnosticLocation = .alternativeMessage(""), - component: BuildOperationDiagnosticComponent = .global, - appendToOutputStream: Bool = false - ) { - sendResponseMessage( - BuildOperationDiagnosticEmitted( - kind: kind, - location: location, - message: message, - component: component, - unknown: "default", - appendToOutputStream: appendToOutputStream - ) - ) - } - - func taskEnded(id: Int64, succeeded: Bool) { - sendResponseMessage( - BuildOperationTaskEnded( - taskID: id, - status: succeeded ? .succeeded : .failed, - skippedErrorsFromSerializedDiagnostics: false, - metrics: nil - ) - ) - } -} - -extension BazelBuildError: LocalizedError { - var errorDescription: String? { - switch self { - case .noTargets: - return "No Bazel valid targets found" - case .dontBuildWithBazel: - // This should be caught and handled instead of being reported - return "Use XCBuild to build" - case .productNameRequired(let targetName): - return "PRODUCT_NAME must be explicitly set on \(targetName) for Bazel integration" - case .bazelLabelNotSet(let targetName): - return "BAZEL_LABEL must be explicitly set on \(targetName) for Bazel integration" - case .deploymentTargetNotSet(let targetName): - return "The deployment target (e.g. IPHONEOS_DEPLOYMENT_TARGET) must be explicitly set on \(targetName) for Bazel integration" - case .targetNotFound(let guid): - return "Target with guid \(guid) not found in PIF cache" - } - } -} - -private extension BazelBuild.Target { - static let shouldBuildWithBazelBuildSetting = "USE_BAZELXCBBUILDSERVICE" - static let bazelLabelBuildSetting = "BAZEL_LABEL" - static let bazelXcodeLabelBuildSetting = "BAZEL_XCODE_LABEL" - - func buildSetting(_ name: String, for configuration: String) -> BuildSetting? { - guard let targetBuildSettings = buildConfigurations[configuration] else { - return nil - } - - if let targetSetting = targetBuildSettings[name] { - return targetSetting - } - - return project.buildConfigurations[configuration]?[name] - } - - func shouldBuildWithBazel(configuration: String) -> Bool { - guard case let .string(setting) = buildSetting(Self.shouldBuildWithBazelBuildSetting, for: configuration) else { - return false - } - return setting == "YES" - } -} - -private extension BuildOperationProjectInfo { - init(_ parsedProject: BazelBuild.Project) { - self.init( - name: parsedProject.name, - path: parsedProject.path, - isPackage: parsedProject.isPackage - ) - } -} - -private extension Array where Element == BazelBuild.Target { - func bazelTargets(for configuration: String) -> (bazelTargets: [(target: BazelBuild.Target, label: String, xcodeLabel: String)], nonBazelTargets: [BazelBuild.Target]) { - var bazelTargets: [(target: BazelBuild.Target, label: String, xcodeLabel: String)] = [] - var nonBazelTargets: [BazelBuild.Target] = [] - for target in self { - if - target.shouldBuildWithBazel(configuration: configuration), - case let .string(label) = target.buildSetting(BazelBuild.Target.bazelLabelBuildSetting, for: configuration), - case let .string(xcodeLabel) = target.buildSetting(BazelBuild.Target.bazelXcodeLabelBuildSetting, for: configuration) - { - bazelTargets.append((target, label, xcodeLabel)) - } else { - nonBazelTargets.append(target) - } - } - return (bazelTargets, nonBazelTargets) - } -} - -private extension Dictionary where Value == BuildSetting { - func asStrings() -> [Key: String] { - mapValues { setting in - switch setting { - case let .string(string): return string - case let .array(array): return array.joined(separator: " ") - } - } - } -} - -private extension String { - func indent() -> String { - " " + replacingOccurrences(of: "\n", with: "\n ") - } -} - -private extension BuildPlatform { - // e.g. "IPHONEOS_DEPLOYMENT_TARGET" - var deploymentTargetClangEnvName: String { - switch self { - case .macosx: - return "MACOSX_DEPLOYMENT_TARGET" - - case .iphoneos, .iphonesimulator: - return "IPHONEOS_DEPLOYMENT_TARGET" - - case .watchos, .watchsimulator: - return "WATCHOS_DEPLOYMENT_TARGET" - - case .appletvos, .appletvsimulator: - return "TVOS_DEPLOYMENT_TARGET" - } - } - - // e.g. "iphonesimulator" -> "iPhoneSimulator.platform" - var directoryName: String { - return "\(stylizedForDirectoryName).platform" - } - - // e.g. "iphonesimulator" -> "iPhoneSimulator" - var stylizedForDirectoryName: String { - switch self { - case .macosx: - return "MacOSX" - - case .iphonesimulator: - return "iPhoneSimulator" - case .iphoneos: - return "iPhoneOS" - - case .watchos: - return "WatchOS" - case .watchsimulator: - return "WatchSimulator" - - case .appletvos: - return "AppleTVOS" - case .appletvsimulator: - return "AppleTVSimulator" - } - } - - // e.g. "-iphonesimulator" - var effectivePlatform: String? { - guard rawValue != "macosx" else { return nil } - return "-\(rawValue)" - } - - // e.g. "-simulator" - var llvmTargetTripleSuffix: String? { - switch self { - case .iphonesimulator, .watchsimulator, .appletvsimulator: - return "-simulator" - - default: - return nil - } - } - - // e.g. "ios", "macos", "tvos" - var swiftPlatformTargetPrefix: String { - switch self { - case .macosx: - return "macos" - - case .iphoneos, .iphonesimulator: - return "ios" - - case .watchos, .watchsimulator: - return "watchos" - - case .appletvos, .appletvsimulator: - return "tvos" - } - } -} - -private extension SDKVariant { - private static let regex = try! NSRegularExpression(pattern: #"^(\D+)(\d+\.\d+)$"#) - - // e.g. "iphonesimulator13.2" -> "iPhoneSimulator13.2.sdk" - var directoryName: String { - // TODO: Figure this out better - guard - let match = Self.regex.firstMatch( - in: rawValue, - options: [], - range: NSRange(rawValue.startIndex ..< rawValue.endIndex, in: rawValue) - ), - match.numberOfRanges == 3, - let nameRange = Range(match.range(at: 1), in: rawValue), - let versionRange = Range(match.range(at: 2), in: rawValue), - let platform = BuildPlatform(rawValue: String(rawValue[nameRange])) - else { - logger.error("Unknown platform used for SDKVariant: \(rawValue)") - return "Unknown.sdk" - } - - return "\(platform.stylizedForDirectoryName)\(rawValue[versionRange]).sdk" - } -} - -private extension String { - func capitalizingFirstLetter() -> String { - return prefix(1).capitalized + dropFirst() - } - - func deletingPrefix(_ prefix: String) -> String { - guard hasPrefix(prefix) else { return self } - return String(dropFirst(prefix.count)) - } - - func deletingSuffix(_ suffix: String) -> String { - guard hasSuffix(suffix) else { return self } - return String(dropLast(suffix.count)) - } - - func substringBefore(_ marker: String.Element) -> String { - guard let index = firstIndex(of: marker) else { return self } - return String(self[..) -> Void - ) -> Void, - _ startProcessHandler: @escaping (_ finalTargetPatterns: String, _ workingDirectory: String, _ environment: [String: String]) -> String - ) -> Void, - outputHandler: @escaping (Data) -> Void, - bepHandler: @escaping (BuildEventStream_BuildEvent) -> Void, - terminationHandler: @escaping (_ exitCode: Int32, _ cancelled: Bool) -> Void - ) throws - - func stop() -} - -enum BazelBuildProcessError: Error { - case alreadyStarted - case failedToCreateBEPFile - case failToParseUniqueTargetsOutput - case uniqueTargetsFailed(_ exitCode: Int32) -} - -/// Encapsulates a child Bazel script process. -final class BazelClient: BazelBuildProcess { - /// Queue used to ensure proper ordering of results from process output/termination. - private let processResultsQueue = DispatchQueue( - label: "BazelXCBBuildService.BazelBuildProcess", - qos: .userInitiated - ) - private let process: Process - private let uniqueTargetsProcess: UniqueTargetsProcess - - private var isCancelled = false - - private let bepPath: String - - init() { - self.bepPath = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true) - .appendingPathComponent(ProcessInfo().globallyUniqueString).path - - self.process = Process() - - // Automatically terminate process if our process exits - let selector = Selector(("setStartsNewProcessGroup:")) - if process.responds(to: selector) { - process.perform(selector, with: false as NSNumber) - } - - self.uniqueTargetsProcess = UniqueTargetsProcess() - } - - func start( - startedHandler: @escaping ( - _ uniqueTargetsHandler: @escaping ( - _ targetPatterns: String, - _ workingDirectory: String, - _ environment: [String: String], - _ finishStartup: @escaping (_ buildLabelsResult: Result<[String], Error>) -> Void - ) -> Void, - _ startProcessHandler: @escaping (_ finalTargetPatterns: String, _ workingDirectory: String, _ environment: [String: String]) -> String - ) -> Void, - outputHandler: @escaping (Data) -> Void, - bepHandler: @escaping (BuildEventStream_BuildEvent) -> Void, - terminationHandler: @escaping (_ exitCode: Int32, _ cancelled: Bool) -> Void - ) throws { - guard !process.isRunning else { - throw BazelBuildProcessError.alreadyStarted - } - - let fileManager = FileManager.default - - fileManager.createFile(atPath: bepPath, contents: Data()) - guard let bepFileHandle = FileHandle(forReadingAtPath: bepPath) else { - logger.error("Failed to create file for BEP stream at “\(bepPath)”") - throw BazelBuildProcessError.failedToCreateBEPFile - } - - /// Dispatch group used to ensure that stdout and stderr are processed before the process termination. - /// This is needed since all three notifications come in on different threads. - let processDispatchGroup = DispatchGroup() - - /// `true` if the `terminationHandler` has been called. Xcode will crash if we send more events after that. - var isTerminated = false - - // Bazel works by appending content to a file, specifically, Java's `BufferedOutputStream`. - // Naively using an input stream for the path and waiting for available data simply does not work with - // whatever `BufferedOutputStream.flush()` is doing internally. - // - // Reference: - // https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/buildeventstream/transports/FileTransport.java - // - // Perhaps, SwiftProtobuf can come up with a better solution to read from files or upstream similar code: - // https://github.com/apple/swift-protobuf/issues/130 - // - // Logic: - // - Create a few file - // - When the build starts, Bazel will attempt to reuse the inode, and stream to it - // - Then, via `FileHandle`, wait for data to be available and read all the bytes - bepFileHandle.readabilityHandler = { [processResultsQueue] _ in - // `bepFileHandle` is captured in the closure, which keeps the reference around - let data = bepFileHandle.availableData - guard !data.isEmpty else { - return - } - - processDispatchGroup.enter() - processResultsQueue.async { - defer { processDispatchGroup.leave() } - - // We don't want to report any more progress if the build has been terminated - guard !isTerminated else { - bepFileHandle.closeFile() - bepFileHandle.readabilityHandler = nil - return - } - - // Wrap the file handle in an `InputStream` for SwiftProtobuf to read - // We read the stream until the (current) end of the file - let input = InputStream(data: data) - input.open() - while input.hasBytesAvailable { - do { - let event = try BinaryDelimited.parse(messageType: BuildEventStream_BuildEvent.self, from: input) - - logger.trace("Received BEP event: \(event)") - - bepHandler(event) - - if event.lastMessage { - logger.trace("Received last BEP event") - - bepFileHandle.closeFile() - bepFileHandle.readabilityHandler = nil - } - } catch { - logger.error("Failed to parse BEP event: \(error)") - return - } - } - } - } - - let stdout = Pipe() - let stderr = Pipe() - - processDispatchGroup.enter() - stdout.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received Bazel standard output EOF") - stdout.fileHandleForReading.readabilityHandler = nil - processDispatchGroup.leave() - - return - } - - processResultsQueue.async { - logger.trace("Received Bazel standard output: \(data)") - outputHandler(data) - } - } - - processDispatchGroup.enter() - stderr.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received Bazel standard error EOF") - stderr.fileHandleForReading.readabilityHandler = nil - processDispatchGroup.leave() - return - } - - processResultsQueue.async { - logger.trace("Received Bazel standard error: \(data)") - outputHandler(data) - } - } - - process.standardOutput = stdout - process.standardError = stderr - - processDispatchGroup.enter() - process.terminationHandler = { process in - logger.debug("xcode.sh exited with status code: \(process.terminationStatus)") - processDispatchGroup.leave() - } - - processDispatchGroup.notify(queue: processResultsQueue) { - if bepFileHandle.readabilityHandler != nil { - bepFileHandle.closeFile() - bepFileHandle.readabilityHandler = nil - } - terminationHandler(self.process.terminationStatus, self.isCancelled) - isTerminated = true - } - - startedHandler( - { [uniqueTargetsProcess] targetPatterns, workingDirectory, environment, finishStartup in - uniqueTargetsProcess.start( - targetPatterns: targetPatterns, - workingDirectory: workingDirectory, - environment: environment, - errorOutputHandler: outputHandler, - uniqueBuildLabelsHandler: finishStartup - ) - }, - { [process, bepPath] finalTargetPatterns, workingDirectory, environment in - var environment = environment - environment["NBS_BEP_PATH"] = bepPath - - process.launchPath = "/bin/bash" - process.currentDirectoryPath = workingDirectory - process.environment = environment - process.arguments = [ - "-c", - "bazel/xcode.sh nbs \(finalTargetPatterns)", - ] - - let command = "\(process.launchPath!) \(process.arguments!.joined(separator: " "))" - logger.info("Starting Bazel with command: \(command)") - - process.launch() - - return """ - cd \(process.currentDirectoryPath) - \( - (process.environment ?? [:]) - .sorted { $0.key < $1.key } - .map { "export \($0)=\($1.exportQuoted)" } - .joined(separator: "\n") - ) - \(command) - """ - } - ) - } - - func stop() { - isCancelled = true - if process.isRunning { - // Sends SIGTERM to the Bazel client. It will cleanup and exit. - process.terminate() - } - } -} - -final class CleanBuildFolderProcess: BazelBuildProcess { - /// Queue used to ensure proper ordering of results from process output/termination. - private let processResultsQueue = DispatchQueue( - label: "BazelXCBBuildService.CleanBuildFolderProcess", - qos: .userInitiated - ) - private let process: Process - - private var isCancelled = false - - init(buildProductsPath: String, buildIntermediatesPath: String) { - self.process = Process() - process.launchPath = "/bin/rm" - process.arguments = [ - "-r", - buildProductsPath, - buildIntermediatesPath, - ] - - // Automatically terminate process if our process exits - let selector = Selector(("setStartsNewProcessGroup:")) - if process.responds(to: selector) { - process.perform(selector, with: false as NSNumber) - } - } - - func start( - startedHandler: @escaping ( - _ uniqueTargetsHandler: @escaping ( - _ targetPatterns: String, - _ workingDirectory: String, - _ environment: [String: String], - _ finishStartup: @escaping (_ buildLabelsResult: Result<[String], Error>) -> Void - ) -> Void, - _ startProcessHandler: @escaping (_ finalTargetPatterns: String, _ workingDirectory: String, _ environment: [String: String]) -> String - ) -> Void, - outputHandler: @escaping (Data) -> Void, - bepHandler: @escaping (BuildEventStream_BuildEvent) -> Void, - terminationHandler: @escaping (_ exitCode: Int32, _ cancelled: Bool) -> Void - ) throws { - guard !process.isRunning else { - throw BazelBuildProcessError.alreadyStarted - } - - let stdout = Pipe() - let stderr = Pipe() - - stdout.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received CleanBuildFolder standard output EOF") - stdout.fileHandleForReading.readabilityHandler = nil - return - } - - processResultsQueue.sync { - if let output = String(data: data, encoding: .utf8) { - logger.error("Received CleanBuildFolder standard output: \(output)") - } - } - } - - stderr.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received CleanBuildFolder standard error EOF") - stderr.fileHandleForReading.readabilityHandler = nil - return - } - - processResultsQueue.sync { - if let output = String(data: data, encoding: .utf8) { - logger.error("Received CleanBuildFolder standard error: \(output)") - } - } - } - - process.standardOutput = stdout - process.standardError = stderr - - process.terminationHandler = { _ in - terminationHandler(self.process.terminationStatus, self.isCancelled) - } - - let command = "\(process.launchPath!) \(process.arguments!.joined(separator: " "))" - - logger.info("Cleaning build folder with command: \(command)") - startedHandler({ $3(.success([])) }, { [process] _, _, _ in - process.launch() - return "" - }) - } - - func stop() { - isCancelled = true - if process.isRunning { - process.terminate() - } - } -} - -/// Encapsulates a child `tools/UniqueTargets` process. -private final class UniqueTargetsProcess { - /// Queue used to ensure proper ordering of results from process output/termination. - private let processResultsQueue = DispatchQueue( - label: "BazelXCBBuildService.UniqueTargetsProcess", - qos: .userInitiated - ) - private let process: Process - - private var isCancelled = false - - init() { - self.process = Process() - - // Automatically terminate process if our process exits - let selector = Selector(("setStartsNewProcessGroup:")) - if process.responds(to: selector) { - process.perform(selector, with: false as NSNumber) - } - } - - func start( - targetPatterns: String, - workingDirectory: String, - environment: [String: String], - errorOutputHandler: @escaping (Data) -> Void, - uniqueBuildLabelsHandler: @escaping (Result<[String], Error>) -> Void - ) { - guard !process.isRunning else { - uniqueBuildLabelsHandler(.failure(BazelBuildProcessError.alreadyStarted)) - return - } - - process.launchPath = "/bin/bash" - process.currentDirectoryPath = workingDirectory - process.environment = environment - process.arguments = [ - "-c", - "tools/UniqueTargets/bin/UniqueTargets \(targetPatterns)", - ] - - /// Dispatch group used to ensure that stdout and stderr are processed before the process termination. - /// This is needed since all three notifications come in on different threads. - let processDispatchGroup = DispatchGroup() - - let stdout = Pipe() - let stderr = Pipe() - - var collectedData = Data() - - processDispatchGroup.enter() - stdout.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received UniqueTargets standard output EOF") - stdout.fileHandleForReading.readabilityHandler = nil - processDispatchGroup.leave() - - return - } - - collectedData.append(data) - - processResultsQueue.async { - logger.trace("Received UniqueTargets standard output: \(data)") - } - } - - processDispatchGroup.enter() - stderr.fileHandleForReading.readabilityHandler = { [processResultsQueue] handle in - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received UniqueTargets standard error EOF") - stderr.fileHandleForReading.readabilityHandler = nil - processDispatchGroup.leave() - return - } - - processResultsQueue.async { - logger.trace("Received UniqueTargets standard error: \(data)") - errorOutputHandler(data) - } - } - - process.standardOutput = stdout - process.standardError = stderr - - processDispatchGroup.enter() - process.terminationHandler = { process in - logger.debug("UniqueTargets exited with status code: \(process.terminationStatus)") - processDispatchGroup.leave() - } - - processDispatchGroup.notify(queue: processResultsQueue) { - if self.process.terminationStatus == 0 { - if let uniqueTargetPatterns = String(data: collectedData, encoding: .utf8) { - let uniqueBuildLabels = uniqueTargetPatterns - .trimmingCharacters(in: .whitespacesAndNewlines) - .components(separatedBy: .whitespaces) - uniqueBuildLabelsHandler(.success(uniqueBuildLabels)) - } else { - uniqueBuildLabelsHandler(.failure(BazelBuildProcessError.failToParseUniqueTargetsOutput)) - } - } else { - uniqueBuildLabelsHandler(.failure(BazelBuildProcessError.uniqueTargetsFailed(self.process.terminationStatus))) - } - } - - let command = "\(process.launchPath!) \(process.arguments!.joined(separator: " "))" - - logger.info("Starting UniqueTargets with command: \(command)") - - process.launch() - } - - func stop() { - if process.isRunning { - // Sends SIGTERM to the Bazel client. It will cleanup and exit. - process.terminate() - } - } -} - -private extension String { - var exportQuoted: String { - guard rangeOfCharacter(from: .whitespacesAndNewlines) != nil else { return self } - return #""\#(self)""# - } -} diff --git a/Examples/BazelXCBBuildService/Sources/QueryXcodeVersion.swift b/Examples/BazelXCBBuildService/Sources/QueryXcodeVersion.swift deleted file mode 100644 index 1de6222..0000000 --- a/Examples/BazelXCBBuildService/Sources/QueryXcodeVersion.swift +++ /dev/null @@ -1,62 +0,0 @@ -import Foundation -import NIO - -final class QueryXcodeVersion { - private let process: Process - - init(appPath: String) { - self.process = Process() - process.launchPath = "/usr/libexec/PlistBuddy" - process.arguments = [ - "-c", - "Print :ProductBuildVersion", - "\(appPath)/Contents/version.plist", - ] - - // Automatically terminate process if our process exits - let selector = Selector(("setStartsNewProcessGroup:")) - if process.responds(to: selector) { - process.perform(selector, with: false as NSNumber) - } - } - - func start(eventLoop: EventLoop) -> EventLoopFuture { - let promise = eventLoop.makePromise(of: String.self) - - let stdout = Pipe() - let stderr = Pipe() - - stdout.fileHandleForReading.readabilityHandler = { handle in - // We only process a single line - defer { stdout.fileHandleForReading.readabilityHandler = nil } - - let data = handle.availableData - guard !data.isEmpty else { - logger.trace("Received QueryXcodeVersion standard output EOF") - return - } - - if let response = String(data: data, encoding: .utf8) { - promise.succeed(response.trimmingCharacters(in: .whitespacesAndNewlines)) - } else { - logger.error("Failed to decode response for QueryXcodeVersion") - promise.succeed("") - } - } - - process.standardOutput = stdout - process.standardError = stderr - - process.terminationHandler = { process in - logger.debug("QueryXcodeVersion exited with status code: \(process.terminationStatus)") - } - - let command = "\(process.launchPath!) \(process.arguments!.joined(separator: " "))" - - logger.info("Querying Xcode version with command: \(command)") - - process.launch() - - return promise.futureResult - } -} diff --git a/Examples/BazelXCBBuildService/Sources/RequestHandler.swift b/Examples/BazelXCBBuildService/Sources/RequestHandler.swift deleted file mode 100644 index 62d6262..0000000 --- a/Examples/BazelXCBBuildService/Sources/RequestHandler.swift +++ /dev/null @@ -1,400 +0,0 @@ -import Foundation -import Logging -import NIO -import XCBBuildServiceProxyKit -import XCBProtocol - -@_exported import XCBProtocol_12_0 -typealias BazelXCBBuildServiceRequestPayload = XCBProtocol_12_0.RequestPayload -typealias BazelXCBBuildServiceResponsePayload = XCBProtocol_12_0.ResponsePayload - -final class RequestHandler: HybridXCBBuildServiceRequestHandler { - typealias Context = HybridXCBBuildServiceRequestHandlerContext - - private typealias SessionHandle = String - - private var sessionAppPaths: [SessionHandle: String] = [:] - private var sessionXcodeBuildVersionFutures: [SessionHandle: (Any, EventLoopFuture)] = [:] - private var sessionPIFCachePaths: [SessionHandle: String] = [:] - private var sessionWorkplaceSignatures: [SessionHandle: String] = [:] - private var sessionBazelTargetsFutures: [SessionHandle: (environment: [String: String], EventLoopFuture<[String: BazelBuild.Target]?>)] = [:] - private var sessionBazelBuilds: [SessionHandle: BazelBuild] = [:] - - // We use negative numbers to ensure no duplication with XCBBuildService (though it seems that doesn't matter) - private var lastBazelBuildNumber: Int64 = 0 - - private let fileIO: NonBlockingFileIO - - init(fileIO: NonBlockingFileIO) { - self.fileIO = fileIO - } - - func handleRequest(_ request: RPCRequest, context: Context) { - // Unless `forwardRequest` is set to `false`, at the end we forward the request to XCBBuildService - var shouldForwardRequest = true - defer { - if shouldForwardRequest { - context.forwardRequest() - } - } - - func handleBazelTargets( - session: String, - handler: @escaping ( - _ environment: [String: String], - _ targets: [String: BazelBuild.Target], - _ xcodeBuildVersion: String - ) -> Void - ) { - guard let (environment, bazelTargetsFuture) = sessionBazelTargetsFutures[session] else { - logger.error("Bazel target mapping future not found for session “\(session)”") - return - } - - guard let (_, xcodeBuildVersionFuture) = sessionXcodeBuildVersionFutures[session] else { - logger.error("Xcode Build Version future not found for session “\(session)”") - return - } - - let future = bazelTargetsFuture.and(xcodeBuildVersionFuture) - - // We are handling this ourselves - shouldForwardRequest = false - - future.whenFailure { error in - // If we have a failure it means we should build with bazel, but we can't - // We need to report an error back - context.sendErrorResponse( - "[\(session)] Failed to parse targets for BazelXCBBuildService: \(error)", - request: request - ) - return - } - future.whenSuccess { bazelTargets, xcodeBuildVersion in - // If we don't have any mappings we forward the request - guard let bazelTargets = bazelTargets else { - context.forwardRequest() - return - } - - handler(environment, bazelTargets, xcodeBuildVersion) - } - } - - switch request.payload { - case let .createSession(message): - // We need to read the response to the request - shouldForwardRequest = false - - context.sendRequest(request).whenSuccess { response in - // Always send response back to Xcode - defer { - context.sendResponse(response) - } - - guard case let .sessionCreated(payload) = response.payload else { - logger.error("Expected SESSION_CREATED RPCResponse.Payload to CREATE_SESSION, instead got: \(response)") - return - } - - let session = payload.sessionHandle - - // Store the Xcode app path for later use in `CreateBuildRequest` - self.sessionAppPaths[session] = message.appPath - - // Store the PIF cache path for later use in `CreateBuildRequest` - self.sessionPIFCachePaths[session] = message.cachePath + "/PIFCache" - - let query = QueryXcodeVersion(appPath: message.appPath) - self.sessionXcodeBuildVersionFutures[session] = (query, query.start(eventLoop: context.eventLoop)) - } - - case let .transferSessionPIFRequest(message): - // Store `workspaceSignature` for later parsing in `CreateBuildRequest` - sessionWorkplaceSignatures[message.sessionHandle] = message.workspaceSignature - - case let .setSessionUserInfo(message): - // At this point the PIF cache will be populated soon, so generate the Bazel target mapping - let session = message.sessionHandle - - sessionBazelTargetsFutures[session] = nil - - if let future = generateSessionBazelTargets(context: context, session: session) { - guard let appPath = sessionAppPaths[session] else { - logger.error("Xcode app path not found for session “\(session)”") - return - } - - let developerDir = "\(appPath)/Contents/Developer" - - let environment = [ - "DEVELOPER_APPLICATIONS_DIR": "\(developerDir)/Applications", - "DEVELOPER_BIN_DIR": "\(developerDir)/usr/bin", - "DEVELOPER_DIR": developerDir, - "DEVELOPER_FRAMEWORKS_DIR": "\(developerDir)/Library/Frameworks", - "DEVELOPER_FRAMEWORKS_DIR_QUOTED": "\(developerDir)/Library/Frameworks", - "DEVELOPER_LIBRARY_DIR": "\(developerDir)/Library", - "DEVELOPER_TOOLS_DIR": "\(developerDir)/Tools", - "GID": String(message.gid), - "GROUP": message.group, - "HOME": message.home, - "UID": String(message.uid), - "USER": message.user, - ] - let baseEnvironment = message.buildSystemEnvironment.merging(environment) { _, new in new } - - sessionBazelTargetsFutures[session] = (baseEnvironment, future) - } - - case let .createBuildRequest(message): - let session = message.sessionHandle - - // Reset in case we decide not to build - sessionBazelBuilds[session]?.cancel() - sessionBazelBuilds[session] = nil - - handleBazelTargets(session: session) { baseEnvironment, bazelTargets, xcodeBuildVersion in - logger.trace("Parsed targets for BazelXCBBuildService: \(bazelTargets)") - - var desiredTargets: [BazelBuild.Target] = [] - for target in message.buildRequest.configuredTargets { - let guid = target.guid - - guard var bazelTarget = bazelTargets[guid] else { - context.sendErrorResponse( - "[\(session)] Parsed target not found for GUID “\(guid)”", - request: request - ) - return - } - - // TODO: Do this check after uniquing targets, to allow excluding of "Testing" modules as well - guard !BazelBuild.shouldSkipTarget(bazelTarget, buildRequest: message.buildRequest) else { - logger.info("Skipping target for Bazel build: \(bazelTarget.name)") - continue - } - - bazelTarget.parameters = target.parameters - - desiredTargets.append(bazelTarget) - } - - guard BazelBuild.shouldBuild(targets: desiredTargets, buildRequest: message.buildRequest) else { - // There were no bazel based targets, so we will build normally - context.forwardRequest() - return - } - - self.lastBazelBuildNumber -= 1 - let buildNumber = self.lastBazelBuildNumber - - let buildContext = BuildContext( - sendResponse: context.sendResponse, - session: session, - buildNumber: buildNumber, - responseChannel: message.responseChannel - ) - - do { - let build = try BazelBuild( - buildContext: buildContext, - environment: baseEnvironment, - xcodeBuildVersion: xcodeBuildVersion, - developerDir: baseEnvironment["DEVELOPER_DIR"]!, - buildRequest: message.buildRequest, - targets: desiredTargets - ) - - self.sessionBazelBuilds[session] = build - context.sendResponseMessage(BuildCreated(buildNumber: buildNumber), channel: request.channel) - } catch { - context.sendErrorResponse(error, session: session, request: request) - } - } - - case let .buildStartRequest(message): - let session = message.sessionHandle - - guard let build = sessionBazelBuilds[session] else { - return - } - - // We are handling this ourselves - shouldForwardRequest = false - - do { - try build.start { - context.sendResponseMessage(BoolResponse(true), channel: request.channel) - } - } catch { - context.sendErrorResponse(error, session: session, request: request) - } - - case let .buildCancelRequest(message): - let session = message.sessionHandle - - guard let build = sessionBazelBuilds[session] else { - return - } - - // We are handling this ourselves - shouldForwardRequest = false - - build.cancel() - - case let .previewInfoRequest(message): - let session = message.sessionHandle - - handleBazelTargets(session: session) { baseEnvironment, targets, xcodeBuildVersion in - do { - let response = try BazelBuild.previewInfo( - message, - targets: targets, - baseEnvironment: baseEnvironment, - xcodeBuildVersion: xcodeBuildVersion - ) - - context.sendResponseMessage(PingResponse(), channel: request.channel) - - context.sendResponseMessage(response, channel: message.responseChannel) - } catch BazelBuildError.dontBuildWithBazel { - // There were no bazel based targets, so we will build normally - context.forwardRequest() - } catch { - // Xcode doesn't really respond to errors 🤷‍♂️, but this will at least log something for us - context.sendErrorResponse(error, session: session, request: request) - } - } - - default: - // By default just forward the request - break - } - } -} - -extension RequestHandler { - private func decodeJSON( - _ type: T.Type, - context: Context, - filePath: String - ) -> EventLoopFuture where T: Decodable { - return fileIO.openFile(path: filePath, eventLoop: context.eventLoop).flatMap { [fileIO] fileHandle, region in - return fileIO.read( - fileRegion: region, - allocator: context.allocator, - eventLoop: context.eventLoop - ).flatMapThrowing { buffer in - defer { try? fileHandle.close() } - return try JSONDecoder().decode(T.self, from: Data(buffer.readableBytesView)) - } - } - } - - /// - Returns: `true` if we should build with Bazel. This future will never error. - private func shouldBuildWithBazel( - context: Context, - workspacePIFFuture: EventLoopFuture - ) -> EventLoopFuture { - return workspacePIFFuture.flatMap { [fileIO] pif in - let path = "\(pif.path)/xcshareddata/BazelXCBBuildServiceSettings.plist" - return fileIO.openFile(path: path, eventLoop: context.eventLoop) - .map { fileHandle, _ in - // Close the file, we just wanted to ensure it exists for now - // Later we might read the contents - try? fileHandle.close() - logger.debug("“\(path)” found. Building with Bazel.") - return true - }.recover { error in - logger.debug("“\(path)” could not be opened (\(error)). Not building with Bazel.") - return false - } - } - } - - /// - Returns: parsed projects or an error, if we should build with Bazel, or `nil` if we shouldn't. - private func generateSessionBazelTargets( - context: Context, - session: String - ) -> EventLoopFuture<[String: BazelBuild.Target]?>? { - guard let pifCachePath = sessionPIFCachePaths[session] else { - logger.error("PIF cache path not found for session “\(session)”") - return nil - } - - guard let workspaceSignature = sessionWorkplaceSignatures[session] else { - logger.error("Workspace signature not found for session “\(session)”") - return nil - } - - let path = "\(pifCachePath)/workspace/\(workspaceSignature)-json" - let workspacePIFFuture = decodeJSON( - WorkspacePIF.self, - context: context, - filePath: path - ) - - workspacePIFFuture.whenFailure { error in - logger.error("Failed to decode workspace PIF “\(path)”: \(error)") - } - - return shouldBuildWithBazel( - context: context, - workspacePIFFuture: workspacePIFFuture - ).flatMap { shouldBuildWithBazel in - guard shouldBuildWithBazel else { return context.eventLoop.makeSucceededFuture(nil) } - - return workspacePIFFuture.map { pif in - pif.projects.map { self.processPIFProject(cachePath: pifCachePath, signature: $0, context: context) } - }.flatMap { futures in - EventLoopFuture.reduce(into: [:], futures, on: context.eventLoop) { targetMappings, projectTargets in - for case let projectTarget in projectTargets { - targetMappings[projectTarget.xcodeGUID] = projectTarget - } - } - }.map { .some($0) } - } - } - - private func processPIFProject( - cachePath: String, - signature: String, - context: Context - ) -> EventLoopFuture<[BazelBuild.Target]> { - let path = "\(cachePath)/project/\(signature)-json" - return decodeJSON(ProjectPIF.self, context: context, filePath: path).flatMap { pif in - let project = BazelBuild.Project( - name: pif.name, - path: pif.path, - projectDirectory: pif.projectDirectory, - isPackage: pif.isPackage, - buildConfigurations: pif.buildConfigurations.reduce(into: [:]) { $0[$1.name] = $1.buildSettings } - ) - - return EventLoopFuture.whenAllSucceed( - pif.targets.map { - self.processPIFTarget(cachePath: cachePath, signature: $0, project: project, context: context) - }, - on: context.eventLoop - ) - } - } - - private func processPIFTarget( - cachePath: String, - signature: String, - project: BazelBuild.Project, - context: Context - ) -> EventLoopFuture { - let path = "\(cachePath)/target/\(signature)-json" - return decodeJSON(TargetPIF.self, context: context, filePath: path).map { pif in - return BazelBuild.Target( - name: pif.name, - xcodeGUID: pif.guid, - project: project, - productTypeIdentifier: pif.productTypeIdentifier, - buildConfigurations: pif.buildConfigurations.reduce(into: [:]) { $0[$1.name] = $1.buildSettings } - ) - } - } -} diff --git a/Examples/BazelXCBBuildService/Sources/main.swift b/Examples/BazelXCBBuildService/Sources/main.swift deleted file mode 100644 index a7a65b3..0000000 --- a/Examples/BazelXCBBuildService/Sources/main.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation -import Logging -import NIO -import XCBBuildServiceProxyKit - -LoggingSystem.bootstrap { label in - var handler = StreamLogHandler.standardError(label: label) - - let logLevel: Logger.Level - switch ProcessInfo.processInfo.environment["BAZELXCBBUILDSERVICE_LOGLEVEL"]?.lowercased() { - case "debug": logLevel = .debug - case "trace": logLevel = .trace - default: logLevel = .info - } - - handler.logLevel = logLevel - return handler -} - -let logger = Logger(label: "BazelXCBBuildService") - -let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount) - -let threadPool = NIOThreadPool(numberOfThreads: System.coreCount) -threadPool.start() - -let fileIO = NonBlockingFileIO(threadPool: threadPool) - -do { - let service = try HybridXCBBuildService( - name: "BazelXCBBuildService", - group: group, - requestHandler: RequestHandler(fileIO: fileIO) - ) - - do { - let channel = try service.start() - try channel.closeFuture.wait() - } catch { - logger.error("\(error)") - } - - service.stop() -} catch { - logger.critical("\(error)") -} diff --git a/Examples/BazelXCBBuildService/integration_tests.sh b/Examples/BazelXCBBuildService/integration_tests.sh deleted file mode 100755 index fe680d9..0000000 --- a/Examples/BazelXCBBuildService/integration_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -# --- begin runfiles.bash initialization --- -if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - if [[ -f "$0.runfiles_manifest" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" - elif [[ -f "$0.runfiles/MANIFEST" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" - elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - export RUNFILES_DIR="$0.runfiles" - fi -fi -if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" -elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ - "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" -else - echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" - exit 1 -fi -# --- end runfiles.bash initialization --- - -# Ensure that it can start without crashing -echo "" | "$(rlocation $TEST_WORKSPACE/BazelXCBBuildService/BazelXCBBuildService)" diff --git a/Examples/BazelXCBBuildService/write_shim.sh b/Examples/BazelXCBBuildService/write_shim.sh deleted file mode 100755 index 15cdcac..0000000 --- a/Examples/BazelXCBBuildService/write_shim.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -readonly service_path="$1" -readonly output_path="$2" -readonly xcode_version="$3" -readonly log_base="${4:-"/tmp/Bazel-trace/XCBBuildService-$xcode_version"}" - -cat <<-END > "$output_path" -#!/bin/bash - -set -euo pipefail - -readonly original_service_path="\${BASH_SOURCE[0]}.original" -readonly replacement_service_path="$service_path" - -if [ -s "\$replacement_service_path" ]; then - # Use the version installed next to it - readonly default_log_level=debug - readonly service="\${ACTUAL_XCBBUILDSERVICE_PATH:-"\$replacement_service_path"}" -else - # Otherwise, call the original - readonly default_log_level=info - readonly service="\${ACTUAL_XCBBUILDSERVICE_PATH:-"\$original_service_path"}" -fi - -export BAZELXCBBUILDSERVICE_LOGLEVEL=\${BAZELXCBBUILDSERVICE_LOGLEVEL:-\$default_log_level} - -if [ -s "$log_base.err.log" ]; then - /bin/cp -f "$log_base.err.log" "$log_base.err.last.log" || true -fi - -/bin/mkdir -p "$(dirname "$log_base")" -if [ "\${BAZELXCBBUILDSERVICE_CAPTURE_IO:-}" != "" ]; then - if [ -s "$log_base.in" ]; then - /bin/cp -f "$log_base.in" "$log_base.last.in" || true - fi - if [ -s "$log_base.out" ]; then - /bin/cp -f "$log_base.out" "$log_base.last.out" || true - fi - - /usr/bin/tee "$log_base.in" | "\$service" 2> "$log_base.err.log" | /usr/bin/tee "$log_base.out" -else - "\$service" 2> "$log_base.err.log" -fi -END - -chmod +x "$output_path" diff --git a/Examples/BazelXCBBuildService/write_shim_tests.sh b/Examples/BazelXCBBuildService/write_shim_tests.sh deleted file mode 100755 index 5740013..0000000 --- a/Examples/BazelXCBBuildService/write_shim_tests.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -# --- begin runfiles.bash initialization --- -if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - if [[ -f "$0.runfiles_manifest" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" - elif [[ -f "$0.runfiles/MANIFEST" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" - elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - export RUNFILES_DIR="$0.runfiles" - fi -fi -if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" -elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ - "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" -else - echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" - exit 1 -fi -# --- end runfiles.bash initialization --- - -readonly stub="$TEST_UNDECLARED_OUTPUTS_DIR/stub" -readonly output="$TEST_UNDECLARED_OUTPUTS_DIR/output" -readonly log_base="$TEST_UNDECLARED_OUTPUTS_DIR/log/stub" - -readonly stdout="$TEST_UNDECLARED_OUTPUTS_DIR/stdout" -readonly stderr="$TEST_UNDECLARED_OUTPUTS_DIR/stderr" -readonly err_log="$log_base.err.log" -readonly traced_in="$log_base.in" -readonly traced_out="$log_base.out" - -# Create stub executable -cat <<-END > "$stub" -#!/bin/bash - -echo "Hello, stdout!" -echo >&2 "Hello, stderr!" -END - -chmod +x "$stub" - -# Execute -"$(rlocation $TEST_WORKSPACE/BazelXCBBuildService/write_shim.sh)" "$stub" "$output" "11.6" "$log_base" - -# Ensure that the shim runs -echo "Hello, stdin!" | "$output" > "$stdout" 2> "$stderr" - -echo "Hello, stdout!" | cmp "$stdout" - -echo "Hello, stderr!" | cmp "$err_log" - -[ ! -s "$stderr" ] -[ ! -s "$traced_in" ] -[ ! -s "$traced_out" ] - -# Ensure that tracing works -echo "Hello, stdin!" | env BAZELXCBBUILDSERVICE_CAPTURE_IO=true "$output" > "$stdout" 2> "$stderr" - -echo "Hello, stdout!" | cmp "$stdout" - -echo "Hello, stderr!" | cmp "$err_log" - -[ ! -s "$stderr" ] -echo "Hello, stdin!" | cmp "$traced_in" - -echo "Hello, stdout!" | cmp "$traced_out" - diff --git a/Examples/WORKSPACE b/Examples/WORKSPACE deleted file mode 100644 index 2541048..0000000 --- a/Examples/WORKSPACE +++ /dev/null @@ -1,54 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "com_github_buildbuddy_io_rules_xcodeproj", - sha256 = "728cb6089ad2f4c4de2003ce23462be662bfdd250a8735dc590e61fb7401e7d2", - url = "https://github.com/buildbuddy-io/rules_xcodeproj/releases/download/0.5.0/release.tar.gz", -) - -load( - "@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:repositories.bzl", - "xcodeproj_rules_dependencies", -) - -xcodeproj_rules_dependencies() - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:extras.bzl", - "swift_rules_extra_dependencies", -) - -swift_rules_extra_dependencies() - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() - -local_repository( - name = "com_github_mobilenativefoundation_xcbbuildserviceproxykit", - path = "../", -) - -load( - "@com_github_mobilenativefoundation_xcbbuildserviceproxykit//:repositories.bzl", - "xcbbuildserviceproxykit_dependencies", -) - -xcbbuildserviceproxykit_dependencies() diff --git a/LICENSE b/LICENSE index 632fdb0..fb8d3bc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,5 @@ -Copyright (C) 2020 Target Brands, Inc. +Copyright (C) 2023-present Mobile Native Foundation +Copyright (C) 2020-2022 Target Brands, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index d2e710b..6d986f9 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,5 @@ # XCBBuildServiceProxyKit XCBBuildServiceProxyKit is a framework that enables you to write a proxy for -Xcode's XCBBuildService, which enables you to extend or replace Xcode's build +Xcode’s XCBBuildService, which enables you to extend or replace Xcode’s build system. - -## Usage - -Check out the [Examples](Examples/). - -## Future Improvements - -- [ ] Add tests -- [ ] Use `Codable` for XCBProtocol parsing -- [ ] Use [Swift Service Lifecycle](https://github.com/swift-server/swift-service-lifecycle) - -## Updating to Support New Xcode Versions - -Check out [our guide](Docs/UPDATING.md). - -## Recognition - -- [jerrymarino/xcbuildkit](https://github.com/jerrymarino/xcbuildkit) for - initial inspiration -- [a2/MessagePack.swift](https://github.com/a2/MessagePack.swift) for starting - point of MessagePack parsing diff --git a/Sources/BUILD b/Sources/BUILD deleted file mode 100644 index e69de29..0000000 diff --git a/Sources/MessagePack/BUILD b/Sources/MessagePack/BUILD deleted file mode 100644 index 65c2b2f..0000000 --- a/Sources/MessagePack/BUILD +++ /dev/null @@ -1,11 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "MessagePack", - srcs = glob(["**/*.swift"]), - module_name = "MessagePack", - visibility = [ - "//Sources:__subpackages__", - "//Tests:__subpackages__", - ], -) diff --git a/Sources/MessagePack/LICENSE b/Sources/MessagePack/LICENSE deleted file mode 100644 index 37571bf..0000000 --- a/Sources/MessagePack/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Alexsander Akers - -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. diff --git a/Sources/MessagePack/LiteralConvertibles.swift b/Sources/MessagePack/LiteralConvertibles.swift deleted file mode 100644 index e8e85a7..0000000 --- a/Sources/MessagePack/LiteralConvertibles.swift +++ /dev/null @@ -1,46 +0,0 @@ -extension MessagePackValue: ExpressibleByArrayLiteral { - public init(arrayLiteral elements: MessagePackValue...) { - self = .array(elements) - } -} - -extension MessagePackValue: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = .bool(value) - } -} - -extension MessagePackValue: ExpressibleByDictionaryLiteral { - public init(dictionaryLiteral elements: (MessagePackValue, MessagePackValue)...) { - var dict = [MessagePackValue: MessagePackValue](minimumCapacity: elements.count) - for (key, value) in elements { - dict[key] = value - } - - self = .map(dict) - } -} - -extension MessagePackValue: ExpressibleByExtendedGraphemeClusterLiteral { - public init(extendedGraphemeClusterLiteral value: String) { - self = .string(value) - } -} - -extension MessagePackValue: ExpressibleByNilLiteral { - public init(nilLiteral: ()) { - self = .nil - } -} - -extension MessagePackValue: ExpressibleByStringLiteral { - public init(stringLiteral value: String) { - self = .string(value) - } -} - -extension MessagePackValue: ExpressibleByUnicodeScalarLiteral { - public init(unicodeScalarLiteral value: String) { - self = .string(value) - } -} diff --git a/Sources/MessagePack/MessagePack.swift b/Sources/MessagePack/MessagePack.swift deleted file mode 100644 index 5fddc3b..0000000 --- a/Sources/MessagePack/MessagePack.swift +++ /dev/null @@ -1,62 +0,0 @@ -import Foundation - -public enum MessagePackValue: Equatable, Hashable { - case `nil` - case bool(Bool) - case int8(Int8) - case int16(Int16) - case int32(Int32) - case int64(Int64) - case uint8(UInt8) - case uint16(UInt16) - case uint32(UInt32) - case uint64(UInt64) - case float(Float) - case double(Double) - case string(String) - case binary(Data) - case array([MessagePackValue]) - case map([MessagePackValue: MessagePackValue]) - case extended(Int8, Data) -} - -extension MessagePackValue: CustomStringConvertible { - public var description: String { - switch self { - case .nil: - return "nil" - case .bool(let value): - return "bool(\(value))" - case .int8(let value): - return "int8(\(value))" - case .int16(let value): - return "int16(\(value))" - case .int32(let value): - return "int32(\(value))" - case .int64(let value): - return "int64(\(value))" - case .uint8(let value): - return "uint8(\(value))" - case .uint16(let value): - return "uint16(\(value))" - case .uint32(let value): - return "uint32(\(value))" - case .uint64(let value): - return "uint64(\(value))" - case .float(let value): - return "float(\(value))" - case .double(let value): - return "double(\(value))" - case .string(let string): - return "string(\(string))" - case .binary(let data): - return "data(\(data))" - case .array(let array): - return "array(\(array.description))" - case .map(let dict): - return "map(\(dict.description))" - case .extended(let type, let data): - return "extended(\(type), \(data))" - } - } -} diff --git a/Sources/MessagePack/Pack.swift b/Sources/MessagePack/Pack.swift deleted file mode 100644 index 757f6a3..0000000 --- a/Sources/MessagePack/Pack.swift +++ /dev/null @@ -1,169 +0,0 @@ -import Foundation - -extension MessagePackValue { - /// Packs an integer into a byte array. - /// - /// - parameter value: The integer to split. - /// - parameter parts: The number of bytes into which to split. - /// - /// - returns: An byte array representation. - static func packInteger(_ value: UInt64, parts: Int) -> Data { - precondition(parts > 0) - let bytes = stride(from: 8 * (parts - 1), through: 0, by: -8).map { shift in - return UInt8(truncatingIfNeeded: value >> UInt64(shift)) - } - return Data(bytes) - } - - /// Packs a `MessagePackValue` into an array of bytes. - /// - /// - parameter value: The value to encode - /// - /// - returns: A MessagePack byte representation. - static func pack(_ value: MessagePackValue) -> Data { - switch value { - case .nil: - return Data([0xc0]) - - case .bool(let value): - return Data([value ? 0xc3 : 0xc2]) - - case .int8(let value): - if value < 0 && value >= -0x20 { - // negative fixnum - return Data([0xe0 + 0x1f & UInt8(truncatingIfNeeded: value)]) - } else { - return Data([0xd0, UInt8(bitPattern: value)]) - } - - case .int16(let value): - return Data([0xd1]) + packInteger(UInt64(bitPattern: Int64(value)), parts: 2) - - case .int32(let value): - return Data([0xd2]) + packInteger(UInt64(bitPattern: Int64(value)), parts: 4) - - case .int64(let value): - return Data([0xd3]) + packInteger(UInt64(bitPattern: Int64(value)), parts: 8) - - case .uint8(let value): - if value <= 0x7f { - // positive fixnum - return Data([value]) - } else { - return Data([0xcc, value]) - } - - case .uint16(let value): - return Data([0xcd]) + packInteger(UInt64(value), parts: 2) - - case .uint32(let value): - return Data([0xce]) + packInteger(UInt64(value), parts: 4) - - case .uint64(let value): - return Data([0xcf]) + packInteger(value, parts: 8) - - case .float(let value): - return Data([0xca]) + packInteger(UInt64(value.bitPattern), parts: 4) - - case .double(let value): - return Data([0xcb]) + packInteger(value.bitPattern, parts: 8) - - case .string(let string): - let utf8 = string.utf8 - let count = UInt32(utf8.count) - precondition(count <= 0xffff_ffff as UInt32) - - let prefix: Data - if count <= 0x1f { - prefix = Data([0xa0 | UInt8(count)]) - } else if count <= 0xff { - prefix = Data([0xd9, UInt8(count)]) - } else if count <= 0xffff { - prefix = Data([0xda]) + packInteger(UInt64(count), parts: 2) - } else { - prefix = Data([0xdb]) + packInteger(UInt64(count), parts: 4) - } - - return prefix + utf8 - - case .binary(let data): - let count = UInt32(data.count) - precondition(count <= 0xffff_ffff as UInt32) - - let prefix: Data - if count <= 0xff { - prefix = Data([0xc4, UInt8(count)]) - } else if count <= 0xffff { - prefix = Data([0xc5]) + packInteger(UInt64(count), parts: 2) - } else { - prefix = Data([0xc6]) + packInteger(UInt64(count), parts: 4) - } - - return prefix + data - - case .array(let array): - let count = UInt32(array.count) - precondition(count <= 0xffff_ffff as UInt32) - - let prefix: Data - if count <= 0xf { - prefix = Data([0x90 | UInt8(count)]) - } else if count <= 0xffff { - prefix = Data([0xdc]) + packInteger(UInt64(count), parts: 2) - } else { - prefix = Data([0xdd]) + packInteger(UInt64(count), parts: 4) - } - - return prefix + array.flatMap(pack) - - case .map(let dict): - let count = UInt32(dict.count) - precondition(count < 0xffff_ffff) - - var prefix: Data - if count <= 0xf { - prefix = Data([0x80 | UInt8(count)]) - } else if count <= 0xffff { - prefix = Data([0xde]) + packInteger(UInt64(count), parts: 2) - } else { - prefix = Data([0xdf]) + packInteger(UInt64(count), parts: 4) - } - - return prefix + dict.flatMap { [$0, $1] }.flatMap(pack) - - case .extended(let type, let data): - let count = UInt32(data.count) - precondition(count <= 0xffff_ffff as UInt32) - - let unsignedType = UInt8(bitPattern: type) - var prefix: Data - switch count { - case 1: - prefix = Data([0xd4, unsignedType]) - case 2: - prefix = Data([0xd5, unsignedType]) - case 4: - prefix = Data([0xd6, unsignedType]) - case 8: - prefix = Data([0xd7, unsignedType]) - case 16: - prefix = Data([0xd8, unsignedType]) - case let count where count <= 0xff: - prefix = Data([0xc7, UInt8(count), unsignedType]) - case let count where count <= 0xffff: - prefix = Data([0xc8]) + packInteger(UInt64(count), parts: 2) + Data([unsignedType]) - default: - prefix = Data([0xc9]) + packInteger(UInt64(count), parts: 4) + Data([unsignedType]) - } - - return prefix + data - } - } - - /// Packs the `MessagePackValue` into an array of bytes. - /// - /// - returns: A MessagePack byte representation. - public func pack() -> Data { - return Self.pack(self) - } -} diff --git a/Sources/MessagePack/README.md b/Sources/MessagePack/README.md deleted file mode 100644 index 285372a..0000000 --- a/Sources/MessagePack/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# MessagePack - -This [MessagePack](https://msgpack.org) implementation is based on the wonderful work of [https://github.com/a2/MessagePack.swift](https://github.com/a2/MessagePack.swift). - -We are using a fork because XCBBuildService requires fixed size integers (i.e. `.int64` versus `.int`). After forking we also modified it to tightly integrate with the way it was being used. diff --git a/Sources/MessagePack/Subdata.swift b/Sources/MessagePack/Subdata.swift deleted file mode 100644 index 7dec71f..0000000 --- a/Sources/MessagePack/Subdata.swift +++ /dev/null @@ -1,54 +0,0 @@ -import Foundation - -public struct Subdata: RandomAccessCollection { - let base: Data - let baseStartIndex: Int - let baseEndIndex: Int - - public init(data: Data, startIndex: Int = 0) { - self.init(data: data, startIndex: startIndex, endIndex: data.endIndex) - } - - public init(data: Data, startIndex: Int, endIndex: Int) { - self.base = data - self.baseStartIndex = startIndex - self.baseEndIndex = endIndex - } - - public var startIndex: Int { - return 0 - } - - public var endIndex: Int { - return baseEndIndex - baseStartIndex - } - - public var count: Int { - return endIndex - startIndex - } - - public var isEmpty: Bool { - return baseStartIndex == baseEndIndex - } - - public subscript(index: Int) -> UInt8 { - return base[baseStartIndex + index] - } - - public func index(before i: Int) -> Int { - return i - 1 - } - - public func index(after i: Int) -> Int { - return i + 1 - } - - public subscript(bounds: Range) -> Subdata { - precondition(baseStartIndex + bounds.upperBound <= baseEndIndex) - return Subdata(data: base, startIndex: baseStartIndex + bounds.lowerBound, endIndex: baseStartIndex + bounds.upperBound) - } - - public var data: Data { - return base.subdata(in: baseStartIndex ..< baseEndIndex) - } -} diff --git a/Sources/MessagePack/Unpack.swift b/Sources/MessagePack/Unpack.swift deleted file mode 100644 index 990386f..0000000 --- a/Sources/MessagePack/Unpack.swift +++ /dev/null @@ -1,309 +0,0 @@ -// -// swiftlint:disable empty_count -// - -import Foundation - -extension MessagePackValue { - /// Joins bytes to form an integer. - /// - /// - parameter data: The input data to unpack. - /// - parameter size: The size of the integer. - /// - /// - returns: An integer representation of `size` bytes of data and the not-unpacked remaining data. - static func unpackInteger(_ data: Subdata, count: Int) throws -> (value: UInt64, remainder: Subdata) { - guard count > 0 else { - throw MessagePackUnpackError.invalidArgument - } - - guard data.count >= count else { - throw MessagePackUnpackError.insufficientData - } - - var value: UInt64 = 0 - for i in 0 ..< count { - let byte = data[i] - value = value << 8 | UInt64(byte) - } - - return (value, data[count ..< data.count]) - } - - /// Joins bytes to form a string. - /// - /// - parameter data: The input data to unpack. - /// - parameter length: The length of the string. - /// - /// - returns: A string representation of `size` bytes of data and the not-unpacked remaining data. - static func unpackString(_ data: Subdata, count: Int) throws -> (value: String, remainder: Subdata) { - guard count > 0 else { - return ("", data) - } - - guard data.count >= count else { - throw MessagePackUnpackError.insufficientData - } - - let subdata = data[0 ..< count] - guard let result = String(data: subdata.data, encoding: .utf8) else { - throw MessagePackUnpackError.invalidData - } - - return (result, data[count ..< data.count]) - } - - /// Joins bytes to form a data object. - /// - /// - parameter data: The input data to unpack. - /// - parameter length: The length of the data. - /// - /// - returns: A subsection of data representing `size` bytes and the not-unpacked remaining data. - static func unpackData(_ data: Subdata, count: Int) throws -> (value: Subdata, remainder: Subdata) { - guard data.count >= count else { - throw MessagePackUnpackError.insufficientData - } - - return (data[0 ..< count], data[count ..< data.count]) - } - - /// Joins bytes to form an array of `MessagePackValue` values. - /// - /// - parameter data: The input data to unpack. - /// - parameter count: The number of elements to unpack. - /// - /// - returns: An array of `count` elements and the not-unpacked remaining data. - static func unpackArray(_ data: Subdata, count: Int) throws -> (value: [MessagePackValue], remainder: Subdata) { - var values = [MessagePackValue]() - var remainder = data - var newValue: MessagePackValue - - for _ in 0 ..< count { - (newValue, remainder) = try unpack(remainder) - values.append(newValue) - } - - return (values, remainder) - } - - /// Joins bytes to form a dictionary with `MessagePackValue` key/value entries. - /// - /// - parameter data: The input data to unpack. - /// - parameter count: The number of elements to unpack. - /// - /// - returns: A dictionary of `count` entries and the not-unpacked remaining data. - static func unpackMap(_ data: Subdata, count: Int) throws -> (value: [MessagePackValue: MessagePackValue], remainder: Subdata) { - var dict = [MessagePackValue: MessagePackValue](minimumCapacity: count) - var lastKey: MessagePackValue? - - let (array, remainder) = try unpackArray(data, count: 2 * count) - for item in array { - if let key = lastKey { - dict[key] = item - lastKey = nil - } else { - lastKey = item - } - } - - return (dict, remainder) - } - - /// Unpacks data into a `MessagePackValue` and returns the remaining data. - /// - /// - parameter data: The input data to unpack. - /// - /// - returns: A `MessagePackValue`and the not-unpacked remaining data. - static func unpack(_ data: Subdata) throws -> (value: MessagePackValue, remainder: Subdata) { - guard !data.isEmpty else { - throw MessagePackUnpackError.insufficientData - } - - let value = data[0] - let data = data[1 ..< data.endIndex] - - switch value { - // positive fixint - case 0x00 ... 0x7f: - return (.uint8(UInt8(value)), data) - - // fixmap - case 0x80 ... 0x8f: - let count = Int(value - 0x80) - let (dict, remainder) = try unpackMap(data, count: count) - return (.map(dict), remainder) - - // fixarray - case 0x90 ... 0x9f: - let count = Int(value - 0x90) - let (array, remainder) = try unpackArray(data, count: count) - return (.array(array), remainder) - - // fixstr - case 0xa0 ... 0xbf: - let count = Int(value - 0xa0) - let (string, remainder) = try unpackString(data, count: count) - return (.string(string), remainder) - - // nil - case 0xc0: - return (.nil, data) - - // false - case 0xc2: - return (.bool(false), data) - - // true - case 0xc3: - return (.bool(true), data) - - // bin 8, 16, 32 - case 0xc4 ... 0xc6: - let intCount = 1 << Int(value - 0xc4) - let (dataCount, remainder1) = try unpackInteger(data, count: intCount) - let (subdata, remainder2) = try unpackData(remainder1, count: Int(dataCount)) - return (.binary(subdata.data), remainder2) - - // ext 8, 16, 32 - case 0xc7 ... 0xc9: - let intCount = 1 << Int(value - 0xc7) - - let (dataCount, remainder1) = try unpackInteger(data, count: intCount) - guard !remainder1.isEmpty else { - throw MessagePackUnpackError.insufficientData - } - - let type = Int8(bitPattern: remainder1[0]) - let (subdata, remainder2) = try unpackData(remainder1[1 ..< remainder1.count], count: Int(dataCount)) - return (.extended(type, subdata.data), remainder2) - - // float 32 - case 0xca: - let (intValue, remainder) = try unpackInteger(data, count: 4) - let float = Float(bitPattern: UInt32(truncatingIfNeeded: intValue)) - return (.float(float), remainder) - - // float 64 - case 0xcb: - let (intValue, remainder) = try unpackInteger(data, count: 8) - let double = Double(bitPattern: intValue) - return (.double(double), remainder) - - // uint 8 - case 0xcc: - let integer = data[0] - return (.uint8(integer), data[1 ..< data.count]) - - // uint 16 - case 0xcd: - let (bytes, remainder) = try unpackInteger(data, count: 2) - let integer = UInt16(truncatingIfNeeded: bytes) - return (.uint16(integer), remainder) - - // uint 32 - case 0xce: - let (bytes, remainder) = try unpackInteger(data, count: 4) - let integer = UInt32(truncatingIfNeeded: bytes) - return (.uint32(integer), remainder) - - // uint 64 - case 0xcf: - let (integer, remainder) = try unpackInteger(data, count: 8) - return (.uint64(integer), remainder) - - // int 8 - case 0xd0: - guard !data.isEmpty else { - throw MessagePackUnpackError.insufficientData - } - - let byte = Int8(bitPattern: data[0]) - return (.int8(byte), data[1 ..< data.count]) - - // int 16 - case 0xd1: - let (bytes, remainder) = try unpackInteger(data, count: 2) - let integer = Int16(bitPattern: UInt16(truncatingIfNeeded: bytes)) - return (.int16(integer), remainder) - - // int 32 - case 0xd2: - let (bytes, remainder) = try unpackInteger(data, count: 4) - let integer = Int32(bitPattern: UInt32(truncatingIfNeeded: bytes)) - return (.int32(integer), remainder) - - // int 64 - case 0xd3: - let (bytes, remainder) = try unpackInteger(data, count: 8) - let integer = Int64(bitPattern: bytes) - return (.int64(integer), remainder) - - // fixent 1, 2, 4, 8, 16 - case 0xd4 ... 0xd8: - let count = 1 << Int(value - 0xd4) - - guard !data.isEmpty else { - throw MessagePackUnpackError.insufficientData - } - - let type = Int8(bitPattern: data[0]) - let (subdata, remainder) = try unpackData(data[1 ..< data.count], count: count) - return (.extended(type, subdata.data), remainder) - - // str 8, 16, 32 - case 0xd9 ... 0xdb: - let countSize = 1 << Int(value - 0xd9) - let (count, remainder1) = try unpackInteger(data, count: countSize) - let (string, remainder2) = try unpackString(remainder1, count: Int(count)) - return (.string(string), remainder2) - - // array 16, 32 - case 0xdc ... 0xdd: - let countSize = 1 << Int(value - 0xdb) - let (count, remainder1) = try unpackInteger(data, count: countSize) - let (array, remainder2) = try unpackArray(remainder1, count: Int(count)) - return (.array(array), remainder2) - - // map 16, 32 - case 0xde ... 0xdf: - let countSize = 1 << Int(value - 0xdd) - let (count, remainder1) = try unpackInteger(data, count: countSize) - let (dict, remainder2) = try unpackMap(remainder1, count: Int(count)) - return (.map(dict), remainder2) - - // negative fixint - case 0xe0 ..< 0xff: - return (.int8(Int8(Int64(value) - 0x100)), data) - - // negative fixint (workaround for rdar://19779978) - case 0xff: - return (.int8(Int8(Int64(value) - 0x100)), data) - - default: - throw MessagePackUnpackError.invalidData - } - } - - /// Unpacks a data object into an array of `MessagePackValue` values. - /// - /// - parameter data: The data to unpack. - /// - /// - returns: The contained `MessagePackValue` values. - public static func unpackAll(_ data: Data) throws -> [MessagePackValue] { - var values = [MessagePackValue]() - - var data = Subdata(data: data) - while !data.isEmpty { - let value: MessagePackValue - (value, data) = try unpack(data) - values.append(value) - } - - return values - } -} - -public enum MessagePackUnpackError: Error { - case invalidArgument - case insufficientData - case invalidData -} diff --git a/Sources/XCBBuildServiceProxyKit/BUILD b/Sources/XCBBuildServiceProxyKit/BUILD deleted file mode 100644 index a29dd91..0000000 --- a/Sources/XCBBuildServiceProxyKit/BUILD +++ /dev/null @@ -1,13 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBBuildServiceProxyKit", - srcs = glob(["**/*.swift"]), - module_name = "XCBBuildServiceProxyKit", - deps = [ - "//Sources/XCBProtocol", - "@com_github_apple_swift_log//:Logging", - "@com_github_apple_swift_nio//:NIO", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBBuildServiceProxyKit/BuildContext.swift b/Sources/XCBBuildServiceProxyKit/BuildContext.swift deleted file mode 100644 index 7ce5bd1..0000000 --- a/Sources/XCBBuildServiceProxyKit/BuildContext.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation -import Logging -import XCBProtocol - -/// A helper object that allows processes to send responses for a specific build. -/// -/// An instance of this will be created for each build created. -public final class BuildContext { - public let session: String - public let buildNumber: Int64 - - private let responseChannel: UInt64 - private let sendResponse: (RPCResponse) -> Void - - public init( - sendResponse: @escaping (RPCResponse) -> Void, - session: String, - buildNumber: Int64, - responseChannel: UInt64 - ) { - self.session = session - self.buildNumber = buildNumber - self.responseChannel = responseChannel - self.sendResponse = sendResponse - } - - public func sendResponseMessage(_ payloadConvertible: PayloadConvertible) where - PayloadConvertible: ResponsePayloadConvertible, - PayloadConvertible.Payload == ResponsePayload { - sendResponse(RPCResponse(channel: responseChannel, payload: payloadConvertible.toResponsePayload())) - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridRPCRequestHandler.swift b/Sources/XCBBuildServiceProxyKit/Hybrid/HybridRPCRequestHandler.swift deleted file mode 100644 index a41abe8..0000000 --- a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridRPCRequestHandler.swift +++ /dev/null @@ -1,107 +0,0 @@ -import Foundation -import Logging -import NIO -import os -import XCBProtocol - -// swiftlint:disable opening_brace - -final class HybridRPCRequestHandler: ChannelDuplexHandler { - public typealias InboundIn = RPCRequest // From Xcode - - public typealias OutboundIn = RPCResponse // From XCBBuildService - public typealias OutboundOut = RPCResponse // To Xcode - - typealias Request = InboundIn - typealias Response = OutboundIn - - private let xcbBuildService: XCBBuildService - private let requestHandler: RequestHandler - - private var responsePromises: [UInt64: EventLoopPromise] = [:] - - init(xcbBuildService: XCBBuildService, requestHandler: RequestHandler) { - self.xcbBuildService = xcbBuildService - self.requestHandler = requestHandler - } - - func channelActive(context: ChannelHandlerContext) { - // Register the response channel on the XCBBuildService channel - xcbBuildService.channel.triggerUserOutboundEvent( - ProxiedRPCRequestHandlerEvent.registerResponseChannel(context.channel), - promise: nil - ) - - context.fireChannelActive() - } - - func channelRead(context: ChannelHandlerContext, data: NIOAny) { - // Here we are receiving a request from Xcode - let request = unwrapInboundIn(data) - - os_log(.debug, "Received RPCRequest from Xcode: \(request)") - - // Start the proxied XCBBuildService if needed - if let xcodePath = request.payload.createSessionXcodePath { - xcbBuildService.startIfNeeded(xcodePath: xcodePath) - } - - let requestHandlerContext = HybridXCBBuildServiceRequestHandlerContext( - eventLoop: context.eventLoop, - allocator: context.channel.allocator, - forwardRequest: { self.sendRequest(request, context: context, promise: nil) }, - sendRequest: { self.sendRequest($0, context: context) }, - sendResponse: { response in - // Ensure we are on the right event loop - if context.eventLoop.inEventLoop { - self.sendResponse(response, context: context) - } else { - context.eventLoop.execute { - self.sendResponse(response, context: context) - } - } - } - ) - - requestHandler.handleRequest(request, context: requestHandlerContext) - } - - func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise?) { - // Here we are receiving a response from XCBBuildService - let response = unwrapOutboundIn(data) - - // Return a result for `sendRequest()` - if let promise = responsePromises.removeValue(forKey: response.channel) { - os_log(.debug, "Received RPCResponse from XCBBuildService: \(response)") - promise.succeed(response) - } else { - // Unknown channel, because of event stream or forwarded request - // Just forward it back to Xcode - os_log(.debug, "Received RPCResponse from XCBBuildService and sending to Xcode: \(response)") - context.writeAndFlush(data, promise: promise) - } - } - - private func sendRequest(_ request: Request, context: ChannelHandlerContext, promise: EventLoopPromise?) { - if let promise = promise { - responsePromises[request.channel] = promise - } - - os_log(.debug, "Sending RPCRequest to XCBBuildService: \(request)") - - xcbBuildService.channel.writeAndFlush(request, promise: nil) - } - - private func sendRequest(_ request: Request, context: ChannelHandlerContext) -> EventLoopFuture { - let promise = context.eventLoop.makePromise(of: Response.self) - - sendRequest(request, context: context, promise: promise) - - return promise.futureResult - } - - private func sendResponse(_ response: Response, context: ChannelHandlerContext) { - os_log(.debug, "Sending RPCResponse to Xcode: \(response)") - context.writeAndFlush(wrapOutboundOut(response), promise: nil) - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildService.swift b/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildService.swift deleted file mode 100644 index 39856e0..0000000 --- a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildService.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Foundation -import NIO -import os -import XCBProtocol - -public final class HybridXCBBuildService { - private let name: String - private let group: EventLoopGroup - private let bootstrap: NIOPipeBootstrap - - // TODO: Move NIO specific stuff into class - public init(name: String, group: EventLoopGroup, requestHandler: RequestHandler) throws { - self.name = name - self.group = group - - let xcbBuildServiceBootstrap = XCBBuildServiceBootstrap(group: group) - - let xcbBuildServiceFuture = xcbBuildServiceBootstrap.create() - - self.bootstrap = NIOPipeBootstrap(group: group) - .channelInitializer { channel in - xcbBuildServiceFuture.flatMap { xcbBuildService in - let framingHandler = RPCPacketCodec(label: "HybridXCBBuildService(\(name))") - - // When the channel for XCBBuildService is closed, such as the process is terminated, - // close the channel for Xcode as well, which allows to terminate proxy process. - // Xcode then relaunch it when it's needed. - xcbBuildService.channel.closeFuture.whenComplete { _ in - channel.close(promise: nil) - } - - return channel.pipeline.addHandlers([ - // Bytes -> RPCPacket from Xcode - ByteToMessageHandler(framingHandler), - // RPCPacket -> Bytes to Xcode - MessageToByteHandler(framingHandler), - // RPCPacket -> RPCRequest from Xcode - RPCRequestDecoder(), - // RPCResponse -> RPCPacket to Xcode - RPCResponseEncoder(), - // RPCRequests from Xcode, RPCResponses from XCBBuildService - HybridRPCRequestHandler( - xcbBuildService: xcbBuildService, - requestHandler: requestHandler - ), - ]) - } - } - } - - public func start() throws -> Channel { - let channel = try bootstrap.withPipes(inputDescriptor: STDIN_FILENO, outputDescriptor: STDOUT_FILENO).wait() - - os_log(.info, "\(self.name) started and listening on STDIN") - - return channel - } - - public func stop() { - do { - try group.syncShutdownGracefully() - } catch { - os_log(.error, "Error shutting down: \(error.localizedDescription)") - exit(0) - } - os_log(.info, "\(self.name) stopped") - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildServiceRequestHandler.swift b/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildServiceRequestHandler.swift deleted file mode 100644 index 39d10de..0000000 --- a/Sources/XCBBuildServiceProxyKit/Hybrid/HybridXCBBuildServiceRequestHandler.swift +++ /dev/null @@ -1,92 +0,0 @@ -import Logging -import NIO -import os -import XCBProtocol - -// swiftformat:disable braces -// swiftlint:disable opening_brace - -public protocol HybridXCBBuildServiceRequestHandler { - associatedtype RequestPayload: XCBProtocol.RequestPayload - associatedtype ResponsePayload: XCBProtocol.ResponsePayload - - func handleRequest( - _ request: RPCRequest, - context: HybridXCBBuildServiceRequestHandlerContext - ) -} - -public final class HybridXCBBuildServiceRequestHandlerContext where - RequestPayload: XCBProtocol.RequestPayload, - ResponsePayload: XCBProtocol.ResponsePayload -{ - public typealias Request = RPCRequest - public typealias Response = RPCResponse - - private let forwardRequestProxy: () -> Void - private let sendRequestProxy: (_ request: Request) -> EventLoopFuture - private let sendResponseProxy: (_ response: Response) -> Void - - // TODO: Hide Swift NIO - public let eventLoop: EventLoop - public let allocator: ByteBufferAllocator - - init( - eventLoop: EventLoop, - allocator: ByteBufferAllocator, - forwardRequest: @escaping () -> Void, - sendRequest: @escaping (_ request: Request) -> EventLoopFuture, - sendResponse: @escaping (_ response: Response) -> Void - ) { - self.eventLoop = eventLoop - self.allocator = allocator - self.forwardRequestProxy = forwardRequest - self.sendRequestProxy = sendRequest - self.sendResponseProxy = sendResponse - } - - public func forwardRequest() { - forwardRequestProxy() - } - - public func sendRequest(_ request: Request) -> EventLoopFuture { - return sendRequestProxy(request) - } - - public func sendResponse(_ response: Response) { - sendResponseProxy(response) - } - - public func sendResponseMessage(_ payload: ResponsePayload, channel: UInt64) { - sendResponse(Response(channel: channel, payload: payload)) - } - - public func sendResponseMessage(_ payloadConvertible: PayloadConvertible, channel: UInt64) where - PayloadConvertible: ResponsePayloadConvertible, - PayloadConvertible.Payload == ResponsePayload - { - sendResponse(Response(channel: channel, payloadConvertible: payloadConvertible)) - } - - public func sendErrorResponse( - _ error: Error, - session: String?, - request: Request, - file: String = #file, function: String = #function, line: UInt = #line - ) { - sendErrorResponse( - "\(session.flatMap { "[\($0)] " } ?? "")\(error)", - request: request, - file: file, function: function, line: line - ) - } - - public func sendErrorResponse( - _ messageClosure: @autoclosure () -> String, - request: Request, - file: String = #file, function: String = #function, line: UInt = #line - ) { - let message = messageClosure() - sendResponseMessage(.errorResponse(message.description), channel: request.channel) - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Hybrid/ProxiedRPCRequestHandler.swift b/Sources/XCBBuildServiceProxyKit/Hybrid/ProxiedRPCRequestHandler.swift deleted file mode 100644 index 9e8b9ba..0000000 --- a/Sources/XCBBuildServiceProxyKit/Hybrid/ProxiedRPCRequestHandler.swift +++ /dev/null @@ -1,43 +0,0 @@ -import NIO -import XCBProtocol - -// swiftformat:disable braces -// swiftlint:disable opening_brace - -enum ProxiedRPCRequestHandlerEvent { - case registerResponseChannel(Channel) -} - -final class ProxiedRPCRequestHandler: ChannelDuplexHandler where - RequestPayload: XCBProtocol.RequestPayload, - ResponsePayload: XCBProtocol.ResponsePayload -{ - typealias InboundIn = RPCResponse // From XCBBuildService - - typealias OutboundIn = RPCRequest // From Xcode/BazelXCBBuildService - typealias OutboundOut = RPCPacket // To XCBBuildService - - // This needs to be set in `triggerUserOutboundEvent` - var responseChannel: Channel! - - func triggerUserOutboundEvent(context: ChannelHandlerContext, event: Any, promise: EventLoopPromise?) { - if case let .registerResponseChannel(channel) = event as? ProxiedRPCRequestHandlerEvent { - responseChannel = channel - } else { - context.triggerUserOutboundEvent(event, promise: promise) - } - } - - func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise?) { - // This will be invoked from BazelXCBBuildService - let request = unwrapOutboundIn(data) - let packet = RPCPacket(request) - context.write(wrapOutboundOut(packet), promise: promise) - } - - func channelRead(context: ChannelHandlerContext, data: NIOAny) { - // This will be invoked from XCBBuildService - let response = unwrapInboundIn(data) - responseChannel.write(response, promise: nil) - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Hybrid/XCBBuildService.swift b/Sources/XCBBuildServiceProxyKit/Hybrid/XCBBuildService.swift deleted file mode 100644 index 5ab219a..0000000 --- a/Sources/XCBBuildServiceProxyKit/Hybrid/XCBBuildService.swift +++ /dev/null @@ -1,134 +0,0 @@ -import Foundation -import Logging -import NIO -import os -import XCBProtocol - -// swiftformat:disable braces -// swiftlint:disable opening_brace - -/// Encapsulates a child XCBBuildService process. -/// -/// Communication takes place over the Swift NIO `channel`. -final class XCBBuildService { - private static let serviceRelativePath = "/Contents/SharedFrameworks/XCBuild.framework/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService" - - private let process: Process - - let channel: Channel - - init(process: Process, channel: Channel) { - self.process = process - self.channel = channel - } - - private func servicePath(with xcodePath: String) -> String { - return xcodePath + Self.serviceRelativePath - } - - func startIfNeeded(xcodePath: String) { - let defaultProcessPath = servicePath(with: xcodePath) - let originalProcessPath = defaultProcessPath + ".original" - - let processPath: String - if FileManager.default.fileExists(atPath: originalProcessPath) { - processPath = originalProcessPath - } else { - guard defaultProcessPath != CommandLine.arguments[0] else { - fatalError("HybridXCBBuildService installation requires XCBBuildService to be at \(defaultProcessPath)") - } - processPath = defaultProcessPath - } - - guard !process.isRunning else { - if process.launchPath != processPath { - let launchPath = process.launchPath ?? "" - os_log(.error, "XCBBuildService start request for “\(processPath)” but it’s already running at “\(launchPath)”") - } - return - } - - os_log(.info, "Starting XCBBuildService at “\(processPath)”") - - process.launchPath = processPath - process.launch() - } - - func stop() { - process.terminate() - } -} - -final class XCBBuildServiceBootstrap where - RequestPayload: XCBProtocol.RequestPayload, - ResponsePayload: XCBProtocol.ResponsePayload -{ - private let bootstrap: NIOPipeBootstrap - - init(group: EventLoopGroup) { - self.bootstrap = NIOPipeBootstrap(group: group) - .channelInitializer { channel in - let framingHandler = RPCPacketCodec(label: "XCBBuildService") - - return channel.pipeline.addHandlers([ - // Bytes -> RPCPacket from XCBBBuildService - ByteToMessageHandler(framingHandler), - // RPCPacket -> Bytes to XCBBBuildService - MessageToByteHandler(framingHandler), - // RPCPacket -> RPCResponse from XCBBBuildService - RPCResponseDecoder(), - // RPCRequests from BazelXCBBuildService, RPCResponses from XCBBBuildService - ProxiedRPCRequestHandler(), - ]) - } - } - - func create() -> EventLoopFuture { - let stdin = Pipe() - let stdout = Pipe() - let stderr = Pipe() - - let process = Process() - - process.standardInput = stdin - process.standardOutput = stdout - process.standardError = stderr - - stderr.fileHandleForReading.readabilityHandler = { handle in - let data = handle.availableData - guard !data.isEmpty else { - os_log(.debug, "Received XCBBuildService standard error EOF") - stderr.fileHandleForReading.readabilityHandler = nil - return - } - - if let output = String(data: data, encoding: .utf8) { - os_log(.info, "XCBBuildService stderr: \(output)") - } - } - - process.terminationHandler = { process in - os_log(.info, "XCBBuildService exited with status code: \(process.terminationStatus)") - } - - os_log(.info, "Prepping XCBBuildService") - - let channelFuture = bootstrap.withPipes( - inputDescriptor: stdout.fileHandleForReading.fileDescriptor, - outputDescriptor: stdin.fileHandleForWriting.fileDescriptor - ) - - // Automatically terminate process if our process exits - let selector = Selector(("setStartsNewProcessGroup:")) - if process.responds(to: selector) { - process.perform(selector, with: false as NSNumber) - } - - channelFuture - .whenSuccess { _ in - os_log(.info, "XCBBuildService prepped") - } - - return channelFuture.map { XCBBuildService(process: process, channel: $0) } - } -} diff --git a/Sources/XCBBuildServiceProxyKit/Logger.swift b/Sources/XCBBuildServiceProxyKit/Logger.swift deleted file mode 100644 index 51fe611..0000000 --- a/Sources/XCBBuildServiceProxyKit/Logger.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Logging - -let logger = Logger(label: "XCBBuildServiceProxyKit") diff --git a/Sources/XCBProtocol/BUILD b/Sources/XCBProtocol/BUILD deleted file mode 100644 index ffe0d11..0000000 --- a/Sources/XCBProtocol/BUILD +++ /dev/null @@ -1,13 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol", - deps = [ - "//Sources/MessagePack", - "@com_github_apple_swift_log//:Logging", - "@com_github_apple_swift_nio//:NIO", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBProtocol/Logger.swift b/Sources/XCBProtocol/Logger.swift deleted file mode 100644 index fc69c21..0000000 --- a/Sources/XCBProtocol/Logger.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Logging - -let logger = Logger(label: "XCBProtocol") diff --git a/Sources/XCBProtocol/PIF.swift b/Sources/XCBProtocol/PIF.swift deleted file mode 100644 index 10e3fba..0000000 --- a/Sources/XCBProtocol/PIF.swift +++ /dev/null @@ -1,55 +0,0 @@ -import Foundation - -public struct WorkspacePIF: Decodable { - public let guid: String - public let path: String - public let projects: [String] -} - -public enum BuildSetting { - case string(String) - case array([String]) -} - -extension BuildSetting: Decodable { - public init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - - if let array = try? container.decode([String].self) { - self = .array(array) - } else { - self = .string(try container.decode(String.self)) - } - } -} - -public struct PIFBuildConfiguration: Decodable { - public let name: String - public let buildSettings: [String: BuildSetting] -} - -public struct ProjectPIF: Decodable { - private let projectName: String? - public let path: String - public let projectDirectory: String - private let projectIsPackage: String? - public let guid: String - public let buildConfigurations: [PIFBuildConfiguration] - public let targets: [String] -} - -extension ProjectPIF { - public var name: String { - // "/Path/To/Project.xcodeproj" -> "Project" - projectName ?? ((path as NSString).lastPathComponent as NSString).deletingPathExtension - } - - public var isPackage: Bool { projectIsPackage?.lowercased() == "true" } -} - -public struct TargetPIF: Decodable { - public let name: String - public let guid: String - public let productTypeIdentifier: String? - public let buildConfigurations: [PIFBuildConfiguration] -} diff --git a/Sources/XCBProtocol/RPC/RPCPacket.swift b/Sources/XCBProtocol/RPC/RPCPacket.swift deleted file mode 100644 index 802e9da..0000000 --- a/Sources/XCBProtocol/RPC/RPCPacket.swift +++ /dev/null @@ -1,99 +0,0 @@ -import Foundation -import MessagePack -import NIO -import os - -/// An intermediate representation of an RPC message. -/// -/// Bytes are decoded to form an `RPCPacket`. `RPCPacket`s are decoded to form `RPCRequest` and `RPCResponse` instances. -public struct RPCPacket: CustomStringConvertible { - public var description: String { "Channel: \(channel) - Body: \(body) "} - - /// The RPC channel that is being communicated on. - /// - /// A response will come back on the same channel as a request. - /// The request might additionally open up a "stream" and send the channel for multiple responses to come back on (e.g. build results), - /// in which case responses will have a `channel` not first used by a request. - public let channel: UInt64 - - /// The content of the message. This will be parsed to form a specific request or response. - public let body: [MessagePackValue] -} - -/// Decodes `RPCPacket`s from, and encodes `RPCPacket`s to, a NIO `Channel`. -public class RPCPacketCodec: ByteToMessageDecoder, MessageToByteEncoder { - public typealias InboundOut = RPCPacket - public typealias OutboundIn = RPCPacket - - private struct PacketHeader { - let channel: UInt64 - let payloadSize: UInt32 - } - - private let label: String - - private var decodedHeader: PacketHeader? - - public init(label: String) { - self.label = label - } - - public func decode(context: ChannelHandlerContext, buffer: inout ByteBuffer) throws -> DecodingState { - if let packet = try findNextPacket(buffer: &buffer) { - os_log(.debug, "[\(self.label)] Decoded RPCPacket: \(packet)") - context.fireChannelRead(wrapInboundOut(packet)) - return .continue - } else { - return .needMoreData - } - } - - private func findNextPacket(buffer: inout ByteBuffer) throws -> RPCPacket? { - guard - let header = decodeHeader(buffer: &buffer), - let payload = buffer.readBytes(length: Int(header.payloadSize)) - else { - return nil - } - - // Reset header state since we have read the full packet now - decodedHeader = nil - - os_log(.debug, "[\(self.label)] Decoded RPCPacket payload: \(payload)") - - let body = try MessagePackValue.unpackAll(Data(payload)) - - return RPCPacket(channel: header.channel, body: body) - } - - private func decodeHeader(buffer: inout ByteBuffer) -> PacketHeader? { - if let decodedHeader = decodedHeader { - return decodedHeader - } - - // The first 12 bytes are the channel (UInt64) and payload size (UInt32) - guard buffer.readableBytes >= 12 else { - return nil - } - - let header = PacketHeader( - channel: buffer.readInteger(endianness: .little)!, - payloadSize: buffer.readInteger(endianness: .little)! - ) - - // Save header state since we read it off the stream - decodedHeader = header - - return header - } - - public func encode(data packet: RPCPacket, out: inout ByteBuffer) throws { - os_log(.debug, "[\(self.label)] Encoding RPCPacket: \(packet)") - - let body = packet.body.reduce(into: Data()) { body, element in body.append(element.pack()) } - - out.writeInteger(packet.channel, endianness: .little, as: UInt64.self) - out.writeInteger(UInt32(body.count), endianness: .little, as: UInt32.self) - out.writeBytes(body) - } -} diff --git a/Sources/XCBProtocol/RPC/RPCPayload.swift b/Sources/XCBProtocol/RPC/RPCPayload.swift deleted file mode 100644 index e116eba..0000000 --- a/Sources/XCBProtocol/RPC/RPCPayload.swift +++ /dev/null @@ -1,271 +0,0 @@ -import Foundation -import MessagePack - -// swiftformat:disable braces -// swiftlint:disable opening_brace - -public protocol RequestPayload: CustomDecodableRPCPayload { - static func unknownRequest(values: [MessagePackValue]) -> Self - - /// - Returns: the Xcode path in the `CREATE_SESSION` message, or `nil` if it's another message. - var createSessionXcodePath: String? { get } -} - -public protocol ResponsePayload: CustomDecodableRPCPayload, EncodableRPCPayload { - static func unknownResponse(values: [MessagePackValue]) -> Self - static func errorResponse(_ message: String) -> Self -} - -public protocol ResponsePayloadConvertible { - associatedtype Payload: ResponsePayload - - func toResponsePayload() -> Payload -} - -extension RPCResponse { - public init(channel: UInt64, payloadConvertible: PayloadConvertible) where - PayloadConvertible: ResponsePayloadConvertible, - PayloadConvertible.Payload == Payload - { - self.init(channel: channel, payload: payloadConvertible.toResponsePayload()) - } -} - -// MARK: - Encoding/Decoding - -// TODO: Replace with Decodable -public protocol DecodableRPCPayload { - init(args: [MessagePackValue], indexPath: IndexPath) throws -} - -// TODO: Replace with Decodable -public protocol CustomDecodableRPCPayload { - init(values: [MessagePackValue], indexPath: IndexPath) throws -} - -// TODO: Replace with Encodable -public protocol EncodableRPCPayload: CustomEncodableRPCPayload { - func encode() -> [MessagePackValue] -} - -public protocol CustomEncodableRPCPayload { - func encode() -> MessagePackValue -} - -public extension EncodableRPCPayload { - func encode() -> MessagePackValue { - return .array(encode()) - } -} - -public enum RPCPayloadDecodingError: Error { - case invalidCount(_ count: Int, indexPath: IndexPath) - case indexOutOfBounds(indexPath: IndexPath) - case incorrectValueType(indexPath: IndexPath, expectedType: Any.Type) - case missingValue(indexPath: IndexPath) -} - -// TODO: Replace with Codable -extension Array where Element == MessagePackValue { - private func index(_ indexPath: IndexPath) throws -> Int { - guard let index = indexPath.last else { preconditionFailure("Empty indexPath") } - - guard count > index else { - throw RPCPayloadDecodingError.indexOutOfBounds(indexPath: indexPath) - } - - return index - } - - public func parseArray(indexPath: IndexPath) throws -> [MessagePackValue] { - guard case let .array(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: [MessagePackValue].self) - } - return value - } - - public func parseOptionalArray(indexPath: IndexPath) throws -> [MessagePackValue]? { - if case .nil = self[try index(indexPath)] { - return nil - } - - guard case let .array(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: [MessagePackValue].self) - } - return value - } - - public func parseBinary(indexPath: IndexPath) throws -> Data { - guard case let .binary(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Data.self) - } - return value - } - - public func parseBool(indexPath: IndexPath) throws -> Bool { - guard case let .bool(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Bool.self) - } - return value - } - - public func parseOptionalBool(indexPath: IndexPath) throws -> Bool? { - if case .nil = self[try index(indexPath)] { - return nil - } - - guard case let .bool(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Bool.self) - } - return value - } - - public func parseDouble(indexPath: IndexPath) throws -> Double { - guard case let .double(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Double.self) - } - return value - } - - public func parseInt8(indexPath: IndexPath) throws -> Int8 { - guard case let .int8(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Int8.self) - } - return value - } - - public func parseInt16(indexPath: IndexPath) throws -> Int16 { - guard case let .int16(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Int16.self) - } - return value - } - - public func parseInt32(indexPath: IndexPath) throws -> Int32 { - guard case let .int32(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Int32.self) - } - return value - } - - public func parseInt64(indexPath: IndexPath) throws -> Int64 { - guard case let .int64(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Int64.self) - } - return value - } - - public func parseOptionalInt64(indexPath: IndexPath) throws -> Int64? { - if case .nil = self[try index(indexPath)] { - return nil - } - - guard case let .int64(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Int64.self) - } - return value - } - - public func parseMap(indexPath: IndexPath) throws -> [String: String] { - guard case let .map(dict) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: [String: String].self) - } - - return try dict.reduce(into: [:]) { dict, entry in - guard case let .string(key) = entry.key, case let .string(value) = entry.value else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: [String: String].self) - } - dict[key] = value - } - } - - public func parseString(indexPath: IndexPath) throws -> String { - guard case let .string(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: String.self) - } - return value - } - - public func parseOptionalString(indexPath: IndexPath) throws -> String? { - if case .nil = self[try index(indexPath)] { - return nil - } - - guard case let .string(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: String.self) - } - return value - } - - public func parseStringArray(indexPath: IndexPath) throws -> [String] { - let array = try parseArray(indexPath: indexPath) - - return try (0 ..< array.count).compactMap { index in - if index < array.count, case .nil = array[index] { return nil } - return try array.parseString(indexPath: indexPath.appending(index)) - } - } - - public func parseUInt8(indexPath: IndexPath) throws -> UInt8 { - guard case let .uint8(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: UInt8.self) - } - return value - } - - public func parseUInt16(indexPath: IndexPath) throws -> UInt16 { - guard case let .uint16(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: UInt16.self) - } - return value - } - - public func parseUInt32(indexPath: IndexPath) throws -> UInt32 { - guard case let .uint32(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: UInt32.self) - } - return value - } - - public func parseUInt64(indexPath: IndexPath) throws -> UInt64 { - guard case let .uint64(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: UInt64.self) - } - return value - } - - public func parseOptionalUInt64(indexPath: IndexPath) throws -> UInt64? { - if case .nil = self[try index(indexPath)] { - return nil - } - - guard case let .uint64(value) = self[try index(indexPath)] else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: UInt64.self) - } - return value - } - - public func parseUnknown(indexPath: IndexPath) throws -> MessagePackValue { - return self[try index(indexPath)] - } - - public func parseObject(type: T.Type = T.self, indexPath: IndexPath) throws -> T { - return try T(values: self, indexPath: indexPath) - } - - public func parseObject(type: T.Type = T.self, indexPath: IndexPath) throws -> T { - guard let object = try parseOptionalObject(type: type, indexPath: indexPath) else { - throw RPCPayloadDecodingError.missingValue(indexPath: indexPath) - } - - return object - } - - public func parseOptionalObject(type: T.Type = T.self, indexPath: IndexPath) throws -> T? { - guard let args = try parseOptionalArray(indexPath: indexPath) else { - return nil - } - - return try T(args: args, indexPath: indexPath) - } -} diff --git a/Sources/XCBProtocol/RPC/RPCRequest.swift b/Sources/XCBProtocol/RPC/RPCRequest.swift deleted file mode 100644 index bb1532f..0000000 --- a/Sources/XCBProtocol/RPC/RPCRequest.swift +++ /dev/null @@ -1,59 +0,0 @@ -import Foundation -import MessagePack -import NIO -import os - -/// An RPC request sent from Xcode. -public struct RPCRequest: CustomStringConvertible { - public var description: String { "Channel: \(channel) - Payload: \(payload) "} - - public let channel: UInt64 - public let payload: Payload - - /// Currently, instead of re-encoding requests when sending them to XCBBuildService, we send the original packet along. - let forwardPacket: RPCPacket -} - -// MARK: - Decoder - -public final class RPCRequestDecoder: ChannelInboundHandler { - public typealias InboundIn = RPCPacket - public typealias InboundOut = RPCRequest - public typealias OutboundOut = RPCPacket - - public init() {} - - public func channelRead(context: ChannelHandlerContext, data: NIOAny) { - let request = RPCRequest(unwrapInboundIn(data)) - - os_log(.debug, "RPCRequest decoded: \(request)") - - context.fireChannelRead(wrapInboundOut(request)) - } -} - -extension RPCRequest { - init(_ packet: RPCPacket) { - let payload: Payload - do { - payload = try packet.body.parseObject(indexPath: IndexPath()) - } catch { - let errorStr = "\(error)" - os_log(.error, "Failed parsing RequestPayload received from Xcode: \(errorStr)\nValues: \(packet.body)") - - payload = .unknownRequest(values: packet.body) - } - - self.init( - channel: packet.channel, - payload: payload, - forwardPacket: packet - ) - } -} - -extension RPCPacket { - public init(_ request: RPCRequest) { - self = request.forwardPacket - } -} diff --git a/Sources/XCBProtocol/RPC/RPCResponse.swift b/Sources/XCBProtocol/RPC/RPCResponse.swift deleted file mode 100644 index da2dd21..0000000 --- a/Sources/XCBProtocol/RPC/RPCResponse.swift +++ /dev/null @@ -1,83 +0,0 @@ -import Foundation -import MessagePack -import NIO -import os - -/// An RPC response sent to Xcode. -public struct RPCResponse: CustomStringConvertible { - public var description: String { "Channel: \(channel) - Payload: \(payload) "} - - public let channel: UInt64 - public let payload: Payload - - public init(channel: UInt64, payload: Payload) { - self.channel = channel - self.payload = payload - } -} - -// MARK: - Encoder/Decoder - -/// Encodes `RPCResponse`s into `RPCPacket`s. -public final class RPCResponseEncoder: ChannelOutboundHandler { - public typealias OutboundIn = RPCResponse - public typealias OutboundOut = RPCPacket - - public init() {} - - public func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise?) { - let packet = RPCPacket(unwrapOutboundIn(data)) - context.write(wrapOutboundOut(packet), promise: promise) - } -} - -/// Decodes `RPCResponse`s from `RPCPacket`s. -public final class RPCResponseDecoder: ChannelInboundHandler { - public typealias InboundIn = RPCPacket - public typealias InboundOut = RPCResponse - - public init() {} - - public func channelRead(context: ChannelHandlerContext, data: NIOAny) { - let packet = unwrapInboundIn(data) - let response = RPCResponse(packet) - - os_log(.debug, "RPCResponse decoded: \(response)") - - context.fireChannelRead(wrapInboundOut(response)) - } -} - -extension RPCResponse { - init(_ packet: RPCPacket) { - let payload: Payload - do { - payload = try packet.body.parseObject(indexPath: IndexPath()) - } catch { - let errorStr = "\(error)" - os_log(.error, "Failed parsing ResponsePayload received from XCBBuildService: \(errorStr)\nValues: \(packet.body)") - - payload = .unknownResponse(values: packet.body) - } - - self.init( - channel: packet.channel, - payload: payload - ) - } -} - -extension RPCPacket { - init(_ response: RPCResponse) { - self.init( - channel: response.channel, - body: response.payload.encode() - ) - } -} - -enum ResponseParsingError: Error { - case nameNotFound - case indexOutOfBounds(indexPath: IndexPath) - case incorrectValueType(indexPath: IndexPath, expectedType: Any.Type) -} diff --git a/Sources/XCBProtocol_11_3/BUILD.bazel b/Sources/XCBProtocol_11_3/BUILD.bazel deleted file mode 100644 index 11f42c7..0000000 --- a/Sources/XCBProtocol_11_3/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_11_3", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_11_3", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationEnded.swift deleted file mode 100644 index 2f32951..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationEnded { - public let buildNumber: Int64 - public let status: BuildOperationStatus - public let unknown: MessagePackValue // This might be metrics? - - public init(buildNumber: Int64, status: BuildOperationStatus) { - self.buildNumber = buildNumber - self.status = status - self.unknown = .nil - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationEnded: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationEnded(self) } -} - -// MARK: - Decoding - -extension BuildOperationEnded: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.buildNumber = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.status = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationEnded: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(buildNumber), - .int64(status.rawValue), - unknown, - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 100644 index ebb3e7d..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationPreparationCompleted { - public init() {} -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationPreparationCompleted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationPreparationCompleted(self) } -} - -// MARK: - Decoding - -extension BuildOperationPreparationCompleted: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) {} -} - -extension BuildOperationPreparationCompleted: CustomEncodableRPCPayload { - public func encode() -> MessagePackValue { - return .nil - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 100644 index 0a0fbff..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationProgressUpdated { - public let targetName: String? - public let statusMessage: String - public let percentComplete: Double - public let showInLog: Bool - - public init(targetName: String?, statusMessage: String, percentComplete: Double, showInLog: Bool) { - self.targetName = targetName - self.statusMessage = statusMessage - self.percentComplete = percentComplete - self.showInLog = showInLog - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationProgressUpdated: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationProgressUpdated(self) } -} - -// MARK: - Decoding - -extension BuildOperationProgressUpdated: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.targetName = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 0)) - self.statusMessage = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.percentComplete = try args.parseDouble(indexPath: indexPath + IndexPath(index: 2)) - self.showInLog = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - } -} - -// MARK: - Encoding - -extension BuildOperationProgressUpdated: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - targetName.flatMap { .string($0) } ?? .nil, - .string(statusMessage), - .double(percentComplete), - .bool(showInLog), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationReportPathMap.swift deleted file mode 100644 index 98aac51..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationReportPathMap { - public let unknown1: MessagePackValue - public let unknown2: MessagePackValue - - public init() { - self.unknown1 = .map([:]) - self.unknown2 = .map([:]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationReportPathMap: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationReportPathMap(self) } -} - -// MARK: - Decoding - -extension BuildOperationReportPathMap: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.unknown1 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 0)) - self.unknown2 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1)) - } -} - -extension BuildOperationReportPathMap: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - unknown1, - unknown2, - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStarted.swift deleted file mode 100644 index af491ce..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationStarted { - public let buildNumber: Int64 - - public init(buildNumber: Int64) { - self.buildNumber = buildNumber - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationStarted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationStarted(self) } -} - -// MARK: - Decoding - -extension BuildOperationStarted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.buildNumber = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension BuildOperationStarted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.int64(buildNumber)] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStatus.swift deleted file mode 100644 index 9edab18..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildOperationStatus: Int64 { - case succeeded - case cancelled - case failed -} - -// MARK: - Decoding - -extension BuildOperationStatus: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let rawValue = try values.parseInt64(indexPath: indexPath) - - guard let parsed = Self(rawValue: rawValue) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 100644 index beef23e..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1,67 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildOperationDiagnosticComponent { - case task(taskID: Int64, targetID: Int64) - case unknown(MessagePackValue) // Haven't seen it - case global -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticComponent: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - let rawValue = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - - switch rawValue { - case 0: - let taskArgs = try args.parseArray(indexPath: indexPath + IndexPath(index: 1)) - - self = .task( - taskID: try taskArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 0])), - targetID: try taskArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 1])) - ) - - case 1: - self = .unknown(try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1))) - - case 2: - self = .global - - default: - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath + IndexPath(index: 0), expectedType: Self.self) - } - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticComponent: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - switch self { - case let .task(taskID, parentTaskID): - return [ - .int64(0), - .array([ - .int64(taskID), - .int64(parentTaskID), - ]), - ] - - case let .unknown(unknown): - return [ - .int64(1), - unknown, - ] - - case .global: - return [ - .int64(2), - .nil, - ] - } - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 100644 index ffc1d3d..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationDiagnosticEmitted { - public let kind: BuildOperationDiagnosticKind - public let location: BuildOperationDiagnosticLocation - public let message: String - public let component: BuildOperationDiagnosticComponent - public let unknown1: String // e.g. "default" - public let appendToOutputStream: Bool // If `true`, it's attached to the output instead of showing as a new entry - public let unknown2: MessagePackValue // ??? - public let unknown3: MessagePackValue // Might be `childDiagnostics` - - public init( - kind: BuildOperationDiagnosticKind, - location: BuildOperationDiagnosticLocation, - message: String, - component: BuildOperationDiagnosticComponent, - unknown: String, - appendToOutputStream: Bool - ) { - self.kind = kind - self.location = location - self.message = message - self.component = component - self.unknown1 = unknown - self.appendToOutputStream = appendToOutputStream - self.unknown2 = .nil - self.unknown3 = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationDiagnosticEmitted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationDiagnostic(self) } -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticEmitted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 8 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.kind = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.location = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.message = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.component = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - self.unknown1 = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.appendToOutputStream = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.unknown2 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 6)) - self.unknown3 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 7)) - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticEmitted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(kind.rawValue), - .array(location.encode()), - .string(message), - .array(component.encode()), - .string(unknown1), - .bool(appendToOutputStream), - unknown2, - unknown3, - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 100644 index d51ed8e..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildOperationDiagnosticKind: Int64 { - case info - case warning - case error -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticKind: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let rawValue = try values.parseInt64(indexPath: indexPath) - - guard let parsed = Self(rawValue: rawValue) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} - -// MARK: - Encoding diff --git a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 100644 index 40711bf..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1,60 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -// Probably named wrong -public enum BuildOperationDiagnosticLocation { - case alternativeMessage(String) // Might be named wrong. Always empty so far. - case locationContext(file: String, line: Int64, column: Int64) -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticLocation: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - let rawValue = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - - switch rawValue { - case 0: - self = .alternativeMessage(try args.parseString(indexPath: indexPath + IndexPath(index: 1))) - - case 1: - let locationArgs = try args.parseArray(indexPath: indexPath + IndexPath(index: 1)) - - self = .locationContext( - file: try locationArgs.parseString(indexPath: indexPath + IndexPath(indexes: [1, 0])), - line: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 1])), - column: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 2])) - ) - - default: - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath + IndexPath(index: 0), expectedType: Self.self) - } - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticLocation: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - switch self { - case let .alternativeMessage(message): - return [ - .int64(0), - .string(message), - ] - - case let .locationContext(file, line, column): - return [ - .int64(1), - .array([ - .string(file), - .int64(line), - .int64(column), - ]), - ] - } - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 100644 index ee3f8ac..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetEnded { - public let targetID: Int64 - - public init(targetID: Int64) { - self.targetID = targetID - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTargetEnded: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTargetEnded(self) } -} - -// MARK: - Decoding - -extension BuildOperationTargetEnded: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.targetID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension BuildOperationTargetEnded: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.int64(targetID)] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 100644 index 9688c29..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetInfo { - public let name: String - public let typeName: String // e.g. "Native" or "Aggregate" - public let projectInfo: BuildOperationProjectInfo - public let configurationName: String // e.g. "Debug" - public let configurationIsDefault: Bool - public let sdkRoot: String // e.g. "/Applications/Xcode-11.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk" - - public init( - name: String, - typeName: String, - projectInfo: BuildOperationProjectInfo, - configurationName: String, - configurationIsDefault: Bool, - sdkRoot: String - ) { - self.name = name - self.typeName = typeName - self.projectInfo = projectInfo - self.configurationName = configurationName - self.configurationIsDefault = configurationIsDefault - self.sdkRoot = sdkRoot - } -} - -// MARK: - Decoding - -extension BuildOperationTargetInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 6 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.name = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.typeName = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.projectInfo = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.configurationName = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.configurationIsDefault = try args.parseBool(indexPath: indexPath + IndexPath(index: 4)) - self.sdkRoot = try args.parseString(indexPath: indexPath + IndexPath(index: 5)) - } -} - -// MARK: - Encoding - -extension BuildOperationTargetInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(name), - .string(typeName), - .array(projectInfo.encode()), - .string(configurationName), - .bool(configurationIsDefault), - .string(sdkRoot), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 100644 index 7aad9e1..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationProjectInfo { - public let name: String - public let path: String - public let isPackage: Bool - - public init(name: String, path: String, isPackage: Bool) { - self.name = name - self.path = path - self.isPackage = isPackage - } -} - -// MARK: - Decoding - -extension BuildOperationProjectInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.name = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.path = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.isPackage = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationProjectInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(name), - .string(path), - .bool(isPackage), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 100644 index f0ab6a6..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetStarted { - public let targetID: Int64 - public let guid: String // Used in `CreateBuildRequest` and `BuildOperationTargetUpToDate` - public let targetInfo: BuildOperationTargetInfo - - public init(targetID: Int64, guid: String, targetInfo: BuildOperationTargetInfo) { - self.targetID = targetID - self.guid = guid - self.targetInfo = targetInfo - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTargetStarted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTargetStarted(self) } -} - -// MARK: - Decoding - -extension BuildOperationTargetStarted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.targetID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.guid = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.targetInfo = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationTargetStarted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(targetID), - .string(guid), - .array(targetInfo.encode()), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 100644 index 65630dd..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetUpToDate { - public let guid: String - - public init(guid: String) { - self.guid = guid - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTargetUpToDate: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTargetUpToDate(self) } -} - -// MARK: - Decoding - -extension BuildOperationTargetUpToDate: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.guid = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension BuildOperationTargetUpToDate: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.string(guid)] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 100644 index 5188875..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationConsoleOutputEmitted { - public let taskID: Int64 - public let unknown: MessagePackValue - public let output: Data - - public init(taskID: Int64, output: Data) { - self.taskID = taskID - self.unknown = .nil - self.output = output - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationConsoleOutputEmitted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationConsoleOutput(self) } -} - -// MARK: - Decoding - -extension BuildOperationConsoleOutputEmitted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.output = try args.parseBinary(indexPath: indexPath + IndexPath(index: 0)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1)) - self.taskID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationConsoleOutputEmitted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .binary(output), - unknown, - .int64(taskID), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 100644 index 2644c14..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskEnded { - public let taskID: Int64 - public let status: BuildOperationStatus - public let skippedErrorsFromSerializedDiagnostics: Bool // Might be named "signalled" - public let metrics: BuildOperationTaskMetrics? - public let unknown: MessagePackValue - - public init(taskID: Int64, status: BuildOperationStatus, skippedErrorsFromSerializedDiagnostics: Bool, metrics: BuildOperationTaskMetrics?) { - self.taskID = taskID - self.status = status - self.skippedErrorsFromSerializedDiagnostics = skippedErrorsFromSerializedDiagnostics - self.metrics = metrics - self.unknown = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskEnded: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskEnded(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskEnded: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 5 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.status = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.skippedErrorsFromSerializedDiagnostics = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.metrics = try args.parseOptionalObject(indexPath: indexPath + IndexPath(index: 3)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 4)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskEnded: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(taskID), - .int64(status.rawValue), - .bool(skippedErrorsFromSerializedDiagnostics), - metrics.flatMap { MessagePackValue.array($0.encode()) } ?? .nil, - unknown, - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 100644 index 45ce425..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskMetrics { - public let utime: UInt64 - public let stime: UInt64 - public let maxRSS: UInt64 - public let wcStartTime: UInt64 - public let wcDuration: UInt64 - - public init( - utime: UInt64, - stime: UInt64, - maxRSS: UInt64, - wcStartTime: UInt64, - wcDuration: UInt64 - ) { - self.utime = utime - self.stime = stime - self.maxRSS = maxRSS - self.wcStartTime = wcStartTime - self.wcDuration = wcDuration - } -} - -// MARK: - Decoding - -extension BuildOperationTaskMetrics: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 5 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.utime = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 0)) - self.stime = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.maxRSS = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 2)) - self.wcStartTime = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 3)) - self.wcDuration = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 4)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskMetrics: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .uint64(utime), - .uint64(stime), - .uint64(maxRSS), - .uint64(wcStartTime), - .uint64(wcDuration), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 100644 index 7268d50..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1,110 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskStarted { - public struct TaskDetails { - public let taskName: String // e.g. "Swift Compiler", "Shell Script Invocation" - public let signature: Data // Used in `BuildOperationTaskUpToDate`. Seems to be consistent. - public let ruleInfo: String // e.g. "CompileSwift normal x86_64 /Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift", "PhaseScriptExecution SwiftLint /Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex/PROJECT.build/Debug-iphonesimulator/SCRIPT.build/Script-9A635388D017DF17C1E0081A.sh" - public let executionDescription: String // e.g. "Compile /Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift", "Run custom shell script 'SwiftLint'" - public let commandLineDisplayString: String // e.g. " cd /Users/USER/Desktop/BazelXCBuildServer\n/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c ..." - public let interestingPath: String? // e.g. "/Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift" - public let serializedDiagnosticsPaths: [String] - - public init( - taskName: String, - signature: Data, - ruleInfo: String, - executionDescription: String, - commandLineDisplayString: String, - interestingPath: String?, - serializedDiagnosticsPaths: [String] - ) { - self.taskName = taskName - self.signature = signature - self.ruleInfo = ruleInfo - self.executionDescription = executionDescription - self.commandLineDisplayString = commandLineDisplayString - self.interestingPath = interestingPath - self.serializedDiagnosticsPaths = serializedDiagnosticsPaths - } - } - - public let taskID: Int64 // Starts from 1 within a build - public let targetID: Int64 - public let parentTaskID: Int64? - public let taskDetails: TaskDetails - - public init( - taskID: Int64, - targetID: Int64, - parentTaskID: Int64?, - taskDetails: TaskDetails - ) { - self.taskID = taskID - self.targetID = targetID - self.parentTaskID = parentTaskID - self.taskDetails = taskDetails - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskStarted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskStarted(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskStarted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.targetID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 1)) - self.parentTaskID = try args.parseOptionalInt64(indexPath: indexPath + IndexPath(index: 2)) - self.taskDetails = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - } -} - -extension BuildOperationTaskStarted.TaskDetails: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 7 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskName = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.signature = try args.parseBinary(indexPath: indexPath + IndexPath(index: 1)) - self.ruleInfo = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.executionDescription = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.commandLineDisplayString = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.interestingPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 5)) - self.serializedDiagnosticsPaths = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 6)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskStarted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(taskID), - .int64(targetID), - parentTaskID.flatMap { .int64($0) } ?? .nil, - .array(taskDetails.encode()), - ] - } -} - -extension BuildOperationTaskStarted.TaskDetails: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(taskName), - .binary(signature), - .string(ruleInfo), - .string(executionDescription), - .string(commandLineDisplayString), - interestingPath.flatMap { .string($0) } ?? .nil, - .array(serializedDiagnosticsPaths.map(MessagePackValue.string)), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 100644 index a3e8383..0000000 --- a/Sources/XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskUpToDate { - public let taskGUID: Data - public let targetID: Int64 - public let unknown: MessagePackValue -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskUpToDate: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskUpToDate(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskUpToDate: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskGUID = try args.parseBinary(indexPath: indexPath + IndexPath(index: 0)) - self.targetID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 1)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskUpToDate: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .binary(taskGUID), - .int64(targetID), - unknown, - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build/ArenaInfo.swift b/Sources/XCBProtocol_11_3/Build/ArenaInfo.swift deleted file mode 100644 index 2bbc082..0000000 --- a/Sources/XCBProtocol_11_3/Build/ArenaInfo.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct ArenaInfo { - public let derivedDataPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData" - public let buildProductsPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Products" - public let buildIntermediatesPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex" - public let pchPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex/PrecompiledHeaders" - public let indexPCHPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Index/PrecompiledHeaders" - public let indexDataStoreFolderPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Index/DataStore" - public let indexEnableDataStore: Bool -} - -// MARK: - Decoding - -extension ArenaInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 7 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.derivedDataPath = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.buildProductsPath = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.buildIntermediatesPath = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.pchPath = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.indexPCHPath = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.indexDataStoreFolderPath = try args.parseString(indexPath: indexPath + IndexPath(index: 5)) - self.indexEnableDataStore = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_11_3/Build/BuildCancelRequest.swift deleted file mode 100644 index 7099469..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildCancelRequest.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildCancelRequest { - public let sessionHandle: String - public let buildNumber: Int64 -} - -// MARK: - Decoding - -extension BuildCancelRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.buildNumber = try args.parseInt64(indexPath: indexPath + IndexPath(index: 1)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildCommand.swift b/Sources/XCBProtocol_11_3/Build/BuildCommand.swift deleted file mode 100644 index 635580f..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildCommand.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildCommand: Int64 { - case build - case prepareForIndexing - case migrate - case generateAssemblyCode - case generatePreprocessedFile - case cleanBuildFolder - case preview -} - -// MARK: - Decoding - -extension BuildCommand: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let rawValue = try values.parseInt64(indexPath: indexPath) - - guard let parsed = Self(rawValue: rawValue) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildCreated.swift b/Sources/XCBProtocol_11_3/Build/BuildCreated.swift deleted file mode 100644 index d6213b2..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildCreated.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildCreated { - public let buildNumber: Int64 - - public init(buildNumber: Int64) { - self.buildNumber = buildNumber - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildCreated: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildCreated(self) } -} - -// MARK: - Decoding - -extension BuildCreated: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.buildNumber = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension BuildCreated: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(buildNumber), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildParameters.swift b/Sources/XCBProtocol_11_3/Build/BuildParameters.swift deleted file mode 100644 index 4c6c811..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildParameters.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildParameters { - public let action: String // e.g. "build", "clean" - public let configuration: String // e.g. "Debug", "Release" - public let activeRunDestination: RunDestinationInfo - public let activeArchitecture: String // e.g. "x86_64", "arm64" - public let arenaInfo: ArenaInfo - public let overrides: SettingsOverrides - public let xbsParameters: MessagePackValue -} - -// MARK: - Decoding - -extension BuildParameters: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 7 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.action = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.configuration = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.activeRunDestination = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.activeArchitecture = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.arenaInfo = try args.parseObject(indexPath: indexPath + IndexPath(index: 4)) - self.overrides = try args.parseObject(indexPath: IndexPath(index: 5)) - self.xbsParameters = try args.parseUnknown(indexPath: IndexPath(index: 6)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildPlatform.swift b/Sources/XCBProtocol_11_3/Build/BuildPlatform.swift deleted file mode 100644 index a0bb673..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildPlatform.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildPlatform: String { - case macosx - case iphoneos - case iphonesimulator - case watchos - case watchsimulator - case appletvos - case appletvsimulator -} - -// MARK: - Decoding - -extension BuildPlatform: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - guard let parsed = Self(rawValue: try values.parseString(indexPath: indexPath)) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} - -extension BuildPlatform: CustomStringConvertible { - public var description: String { rawValue } -} - -// MARK: - Encoding - -extension BuildPlatform: CustomEncodableRPCPayload { - public func encode() -> MessagePackValue { - return .string(rawValue) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildRequest.swift b/Sources/XCBProtocol_11_3/Build/BuildRequest.swift deleted file mode 100644 index 3995f1b..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildRequest.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildRequest { - public let parameters: BuildParameters - public let configuredTargets: [ConfiguredTarget] - public let continueBuildingAfterErrors: Bool - public let hideShellScriptEnvironment: Bool - public let useParallelTargets: Bool - public let useImplicitDependencies: Bool - public let useDryRun: Bool - public let showNonLoggedProgress: Bool - public let buildPlanDiagnosticsDirPath: String? - public let buildCommand: BuildCommand - public let schemeCommand: SchemeCommand - public let buildOnlyTheseFiles: MessagePackValue - public let useLegacyBuildLocations: Bool - public let shouldCollectMetrics: Bool -} - -// MARK: - Decoding - -extension BuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 14 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.parameters = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - - let targetsIndexPath = indexPath + IndexPath(index: 1) - let targetGUIDsArray = try args.parseArray(indexPath: targetsIndexPath) - self.configuredTargets = try targetGUIDsArray.enumerated().map { index, _ in - try targetGUIDsArray.parseObject(indexPath: targetsIndexPath + IndexPath(index: index)) - } - - self.continueBuildingAfterErrors = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.hideShellScriptEnvironment = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - self.useParallelTargets = try args.parseBool(indexPath: indexPath + IndexPath(index: 4)) - self.useImplicitDependencies = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.useDryRun = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - self.showNonLoggedProgress = try args.parseBool(indexPath: indexPath + IndexPath(index: 7)) - self.buildPlanDiagnosticsDirPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 8)) - self.buildCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 9)) - self.schemeCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 10)) - self.buildOnlyTheseFiles = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 11)) - self.useLegacyBuildLocations = try args.parseBool(indexPath: indexPath + IndexPath(index: 12)) - self.shouldCollectMetrics = try args.parseBool(indexPath: indexPath + IndexPath(index: 13)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/BuildStartRequest.swift b/Sources/XCBProtocol_11_3/Build/BuildStartRequest.swift deleted file mode 100644 index 682216c..0000000 --- a/Sources/XCBProtocol_11_3/Build/BuildStartRequest.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildStartRequest { - public let sessionHandle: String - public let buildNumber: Int64 -} - -// MARK: - Decoding - -extension BuildStartRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.buildNumber = try args.parseInt64(indexPath: indexPath + IndexPath(index: 1)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_11_3/Build/ConfiguredTarget.swift deleted file mode 100644 index 142e9cb..0000000 --- a/Sources/XCBProtocol_11_3/Build/ConfiguredTarget.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct ConfiguredTarget { - public let guid: String - public let parameters: BuildParameters? -} - -// MARK: - Decoding - -extension ConfiguredTarget: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.guid = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.parameters = try args.parseOptionalObject(indexPath: indexPath + IndexPath(index: 1)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_11_3/Build/CreateBuildRequest.swift deleted file mode 100644 index 10693e3..0000000 --- a/Sources/XCBProtocol_11_3/Build/CreateBuildRequest.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct CreateBuildRequest { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest // Called `request` by Xcode -} - -// MARK: - Decoding - -extension CreateBuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.responseChannel = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.buildRequest = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_11_3/Build/RunDestinationInfo.swift deleted file mode 100644 index 6fcfa50..0000000 --- a/Sources/XCBProtocol_11_3/Build/RunDestinationInfo.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct RunDestinationInfo { - public let platform: BuildPlatform // e.g. "macosx" - public let sdkVariant: SDKVariant // e.g. "macosx10.14" - public let modernPlatform: String // e.g. "macos". This is a made up name. I couldn't find the correct one in https://github.com/keith/Xcode.app-strings/blob/master/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/PlugIns/XCBBuildService.bundle/Contents/Frameworks/XCBProtocol.framework/Versions/A/XCBProtocol. - public let targetArchitecture: String // e.g. "x86_64", "arm64" - public let supportedArchitectures: [String] // e.g. ["armv7s", "arm64"] - public let disableOnlyActiveArch: Bool -} - -// MARK: - Decoding - -extension RunDestinationInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 6 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.platform = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.sdkVariant = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.modernPlatform = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.targetArchitecture = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.supportedArchitectures = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 4)) - self.disableOnlyActiveArch = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/SDKVariant.swift b/Sources/XCBProtocol_11_3/Build/SDKVariant.swift deleted file mode 100644 index 68cdb32..0000000 --- a/Sources/XCBProtocol_11_3/Build/SDKVariant.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SDKVariant { - public let rawValue: String -} - -// MARK: - Decoding - -extension SDKVariant: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - self.rawValue = try values.parseString(indexPath: indexPath) - } -} - -extension SDKVariant: CustomStringConvertible { - public var description: String { rawValue } -} - -// MARK: - Encoding - -extension SDKVariant: CustomEncodableRPCPayload { - public func encode() -> MessagePackValue { - return .string(rawValue) - } -} diff --git a/Sources/XCBProtocol_11_3/Build/SchemeCommand.swift b/Sources/XCBProtocol_11_3/Build/SchemeCommand.swift deleted file mode 100644 index a650f4c..0000000 --- a/Sources/XCBProtocol_11_3/Build/SchemeCommand.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum SchemeCommand: Int64 { - case launch - case test - case profile - case archive -} - -// MARK: - Decoding - -extension SchemeCommand: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let rawValue = try values.parseInt64(indexPath: indexPath) - - guard let parsed = Self(rawValue: rawValue) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} diff --git a/Sources/XCBProtocol_11_3/Build/SettingsOverrides.swift b/Sources/XCBProtocol_11_3/Build/SettingsOverrides.swift deleted file mode 100644 index c180c35..0000000 --- a/Sources/XCBProtocol_11_3/Build/SettingsOverrides.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SettingsOverrides { - public let synthesized: [String: String] // e.g. ["TARGET_DEVICE_MODEL": "iPhone12,5", "TARGET_DEVICE_OS_VERSION": "13.3"] - public let commandLine: [String: String] - public let commandLineConfig: [String: String] - public let environmentConfig: [String: String] - public let toolchainOverride: String? // e.g. "org.swift.515120200323a" -} - -// MARK: - Decoding - -extension SettingsOverrides: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 5 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.synthesized = try args.parseMap(indexPath: indexPath + IndexPath(index: 0)) - self.commandLine = try args.parseMap(indexPath: indexPath + IndexPath(index: 1)) - self.commandLineConfig = try args.parseMap(indexPath: indexPath + IndexPath(index: 2)) - self.environmentConfig = try args.parseMap(indexPath: indexPath + IndexPath(index: 3)) - self.toolchainOverride = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 4)) - } -} diff --git a/Sources/XCBProtocol_11_3/Core/BoolResponse.swift b/Sources/XCBProtocol_11_3/Core/BoolResponse.swift deleted file mode 100644 index 4f1ba7c..0000000 --- a/Sources/XCBProtocol_11_3/Core/BoolResponse.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BoolResponse { - public let value: Bool - - public init(_ value: Bool) { - self.value = value - } -} - -// MARK: - ResponsePayloadConvertible - -extension BoolResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .bool(self) } -} - -// MARK: - Decoding - -extension BoolResponse: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.value = try args.parseBool(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension BoolResponse: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.bool(value)] - } -} diff --git a/Sources/XCBProtocol_11_3/Core/ErrorResponse.swift b/Sources/XCBProtocol_11_3/Core/ErrorResponse.swift deleted file mode 100644 index d116914..0000000 --- a/Sources/XCBProtocol_11_3/Core/ErrorResponse.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct ErrorResponse { - public let message: String - - public init(_ message: String) { - self.message = message - } -} - -// MARK: - ResponsePayloadConvertible - -extension ErrorResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .error(self) } -} - -// MARK: - Decoding - -extension ErrorResponse: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.message = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension ErrorResponse: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.string(message)] - } -} diff --git a/Sources/XCBProtocol_11_3/Core/PingResponse.swift b/Sources/XCBProtocol_11_3/Core/PingResponse.swift deleted file mode 100644 index e624cd6..0000000 --- a/Sources/XCBProtocol_11_3/Core/PingResponse.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PingResponse { - public init() {} -} - -// MARK: - ResponsePayloadConvertible - -extension PingResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .ping(self) } -} - -// MARK: - Decoding - -extension PingResponse: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) {} -} - -// MARK: - Encoding - -extension PingResponse: CustomEncodableRPCPayload { - public func encode() -> MessagePackValue { - return .nil - } -} diff --git a/Sources/XCBProtocol_11_3/Core/StringResponse.swift b/Sources/XCBProtocol_11_3/Core/StringResponse.swift deleted file mode 100644 index 0d59f9f..0000000 --- a/Sources/XCBProtocol_11_3/Core/StringResponse.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct StringResponse { - public let value: String - - public init(_ value: String) { - self.value = value - } -} - -// MARK: - ResponsePayloadConvertible - -extension StringResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .string(self) } -} - -// MARK: - Decoding - -extension StringResponse: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 1 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.value = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - } -} - -// MARK: - Encoding - -extension StringResponse: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.string(value)] - } -} diff --git a/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoRequest.swift deleted file mode 100644 index 76d2417..0000000 --- a/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct IndexingInfoRequest { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest // Called `request` by Xcode - public let targetGUID: String // Called `targetID` by Xcode -} - -// MARK: - Decoding - -extension IndexingInfoRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.responseChannel = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.buildRequest = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.targetGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - } -} diff --git a/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoResponse.swift deleted file mode 100644 index 134095a..0000000 --- a/Sources/XCBProtocol_11_3/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct IndexingInfoResponse { - public let targetGUID: String // Called `targetID` by Xcode - public let data: Data - - public init(targetGUID: String, data: Data) { - self.targetGUID = targetGUID - self.data = data - } -} - -// MARK: - ResponsePayloadConvertible - -extension IndexingInfoResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .indexingInfo(self) } -} - -// MARK: - Decoding - -extension IndexingInfoResponse: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.targetGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.data = try args.parseBinary(indexPath: indexPath + IndexPath(index: 1)) - } -} - -// MARK: - Encoding - -extension IndexingInfoResponse: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(targetGUID), - .binary(data), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 100644 index 936abde..0000000 --- a/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PlanningOperationDidFinish { - public let sessionHandle: String - public let guid: String - - public init(sessionHandle: String, guid: String) { - self.sessionHandle = sessionHandle - self.guid = guid - } -} - -// MARK: - ResponsePayloadConvertible - -extension PlanningOperationDidFinish: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .planningOperationDidFinish(self) } -} - -// MARK: - Decoding - -extension PlanningOperationDidFinish: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.guid = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - } -} - -// MARK: - Encoding - -extension PlanningOperationDidFinish: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.string(sessionHandle), .string(guid)] - } -} diff --git a/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationWillStart.swift deleted file mode 100644 index 50c4fe9..0000000 --- a/Sources/XCBProtocol_11_3/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PlanningOperationWillStart { - public let sessionHandle: String - public let guid: String - - public init(sessionHandle: String, guid: String) { - self.sessionHandle = sessionHandle - self.guid = guid - } -} - -// MARK: - ResponsePayloadConvertible - -extension PlanningOperationWillStart: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .planningOperationWillStart(self) } -} - -// MARK: - Decoding - -extension PlanningOperationWillStart: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.guid = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - } -} - -// MARK: - Encoding - -extension PlanningOperationWillStart: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [.string(sessionHandle), .string(guid)] - } -} diff --git a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_11_3/Preview Info/PreviewInfo.swift deleted file mode 100644 index 68a4e98..0000000 --- a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PreviewInfo { - public let sdkVariant: SDKVariant // Called `sdkRoot` by Xcode. e.g. "macosx10.14" - public let unknown: MessagePackValue - public let buildVariant: String // Might be named wrong. e.g. "normal" - public let architecture: String // e.g. "x86_64" - public let compileCommandLine: [String] // e.g. ["/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-enforce-exclusivity=checked", ...] - public let linkCommandLine: [String] // e.g. ["/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-target", ...] - public let thunkSourceFile: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.swift" - public let thunkObjectFile: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.o" - public let thunkLibrary: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.dylib" - public let pifGUID: String - - public init( - sdkVariant: SDKVariant, - buildVariant: String, - architecture: String, - compileCommandLine: [String], - linkCommandLine: [String], - thunkSourceFile: String, - thunkObjectFile: String, - thunkLibrary: String, - pifGUID: String - ) { - self.sdkVariant = sdkVariant - self.unknown = .nil - self.buildVariant = buildVariant - self.architecture = architecture - self.compileCommandLine = compileCommandLine - self.linkCommandLine = linkCommandLine - self.thunkSourceFile = thunkSourceFile - self.thunkObjectFile = thunkObjectFile - self.thunkLibrary = thunkLibrary - self.pifGUID = pifGUID - } -} - -// MARK: - Decoding - -extension PreviewInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 10 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sdkVariant = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1)) - self.buildVariant = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.architecture = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.compileCommandLine = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 4)) - self.linkCommandLine = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 5)) - self.thunkSourceFile = try args.parseString(indexPath: indexPath + IndexPath(index: 6)) - self.thunkObjectFile = try args.parseString(indexPath: indexPath + IndexPath(index: 7)) - self.thunkLibrary = try args.parseString(indexPath: indexPath + IndexPath(index: 8)) - self.pifGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 9)) - } -} - -// MARK: - Encoding - -extension PreviewInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - sdkVariant.encode(), - unknown, - .string(buildVariant), - .string(architecture), - .array(compileCommandLine.map(MessagePackValue.string)), - .array(linkCommandLine.map(MessagePackValue.string)), - .string(thunkSourceFile), - .string(thunkObjectFile), - .string(thunkLibrary), - .string(pifGUID), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoRequest.swift deleted file mode 100644 index 99bc4bf..0000000 --- a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PreviewInfoRequest { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest // Called `request` by Xcode - public let targetGUID: String // Called `targetID` by Xcode - public let sourceFile: String // e.g. "/Full/Path/To/Project/Source/File.swift" - public let thunkVariantSuffix: String // e.g. "__XCPREVIEW_THUNKSUFFIX__" -} - -// MARK: - Decoding - -extension PreviewInfoRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 6 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.responseChannel = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.buildRequest = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.targetGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.sourceFile = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.thunkVariantSuffix = try args.parseString(indexPath: indexPath + IndexPath(index: 5)) - } -} diff --git a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoResponse.swift deleted file mode 100644 index e452248..0000000 --- a/Sources/XCBProtocol_11_3/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PreviewInfoResponse { - public let targetGUID: String // Called `targetID` by Xcode - public let infos: [PreviewInfo] // Not named correctly - - public init(targetGUID: String, infos: [PreviewInfo]) { - self.targetGUID = targetGUID - self.infos = infos - } -} - -// MARK: - ResponsePayloadConvertible - -extension PreviewInfoResponse: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .previewInfo(self) } -} - -// MARK: - Decoding - -extension PreviewInfoResponse: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.targetGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - - let infosIndexPath = indexPath + IndexPath(index: 1) - let infosArray = try args.parseArray(indexPath: infosIndexPath) - self.infos = try infosArray.enumerated().map { index, _ in - try infosArray.parseObject(indexPath: infosIndexPath + IndexPath(index: index)) - } - } -} - -// MARK: - Encoding - -extension PreviewInfoResponse: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(targetGUID), - .array(infos.map { .array($0.encode()) }), - ] - } -} diff --git a/Sources/XCBProtocol_11_3/RequestPayload.swift b/Sources/XCBProtocol_11_3/RequestPayload.swift deleted file mode 100644 index 34f48ce..0000000 --- a/Sources/XCBProtocol_11_3/RequestPayload.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum RequestPayload { - case createSession(CreateSessionRequest) - case transferSessionPIFRequest(TransferSessionPIFRequest) - case setSessionSystemInfo(SetSessionSystemInfoRequest) - case setSessionUserInfo(SetSessionUserInfoRequest) - - case createBuildRequest(CreateBuildRequest) - case buildStartRequest(BuildStartRequest) - case buildCancelRequest(BuildCancelRequest) - - case indexingInfoRequest(IndexingInfoRequest) - - case previewInfoRequest(PreviewInfoRequest) - - case unknownRequest(UnknownRequest) -} - -public struct UnknownRequest { - public let values: [MessagePackValue] -} - -// MARK: - Encoding - -extension RequestPayload: XCBProtocol.RequestPayload { - public static func unknownRequest(values: [MessagePackValue]) -> Self { - return .unknownRequest(.init(values: values)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "CREATE_SESSION": self = .createSession(try values.parseObject(indexPath: bodyIndexPath)) - case "TRANSFER_SESSION_PIF_REQUEST": self = .transferSessionPIFRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "SET_SESSION_SYSTEM_INFO": self = .setSessionSystemInfo(try values.parseObject(indexPath: indexPath)) - case "SET_SESSION_USER_INFO": self = .setSessionUserInfo(try values.parseObject(indexPath: bodyIndexPath)) - case "CREATE_BUILD": self = .createBuildRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_START": self = .buildStartRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CANCEL": self = .buildCancelRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "INDEXING_INFO_REQUESTED": self = .indexingInfoRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "PREVIEW_INFO_REQUESTED": self = .previewInfoRequest(try values.parseObject(indexPath: bodyIndexPath)) - - default: self = .unknownRequest(.init(values: values)) - } - } - - public var createSessionXcodePath: String? { - switch self { - case .createSession(let message): return message.appPath - default: return nil - } - } -} diff --git a/Sources/XCBProtocol_11_3/ResponsePayload.swift b/Sources/XCBProtocol_11_3/ResponsePayload.swift deleted file mode 100644 index a3da8f0..0000000 --- a/Sources/XCBProtocol_11_3/ResponsePayload.swift +++ /dev/null @@ -1,150 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum ResponsePayload { - case ping(PingResponse) - case bool(BoolResponse) - case string(StringResponse) - case error(ErrorResponse) - - case buildCreated(BuildCreated) - case buildOperationProgressUpdated(BuildOperationProgressUpdated) - case buildOperationPreparationCompleted(BuildOperationPreparationCompleted) - case buildOperationStarted(BuildOperationStarted) - case buildOperationReportPathMap(BuildOperationReportPathMap) - case buildOperationDiagnostic(BuildOperationDiagnosticEmitted) - case buildOperationEnded(BuildOperationEnded) - - case planningOperationWillStart(PlanningOperationWillStart) - case planningOperationDidFinish(PlanningOperationDidFinish) - - case buildOperationTargetUpToDate(BuildOperationTargetUpToDate) - case buildOperationTargetStarted(BuildOperationTargetStarted) - case buildOperationTargetEnded(BuildOperationTargetEnded) - - case buildOperationTaskUpToDate(BuildOperationTaskUpToDate) - case buildOperationTaskStarted(BuildOperationTaskStarted) - case buildOperationConsoleOutput(BuildOperationConsoleOutputEmitted) - case buildOperationTaskEnded(BuildOperationTaskEnded) - - case indexingInfo(IndexingInfoResponse) - - case previewInfo(PreviewInfoResponse) - - case unknownResponse(UnknownResponse) -} - -public struct UnknownResponse { - public let values: [MessagePackValue] -} - -// MARK: - Decoding - -extension ResponsePayload: XCBProtocol.ResponsePayload { - public static func unknownResponse(values: [MessagePackValue]) -> Self { - return .unknownResponse(.init(values: values)) - } - - public static func errorResponse(_ message: String) -> Self { - return .error(.init(message)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "PING": self = .ping(try values.parseObject(indexPath: bodyIndexPath)) - case "BOOL": self = .bool(try values.parseObject(indexPath: bodyIndexPath)) - case "STRING": self = .string(try values.parseObject(indexPath: bodyIndexPath)) - case "ERROR": self = .error(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CREATED": self = .buildCreated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PROGRESS_UPDATED": self = .buildOperationProgressUpdated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PREPARATION_COMPLETED": self = .buildOperationPreparationCompleted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_STARTED": self = .buildOperationStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_REPORT_PATH_MAP": self = .buildOperationReportPathMap(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_DIAGNOSTIC_EMITTED": self = .buildOperationDiagnostic(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_ENDED": self = .buildOperationEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_WILL_START": self = .planningOperationWillStart(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_FINISHED": self = .planningOperationDidFinish(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_UPTODATE": self = .buildOperationTargetUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_STARTED": self = .buildOperationTargetStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_ENDED": self = .buildOperationTargetEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_UPTODATE": self = .buildOperationTaskUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_STARTED": self = .buildOperationTaskStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CONSOLE_OUTPUT_EMITTED": self = .buildOperationConsoleOutput(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_ENDED": self = .buildOperationTaskEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "INDEXING_INFO_RECEIVED": self = .indexingInfo(try values.parseObject(indexPath: bodyIndexPath)) - case "PREVIEW_INFO_RECEIVED": self = .previewInfo(try values.parseObject(indexPath: bodyIndexPath)) - - default: self = .unknownResponse(.init(values: values)) - } - } - - private var name: String { - switch self { - case .ping: return "PING" - case .bool: return "BOOL" - case .string: return "STRING" - case .error: return "ERROR" - case .buildCreated: return "BUILD_CREATED" - case .buildOperationProgressUpdated: return "BUILD_PROGRESS_UPDATED" - case .buildOperationPreparationCompleted: return "BUILD_PREPARATION_COMPLETED" - case .buildOperationStarted: return "BUILD_OPERATION_STARTED" - case .buildOperationReportPathMap: return "BUILD_OPERATION_REPORT_PATH_MAP" - case .buildOperationDiagnostic: return "BUILD_DIAGNOSTIC_EMITTED" - case .buildOperationEnded: return "BUILD_OPERATION_ENDED" - case .planningOperationWillStart: return "PLANNING_OPERATION_WILL_START" - case .planningOperationDidFinish: return "PLANNING_OPERATION_FINISHED" - case .buildOperationTargetUpToDate: return "BUILD_TARGET_UPTODATE" - case .buildOperationTargetStarted: return "BUILD_TARGET_STARTED" - case .buildOperationTargetEnded: return "BUILD_TARGET_ENDED" - case .buildOperationTaskUpToDate: return "BUILD_TASK_UPTODATE" - case .buildOperationTaskStarted: return "BUILD_TASK_STARTED" - case .buildOperationConsoleOutput: return "BUILD_CONSOLE_OUTPUT_EMITTED" - case .buildOperationTaskEnded: return "BUILD_TASK_ENDED" - case .indexingInfo: return "INDEXING_INFO_RECEIVED" - case .previewInfo: return "PREVIEW_INFO_RECEIVED" - - case .unknownResponse: preconditionFailure("Tried to get name of UnknownResponse") - } - } - - private var message: CustomEncodableRPCPayload { - switch self { - case let .ping(message): return message - case let .bool(message): return message - case let .string(message): return message - case let .error(message): return message - case let .buildCreated(message): return message - case let .buildOperationProgressUpdated(message): return message - case let .buildOperationPreparationCompleted(message): return message - case let .buildOperationStarted(message): return message - case let .buildOperationReportPathMap(message): return message - case let .buildOperationDiagnostic(message): return message - case let .buildOperationEnded(message): return message - case let .planningOperationWillStart(message): return message - case let .planningOperationDidFinish(message): return message - case let .buildOperationTargetUpToDate(message): return message - case let .buildOperationTargetStarted(message): return message - case let .buildOperationTargetEnded(message): return message - case let .buildOperationTaskUpToDate(message): return message - case let .buildOperationTaskStarted(message): return message - case let .buildOperationConsoleOutput(message): return message - case let .buildOperationTaskEnded(message): return message - case let .indexingInfo(message): return message - case let .previewInfo(message): return message - - case .unknownResponse: preconditionFailure("Tried to get message of UnknownResponse") - } - } - - public func encode() -> [MessagePackValue] { - if case let .unknownResponse(message) = self { - return message.values - } - - return [.string(name), message.encode()] - } -} diff --git a/Sources/XCBProtocol_11_3/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_11_3/Session/CreateSessionRequest.swift deleted file mode 100644 index 9d2630b..0000000 --- a/Sources/XCBProtocol_11_3/Session/CreateSessionRequest.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct CreateSessionRequest { - public let name: String - public let appPath: String - public let cachePath: String - public let inferiorProductsPath: String? -} - -// MARK: - Decoding - -extension CreateSessionRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.name = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.appPath = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.cachePath = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.inferiorProductsPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 3)) - } -} diff --git a/Sources/XCBProtocol_11_3/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_11_3/Session/SetSessionSystemInfoRequest.swift deleted file mode 100644 index 805e9c2..0000000 --- a/Sources/XCBProtocol_11_3/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SetSessionSystemInfoRequest { - public let sessionHandle: String - public let osMajorVersion: UInt64 - public let osMinorVersion: UInt64 - public let osPatchVersion: UInt64 - public let xcodeBuildVersion: String // Called `productBuildVersion` by Xcode - public let nativeArchitecture: String -} - -extension SetSessionSystemInfoRequest: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - guard values.count == 5 else { throw RPCPayloadDecodingError.invalidCount(values.count, indexPath: indexPath) } - - // Name is at index 0 - let argsIndexPath = indexPath + IndexPath(index: 1) - let args = try values.parseArray(indexPath: argsIndexPath) - - self.sessionHandle = try args.parseString(indexPath: argsIndexPath + IndexPath(index: 0)) - self.osMajorVersion = try args.parseUInt64(indexPath: argsIndexPath + IndexPath(index: 1)) - self.osMinorVersion = try args.parseUInt64(indexPath: argsIndexPath + IndexPath(index: 2)) - - self.osPatchVersion = try values.parseUInt64(indexPath: indexPath + IndexPath(index: 2)) - self.xcodeBuildVersion = try values.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.nativeArchitecture = try values.parseString(indexPath: indexPath + IndexPath(index: 4)) - } -} diff --git a/Sources/XCBProtocol_11_3/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_11_3/Session/SetSessionUserInfoRequest.swift deleted file mode 100644 index 33cac9a..0000000 --- a/Sources/XCBProtocol_11_3/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SetSessionUserInfoRequest { - public let sessionHandle: String - public let user: String - public let group: String - public let uid: Int64 - public let gid: Int64 - public let home: String - public let xcodeProcessEnvironment: [String: String] - public let buildSystemEnvironment: [String: String] - public let usePerConfigurationBuildDirectories: Bool? -} - -// MARK: - Decoding - -extension SetSessionUserInfoRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 9 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.user = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.group = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.uid = try args.parseInt64(indexPath: indexPath + IndexPath(index: 3)) - self.gid = try args.parseInt64(indexPath: indexPath + IndexPath(index: 4)) - self.home = try args.parseString(indexPath: indexPath + IndexPath(index: 5)) - self.xcodeProcessEnvironment = try args.parseMap(indexPath: indexPath + IndexPath(index: 6)) - self.buildSystemEnvironment = try args.parseMap(indexPath: indexPath + IndexPath(index: 7)) - self.usePerConfigurationBuildDirectories = try args.parseOptionalBool(indexPath: indexPath + IndexPath(index: 8)) - } -} diff --git a/Sources/XCBProtocol_11_3/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_11_3/Session/TransferSessionPIFRequest.swift deleted file mode 100644 index c016dc5..0000000 --- a/Sources/XCBProtocol_11_3/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct TransferSessionPIFRequest { - public let sessionHandle: String - public let workspaceSignature: String -} - -// MARK: - Decoding - -extension TransferSessionPIFRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.workspaceSignature = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - } -} diff --git a/Sources/XCBProtocol_11_4/BUILD.bazel b/Sources/XCBProtocol_11_4/BUILD.bazel deleted file mode 100644 index 876b28c..0000000 --- a/Sources/XCBProtocol_11_4/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_11_4", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_11_4", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift deleted file mode 120000 index 77b7ce9..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 120000 index fb403ca..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationPreparationCompleted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 120000 index 3d5d50b..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationProgressUpdated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift deleted file mode 120000 index 25f8b61..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationReportPathMap.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift deleted file mode 120000 index 4e7795e..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift deleted file mode 120000 index ab70c38..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build Operation/BuildOperationStatus.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 120000 index 9bb7574..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 100755 index 52b55ca..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationDiagnosticEmitted { - public let kind: BuildOperationDiagnosticKind - public let location: BuildOperationDiagnosticLocation - public let message: String - public let component: BuildOperationDiagnosticComponent - public let unknown1: String // e.g. "default" - public let appendToOutputStream: Bool // If `true`, it's attached to the output instead of showing as a new entry - public let unknown2: MessagePackValue // ??? - public let unknown3: MessagePackValue // Might be `fixIts` - public let unknown4: MessagePackValue // Might be `childDiagnostics` - - public init( - kind: BuildOperationDiagnosticKind, - location: BuildOperationDiagnosticLocation, - message: String, - component: BuildOperationDiagnosticComponent, - unknown: String, - appendToOutputStream: Bool - ) { - self.kind = kind - self.location = location - self.message = message - self.component = component - self.unknown1 = unknown - self.appendToOutputStream = appendToOutputStream - self.unknown2 = .nil - self.unknown3 = .array([]) - self.unknown4 = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationDiagnosticEmitted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationDiagnostic(self) } -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticEmitted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 9 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.kind = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.location = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.message = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.component = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - self.unknown1 = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.appendToOutputStream = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.unknown2 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 6)) - self.unknown3 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 7)) - self.unknown4 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 8)) - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticEmitted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(kind.rawValue), - .array(location.encode()), - .string(message), - .array(component.encode()), - .string(unknown1), - .bool(appendToOutputStream), - unknown2, - unknown3, - unknown4, - ] - } -} diff --git a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 120000 index 6072eb7..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 120000 index f134619..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 120000 index d118f7e..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 120000 index e9e57d0..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 120000 index 57567c0..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 120000 index 064a67f..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 120000 index f96d420..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Target/BuildOperationTargetUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 120000 index 4e449ea..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 120000 index d1de764..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 120000 index 15628c3..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskMetrics.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 120000 index cc7f876..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 120000 index e77addc..0000000 --- a/Sources/XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_3/Build Operation/Task/BuildOperationTaskUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/ArenaInfo.swift b/Sources/XCBProtocol_11_4/Build/ArenaInfo.swift deleted file mode 120000 index 7dbe02f..0000000 --- a/Sources/XCBProtocol_11_4/Build/ArenaInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/ArenaInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_11_4/Build/BuildCancelRequest.swift deleted file mode 120000 index 83937f7..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildCancelRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildCancelRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildCommand.swift b/Sources/XCBProtocol_11_4/Build/BuildCommand.swift deleted file mode 120000 index d1d26de..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildCreated.swift b/Sources/XCBProtocol_11_4/Build/BuildCreated.swift deleted file mode 120000 index 9801424..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildParameters.swift b/Sources/XCBProtocol_11_4/Build/BuildParameters.swift deleted file mode 120000 index dbbeb9b..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildParameters.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildParameters.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildPlatform.swift b/Sources/XCBProtocol_11_4/Build/BuildPlatform.swift deleted file mode 120000 index e7fc8ce..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildPlatform.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildPlatform.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/BuildRequest.swift b/Sources/XCBProtocol_11_4/Build/BuildRequest.swift deleted file mode 100755 index f29598a..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildRequest.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildRequest { - public let parameters: BuildParameters - public let configuredTargets: [ConfiguredTarget] - public let continueBuildingAfterErrors: Bool - public let hideShellScriptEnvironment: Bool - public let useParallelTargets: Bool - public let useImplicitDependencies: Bool - public let useDryRun: Bool - public let showNonLoggedProgress: Bool - public let buildPlanDiagnosticsDirPath: String? - public let buildCommand: BuildCommand - public let schemeCommand: SchemeCommand - public let buildOnlyTheseFiles: MessagePackValue - public let buildOnlyTheseTargets: MessagePackValue - public let enableIndexBuildArena: Bool - public let useLegacyBuildLocations: Bool - public let shouldCollectMetrics: Bool -} - -// MARK: - Decoding - -extension BuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 16 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.parameters = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - - let targetsIndexPath = indexPath + IndexPath(index: 1) - let targetGUIDsArray = try args.parseArray(indexPath: targetsIndexPath) - self.configuredTargets = try targetGUIDsArray.enumerated().map { index, _ in - try targetGUIDsArray.parseObject(indexPath: targetsIndexPath + IndexPath(index: index)) - } - - self.continueBuildingAfterErrors = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.hideShellScriptEnvironment = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - self.useParallelTargets = try args.parseBool(indexPath: indexPath + IndexPath(index: 4)) - self.useImplicitDependencies = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.useDryRun = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - self.showNonLoggedProgress = try args.parseBool(indexPath: indexPath + IndexPath(index: 7)) - self.buildPlanDiagnosticsDirPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 8)) - self.buildCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 9)) - self.schemeCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 10)) - self.buildOnlyTheseFiles = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 11)) - self.buildOnlyTheseTargets = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 12)) - self.enableIndexBuildArena = try args.parseBool(indexPath: indexPath + IndexPath(index: 13)) - self.useLegacyBuildLocations = try args.parseBool(indexPath: indexPath + IndexPath(index: 14)) - self.shouldCollectMetrics = try args.parseBool(indexPath: indexPath + IndexPath(index: 15)) - } -} diff --git a/Sources/XCBProtocol_11_4/Build/BuildStartRequest.swift b/Sources/XCBProtocol_11_4/Build/BuildStartRequest.swift deleted file mode 120000 index 4e568af..0000000 --- a/Sources/XCBProtocol_11_4/Build/BuildStartRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/BuildStartRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_11_4/Build/ConfiguredTarget.swift deleted file mode 120000 index 54913d7..0000000 --- a/Sources/XCBProtocol_11_4/Build/ConfiguredTarget.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/ConfiguredTarget.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_11_4/Build/CreateBuildRequest.swift deleted file mode 120000 index 9149363..0000000 --- a/Sources/XCBProtocol_11_4/Build/CreateBuildRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/CreateBuildRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_11_4/Build/RunDestinationInfo.swift deleted file mode 120000 index d62d863..0000000 --- a/Sources/XCBProtocol_11_4/Build/RunDestinationInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/RunDestinationInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/SDKVariant.swift b/Sources/XCBProtocol_11_4/Build/SDKVariant.swift deleted file mode 120000 index 40215a1..0000000 --- a/Sources/XCBProtocol_11_4/Build/SDKVariant.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/SDKVariant.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/SchemeCommand.swift b/Sources/XCBProtocol_11_4/Build/SchemeCommand.swift deleted file mode 120000 index 06e367f..0000000 --- a/Sources/XCBProtocol_11_4/Build/SchemeCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/SchemeCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Build/SettingsOverrides.swift b/Sources/XCBProtocol_11_4/Build/SettingsOverrides.swift deleted file mode 120000 index befe22b..0000000 --- a/Sources/XCBProtocol_11_4/Build/SettingsOverrides.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Build/SettingsOverrides.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Core/BoolResponse.swift b/Sources/XCBProtocol_11_4/Core/BoolResponse.swift deleted file mode 120000 index 8cace77..0000000 --- a/Sources/XCBProtocol_11_4/Core/BoolResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Core/BoolResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Core/ErrorResponse.swift b/Sources/XCBProtocol_11_4/Core/ErrorResponse.swift deleted file mode 120000 index c3e9c8f..0000000 --- a/Sources/XCBProtocol_11_4/Core/ErrorResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Core/ErrorResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Core/PingResponse.swift b/Sources/XCBProtocol_11_4/Core/PingResponse.swift deleted file mode 120000 index 01ac280..0000000 --- a/Sources/XCBProtocol_11_4/Core/PingResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Core/PingResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Core/StringResponse.swift b/Sources/XCBProtocol_11_4/Core/StringResponse.swift deleted file mode 120000 index 956f483..0000000 --- a/Sources/XCBProtocol_11_4/Core/StringResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Core/StringResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoRequest.swift deleted file mode 120000 index ee867e0..0000000 --- a/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Indexing Info/IndexingInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift deleted file mode 120000 index 4b39a93..0000000 --- a/Sources/XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Indexing Info/IndexingInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 120000 index c2dd9fa..0000000 --- a/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Planning Operation/PlanningOperationDidFinish.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift deleted file mode 120000 index ff37673..0000000 --- a/Sources/XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Planning Operation/PlanningOperationWillStart.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_11_4/Preview Info/PreviewInfo.swift deleted file mode 120000 index 9c945fe..0000000 --- a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Preview Info/PreviewInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoRequest.swift deleted file mode 120000 index 84c61bd..0000000 --- a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Preview Info/PreviewInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift deleted file mode 120000 index 5c87f84..0000000 --- a/Sources/XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Preview Info/PreviewInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/RequestPayload.swift b/Sources/XCBProtocol_11_4/RequestPayload.swift deleted file mode 120000 index b8960f1..0000000 --- a/Sources/XCBProtocol_11_4/RequestPayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_11_3/RequestPayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/ResponsePayload.swift b/Sources/XCBProtocol_11_4/ResponsePayload.swift deleted file mode 120000 index a7c2ec2..0000000 --- a/Sources/XCBProtocol_11_4/ResponsePayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_11_3/ResponsePayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_11_4/Session/CreateSessionRequest.swift deleted file mode 120000 index 1910b46..0000000 --- a/Sources/XCBProtocol_11_4/Session/CreateSessionRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Session/CreateSessionRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift deleted file mode 120000 index 53bb0d7..0000000 --- a/Sources/XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Session/SetSessionSystemInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift deleted file mode 120000 index ba97466..0000000 --- a/Sources/XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Session/SetSessionUserInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift deleted file mode 120000 index bbbe31e..0000000 --- a/Sources/XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_3/Session/TransferSessionPIFRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/BUILD.bazel b/Sources/XCBProtocol_12_0/BUILD.bazel deleted file mode 100644 index 29f4faa..0000000 --- a/Sources/XCBProtocol_12_0/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_12_0", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_12_0", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationEnded.swift deleted file mode 120000 index 8548403..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 120000 index 82b6777..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 120000 index ae579f2..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationReportPathMap.swift deleted file mode 120000 index 6c5c0f4..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStarted.swift deleted file mode 120000 index 0a67aa1..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStatus.swift deleted file mode 120000 index 1e170b0..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 120000 index a86ba35..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 100755 index d479487..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationDiagnosticEmitted { - public let kind: BuildOperationDiagnosticKind - public let location: BuildOperationDiagnosticLocation - public let message: String - public let component: BuildOperationDiagnosticComponent - public let unknown1: String // e.g. "default" - public let appendToOutputStream: Bool // If `true`, it's attached to the output instead of showing as a new entry - public let unknown2: MessagePackValue // Might be `fixIts` - public let unknown3: MessagePackValue // Might be `childDiagnostics` - - public init( - kind: BuildOperationDiagnosticKind, - location: BuildOperationDiagnosticLocation, - message: String, - component: BuildOperationDiagnosticComponent, - unknown: String, - appendToOutputStream: Bool - ) { - self.kind = kind - self.location = location - self.message = message - self.component = component - self.unknown1 = unknown - self.appendToOutputStream = appendToOutputStream - self.unknown2 = .array([]) - self.unknown3 = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationDiagnosticEmitted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationDiagnostic(self) } -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticEmitted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 8 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.kind = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.location = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.message = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.component = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - self.unknown1 = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.appendToOutputStream = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.unknown2 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 6)) - self.unknown3 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 7)) - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticEmitted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(kind.rawValue), - .array(location.encode()), - .string(message), - .array(component.encode()), - .string(unknown1), - .bool(appendToOutputStream), - unknown2, - unknown3, - ] - } -} diff --git a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 120000 index 6230bbc..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 120000 index 3486339..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 120000 index 0654228..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 120000 index c75ffc7..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 120000 index 6ede003..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetProjectInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 120000 index 60ed702..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 120000 index 2990a80..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 120000 index 9facbed..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 120000 index 052b650..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 120000 index 26298c3..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 120000 index c6f9940..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 120000 index 3ed9ea2..0000000 --- a/Sources/XCBProtocol_12_0/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/ArenaInfo.swift b/Sources/XCBProtocol_12_0/Build/ArenaInfo.swift deleted file mode 120000 index 61d7080..0000000 --- a/Sources/XCBProtocol_12_0/Build/ArenaInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/ArenaInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_12_0/Build/BuildCancelRequest.swift deleted file mode 120000 index 7fb587d..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildCancelRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCancelRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildCommand.swift b/Sources/XCBProtocol_12_0/Build/BuildCommand.swift deleted file mode 120000 index 402986d..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildCreated.swift b/Sources/XCBProtocol_12_0/Build/BuildCreated.swift deleted file mode 120000 index 7f43117..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildParameters.swift b/Sources/XCBProtocol_12_0/Build/BuildParameters.swift deleted file mode 120000 index c61a70a..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildParameters.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildParameters.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildPlatform.swift b/Sources/XCBProtocol_12_0/Build/BuildPlatform.swift deleted file mode 120000 index 279e5bc..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildPlatform.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildPlatform.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/BuildRequest.swift b/Sources/XCBProtocol_12_0/Build/BuildRequest.swift deleted file mode 100755 index 870daaa..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildRequest.swift +++ /dev/null @@ -1,55 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildRequest { - public let parameters: BuildParameters - public let configuredTargets: [ConfiguredTarget] - public let continueBuildingAfterErrors: Bool - public let hideShellScriptEnvironment: Bool - public let useParallelTargets: Bool - public let useImplicitDependencies: Bool - public let useDryRun: Bool - public let showNonLoggedProgress: Bool - public let buildPlanDiagnosticsDirPath: String? - public let buildCommand: BuildCommand - public let schemeCommand: SchemeCommand - public let buildOnlyTheseFiles: MessagePackValue - public let buildOnlyTheseTargets: MessagePackValue - public let buildDescriptionID: MessagePackValue - public let enableIndexBuildArena: Bool - public let useLegacyBuildLocations: Bool - public let shouldCollectMetrics: Bool -} - -// MARK: - Decoding - -extension BuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 17 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.parameters = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - - let targetsIndexPath = indexPath + IndexPath(index: 1) - let targetGUIDsArray = try args.parseArray(indexPath: targetsIndexPath) - self.configuredTargets = try targetGUIDsArray.enumerated().map { index, _ in - try targetGUIDsArray.parseObject(indexPath: targetsIndexPath + IndexPath(index: index)) - } - - self.continueBuildingAfterErrors = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.hideShellScriptEnvironment = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - self.useParallelTargets = try args.parseBool(indexPath: indexPath + IndexPath(index: 4)) - self.useImplicitDependencies = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.useDryRun = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - self.showNonLoggedProgress = try args.parseBool(indexPath: indexPath + IndexPath(index: 7)) - self.buildPlanDiagnosticsDirPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 8)) - self.buildCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 9)) - self.schemeCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 10)) - self.buildOnlyTheseFiles = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 11)) - self.buildOnlyTheseTargets = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 12)) - self.buildDescriptionID = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 13)) - self.enableIndexBuildArena = try args.parseBool(indexPath: indexPath + IndexPath(index: 14)) - self.useLegacyBuildLocations = try args.parseBool(indexPath: indexPath + IndexPath(index: 15)) - self.shouldCollectMetrics = try args.parseBool(indexPath: indexPath + IndexPath(index: 16)) - } -} diff --git a/Sources/XCBProtocol_12_0/Build/BuildStartRequest.swift b/Sources/XCBProtocol_12_0/Build/BuildStartRequest.swift deleted file mode 120000 index 4d6ceff..0000000 --- a/Sources/XCBProtocol_12_0/Build/BuildStartRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildStartRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_12_0/Build/ConfiguredTarget.swift deleted file mode 120000 index dc72be1..0000000 --- a/Sources/XCBProtocol_12_0/Build/ConfiguredTarget.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/ConfiguredTarget.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_12_0/Build/CreateBuildRequest.swift deleted file mode 100644 index 2d91231..0000000 --- a/Sources/XCBProtocol_12_0/Build/CreateBuildRequest.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct CreateBuildRequest { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest // Called `request` by Xcode - public let unknown: Bool -} - -// MARK: - Decoding - -extension CreateBuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.responseChannel = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.buildRequest = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.unknown = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - } -} diff --git a/Sources/XCBProtocol_12_0/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_12_0/Build/RunDestinationInfo.swift deleted file mode 120000 index 13f55b6..0000000 --- a/Sources/XCBProtocol_12_0/Build/RunDestinationInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/RunDestinationInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/SDKVariant.swift b/Sources/XCBProtocol_12_0/Build/SDKVariant.swift deleted file mode 120000 index 903d1ec..0000000 --- a/Sources/XCBProtocol_12_0/Build/SDKVariant.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SDKVariant.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/SchemeCommand.swift b/Sources/XCBProtocol_12_0/Build/SchemeCommand.swift deleted file mode 120000 index c497d26..0000000 --- a/Sources/XCBProtocol_12_0/Build/SchemeCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SchemeCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Build/SettingsOverrides.swift b/Sources/XCBProtocol_12_0/Build/SettingsOverrides.swift deleted file mode 120000 index a3a4b52..0000000 --- a/Sources/XCBProtocol_12_0/Build/SettingsOverrides.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SettingsOverrides.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Core/BoolResponse.swift b/Sources/XCBProtocol_12_0/Core/BoolResponse.swift deleted file mode 120000 index 827b487..0000000 --- a/Sources/XCBProtocol_12_0/Core/BoolResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/BoolResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Core/ErrorResponse.swift b/Sources/XCBProtocol_12_0/Core/ErrorResponse.swift deleted file mode 120000 index eee77ab..0000000 --- a/Sources/XCBProtocol_12_0/Core/ErrorResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/ErrorResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Core/PingResponse.swift b/Sources/XCBProtocol_12_0/Core/PingResponse.swift deleted file mode 120000 index 23c05e6..0000000 --- a/Sources/XCBProtocol_12_0/Core/PingResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/PingResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Core/StringResponse.swift b/Sources/XCBProtocol_12_0/Core/StringResponse.swift deleted file mode 120000 index 1674c54..0000000 --- a/Sources/XCBProtocol_12_0/Core/StringResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/StringResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoRequest.swift deleted file mode 100755 index 6631798..0000000 --- a/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct IndexingInfoRequest { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest // Called `request` by Xcode - public let targetGUID: String // Called `targetID` by Xcode - public let unknown1: MessagePackValue - public let unknown2: Bool -} - -// MARK: - Decoding - -extension IndexingInfoRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 6 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.responseChannel = try args.parseUInt64(indexPath: indexPath + IndexPath(index: 1)) - self.buildRequest = try args.parseObject(indexPath: indexPath + IndexPath(index: 2)) - self.targetGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.unknown1 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 4)) - self.unknown2 = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - } -} diff --git a/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoResponse.swift deleted file mode 120000 index 8401e20..0000000 --- a/Sources/XCBProtocol_12_0/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 120000 index e8a318a..0000000 --- a/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationWillStart.swift deleted file mode 120000 index e081ddb..0000000 --- a/Sources/XCBProtocol_12_0/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_12_0/Preview Info/PreviewInfo.swift deleted file mode 120000 index da8eb1b..0000000 --- a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoRequest.swift deleted file mode 120000 index 5be1e80..0000000 --- a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoResponse.swift deleted file mode 120000 index 759bbef..0000000 --- a/Sources/XCBProtocol_12_0/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/RequestPayload.swift b/Sources/XCBProtocol_12_0/RequestPayload.swift deleted file mode 120000 index 42322d8..0000000 --- a/Sources/XCBProtocol_12_0/RequestPayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_11_4/RequestPayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/ResponsePayload.swift b/Sources/XCBProtocol_12_0/ResponsePayload.swift deleted file mode 100755 index 2444012..0000000 --- a/Sources/XCBProtocol_12_0/ResponsePayload.swift +++ /dev/null @@ -1,155 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum ResponsePayload { - case ping(PingResponse) - case bool(BoolResponse) - case string(StringResponse) - case error(ErrorResponse) - - case sessionCreated(SessionCreated) - - case buildCreated(BuildCreated) - case buildOperationProgressUpdated(BuildOperationProgressUpdated) - case buildOperationPreparationCompleted(BuildOperationPreparationCompleted) - case buildOperationStarted(BuildOperationStarted) - case buildOperationReportPathMap(BuildOperationReportPathMap) - case buildOperationDiagnostic(BuildOperationDiagnosticEmitted) - case buildOperationEnded(BuildOperationEnded) - - case planningOperationWillStart(PlanningOperationWillStart) - case planningOperationDidFinish(PlanningOperationDidFinish) - - case buildOperationTargetUpToDate(BuildOperationTargetUpToDate) - case buildOperationTargetStarted(BuildOperationTargetStarted) - case buildOperationTargetEnded(BuildOperationTargetEnded) - - case buildOperationTaskUpToDate(BuildOperationTaskUpToDate) - case buildOperationTaskStarted(BuildOperationTaskStarted) - case buildOperationConsoleOutput(BuildOperationConsoleOutputEmitted) - case buildOperationTaskEnded(BuildOperationTaskEnded) - - case indexingInfo(IndexingInfoResponse) - - case previewInfo(PreviewInfoResponse) - - case unknownResponse(UnknownResponse) -} - -public struct UnknownResponse { - public let values: [MessagePackValue] -} - -// MARK: - Decoding - -extension ResponsePayload: XCBProtocol.ResponsePayload { - public static func unknownResponse(values: [MessagePackValue]) -> Self { - return .unknownResponse(.init(values: values)) - } - - public static func errorResponse(_ message: String) -> Self { - return .error(.init(message)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "PING": self = .ping(try values.parseObject(indexPath: bodyIndexPath)) - case "BOOL": self = .bool(try values.parseObject(indexPath: bodyIndexPath)) - case "STRING": self = .string(try values.parseObject(indexPath: bodyIndexPath)) - case "ERROR": self = .error(try values.parseObject(indexPath: bodyIndexPath)) - case "SESSION_CREATED": self = .sessionCreated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CREATED": self = .buildCreated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PROGRESS_UPDATED": self = .buildOperationProgressUpdated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PREPARATION_COMPLETED": self = .buildOperationPreparationCompleted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_STARTED": self = .buildOperationStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_REPORT_PATH_MAP": self = .buildOperationReportPathMap(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_DIAGNOSTIC_EMITTED": self = .buildOperationDiagnostic(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_ENDED": self = .buildOperationEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_WILL_START": self = .planningOperationWillStart(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_FINISHED": self = .planningOperationDidFinish(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_UPTODATE": self = .buildOperationTargetUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_STARTED": self = .buildOperationTargetStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_ENDED": self = .buildOperationTargetEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_UPTODATE": self = .buildOperationTaskUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_STARTED": self = .buildOperationTaskStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CONSOLE_OUTPUT_EMITTED": self = .buildOperationConsoleOutput(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_ENDED": self = .buildOperationTaskEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "INDEXING_INFO_RECEIVED": self = .indexingInfo(try values.parseObject(indexPath: bodyIndexPath)) - case "PREVIEW_INFO_RECEIVED": self = .previewInfo(try values.parseObject(indexPath: bodyIndexPath)) - - default: self = .unknownResponse(.init(values: values)) - } - } - - private var name: String { - switch self { - case .ping: return "PING" - case .bool: return "BOOL" - case .string: return "STRING" - case .error: return "ERROR" - case .sessionCreated: return "SESSION_CREATED" - case .buildCreated: return "BUILD_CREATED" - case .buildOperationProgressUpdated: return "BUILD_PROGRESS_UPDATED" - case .buildOperationPreparationCompleted: return "BUILD_PREPARATION_COMPLETED" - case .buildOperationStarted: return "BUILD_OPERATION_STARTED" - case .buildOperationReportPathMap: return "BUILD_OPERATION_REPORT_PATH_MAP" - case .buildOperationDiagnostic: return "BUILD_DIAGNOSTIC_EMITTED" - case .buildOperationEnded: return "BUILD_OPERATION_ENDED" - case .planningOperationWillStart: return "PLANNING_OPERATION_WILL_START" - case .planningOperationDidFinish: return "PLANNING_OPERATION_FINISHED" - case .buildOperationTargetUpToDate: return "BUILD_TARGET_UPTODATE" - case .buildOperationTargetStarted: return "BUILD_TARGET_STARTED" - case .buildOperationTargetEnded: return "BUILD_TARGET_ENDED" - case .buildOperationTaskUpToDate: return "BUILD_TASK_UPTODATE" - case .buildOperationTaskStarted: return "BUILD_TASK_STARTED" - case .buildOperationConsoleOutput: return "BUILD_CONSOLE_OUTPUT_EMITTED" - case .buildOperationTaskEnded: return "BUILD_TASK_ENDED" - case .indexingInfo: return "INDEXING_INFO_RECEIVED" - case .previewInfo: return "PREVIEW_INFO_RECEIVED" - - case .unknownResponse: preconditionFailure("Tried to get name of UnknownResponse") - } - } - - private var message: CustomEncodableRPCPayload { - switch self { - case let .ping(message): return message - case let .bool(message): return message - case let .string(message): return message - case let .error(message): return message - case let .sessionCreated(message): return message - case let .buildCreated(message): return message - case let .buildOperationProgressUpdated(message): return message - case let .buildOperationPreparationCompleted(message): return message - case let .buildOperationStarted(message): return message - case let .buildOperationReportPathMap(message): return message - case let .buildOperationDiagnostic(message): return message - case let .buildOperationEnded(message): return message - case let .planningOperationWillStart(message): return message - case let .planningOperationDidFinish(message): return message - case let .buildOperationTargetUpToDate(message): return message - case let .buildOperationTargetStarted(message): return message - case let .buildOperationTargetEnded(message): return message - case let .buildOperationTaskUpToDate(message): return message - case let .buildOperationTaskStarted(message): return message - case let .buildOperationConsoleOutput(message): return message - case let .buildOperationTaskEnded(message): return message - case let .indexingInfo(message): return message - case let .previewInfo(message): return message - - case .unknownResponse: preconditionFailure("Tried to get message of UnknownResponse") - } - } - - public func encode() -> [MessagePackValue] { - if case let .unknownResponse(message) = self { - return message.values - } - - return [.string(name), message.encode()] - } -} diff --git a/Sources/XCBProtocol_12_0/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_12_0/Session/CreateSessionRequest.swift deleted file mode 120000 index d756d8f..0000000 --- a/Sources/XCBProtocol_12_0/Session/CreateSessionRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/CreateSessionRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Session/SessionCreated.swift b/Sources/XCBProtocol_12_0/Session/SessionCreated.swift deleted file mode 100644 index dad4c9a..0000000 --- a/Sources/XCBProtocol_12_0/Session/SessionCreated.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SessionCreated { - public let sessionHandle: String - public let unknown: MessagePackValue - - public init(sessionHandle: String) { - self.sessionHandle = sessionHandle - self.unknown = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension SessionCreated: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .sessionCreated(self) } -} - -// MARK: - Decoding - -extension SessionCreated: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sessionHandle = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1)) - } -} - -// MARK: - Encoding - -extension SessionCreated: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(sessionHandle), - unknown, - ] - } -} diff --git a/Sources/XCBProtocol_12_0/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_12_0/Session/SetSessionSystemInfoRequest.swift deleted file mode 120000 index abe9688..0000000 --- a/Sources/XCBProtocol_12_0/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_12_0/Session/SetSessionUserInfoRequest.swift deleted file mode 120000 index 63d8ec0..0000000 --- a/Sources/XCBProtocol_12_0/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_0/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_12_0/Session/TransferSessionPIFRequest.swift deleted file mode 120000 index e4341e4..0000000 --- a/Sources/XCBProtocol_12_0/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/BUILD.bazel b/Sources/XCBProtocol_12_5/BUILD.bazel deleted file mode 100644 index 3a93a50..0000000 --- a/Sources/XCBProtocol_12_5/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_12_5", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_12_5", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationEnded.swift deleted file mode 120000 index 8548403..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 120000 index 82b6777..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 120000 index ae579f2..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationReportPathMap.swift deleted file mode 120000 index 6c5c0f4..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStarted.swift deleted file mode 120000 index 0a67aa1..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStatus.swift deleted file mode 120000 index 1e170b0..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 120000 index a86ba35..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 120000 index 160f798..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_12_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 120000 index 6230bbc..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 120000 index 3486339..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 120000 index 0654228..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 120000 index c75ffc7..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 120000 index 6ede003..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetProjectInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 120000 index 60ed702..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 120000 index 2990a80..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 120000 index 9facbed..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 120000 index 052b650..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 120000 index 26298c3..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 120000 index c6f9940..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 100644 index b2a7972..0000000 --- a/Sources/XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskUpToDate { - public let taskGUID: Data - public let targetID: Int64? - public let unknown: MessagePackValue -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskUpToDate: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskUpToDate(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskUpToDate: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 3 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskGUID = try args.parseBinary(indexPath: indexPath + IndexPath(index: 0)) - self.targetID = try args.parseOptionalInt64(indexPath: indexPath + IndexPath(index: 1)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 2)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskUpToDate: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .binary(taskGUID), - targetID.flatMap { .int64($0) } ?? .nil, - unknown, - ] - } -} diff --git a/Sources/XCBProtocol_12_5/Build/ArenaInfo.swift b/Sources/XCBProtocol_12_5/Build/ArenaInfo.swift deleted file mode 120000 index 61d7080..0000000 --- a/Sources/XCBProtocol_12_5/Build/ArenaInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/ArenaInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_12_5/Build/BuildCancelRequest.swift deleted file mode 120000 index 7fb587d..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildCancelRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCancelRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildCommand.swift b/Sources/XCBProtocol_12_5/Build/BuildCommand.swift deleted file mode 120000 index 402986d..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildCreated.swift b/Sources/XCBProtocol_12_5/Build/BuildCreated.swift deleted file mode 120000 index 7f43117..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildParameters.swift b/Sources/XCBProtocol_12_5/Build/BuildParameters.swift deleted file mode 120000 index c61a70a..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildParameters.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildParameters.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildPlatform.swift b/Sources/XCBProtocol_12_5/Build/BuildPlatform.swift deleted file mode 120000 index 279e5bc..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildPlatform.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildPlatform.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/BuildRequest.swift b/Sources/XCBProtocol_12_5/Build/BuildRequest.swift deleted file mode 100755 index 02adbae..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildRequest.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildRequest { - public let parameters: BuildParameters - public let configuredTargets: [ConfiguredTarget] - public let continueBuildingAfterErrors: Bool - public let hideShellScriptEnvironment: Bool - public let useParallelTargets: Bool - public let useImplicitDependencies: Bool - public let useDryRun: Bool - public let showNonLoggedProgress: Bool - public let buildPlanDiagnosticsDirPath: String? - public let buildCommand: BuildCommand - public let schemeCommand: SchemeCommand - public let buildOnlyTheseFiles: MessagePackValue - public let buildOnlyTheseTargets: MessagePackValue - public let buildDescriptionID: MessagePackValue - public let enableIndexBuildArena: Bool - public let unknown: MessagePackValue // comes back as `.nil`, so it's unclear what this is or what type it is - public let useLegacyBuildLocations: Bool - public let shouldCollectMetrics: Bool - public let jsonRepresentation: String? -} - -// MARK: - Decoding - -extension BuildRequest: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 19 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.parameters = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - - let targetsIndexPath = indexPath + IndexPath(index: 1) - let targetGUIDsArray = try args.parseArray(indexPath: targetsIndexPath) - self.configuredTargets = try targetGUIDsArray.enumerated().map { index, _ in - try targetGUIDsArray.parseObject(indexPath: targetsIndexPath + IndexPath(index: index)) - } - - self.continueBuildingAfterErrors = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.hideShellScriptEnvironment = try args.parseBool(indexPath: indexPath + IndexPath(index: 3)) - self.useParallelTargets = try args.parseBool(indexPath: indexPath + IndexPath(index: 4)) - self.useImplicitDependencies = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.useDryRun = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - self.showNonLoggedProgress = try args.parseBool(indexPath: indexPath + IndexPath(index: 7)) - self.buildPlanDiagnosticsDirPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 8)) - self.buildCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 9)) - self.schemeCommand = try args.parseObject(indexPath: indexPath + IndexPath(index: 10)) - self.buildOnlyTheseFiles = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 11)) - self.buildOnlyTheseTargets = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 12)) - self.buildDescriptionID = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 13)) - self.enableIndexBuildArena = try args.parseBool(indexPath: indexPath + IndexPath(index: 14)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 15)) - self.useLegacyBuildLocations = try args.parseBool(indexPath: indexPath + IndexPath(index: 16)) - self.shouldCollectMetrics = try args.parseBool(indexPath: indexPath + IndexPath(index: 17)) - - if let jsonRepresentationBase64String = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 18)) { - guard let base64Data = Data(base64Encoded: jsonRepresentationBase64String), - let decodedString = String(data: base64Data, encoding: .utf8) else { - throw MessagePackUnpackError.invalidData - } - self.jsonRepresentation = decodedString - } else { - self.jsonRepresentation = nil - } - } -} diff --git a/Sources/XCBProtocol_12_5/Build/BuildStartRequest.swift b/Sources/XCBProtocol_12_5/Build/BuildStartRequest.swift deleted file mode 120000 index 4d6ceff..0000000 --- a/Sources/XCBProtocol_12_5/Build/BuildStartRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildStartRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_12_5/Build/ConfiguredTarget.swift deleted file mode 120000 index dc72be1..0000000 --- a/Sources/XCBProtocol_12_5/Build/ConfiguredTarget.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/ConfiguredTarget.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_12_5/Build/CreateBuildRequest.swift deleted file mode 120000 index 91e5a67..0000000 --- a/Sources/XCBProtocol_12_5/Build/CreateBuildRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_12_0/Build/CreateBuildRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_12_5/Build/RunDestinationInfo.swift deleted file mode 120000 index 13f55b6..0000000 --- a/Sources/XCBProtocol_12_5/Build/RunDestinationInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/RunDestinationInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/SDKVariant.swift b/Sources/XCBProtocol_12_5/Build/SDKVariant.swift deleted file mode 120000 index 903d1ec..0000000 --- a/Sources/XCBProtocol_12_5/Build/SDKVariant.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SDKVariant.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/SchemeCommand.swift b/Sources/XCBProtocol_12_5/Build/SchemeCommand.swift deleted file mode 120000 index c497d26..0000000 --- a/Sources/XCBProtocol_12_5/Build/SchemeCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SchemeCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Build/SettingsOverrides.swift b/Sources/XCBProtocol_12_5/Build/SettingsOverrides.swift deleted file mode 120000 index a3a4b52..0000000 --- a/Sources/XCBProtocol_12_5/Build/SettingsOverrides.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/SettingsOverrides.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Core/BoolResponse.swift b/Sources/XCBProtocol_12_5/Core/BoolResponse.swift deleted file mode 120000 index 827b487..0000000 --- a/Sources/XCBProtocol_12_5/Core/BoolResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/BoolResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Core/ErrorResponse.swift b/Sources/XCBProtocol_12_5/Core/ErrorResponse.swift deleted file mode 120000 index eee77ab..0000000 --- a/Sources/XCBProtocol_12_5/Core/ErrorResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/ErrorResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Core/PingResponse.swift b/Sources/XCBProtocol_12_5/Core/PingResponse.swift deleted file mode 120000 index 23c05e6..0000000 --- a/Sources/XCBProtocol_12_5/Core/PingResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/PingResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Core/StringResponse.swift b/Sources/XCBProtocol_12_5/Core/StringResponse.swift deleted file mode 120000 index 1674c54..0000000 --- a/Sources/XCBProtocol_12_5/Core/StringResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/StringResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoRequest.swift deleted file mode 120000 index c6648e1..0000000 --- a/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_12_0/Indexing Info/IndexingInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoResponse.swift deleted file mode 120000 index 8401e20..0000000 --- a/Sources/XCBProtocol_12_5/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 120000 index e8a318a..0000000 --- a/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationWillStart.swift deleted file mode 120000 index e081ddb..0000000 --- a/Sources/XCBProtocol_12_5/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_12_5/Preview Info/PreviewInfo.swift deleted file mode 120000 index da8eb1b..0000000 --- a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoRequest.swift deleted file mode 120000 index 5be1e80..0000000 --- a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoResponse.swift deleted file mode 120000 index 759bbef..0000000 --- a/Sources/XCBProtocol_12_5/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/RequestPayload.swift b/Sources/XCBProtocol_12_5/RequestPayload.swift deleted file mode 120000 index 42322d8..0000000 --- a/Sources/XCBProtocol_12_5/RequestPayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_11_4/RequestPayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/ResponsePayload.swift b/Sources/XCBProtocol_12_5/ResponsePayload.swift deleted file mode 120000 index af303b6..0000000 --- a/Sources/XCBProtocol_12_5/ResponsePayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_12_0/ResponsePayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_12_5/Session/CreateSessionRequest.swift deleted file mode 120000 index d756d8f..0000000 --- a/Sources/XCBProtocol_12_5/Session/CreateSessionRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/CreateSessionRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Session/SessionCreated.swift b/Sources/XCBProtocol_12_5/Session/SessionCreated.swift deleted file mode 120000 index 29e2800..0000000 --- a/Sources/XCBProtocol_12_5/Session/SessionCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_12_0/Session/SessionCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_12_5/Session/SetSessionSystemInfoRequest.swift deleted file mode 120000 index abe9688..0000000 --- a/Sources/XCBProtocol_12_5/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_12_5/Session/SetSessionUserInfoRequest.swift deleted file mode 120000 index 63d8ec0..0000000 --- a/Sources/XCBProtocol_12_5/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_12_5/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_12_5/Session/TransferSessionPIFRequest.swift deleted file mode 120000 index e4341e4..0000000 --- a/Sources/XCBProtocol_12_5/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/BUILD.bazel b/Sources/XCBProtocol_13_0/BUILD.bazel deleted file mode 100644 index 9568303..0000000 --- a/Sources/XCBProtocol_13_0/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_13_0", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_13_0", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) - diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationEnded.swift deleted file mode 120000 index 8548403..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 120000 index 82b6777..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 120000 index ae579f2..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationReportPathMap.swift deleted file mode 120000 index 6c5c0f4..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStarted.swift deleted file mode 120000 index 0a67aa1..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStatus.swift deleted file mode 120000 index 1e170b0..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 120000 index a86ba35..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 100755 index 7f5ab05..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationDiagnosticEmitted { - public let kind: BuildOperationDiagnosticKind - public let location: BuildOperationDiagnosticLocation - public let message: String - public let component: BuildOperationDiagnosticComponent - public let unknown1: String // e.g. "default" - public let appendToOutputStream: Bool // If `true`, it's attached to the output instead of showing as a new entry - public let unknown2: MessagePackValue // Might be `fixIts` - public let unknown3: MessagePackValue // Might be `childDiagnostics` - public let unknown4: MessagePackValue - - public init( - kind: BuildOperationDiagnosticKind, - location: BuildOperationDiagnosticLocation, - message: String, - component: BuildOperationDiagnosticComponent, - unknown: String, - appendToOutputStream: Bool - ) { - self.kind = kind - self.location = location - self.message = message - self.component = component - self.unknown1 = unknown - self.appendToOutputStream = appendToOutputStream - self.unknown2 = .array([]) - self.unknown3 = .array([]) - self.unknown4 = .array([]) - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationDiagnosticEmitted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationDiagnostic(self) } -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticEmitted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 9 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.kind = try args.parseObject(indexPath: indexPath + IndexPath(index: 0)) - self.location = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.message = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.component = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - self.unknown1 = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.appendToOutputStream = try args.parseBool(indexPath: indexPath + IndexPath(index: 5)) - self.unknown2 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 6)) - self.unknown3 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 7)) - self.unknown4 = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 8)) - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticEmitted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(kind.rawValue), - .array(location.encode()), - .string(message), - .array(component.encode()), - .string(unknown1), - .bool(appendToOutputStream), - unknown2, - unknown3, - unknown4, - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 120000 index 6230bbc..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 100644 index 5a49ac4..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1,70 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -// Probably named wrong -public enum BuildOperationDiagnosticLocation { - case alternativeMessage(String) // Might be named wrong. Always empty so far. - case locationContext(file: String, line: Int64, column: Int64) - case sourceRanges([String]) -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticLocation: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - let rawValue = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - - switch rawValue { - case 0: - self = .alternativeMessage(try args.parseString(indexPath: indexPath + IndexPath(index: 1))) - - case 1: - let locationArgs = try args.parseArray(indexPath: indexPath + IndexPath(index: 1)) - - self = .locationContext( - file: try locationArgs.parseString(indexPath: indexPath + IndexPath(indexes: [1, 0])), - line: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 1])), - column: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 2])) - ) - - case 2: - let sourceRangeArgs = try args.parseArray(indexPath: indexPath + IndexPath(index: 1)) - self = .sourceRanges(try sourceRangeArgs.parseStringArray(indexPath: indexPath + IndexPath(indexes: [1, 0]))) - - default: - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath + IndexPath(index: 0), expectedType: Self.self) - } - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticLocation: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - switch self { - case let .alternativeMessage(message): - return [ - .int64(0), - .string(message), - ] - - case let .locationContext(file, line, column): - return [ - .int64(1), - .array([ - .string(file), - .int64(line), - .int64(column), - ]), - ] - - case let .sourceRanges(names): - return [ - .array(names.map { .string($0) }) - ] - } - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 120000 index 0654228..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 100644 index bb9e0d0..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1,43 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetInfo: Decodable { - public let name: String - public let typeName: String // e.g. "Native" or "Aggregate" - public let projectInfo: BuildOperationProjectInfo - public let configurationName: String // e.g. "Debug" - public let configurationIsDefault: Bool - public let sdkRoot: String? // e.g. "/Applications/Xcode-11.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk" - - public init( - name: String, - typeName: String, - projectInfo: BuildOperationProjectInfo, - configurationName: String, - configurationIsDefault: Bool, - sdkRoot: String? - ) { - self.name = name - self.typeName = typeName - self.projectInfo = projectInfo - self.configurationName = configurationName - self.configurationIsDefault = configurationIsDefault - self.sdkRoot = sdkRoot - } -} - -// MARK: - Encoding - -extension BuildOperationTargetInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(name), - .string(typeName), - .array(projectInfo.encode()), - .string(configurationName), - .bool(configurationIsDefault), - sdkRoot.flatMap { .string($0) } ?? .nil, - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 100644 index 3eddba2..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationProjectInfo: Decodable { - public let name: String - public let path: String - public let isPackage: Bool - public let isNameUniqueInWorkspace: Bool - - public init(name: String, path: String, isPackage: Bool, isNameUniqueInWorkspace: Bool) { - self.name = name - self.path = path - self.isPackage = isPackage - self.isNameUniqueInWorkspace = isNameUniqueInWorkspace - } -} - -// MARK: - Encoding - -extension BuildOperationProjectInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(name), - .string(path), - .bool(isPackage), - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 100644 index 0f16a16..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTargetStarted: Decodable { - public let targetID: Int64 - public let guid: String // Used in `CreateBuildRequest` and `BuildOperationTargetUpToDate` - public let targetInfo: BuildOperationTargetInfo - - enum CodingKeys: String, CodingKey { - case targetID = "id" - case guid - case targetInfo = "info" - } - - public init(targetID: Int64, guid: String, targetInfo: BuildOperationTargetInfo) { - self.targetID = targetID - self.guid = guid - self.targetInfo = targetInfo - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTargetStarted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTargetStarted(self) } -} - -// MARK: - Encoding - -extension BuildOperationTargetStarted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(targetID), - .string(guid), - .array(targetInfo.encode()), - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 120000 index 2990a80..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 120000 index 9facbed..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 100644 index 4513dd1..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskEnded { - public let taskID: Int64 - public let status: BuildOperationStatus - public let skippedErrorsFromSerializedDiagnostics: Bool // Might be named "signalled" - public let metrics: BuildOperationTaskMetrics? - - public init(taskID: Int64, status: BuildOperationStatus, skippedErrorsFromSerializedDiagnostics: Bool, metrics: BuildOperationTaskMetrics?) { - self.taskID = taskID - self.status = status - self.skippedErrorsFromSerializedDiagnostics = skippedErrorsFromSerializedDiagnostics - self.metrics = metrics - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskEnded: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskEnded(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskEnded: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.status = try args.parseObject(indexPath: indexPath + IndexPath(index: 1)) - self.skippedErrorsFromSerializedDiagnostics = try args.parseBool(indexPath: indexPath + IndexPath(index: 2)) - self.metrics = try args.parseOptionalObject(indexPath: indexPath + IndexPath(index: 3)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskEnded: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(taskID), - .int64(status.rawValue), - .bool(skippedErrorsFromSerializedDiagnostics), - metrics.flatMap { MessagePackValue.array($0.encode()) } ?? .nil, - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 120000 index 26298c3..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 100644 index fadf6de..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1,110 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildOperationTaskStarted { - public struct TaskDetails { - public let taskName: String // e.g. "Swift Compiler", "Shell Script Invocation" - public let signature: Data // Used in `BuildOperationTaskUpToDate`. Seems to be consistent. - public let ruleInfo: String // e.g. "CompileSwift normal x86_64 /Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift", "PhaseScriptExecution SwiftLint /Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex/PROJECT.build/Debug-iphonesimulator/SCRIPT.build/Script-9A635388D017DF17C1E0081A.sh" - public let executionDescription: String // e.g. "Compile /Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift", "Run custom shell script 'SwiftLint'" - public let commandLineDisplayString: String? // e.g. " cd /Users/USER/Desktop/BazelXCBuildServer\n/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c ..." - public let interestingPath: String? // e.g. "/Users/USER/Desktop/BazelXCBuildServer/Sources/XCBProtocol/Response.swift" - public let serializedDiagnosticsPaths: [String] - - public init( - taskName: String, - signature: Data, - ruleInfo: String, - executionDescription: String, - commandLineDisplayString: String?, - interestingPath: String?, - serializedDiagnosticsPaths: [String] - ) { - self.taskName = taskName - self.signature = signature - self.ruleInfo = ruleInfo - self.executionDescription = executionDescription - self.commandLineDisplayString = commandLineDisplayString - self.interestingPath = interestingPath - self.serializedDiagnosticsPaths = serializedDiagnosticsPaths - } - } - - public let taskID: Int64 // Starts from 1 within a build - public let targetID: Int64? - public let parentTaskID: Int64? - public let taskDetails: TaskDetails - - public init( - taskID: Int64, - targetID: Int64?, - parentTaskID: Int64?, - taskDetails: TaskDetails - ) { - self.taskID = taskID - self.targetID = targetID - self.parentTaskID = parentTaskID - self.taskDetails = taskDetails - } -} - -// MARK: - ResponsePayloadConvertible - -extension BuildOperationTaskStarted: ResponsePayloadConvertible { - public func toResponsePayload() -> ResponsePayload { .buildOperationTaskStarted(self) } -} - -// MARK: - Decoding - -extension BuildOperationTaskStarted: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 4 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskID = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - self.targetID = try args.parseOptionalInt64(indexPath: indexPath + IndexPath(index: 1)) - self.parentTaskID = try args.parseOptionalInt64(indexPath: indexPath + IndexPath(index: 2)) - self.taskDetails = try args.parseObject(indexPath: indexPath + IndexPath(index: 3)) - } -} - -extension BuildOperationTaskStarted.TaskDetails: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 7 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.taskName = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.signature = try args.parseBinary(indexPath: indexPath + IndexPath(index: 1)) - self.ruleInfo = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.executionDescription = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.commandLineDisplayString = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 4)) - self.interestingPath = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 5)) - self.serializedDiagnosticsPaths = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 6)) - } -} - -// MARK: - Encoding - -extension BuildOperationTaskStarted: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .int64(taskID), - targetID.flatMap { .int64($0) } ?? .nil, - parentTaskID.flatMap { .int64($0) } ?? .nil, - .array(taskDetails.encode()), - ] - } -} - -extension BuildOperationTaskStarted.TaskDetails: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(taskName), - .binary(signature), - .string(ruleInfo), - .string(executionDescription), - commandLineDisplayString.flatMap { .string($0) } ?? .nil, - interestingPath.flatMap { .string($0) } ?? .nil, - .array(serializedDiagnosticsPaths.map(MessagePackValue.string)), - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 120000 index d8766e6..0000000 --- a/Sources/XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build/ArenaInfo.swift b/Sources/XCBProtocol_13_0/Build/ArenaInfo.swift deleted file mode 100644 index 28ba20d..0000000 --- a/Sources/XCBProtocol_13_0/Build/ArenaInfo.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct ArenaInfo: Decodable { - public let derivedDataPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData" - public let buildProductsPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Products" - public let buildIntermediatesPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex" - public let pchPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Build/Intermediates.noindex/PrecompiledHeaders" - public let indexPCHPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Index/PrecompiledHeaders" - public let indexDataStoreFolderPath: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-HASH/Index/DataStore" - public let indexEnableDataStore: Bool -} - -// MARK: - Decoding - -extension ArenaInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 7 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.derivedDataPath = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.buildProductsPath = try args.parseString(indexPath: indexPath + IndexPath(index: 1)) - self.buildIntermediatesPath = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.pchPath = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.indexPCHPath = try args.parseString(indexPath: indexPath + IndexPath(index: 4)) - self.indexDataStoreFolderPath = try args.parseString(indexPath: indexPath + IndexPath(index: 5)) - self.indexEnableDataStore = try args.parseBool(indexPath: indexPath + IndexPath(index: 6)) - } -} diff --git a/Sources/XCBProtocol_13_0/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_13_0/Build/BuildCancelRequest.swift deleted file mode 120000 index 7fb587d..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildCancelRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCancelRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build/BuildCommand.swift b/Sources/XCBProtocol_13_0/Build/BuildCommand.swift deleted file mode 100644 index 458cf1f..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildCommand.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildCommand: Decodable { - public let command: Command - let enableIndexBuildArena: Bool? - let targets: [String]? - - public enum Command: String, Decodable { - case build - case prepareForIndexing - case migrate - case generateAssemblyCode - case generatePreprocessedFile - case cleanBuildFolder - case preview - } -} diff --git a/Sources/XCBProtocol_13_0/Build/BuildCreated.swift b/Sources/XCBProtocol_13_0/Build/BuildCreated.swift deleted file mode 120000 index 7f43117..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build/BuildParameters.swift b/Sources/XCBProtocol_13_0/Build/BuildParameters.swift deleted file mode 100644 index 1123a7e..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildParameters.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildParameters: Decodable { - public let action: String // e.g. "build", "clean" - public let configuration: String // e.g. "Debug", "Release" - public let activeRunDestination: RunDestinationInfo - public let activeArchitecture: String // e.g. "x86_64", "arm64" - public let arenaInfo: ArenaInfo - public let overrides: SettingsOverrides - - enum CodingKeys: String, CodingKey { - case action - case configuration - case activeRunDestination - case activeArchitecture - case arenaInfo - case overrides - } - - public init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - - self.action = try values.decode(String.self, forKey: .action) - self.configuration = try values.decodeIfPresent(String.self, forKey: .configuration) ?? "" - self.activeRunDestination = try values.decode(RunDestinationInfo.self, forKey: .activeRunDestination) - self.activeArchitecture = try values.decode(String.self, forKey: .activeArchitecture) - self.arenaInfo = try values.decode(ArenaInfo.self, forKey: .arenaInfo) - self.overrides = try values.decode(SettingsOverrides.self, forKey: .overrides) - } -} diff --git a/Sources/XCBProtocol_13_0/Build/BuildPlatform.swift b/Sources/XCBProtocol_13_0/Build/BuildPlatform.swift deleted file mode 100644 index 5f62780..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildPlatform.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum BuildPlatform: String, Decodable { - case macosx - case iphoneos - case iphonesimulator - case watchos - case watchsimulator - case appletvos - case appletvsimulator -} - -// MARK: - Decoding - -extension BuildPlatform: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - guard let parsed = Self(rawValue: try values.parseString(indexPath: indexPath)) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} - -extension BuildPlatform: CustomStringConvertible { - public var description: String { rawValue } -} - -// MARK: - Encoding - -extension BuildPlatform: CustomEncodableRPCPayload { - public func encode() -> MessagePackValue { - return .string(rawValue) - } -} diff --git a/Sources/XCBProtocol_13_0/Build/BuildRequest.swift b/Sources/XCBProtocol_13_0/Build/BuildRequest.swift deleted file mode 100755 index 6454624..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildRequest.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct BuildRequest: Decodable { - public let parameters: BuildParameters - public let configuredTargets: [ConfiguredTarget] - public let continueBuildingAfterErrors: Bool - public let hideShellScriptEnvironment: Bool - public let useParallelTargets: Bool - public let useImplicitDependencies: Bool - public let useDryRun: Bool - public let showNonLoggedProgress: Bool - public let buildCommand: BuildCommand - public let schemeCommand: SchemeCommand - public let buildDescriptionID: String? - public let shouldCollectMetrics: Bool - public let jsonRepresentation: String? -} - diff --git a/Sources/XCBProtocol_13_0/Build/BuildStartRequest.swift b/Sources/XCBProtocol_13_0/Build/BuildStartRequest.swift deleted file mode 120000 index 4d6ceff..0000000 --- a/Sources/XCBProtocol_13_0/Build/BuildStartRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildStartRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_13_0/Build/ConfiguredTarget.swift deleted file mode 100644 index f03c3d8..0000000 --- a/Sources/XCBProtocol_13_0/Build/ConfiguredTarget.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct ConfiguredTarget: Decodable { - public let guid: String - public let parameters: BuildParameters? -} diff --git a/Sources/XCBProtocol_13_0/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_13_0/Build/CreateBuildRequest.swift deleted file mode 100644 index 000df7e..0000000 --- a/Sources/XCBProtocol_13_0/Build/CreateBuildRequest.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct CreateBuildRequest: Decodable { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest - public let onlyCreateBuildDescription: Bool - - enum CodingKeys: String, CodingKey { - case sessionHandle - case responseChannel - case buildRequest = "request" - case onlyCreateBuildDescription - } -} diff --git a/Sources/XCBProtocol_13_0/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_13_0/Build/RunDestinationInfo.swift deleted file mode 100644 index 2600184..0000000 --- a/Sources/XCBProtocol_13_0/Build/RunDestinationInfo.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct RunDestinationInfo: Decodable { - public let platform: BuildPlatform // e.g. "macosx" - public let sdk: String // e.g. "macosx10.14" - public let sdkVariant: String // e.g. "macos" or "iphonesimulator" - public let targetArchitecture: String // e.g. "x86_64", "arm64" - public let supportedArchitectures: [String] // e.g. ["armv7s", "arm64"] - public let disableOnlyActiveArch: Bool -} diff --git a/Sources/XCBProtocol_13_0/Build/SchemeCommand.swift b/Sources/XCBProtocol_13_0/Build/SchemeCommand.swift deleted file mode 100644 index 78547fd..0000000 --- a/Sources/XCBProtocol_13_0/Build/SchemeCommand.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum SchemeCommand: Int64, Decodable { - case launch - case test - case profile - case archive -} - -// MARK: - Decoding - -extension SchemeCommand: CustomDecodableRPCPayload { - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let rawValue = try values.parseInt64(indexPath: indexPath) - - guard let parsed = Self(rawValue: rawValue) else { - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath, expectedType: Self.self) - } - - self = parsed - } -} diff --git a/Sources/XCBProtocol_13_0/Build/SettingsOverrides.swift b/Sources/XCBProtocol_13_0/Build/SettingsOverrides.swift deleted file mode 100644 index 18860d6..0000000 --- a/Sources/XCBProtocol_13_0/Build/SettingsOverrides.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SettingsOverrides: Decodable { - public let synthesized: [String: String] // e.g. ["TARGET_DEVICE_MODEL": "iPhone12,5", "TARGET_DEVICE_OS_VERSION": "13.3"] - public let commandLine: [String: String] - public let commandLineConfig: [String: String] - public let environmentConfig: [String: String] - public let toolchainOverride: String? // e.g. "org.swift.515120200323a" -} - -// MARK: - Decoding - -extension SettingsOverrides: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 5 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.synthesized = try args.parseMap(indexPath: indexPath + IndexPath(index: 0)) - self.commandLine = try args.parseMap(indexPath: indexPath + IndexPath(index: 1)) - self.commandLineConfig = try args.parseMap(indexPath: indexPath + IndexPath(index: 2)) - self.environmentConfig = try args.parseMap(indexPath: indexPath + IndexPath(index: 3)) - self.toolchainOverride = try args.parseOptionalString(indexPath: indexPath + IndexPath(index: 4)) - } -} diff --git a/Sources/XCBProtocol_13_0/Core/BoolResponse.swift b/Sources/XCBProtocol_13_0/Core/BoolResponse.swift deleted file mode 120000 index 827b487..0000000 --- a/Sources/XCBProtocol_13_0/Core/BoolResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/BoolResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Core/ErrorResponse.swift b/Sources/XCBProtocol_13_0/Core/ErrorResponse.swift deleted file mode 120000 index eee77ab..0000000 --- a/Sources/XCBProtocol_13_0/Core/ErrorResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/ErrorResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Core/PingResponse.swift b/Sources/XCBProtocol_13_0/Core/PingResponse.swift deleted file mode 120000 index 23c05e6..0000000 --- a/Sources/XCBProtocol_13_0/Core/PingResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/PingResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Core/StringResponse.swift b/Sources/XCBProtocol_13_0/Core/StringResponse.swift deleted file mode 120000 index 1674c54..0000000 --- a/Sources/XCBProtocol_13_0/Core/StringResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/StringResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoRequest.swift deleted file mode 100755 index 88cd661..0000000 --- a/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct IndexingInfoRequest: Decodable { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest - public let targetGUID: String - public let filePath: String? - public let outputPathOnly: Bool - - enum CodingKeys: String, CodingKey { - case sessionHandle - case responseChannel - case buildRequest = "request" - case targetGUID = "targetID" - case filePath - case outputPathOnly - } -} diff --git a/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoResponse.swift deleted file mode 120000 index 8401e20..0000000 --- a/Sources/XCBProtocol_13_0/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 120000 index e8a318a..0000000 --- a/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationWillStart.swift deleted file mode 120000 index e081ddb..0000000 --- a/Sources/XCBProtocol_13_0/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_13_0/Preview Info/PreviewInfo.swift deleted file mode 100644 index ab9f9ae..0000000 --- a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PreviewInfo { - public let sdkVariant: String // Called `sdkRoot` by Xcode. e.g. "macosx10.14" - public let unknown: MessagePackValue - public let buildVariant: String // Might be named wrong. e.g. "normal" - public let architecture: String // e.g. "x86_64" - public let compileCommandLine: [String] // e.g. ["/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-enforce-exclusivity=checked", ...] - public let linkCommandLine: [String] // e.g. ["/Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-target", ...] - public let thunkSourceFile: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.swift" - public let thunkObjectFile: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.o" - public let thunkLibrary: String // e.g. "/Users/USER/Library/Developer/Xcode/DerivedData/PROJECT-hash/Build/Intermediates.noindex/Previews/TARGET_NAME/Intermediates.noindex/PROJECT_NAME.build/Debug-iphonesimulator/TARGET_NAME.build/Objects-normal/x86_64/SOURCE_FILE.__XCPREVIEW_THUNKSUFFIX__.preview-thunk.dylib" - public let pifGUID: String - - public init( - sdkVariant: String, - buildVariant: String, - architecture: String, - compileCommandLine: [String], - linkCommandLine: [String], - thunkSourceFile: String, - thunkObjectFile: String, - thunkLibrary: String, - pifGUID: String - ) { - self.sdkVariant = sdkVariant - self.unknown = .nil - self.buildVariant = buildVariant - self.architecture = architecture - self.compileCommandLine = compileCommandLine - self.linkCommandLine = linkCommandLine - self.thunkSourceFile = thunkSourceFile - self.thunkObjectFile = thunkObjectFile - self.thunkLibrary = thunkLibrary - self.pifGUID = pifGUID - } -} - -// MARK: - Decoding - -extension PreviewInfo: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 10 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - self.sdkVariant = try args.parseString(indexPath: indexPath + IndexPath(index: 0)) - self.unknown = try args.parseUnknown(indexPath: indexPath + IndexPath(index: 1)) - self.buildVariant = try args.parseString(indexPath: indexPath + IndexPath(index: 2)) - self.architecture = try args.parseString(indexPath: indexPath + IndexPath(index: 3)) - self.compileCommandLine = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 4)) - self.linkCommandLine = try args.parseStringArray(indexPath: indexPath + IndexPath(index: 5)) - self.thunkSourceFile = try args.parseString(indexPath: indexPath + IndexPath(index: 6)) - self.thunkObjectFile = try args.parseString(indexPath: indexPath + IndexPath(index: 7)) - self.thunkLibrary = try args.parseString(indexPath: indexPath + IndexPath(index: 8)) - self.pifGUID = try args.parseString(indexPath: indexPath + IndexPath(index: 9)) - } -} - -// MARK: - Encoding - -extension PreviewInfo: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - return [ - .string(sdkVariant), - unknown, - .string(buildVariant), - .string(architecture), - .array(compileCommandLine.map(MessagePackValue.string)), - .array(linkCommandLine.map(MessagePackValue.string)), - .string(thunkSourceFile), - .string(thunkObjectFile), - .string(thunkLibrary), - .string(pifGUID), - ] - } -} diff --git a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoRequest.swift deleted file mode 100644 index fcc592b..0000000 --- a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct PreviewInfoRequest: Decodable { - public let sessionHandle: String - public let responseChannel: UInt64 - public let buildRequest: BuildRequest - public let targetGUID: String - public let sourceFile: String // e.g. "/Full/Path/To/Project/Source/File.swift" - public let thunkVariantSuffix: String // e.g. "__XCPREVIEW_THUNKSUFFIX__" - - enum CodingKeys: String, CodingKey { - case sessionHandle - case responseChannel - case buildRequest = "request" - case targetGUID = "targetID" - case sourceFile - case thunkVariantSuffix - } -} diff --git a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoResponse.swift deleted file mode 120000 index 759bbef..0000000 --- a/Sources/XCBProtocol_13_0/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/RequestPayload.swift b/Sources/XCBProtocol_13_0/RequestPayload.swift deleted file mode 100644 index 1b594eb..0000000 --- a/Sources/XCBProtocol_13_0/RequestPayload.swift +++ /dev/null @@ -1,68 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum RequestPayload { - case createSession(CreateSessionRequest) - case transferSessionPIFRequest(TransferSessionPIFRequest) - case setSessionSystemInfo(SetSessionSystemInfoRequest) - case setSessionUserInfo(SetSessionUserInfoRequest) - - case createBuildRequest(CreateBuildRequest) - case buildStartRequest(BuildStartRequest) - case buildCancelRequest(BuildCancelRequest) - - case indexingInfoRequest(IndexingInfoRequest) - - case previewInfoRequest(PreviewInfoRequest) - - case unknownRequest(UnknownRequest) -} - -public struct UnknownRequest { - public let values: [MessagePackValue] -} - -// MARK: - Encoding - -extension RequestPayload: XCBProtocol.RequestPayload { - public static func unknownRequest(values: [MessagePackValue]) -> Self { - return .unknownRequest(.init(values: values)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "CREATE_SESSION": self = .createSession(try values.parseObject(indexPath: bodyIndexPath)) - case "TRANSFER_SESSION_PIF_REQUEST": self = .transferSessionPIFRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "SET_SESSION_SYSTEM_INFO": self = .setSessionSystemInfo(try values.parseObject(indexPath: indexPath)) - case "SET_SESSION_USER_INFO": self = .setSessionUserInfo(try values.parseObject(indexPath: bodyIndexPath)) - - case "CREATE_BUILD": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .createBuildRequest(try JSONDecoder().decode(CreateBuildRequest.self, from: data)) - - case "BUILD_START": self = .buildStartRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CANCEL": self = .buildCancelRequest(try values.parseObject(indexPath: bodyIndexPath)) - - case "INDEXING_INFO_REQUESTED": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .indexingInfoRequest(try JSONDecoder().decode(IndexingInfoRequest.self, from: data)) - - case "PREVIEW_INFO_REQUESTED": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .previewInfoRequest(try JSONDecoder().decode(PreviewInfoRequest.self, from: data)) - - default: self = .unknownRequest(.init(values: values)) - } - } - - public var createSessionXcodePath: String? { - switch self { - case .createSession(let message): return message.appPath - default: return nil - } - } -} diff --git a/Sources/XCBProtocol_13_0/ResponsePayload.swift b/Sources/XCBProtocol_13_0/ResponsePayload.swift deleted file mode 100755 index 323f684..0000000 --- a/Sources/XCBProtocol_13_0/ResponsePayload.swift +++ /dev/null @@ -1,159 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum ResponsePayload { - case ping(PingResponse) - case bool(BoolResponse) - case string(StringResponse) - case error(ErrorResponse) - - case sessionCreated(SessionCreated) - - case buildCreated(BuildCreated) - case buildOperationProgressUpdated(BuildOperationProgressUpdated) - case buildOperationPreparationCompleted(BuildOperationPreparationCompleted) - case buildOperationStarted(BuildOperationStarted) - case buildOperationReportPathMap(BuildOperationReportPathMap) - case buildOperationDiagnostic(BuildOperationDiagnosticEmitted) - case buildOperationEnded(BuildOperationEnded) - - case planningOperationWillStart(PlanningOperationWillStart) - case planningOperationDidFinish(PlanningOperationDidFinish) - - case buildOperationTargetUpToDate(BuildOperationTargetUpToDate) - case buildOperationTargetStarted(BuildOperationTargetStarted) - case buildOperationTargetEnded(BuildOperationTargetEnded) - - case buildOperationTaskUpToDate(BuildOperationTaskUpToDate) - case buildOperationTaskStarted(BuildOperationTaskStarted) - case buildOperationConsoleOutput(BuildOperationConsoleOutputEmitted) - case buildOperationTaskEnded(BuildOperationTaskEnded) - - case indexingInfo(IndexingInfoResponse) - - case previewInfo(PreviewInfoResponse) - - case unknownResponse(UnknownResponse) -} - -public struct UnknownResponse { - public let values: [MessagePackValue] -} - -// MARK: - Decoding - -extension ResponsePayload: XCBProtocol.ResponsePayload { - public static func unknownResponse(values: [MessagePackValue]) -> Self { - return .unknownResponse(.init(values: values)) - } - - public static func errorResponse(_ message: String) -> Self { - return .error(.init(message)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "PING": self = .ping(try values.parseObject(indexPath: bodyIndexPath)) - case "BOOL": self = .bool(try values.parseObject(indexPath: bodyIndexPath)) - case "STRING": self = .string(try values.parseObject(indexPath: bodyIndexPath)) - case "ERROR": self = .error(try values.parseObject(indexPath: bodyIndexPath)) - case "SESSION_CREATED": self = .sessionCreated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CREATED": self = .buildCreated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PROGRESS_UPDATED": self = .buildOperationProgressUpdated(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_PREPARATION_COMPLETED": self = .buildOperationPreparationCompleted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_STARTED": self = .buildOperationStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_REPORT_PATH_MAP": self = .buildOperationReportPathMap(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_DIAGNOSTIC_EMITTED": self = .buildOperationDiagnostic(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_OPERATION_ENDED": self = .buildOperationEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_WILL_START": self = .planningOperationWillStart(try values.parseObject(indexPath: bodyIndexPath)) - case "PLANNING_OPERATION_FINISHED": self = .planningOperationDidFinish(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TARGET_UPTODATE": self = .buildOperationTargetUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - - case "BUILD_TARGET_STARTED": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .buildOperationTargetStarted(try JSONDecoder().decode(BuildOperationTargetStarted.self, from: data)) - - case "BUILD_TARGET_ENDED": self = .buildOperationTargetEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_UPTODATE": self = .buildOperationTaskUpToDate(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_STARTED": self = .buildOperationTaskStarted(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CONSOLE_OUTPUT_EMITTED": self = .buildOperationConsoleOutput(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_TASK_ENDED": self = .buildOperationTaskEnded(try values.parseObject(indexPath: bodyIndexPath)) - case "INDEXING_INFO_RECEIVED": self = .indexingInfo(try values.parseObject(indexPath: bodyIndexPath)) - case "PREVIEW_INFO_RECEIVED": self = .previewInfo(try values.parseObject(indexPath: bodyIndexPath)) - - default: self = .unknownResponse(.init(values: values)) - } - } - - private var name: String { - switch self { - case .ping: return "PING" - case .bool: return "BOOL" - case .string: return "STRING" - case .error: return "ERROR" - case .sessionCreated: return "SESSION_CREATED" - case .buildCreated: return "BUILD_CREATED" - case .buildOperationProgressUpdated: return "BUILD_PROGRESS_UPDATED" - case .buildOperationPreparationCompleted: return "BUILD_PREPARATION_COMPLETED" - case .buildOperationStarted: return "BUILD_OPERATION_STARTED" - case .buildOperationReportPathMap: return "BUILD_OPERATION_REPORT_PATH_MAP" - case .buildOperationDiagnostic: return "BUILD_DIAGNOSTIC_EMITTED" - case .buildOperationEnded: return "BUILD_OPERATION_ENDED" - case .planningOperationWillStart: return "PLANNING_OPERATION_WILL_START" - case .planningOperationDidFinish: return "PLANNING_OPERATION_FINISHED" - case .buildOperationTargetUpToDate: return "BUILD_TARGET_UPTODATE" - case .buildOperationTargetStarted: return "BUILD_TARGET_STARTED" - case .buildOperationTargetEnded: return "BUILD_TARGET_ENDED" - case .buildOperationTaskUpToDate: return "BUILD_TASK_UPTODATE" - case .buildOperationTaskStarted: return "BUILD_TASK_STARTED" - case .buildOperationConsoleOutput: return "BUILD_CONSOLE_OUTPUT_EMITTED" - case .buildOperationTaskEnded: return "BUILD_TASK_ENDED" - case .indexingInfo: return "INDEXING_INFO_RECEIVED" - case .previewInfo: return "PREVIEW_INFO_RECEIVED" - - case .unknownResponse: preconditionFailure("Tried to get name of UnknownResponse") - } - } - - private var message: CustomEncodableRPCPayload { - switch self { - case let .ping(message): return message - case let .bool(message): return message - case let .string(message): return message - case let .error(message): return message - case let .sessionCreated(message): return message - case let .buildCreated(message): return message - case let .buildOperationProgressUpdated(message): return message - case let .buildOperationPreparationCompleted(message): return message - case let .buildOperationStarted(message): return message - case let .buildOperationReportPathMap(message): return message - case let .buildOperationDiagnostic(message): return message - case let .buildOperationEnded(message): return message - case let .planningOperationWillStart(message): return message - case let .planningOperationDidFinish(message): return message - case let .buildOperationTargetUpToDate(message): return message - case let .buildOperationTargetStarted(message): return message - case let .buildOperationTargetEnded(message): return message - case let .buildOperationTaskUpToDate(message): return message - case let .buildOperationTaskStarted(message): return message - case let .buildOperationConsoleOutput(message): return message - case let .buildOperationTaskEnded(message): return message - case let .indexingInfo(message): return message - case let .previewInfo(message): return message - - case .unknownResponse: preconditionFailure("Tried to get message of UnknownResponse") - } - } - - public func encode() -> [MessagePackValue] { - if case let .unknownResponse(message) = self { - return message.values - } - - return [.string(name), message.encode()] - } -} diff --git a/Sources/XCBProtocol_13_0/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_13_0/Session/CreateSessionRequest.swift deleted file mode 120000 index d756d8f..0000000 --- a/Sources/XCBProtocol_13_0/Session/CreateSessionRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/CreateSessionRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Session/SessionCreated.swift b/Sources/XCBProtocol_13_0/Session/SessionCreated.swift deleted file mode 120000 index 29e2800..0000000 --- a/Sources/XCBProtocol_13_0/Session/SessionCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_12_0/Session/SessionCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_13_0/Session/SetSessionSystemInfoRequest.swift deleted file mode 120000 index abe9688..0000000 --- a/Sources/XCBProtocol_13_0/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_13_0/Session/SetSessionUserInfoRequest.swift deleted file mode 120000 index 63d8ec0..0000000 --- a/Sources/XCBProtocol_13_0/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionUserInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_0/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_13_0/Session/TransferSessionPIFRequest.swift deleted file mode 120000 index e4341e4..0000000 --- a/Sources/XCBProtocol_13_0/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/BUILD.bazel b/Sources/XCBProtocol_13_3/BUILD.bazel deleted file mode 100644 index 40ea3d2..0000000 --- a/Sources/XCBProtocol_13_3/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "XCBProtocol_13_3", - srcs = glob(["**/*.swift"]), - module_name = "XCBProtocol_13_3", - deps = [ - "//Sources/MessagePack", - "//Sources/XCBProtocol", - ], - visibility = ["//visibility:public"], -) - diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationEnded.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationEnded.swift deleted file mode 120000 index 8548403..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationPreparationCompleted.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationPreparationCompleted.swift deleted file mode 120000 index 82b6777..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationPreparationCompleted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationPreparationCompleted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationProgressUpdated.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationProgressUpdated.swift deleted file mode 120000 index ae579f2..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationProgressUpdated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationProgressUpdated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationReportPathMap.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationReportPathMap.swift deleted file mode 120000 index 6c5c0f4..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationReportPathMap.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationReportPathMap.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStarted.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStarted.swift deleted file mode 120000 index 0a67aa1..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStatus.swift b/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStatus.swift deleted file mode 120000 index 1e170b0..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/BuildOperationStatus.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build Operation/BuildOperationStatus.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift b/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift deleted file mode 120000 index a86ba35..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticComponent.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift b/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift deleted file mode 120000 index 3d10dd6..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Diagnostic/BuildOperationDiagnosticEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift b/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift deleted file mode 120000 index 6230bbc..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Diagnostic/BuildOperationDiagnosticKind.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift b/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift deleted file mode 100644 index 8efed94..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Diagnostic/BuildOperationDiagnosticLocation.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -// Probably named wrong -public enum BuildOperationDiagnosticLocation { - case alternativeMessage(String) // Might be named wrong. Always empty so far. - case locationContext(file: String, line: Int64, column: Int64) -} - -// MARK: - Decoding - -extension BuildOperationDiagnosticLocation: DecodableRPCPayload { - public init(args: [MessagePackValue], indexPath: IndexPath) throws { - guard args.count == 2 else { throw RPCPayloadDecodingError.invalidCount(args.count, indexPath: indexPath) } - - let rawValue = try args.parseInt64(indexPath: indexPath + IndexPath(index: 0)) - - switch rawValue { - case 0: - self = .alternativeMessage(try args.parseString(indexPath: indexPath + IndexPath(index: 1))) - - case 1: - let locationArgs = try args.parseArray(indexPath: indexPath + IndexPath(index: 1)) - - self = .locationContext( - file: try locationArgs.parseString(indexPath: indexPath + IndexPath(indexes: [1, 0])), - line: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 1])), - column: try locationArgs.parseInt64(indexPath: indexPath + IndexPath(indexes: [1, 2])) - ) - - default: - throw RPCPayloadDecodingError.incorrectValueType(indexPath: indexPath + IndexPath(index: 0), expectedType: Self.self) - } - } -} - -// MARK: - Encoding - -extension BuildOperationDiagnosticLocation: EncodableRPCPayload { - public func encode() -> [MessagePackValue] { - switch self { - case let .alternativeMessage(message): - return [ - .int64(0), - .string(message), - ] - - case let .locationContext(file, line, column): - return [ - .int64(1), - .array([ - .string(file), - .array([ - .int64(0), - .array([ - .int64(line), - .int64(column), - ]) - ]), - ]), - ] - } - } -} diff --git a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetEnded.swift b/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetEnded.swift deleted file mode 120000 index 0654228..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetInfo.swift b/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetInfo.swift deleted file mode 120000 index d1b65bf..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift b/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift deleted file mode 120000 index 52dd8f2..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetProjectInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetProjectInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetStarted.swift b/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetStarted.swift deleted file mode 120000 index 2168f89..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Target/BuildOperationTargetStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetUpToDate.swift b/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetUpToDate.swift deleted file mode 120000 index 2990a80..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Target/BuildOperationTargetUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Target/BuildOperationTargetUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift b/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift deleted file mode 120000 index 9facbed..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationConsoleOutputEmitted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskEnded.swift b/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskEnded.swift deleted file mode 120000 index b7c8538..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskEnded.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskEnded.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskMetrics.swift b/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskMetrics.swift deleted file mode 120000 index 26298c3..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskMetrics.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_11_4/Build Operation/Task/BuildOperationTaskMetrics.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskStarted.swift b/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskStarted.swift deleted file mode 120000 index c3b1122..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskStarted.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_13_0/Build Operation/Task/BuildOperationTaskStarted.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskUpToDate.swift b/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskUpToDate.swift deleted file mode 120000 index d8766e6..0000000 --- a/Sources/XCBProtocol_13_3/Build Operation/Task/BuildOperationTaskUpToDate.swift +++ /dev/null @@ -1 +0,0 @@ -../../../XCBProtocol_12_5/Build Operation/Task/BuildOperationTaskUpToDate.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/ArenaInfo.swift b/Sources/XCBProtocol_13_3/Build/ArenaInfo.swift deleted file mode 120000 index 567fec2..0000000 --- a/Sources/XCBProtocol_13_3/Build/ArenaInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/ArenaInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildCancelRequest.swift b/Sources/XCBProtocol_13_3/Build/BuildCancelRequest.swift deleted file mode 120000 index 7fb587d..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildCancelRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCancelRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildCommand.swift b/Sources/XCBProtocol_13_3/Build/BuildCommand.swift deleted file mode 120000 index e36aea9..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/BuildCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildCreated.swift b/Sources/XCBProtocol_13_3/Build/BuildCreated.swift deleted file mode 120000 index 7f43117..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildParameters.swift b/Sources/XCBProtocol_13_3/Build/BuildParameters.swift deleted file mode 120000 index 36762c9..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildParameters.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/BuildParameters.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildPlatform.swift b/Sources/XCBProtocol_13_3/Build/BuildPlatform.swift deleted file mode 120000 index a22a18b..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildPlatform.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/BuildPlatform.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildRequest.swift b/Sources/XCBProtocol_13_3/Build/BuildRequest.swift deleted file mode 120000 index 9ea2631..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/BuildRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/BuildStartRequest.swift b/Sources/XCBProtocol_13_3/Build/BuildStartRequest.swift deleted file mode 120000 index 4d6ceff..0000000 --- a/Sources/XCBProtocol_13_3/Build/BuildStartRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Build/BuildStartRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/ConfiguredTarget.swift b/Sources/XCBProtocol_13_3/Build/ConfiguredTarget.swift deleted file mode 120000 index 8d6a7b6..0000000 --- a/Sources/XCBProtocol_13_3/Build/ConfiguredTarget.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/ConfiguredTarget.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/CreateBuildRequest.swift b/Sources/XCBProtocol_13_3/Build/CreateBuildRequest.swift deleted file mode 120000 index 71e9de3..0000000 --- a/Sources/XCBProtocol_13_3/Build/CreateBuildRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/CreateBuildRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/RunDestinationInfo.swift b/Sources/XCBProtocol_13_3/Build/RunDestinationInfo.swift deleted file mode 120000 index 9b80923..0000000 --- a/Sources/XCBProtocol_13_3/Build/RunDestinationInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/RunDestinationInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/SchemeCommand.swift b/Sources/XCBProtocol_13_3/Build/SchemeCommand.swift deleted file mode 120000 index 4e1d590..0000000 --- a/Sources/XCBProtocol_13_3/Build/SchemeCommand.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/SchemeCommand.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Build/SettingsOverrides.swift b/Sources/XCBProtocol_13_3/Build/SettingsOverrides.swift deleted file mode 120000 index 0529ea2..0000000 --- a/Sources/XCBProtocol_13_3/Build/SettingsOverrides.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Build/SettingsOverrides.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Core/BoolResponse.swift b/Sources/XCBProtocol_13_3/Core/BoolResponse.swift deleted file mode 120000 index 827b487..0000000 --- a/Sources/XCBProtocol_13_3/Core/BoolResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/BoolResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Core/ErrorResponse.swift b/Sources/XCBProtocol_13_3/Core/ErrorResponse.swift deleted file mode 120000 index eee77ab..0000000 --- a/Sources/XCBProtocol_13_3/Core/ErrorResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/ErrorResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Core/PingResponse.swift b/Sources/XCBProtocol_13_3/Core/PingResponse.swift deleted file mode 120000 index 23c05e6..0000000 --- a/Sources/XCBProtocol_13_3/Core/PingResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/PingResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Core/StringResponse.swift b/Sources/XCBProtocol_13_3/Core/StringResponse.swift deleted file mode 120000 index 1674c54..0000000 --- a/Sources/XCBProtocol_13_3/Core/StringResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Core/StringResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoRequest.swift b/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoRequest.swift deleted file mode 120000 index 4fe7d9d..0000000 --- a/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Indexing Info/IndexingInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoResponse.swift b/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoResponse.swift deleted file mode 120000 index 8401e20..0000000 --- a/Sources/XCBProtocol_13_3/Indexing Info/IndexingInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Indexing Info/IndexingInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationDidFinish.swift b/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationDidFinish.swift deleted file mode 120000 index e8a318a..0000000 --- a/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationDidFinish.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationDidFinish.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationWillStart.swift b/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationWillStart.swift deleted file mode 120000 index e081ddb..0000000 --- a/Sources/XCBProtocol_13_3/Planning Operation/PlanningOperationWillStart.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Planning Operation/PlanningOperationWillStart.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfo.swift b/Sources/XCBProtocol_13_3/Preview Info/PreviewInfo.swift deleted file mode 120000 index 79100f9..0000000 --- a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfo.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Preview Info/PreviewInfo.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoRequest.swift b/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoRequest.swift deleted file mode 120000 index 408a98e..0000000 --- a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_13_0/Preview Info/PreviewInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoResponse.swift b/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoResponse.swift deleted file mode 120000 index 759bbef..0000000 --- a/Sources/XCBProtocol_13_3/Preview Info/PreviewInfoResponse.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Preview Info/PreviewInfoResponse.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/RequestPayload.swift b/Sources/XCBProtocol_13_3/RequestPayload.swift deleted file mode 100644 index 47302be..0000000 --- a/Sources/XCBProtocol_13_3/RequestPayload.swift +++ /dev/null @@ -1,70 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public enum RequestPayload { - case createSession(CreateSessionRequest) - case transferSessionPIFRequest(TransferSessionPIFRequest) - case setSessionSystemInfo(SetSessionSystemInfoRequest) - case setSessionUserInfo(SetSessionUserInfoRequest) - - case createBuildRequest(CreateBuildRequest) - case buildStartRequest(BuildStartRequest) - case buildCancelRequest(BuildCancelRequest) - - case indexingInfoRequest(IndexingInfoRequest) - - case previewInfoRequest(PreviewInfoRequest) - - case unknownRequest(UnknownRequest) -} - -public struct UnknownRequest { - public let values: [MessagePackValue] -} - -// MARK: - Encoding - -extension RequestPayload: XCBProtocol.RequestPayload { - public static func unknownRequest(values: [MessagePackValue]) -> Self { - return .unknownRequest(.init(values: values)) - } - - public init(values: [MessagePackValue], indexPath: IndexPath) throws { - let name = try values.parseString(indexPath: indexPath + IndexPath(index: 0)) - let bodyIndexPath = indexPath + IndexPath(index: 1) - - switch name { - case "CREATE_SESSION": self = .createSession(try values.parseObject(indexPath: bodyIndexPath)) - case "TRANSFER_SESSION_PIF_REQUEST": self = .transferSessionPIFRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "SET_SESSION_SYSTEM_INFO": self = .setSessionSystemInfo(try values.parseObject(indexPath: indexPath)) - case "SET_SESSION_USER_INFO": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .setSessionUserInfo(try JSONDecoder().decode(SetSessionUserInfoRequest.self, from: data)) - - case "CREATE_BUILD": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .createBuildRequest(try JSONDecoder().decode(CreateBuildRequest.self, from: data)) - - case "BUILD_START": self = .buildStartRequest(try values.parseObject(indexPath: bodyIndexPath)) - case "BUILD_CANCEL": self = .buildCancelRequest(try values.parseObject(indexPath: bodyIndexPath)) - - case "INDEXING_INFO_REQUESTED": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .indexingInfoRequest(try JSONDecoder().decode(IndexingInfoRequest.self, from: data)) - - case "PREVIEW_INFO_REQUESTED": - let data = try values.parseBinary(indexPath: bodyIndexPath) - self = .previewInfoRequest(try JSONDecoder().decode(PreviewInfoRequest.self, from: data)) - - default: self = .unknownRequest(.init(values: values)) - } - } - - public var createSessionXcodePath: String? { - switch self { - case .createSession(let message): return message.appPath - default: return nil - } - } -} diff --git a/Sources/XCBProtocol_13_3/ResponsePayload.swift b/Sources/XCBProtocol_13_3/ResponsePayload.swift deleted file mode 120000 index 89ac874..0000000 --- a/Sources/XCBProtocol_13_3/ResponsePayload.swift +++ /dev/null @@ -1 +0,0 @@ -../XCBProtocol_13_0/ResponsePayload.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Session/CreateSessionRequest.swift b/Sources/XCBProtocol_13_3/Session/CreateSessionRequest.swift deleted file mode 120000 index d756d8f..0000000 --- a/Sources/XCBProtocol_13_3/Session/CreateSessionRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/CreateSessionRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Session/SessionCreated.swift b/Sources/XCBProtocol_13_3/Session/SessionCreated.swift deleted file mode 120000 index 29e2800..0000000 --- a/Sources/XCBProtocol_13_3/Session/SessionCreated.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_12_0/Session/SessionCreated.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Session/SetSessionSystemInfoRequest.swift b/Sources/XCBProtocol_13_3/Session/SetSessionSystemInfoRequest.swift deleted file mode 120000 index abe9688..0000000 --- a/Sources/XCBProtocol_13_3/Session/SetSessionSystemInfoRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/SetSessionSystemInfoRequest.swift \ No newline at end of file diff --git a/Sources/XCBProtocol_13_3/Session/SetSessionUserInfoRequest.swift b/Sources/XCBProtocol_13_3/Session/SetSessionUserInfoRequest.swift deleted file mode 100644 index 85673a5..0000000 --- a/Sources/XCBProtocol_13_3/Session/SetSessionUserInfoRequest.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import MessagePack -import XCBProtocol - -public struct SetSessionUserInfoRequest: Decodable { - public let sessionHandle: String - public let user: String - public let group: String - public let uid: Int64 - public let gid: Int64 - public let home: String - public let xcodeProcessEnvironment: [String: String]? - public let buildSystemEnvironment: [String: String] - public let usePerConfigurationBuildDirectories: Bool? -} diff --git a/Sources/XCBProtocol_13_3/Session/TransferSessionPIFRequest.swift b/Sources/XCBProtocol_13_3/Session/TransferSessionPIFRequest.swift deleted file mode 120000 index e4341e4..0000000 --- a/Sources/XCBProtocol_13_3/Session/TransferSessionPIFRequest.swift +++ /dev/null @@ -1 +0,0 @@ -../../XCBProtocol_11_4/Session/TransferSessionPIFRequest.swift \ No newline at end of file diff --git a/Tests/MessagePackTests/ArrayTests.swift b/Tests/MessagePackTests/ArrayTests.swift deleted file mode 100644 index 0b9a9a3..0000000 --- a/Tests/MessagePackTests/ArrayTests.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class ArrayTests: XCTestCase { - func testLiteralConversion() { - let implicitValue: MessagePackValue = ["a", "b", "c"] - XCTAssertEqual(implicitValue, .array([.string("a"), .string("b"), .string("c")])) - } - - func testPackFixarray() { - let value: [MessagePackValue] = [.uint8(0), .uint8(1), .uint8(2), .uint8(3), .uint8(4)] - let packed = Data([0x95, 0x00, 0x01, 0x02, 0x03, 0x04]) - XCTAssertEqual(MessagePackValue.pack(.array(value)), packed) - } - - func testUnpackFixarray() { - let packed = Data([0x95, 0x00, 0x01, 0x02, 0x03, 0x04]) - let value: [MessagePackValue] = [.uint8(0), .uint8(1), .uint8(2), .uint8(3), .uint8(4)] - - let unpacked = try? MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked?.value, .array(value)) - XCTAssertEqual(unpacked?.remainder.count, 0) - } - - func testPackArray16() { - let value = [MessagePackValue](repeating: nil, count: 16) - let packed = Data([0xdc, 0x00, 0x10] + [UInt8](repeating: 0xc0, count: 16)) - XCTAssertEqual(MessagePackValue.pack(.array(value)), packed) - } - - func testUnpackArray16() { - let packed = Data([0xdc, 0x00, 0x10] + [UInt8](repeating: 0xc0, count: 16)) - let value = [MessagePackValue](repeating: nil, count: 16) - - let unpacked = try? MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked?.value, .array(value)) - XCTAssertEqual(unpacked?.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/BUILD b/Tests/MessagePackTests/BUILD deleted file mode 100644 index e4716f1..0000000 --- a/Tests/MessagePackTests/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test") -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "MessagePackTests.library", - srcs = glob(["**/*.swift"]), - module_name = "MessagePackTests", - deps = ["//Sources/MessagePack"], -) - -macos_unit_test( - name = "MessagePackTests", - minimum_os_version = "10.14", - deps = [":MessagePackTests.library"], -) diff --git a/Tests/MessagePackTests/BinaryTests.swift b/Tests/MessagePackTests/BinaryTests.swift deleted file mode 100644 index 57ecef5..0000000 --- a/Tests/MessagePackTests/BinaryTests.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class BinaryTests: XCTestCase { - let payload = Data([0x00, 0x01, 0x02, 0x03, 0x04]) - let packed = Data([0xc4, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04]) - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.binary(payload)), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .binary(payload)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackBinEmpty() { - let value = Data() - let expectedPacked = Data([0xc4, 0x00]) + value - XCTAssertEqual(MessagePackValue.pack(.binary(value)), expectedPacked) - } - - func testUnpackBinEmpty() throws { - let data = Data() - let packed = Data([0xc4, 0x00]) + data - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, MessagePackValue.binary(data)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackBin16() { - let value = Data(count: 0xff) - let expectedPacked = Data([0xc4, 0xff]) + value - XCTAssertEqual(MessagePackValue.pack(.binary(value)), expectedPacked) - } - - func testUnpackBin16() throws { - let data = Data([0xc4, 0xff]) + Data(count: 0xff) - let value = Data(count: 0xff) - - let unpacked = try MessagePackValue.unpack(data) - XCTAssertEqual(unpacked.value, .binary(value)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackBin32() { - let value = Data(count: 0x100) - let expectedPacked = Data([0xc5, 0x01, 0x00]) + value - XCTAssertEqual(MessagePackValue.pack(.binary(value)), expectedPacked) - } - - func testUnpackBin32() throws { - let data = Data([0xc5, 0x01, 0x00]) + Data(count: 0x100) - let value = Data(count: 0x100) - - let unpacked = try MessagePackValue.unpack(data) - XCTAssertEqual(unpacked.value, .binary(value)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackBin64() { - let value = Data(count: 0x1_0000) - let expectedPacked = Data([0xc6, 0x00, 0x01, 0x00, 0x00]) + value - XCTAssertEqual(MessagePackValue.pack(.binary(value)), expectedPacked) - } - - func testUnpackBin64() throws { - let data = Data([0xc6, 0x00, 0x01, 0x00, 0x00]) + Data(count: 0x1_0000) - let value = Data(count: 0x1_0000) - - let unpacked = try MessagePackValue.unpack(data) - XCTAssertEqual(unpacked.value, .binary(value)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testUnpackInsufficientData() { - let dataArray: [Data] = [ - // only type byte - Data([0xc4]), Data([0xc5]), Data([0xc6]), - - // type byte with no data - Data([0xc4, 0x01]), - Data([0xc5, 0x00, 0x01]), - Data([0xc6, 0x00, 0x00, 0x00, 0x01]), - ] - - for data in dataArray { - do { - _ = try MessagePackValue.unpack(data) - XCTFail("Expected unpack to throw") - } catch { - XCTAssertEqual(error as? MessagePackUnpackError, .insufficientData) - } - } - } -} diff --git a/Tests/MessagePackTests/DescriptionTests.swift b/Tests/MessagePackTests/DescriptionTests.swift deleted file mode 100644 index f925b7a..0000000 --- a/Tests/MessagePackTests/DescriptionTests.swift +++ /dev/null @@ -1,96 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class DescriptionTests: XCTestCase { - func testNilDescription() { - XCTAssertEqual(MessagePackValue.nil.description, "nil") - } - - func testBoolDescription() { - XCTAssertEqual(MessagePackValue.bool(true).description, "bool(true)") - XCTAssertEqual(MessagePackValue.bool(false).description, "bool(false)") - } - - func testInt8Description() { - XCTAssertEqual(MessagePackValue.int8(-1).description, "int8(-1)") - XCTAssertEqual(MessagePackValue.int8(0).description, "int8(0)") - XCTAssertEqual(MessagePackValue.int8(1).description, "int8(1)") - } - - func testUInt8Description() { - XCTAssertEqual(MessagePackValue.uint8(0).description, "uint8(0)") - XCTAssertEqual(MessagePackValue.uint8(1).description, "uint8(1)") - XCTAssertEqual(MessagePackValue.uint8(2).description, "uint8(2)") - } - - func testFloatDescription() { - XCTAssertEqual(MessagePackValue.float(0.0).description, "float(0.0)") - XCTAssertEqual(MessagePackValue.float(1.618).description, "float(1.618)") - XCTAssertEqual(MessagePackValue.float(3.14).description, "float(3.14)") - } - - func testDoubleDescription() { - XCTAssertEqual(MessagePackValue.double(0.0).description, "double(0.0)") - XCTAssertEqual(MessagePackValue.double(1.618).description, "double(1.618)") - XCTAssertEqual(MessagePackValue.double(3.14).description, "double(3.14)") - } - - func testStringDescription() { - XCTAssertEqual(MessagePackValue.string("").description, "string()".description) - XCTAssertEqual(MessagePackValue.string("MessagePack").description, "string(MessagePack)".description) - } - - func testBinaryDescription() { - XCTAssertEqual(MessagePackValue.binary(Data()).description, "data(0 bytes)") - XCTAssertEqual(MessagePackValue.binary(Data(Data([0x00, 0x01, 0x02, 0x03, 0x04]))).description, "data(5 bytes)") - } - - func testArrayDescription() { - let values: [MessagePackValue] = [.int64(1), true, ""] - XCTAssertEqual(MessagePackValue.array(values).description, "array([int64(1), bool(true), string()])") - } - - func testMapDescription() { - let values: [MessagePackValue: MessagePackValue] = [ - "a": "apple", - "b": "banana", - "c": "cookie", - ] - - let components = [ - "string(a): string(apple)", - "string(b): string(banana)", - "string(c): string(cookie)", - ] - - let indexPermutations: [[Int]] = [ - [0, 1, 2], - [0, 2, 1], - [1, 0, 2], - [1, 2, 0], - [2, 0, 1], - [2, 1, 0], - ] - - let description = MessagePackValue.map(values).description - - var isValid = false - for indices in indexPermutations { - let permutation = indices.map { index in components[index] } - let innerDescription = permutation.joined(separator: ", ") - if description == "map([\(innerDescription)])" { - isValid = true - break - } - } - - XCTAssertTrue(isValid) - } - - func testExtendedDescription() { - XCTAssertEqual(MessagePackValue.extended(5, Data()).description, "extended(5, 0 bytes)") - XCTAssertEqual(MessagePackValue.extended(5, Data([0x00, 0x10, 0x20, 0x30, 0x40])).description, "extended(5, 5 bytes)") - } -} diff --git a/Tests/MessagePackTests/DoubleTests.swift b/Tests/MessagePackTests/DoubleTests.swift deleted file mode 100644 index 462f88b..0000000 --- a/Tests/MessagePackTests/DoubleTests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class DoubleTests: XCTestCase { - let packed = Data([0xcb, 0x40, 0x09, 0x1e, 0xb8, 0x51, 0xeb, 0x85, 0x1f]) - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.double(3.14)), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .double(3.14)) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/ExampleTests.swift b/Tests/MessagePackTests/ExampleTests.swift deleted file mode 100644 index 8d39a3e..0000000 --- a/Tests/MessagePackTests/ExampleTests.swift +++ /dev/null @@ -1,47 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class ExampleTests: XCTestCase { - let example: MessagePackValue = ["compact": true, "schema": .uint8(0)] - - // Two possible "correct" values because dictionaries are unordered - let correctA = Data([0x82, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xc3, 0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00]) - let correctB = Data([0x82, 0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xc3]) - - func testPack() { - let packed = MessagePackValue.pack(example) - XCTAssertTrue(packed == correctA || packed == correctB) - } - - func testUnpack() throws { - let unpacked1 = try MessagePackValue.unpack(correctA) - XCTAssertEqual(unpacked1.value, example) - XCTAssertEqual(unpacked1.remainder.count, 0) - - let unpacked2 = try MessagePackValue.unpack(correctB) - XCTAssertEqual(unpacked2.value, example) - XCTAssertEqual(unpacked2.remainder.count, 0) - } - - func testUnpackInvalidData() { - do { - _ = try MessagePackValue.unpack(Data([0xc1])) - XCTFail("Expected unpack to throw") - } catch { - XCTAssertEqual(error as? MessagePackUnpackError, .invalidData) - } - } - - func testUnpackInsufficientData() { - do { - var data = correctA - data.removeLast() - _ = try MessagePackValue.unpack(data) - XCTFail("Expected unpack to throw") - } catch { - XCTAssertEqual(error as? MessagePackUnpackError, .insufficientData) - } - } -} diff --git a/Tests/MessagePackTests/ExtendedTests.swift b/Tests/MessagePackTests/ExtendedTests.swift deleted file mode 100644 index ea57339..0000000 --- a/Tests/MessagePackTests/ExtendedTests.swift +++ /dev/null @@ -1,153 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class ExtendedTests: XCTestCase { - func testPackFixext1() { - let value = MessagePackValue.extended(5, Data([0x00])) - let packed = Data([0xd4, 0x05, 0x00]) - XCTAssertEqual(MessagePackValue.pack(value), packed) - } - - func testUnpackFixext1() throws { - let packed = Data([0xd4, 0x05, 0x00]) - let value = MessagePackValue.extended(5, Data([0x00])) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackFixext2() { - let value = MessagePackValue.extended(5, Data([0x00, 0x01])) - let packed = Data([0xd5, 0x05, 0x00, 0x01]) - XCTAssertEqual(MessagePackValue.pack(value), packed) - } - - func testUnpackFixext2() throws { - let packed = Data([0xd5, 0x05, 0x00, 0x01]) - let value = MessagePackValue.extended(5, Data([0x00, 0x01])) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackFixext4() { - let value = MessagePackValue.extended(5, Data([0x00, 0x01, 0x02, 0x03])) - let packed = Data([0xd6, 0x05, 0x00, 0x01, 0x02, 0x03]) - XCTAssertEqual(MessagePackValue.pack(value), packed) - } - - func testUnpackFixext4() throws { - let packed = Data([0xd6, 0x05, 0x00, 0x01, 0x02, 0x03]) - let value = MessagePackValue.extended(5, Data([0x00, 0x01, 0x02, 0x03])) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackFixext8() { - let value = MessagePackValue.extended(5, Data([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07])) - let packed = Data([0xd7, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]) - XCTAssertEqual(MessagePackValue.pack(value), packed) - } - - func testUnpackFixext8() throws { - let packed = Data([0xd7, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]) - let value = MessagePackValue.extended(5, Data([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07])) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackFixext16() { - let value = MessagePackValue.extended(5, Data([ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - ])) - let packed = Data([ - 0xd8, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - ]) - XCTAssertEqual(MessagePackValue.pack(value), packed) - } - - func testUnpackFixext16() throws { - let value = MessagePackValue.extended(5, Data([ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - ])) - let packed = Data([ - 0xd8, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - ]) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackExt8() { - let payload = Data(count: 7) - let value = MessagePackValue.extended(5, payload) - XCTAssertEqual(MessagePackValue.pack(value), Data([0xc7, 0x07, 0x05]) + payload) - } - - func testUnpackExt8() throws { - let payload = Data(count: 7) - let value = MessagePackValue.extended(5, payload) - - let unpacked = try MessagePackValue.unpack(Data([0xc7, 0x07, 0x05]) + payload) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackExt16() { - let payload = Data(count: 0x100) - let value = MessagePackValue.extended(5, payload) - XCTAssertEqual(MessagePackValue.pack(value), Data([0xc8, 0x01, 0x00, 0x05]) + payload) - } - - func testUnpackExt16() throws { - let payload = Data(count: 0x100) - let value = MessagePackValue.extended(5, payload) - - let unpacked = try MessagePackValue.unpack(Data([0xc8, 0x01, 0x00, 0x05]) + payload) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackExt32() { - let payload = Data(count: 0x10000) - let value = MessagePackValue.extended(5, payload) - XCTAssertEqual(MessagePackValue.pack(value), Data([0xc9, 0x00, 0x01, 0x00, 0x00, 0x05]) + payload) - } - - func testUnpackExt32() throws { - let payload = Data(count: 0x10000) - let value = MessagePackValue.extended(5, payload) - - let unpacked = try MessagePackValue.unpack(Data([0xc9, 0x00, 0x01, 0x00, 0x00, 0x05]) + payload) - XCTAssertEqual(unpacked.value, value) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testUnpackInsufficientData() { - let dataArray: [Data] = [ - // fixent - Data([0xd4]), Data([0xd5]), Data([0xd6]), Data([0xd7]), Data([0xd8]), - - // ext 8, 16, 32 - Data([0xc7]), Data([0xc8]), Data([0xc9]), - ] - - for data in dataArray { - do { - _ = try MessagePackValue.unpack(data) - XCTFail("Expected unpack to throw") - } catch { - XCTAssertEqual(error as? MessagePackUnpackError, .insufficientData) - } - } - } -} diff --git a/Tests/MessagePackTests/FalseTests.swift b/Tests/MessagePackTests/FalseTests.swift deleted file mode 100644 index dc73f3e..0000000 --- a/Tests/MessagePackTests/FalseTests.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class FalseTests: XCTestCase { - let packed = Data([0xc2]) - - func testLiteralConversion() { - let implicitValue: MessagePackValue = false - XCTAssertEqual(implicitValue, MessagePackValue.bool(false)) - } - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.bool(false)), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .bool(false)) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/FloatTests.swift b/Tests/MessagePackTests/FloatTests.swift deleted file mode 100644 index 26b1ac1..0000000 --- a/Tests/MessagePackTests/FloatTests.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class FloatTests: XCTestCase { - let packed = Data([0xca, 0x40, 0x48, 0xf5, 0xc3]) - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.float(3.14)), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .float(3.14)) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/Helpers.swift b/Tests/MessagePackTests/Helpers.swift deleted file mode 100644 index 6efab2e..0000000 --- a/Tests/MessagePackTests/Helpers.swift +++ /dev/null @@ -1,13 +0,0 @@ -import Foundation - -@testable import MessagePack - -extension MessagePackValue { - static func unpack(_ bytes: [UInt8]) throws -> (value: MessagePackValue, remainder: Subdata) { - return try unpack(Data(bytes)) - } - - static func unpack(_ data: Data) throws -> (value: MessagePackValue, remainder: Subdata) { - return try unpack(Subdata(data: data)) - } -} diff --git a/Tests/MessagePackTests/IntegerTests.swift b/Tests/MessagePackTests/IntegerTests.swift deleted file mode 100644 index 00d27e4..0000000 --- a/Tests/MessagePackTests/IntegerTests.swift +++ /dev/null @@ -1,138 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class IntegerTests: XCTestCase { - func testPackNegFixint() { - XCTAssertEqual(MessagePackValue.pack(.int8(-1)), Data([0xff])) - } - - func testUnpackNegFixint() throws { - let unpacked1 = try MessagePackValue.unpack(Data([0xff])) - XCTAssertEqual(unpacked1.value, .int8(-1)) - XCTAssertEqual(unpacked1.remainder.count, 0) - - let unpacked2 = try MessagePackValue.unpack(Data([0xe0])) - XCTAssertEqual(unpacked2.value, .int8(-32)) - XCTAssertEqual(unpacked2.remainder.count, 0) - } - - func testPackPosFixintSigned() { - XCTAssertEqual(MessagePackValue.pack(.int8(1)), Data([0xd0, 0x01])) - } - - func testUnpackPosFixintSigned() throws { - let unpacked = try MessagePackValue.unpack(Data([0x01])) - XCTAssertEqual(unpacked.value, .uint8(1)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackPosFixintUnsigned() { - XCTAssertEqual(MessagePackValue.pack(.uint8(42)), Data([0x2a])) - } - - func testUnpackPosFixintUnsigned() throws { - let unpacked = try MessagePackValue.unpack(Data([0x2a])) - XCTAssertEqual(unpacked.value, .uint8(42)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackUInt8() { - XCTAssertEqual(MessagePackValue.pack(.uint8(0xff)), Data([0xcc, 0xff])) - } - - func testUnpackUInt8() throws { - let unpacked = try MessagePackValue.unpack(Data([0xcc, 0xff])) - XCTAssertEqual(unpacked.value, .uint8(0xff)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackUInt16() { - XCTAssertEqual(MessagePackValue.pack(.uint16(0xffff)), Data([0xcd, 0xff, 0xff])) - } - - func testUnpackUInt16() throws { - let unpacked = try MessagePackValue.unpack(Data([0xcd, 0xff, 0xff])) - XCTAssertEqual(unpacked.value, .uint16(0xffff)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackUInt32() { - XCTAssertEqual(MessagePackValue.pack(.uint32(0xffff_ffff)), Data([0xce, 0xff, 0xff, 0xff, 0xff])) - } - - func testUnpackUInt32() throws { - let unpacked = try MessagePackValue.unpack(Data([0xce, 0xff, 0xff, 0xff, 0xff])) - XCTAssertEqual(unpacked.value, .uint32(0xffff_ffff)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackUInt64() { - XCTAssertEqual( - MessagePackValue.pack(.uint64(0xffff_ffff_ffff_ffff)), - Data([0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]) - ) - } - - func testUnpackUInt64() throws { - let unpacked = try MessagePackValue.unpack(Data([0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])) - XCTAssertEqual(unpacked.value, .uint64(0xffff_ffff_ffff_ffff)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackInt8() { - XCTAssertEqual(MessagePackValue.pack(.int8(-0x7f)), Data([0xd0, 0x81])) - } - - func testUnpackInt8() throws { - let unpacked = try MessagePackValue.unpack(Data([0xd0, 0x81])) - XCTAssertEqual(unpacked.value, .int8(-0x7f)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackInt16() { - XCTAssertEqual(MessagePackValue.pack(.int16(-0x7fff)), Data([0xd1, 0x80, 0x01])) - } - - func testUnpackInt16() throws { - let unpacked = try MessagePackValue.unpack(Data([0xd1, 0x80, 0x01])) - XCTAssertEqual(unpacked.value, .int16(-0x7fff)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackInt32() { - XCTAssertEqual(MessagePackValue.pack(.int32(-0x1_0000)), Data([0xd2, 0xff, 0xff, 0x00, 0x00])) - } - - func testUnpackInt32() throws { - let unpacked = try MessagePackValue.unpack(Data([0xd2, 0xff, 0xff, 0x00, 0x00])) - XCTAssertEqual(unpacked.value, .int32(-0x1_0000)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackInt64() { - XCTAssertEqual( - MessagePackValue.pack(.int64(-0x1_0000_0000)), - Data([0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00]) - ) - } - - func testUnpackInt64() throws { - let unpacked = try MessagePackValue.unpack(Data([0xd3, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00])) - XCTAssertEqual(unpacked.value, .int64(-0x1_0000_0000)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testUnpackInsufficientData() { - let dataArray: [Data] = [Data([0xd0]), Data([0xd1]), Data([0xd2]), Data([0xd3]), Data([0xd4])] - for data in dataArray { - do { - _ = try MessagePackValue.unpack(data) - XCTFail("Expected unpack to throw") - } catch { - XCTAssertEqual(error as? MessagePackUnpackError, .insufficientData) - } - } - } -} diff --git a/Tests/MessagePackTests/MapTests.swift b/Tests/MessagePackTests/MapTests.swift deleted file mode 100644 index fd49135..0000000 --- a/Tests/MessagePackTests/MapTests.swift +++ /dev/null @@ -1,81 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -func map(_ count: Int) -> [MessagePackValue: MessagePackValue] { - var dict = [MessagePackValue: MessagePackValue]() - for i in 0 ..< UInt64(count) { - dict[.uint64(i)] = .nil - } - - return dict -} - -func payload(_ count: Int) -> Data { - var data = Data() - for i in 0 ..< UInt64(count) { - data.append(MessagePackValue.pack(.uint64(i)) + MessagePackValue.pack(.nil)) - } - - return data -} - -func testPackMap(_ count: Int, prefix: Data) throws { - let packed = MessagePackValue.pack(.map(map(count))) - - XCTAssertEqual(packed.subdata(in: 0 ..< prefix.count), prefix) - - var remainder = Subdata(data: packed, startIndex: prefix.count, endIndex: packed.count) - var keys = Set() - - for _ in 0 ..< count { - let value: MessagePackValue - (value, remainder) = try MessagePackValue.unpack(remainder) - let key: UInt64 - if case let .uint64(i) = value { - key = i - } else { - throw MessagePackUnpackError.invalidData - } - - XCTAssertFalse(keys.contains(key)) - keys.insert(key) - - let nilValue: MessagePackValue - (nilValue, remainder) = try MessagePackValue.unpack(remainder) - XCTAssertEqual(nilValue, MessagePackValue.nil) - } - - XCTAssertEqual(keys.count, count) -} - -class MapTests: XCTestCase { - func testLiteralConversion() { - let implicitValue: MessagePackValue = ["c": "cookie"] - XCTAssertEqual(implicitValue, .map([.string("c"): .string("cookie")])) - } - - func testPackFixmap() { - let packed = Data([0x81, 0xa1, 0x63, 0xa6, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65]) - XCTAssertEqual(MessagePackValue.pack(.map([.string("c"): .string("cookie")])), packed) - } - - func testUnpackFixmap() throws { - let packed = Data([0x81, 0xa1, 0x63, 0xa6, 0x63, 0x6f, 0x6f, 0x6b, 0x69, 0x65]) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, MessagePackValue.map([.string("c"): .string("cookie")])) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackMap16() throws { - try testPackMap(16, prefix: Data([0xde, 0x00, 0x10])) - } - - func testUnpackMap16() throws { - let unpacked = try MessagePackValue.unpack(Data([0xde, 0x00, 0x10]) + payload(16)) - XCTAssertEqual(unpacked.value, MessagePackValue.map(map(16))) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/NilTests.swift b/Tests/MessagePackTests/NilTests.swift deleted file mode 100644 index df05e92..0000000 --- a/Tests/MessagePackTests/NilTests.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class NilTests: XCTestCase { - let packed = Data([0xc0]) - - func testLiteralConversion() { - let implicitValue: MessagePackValue = nil - XCTAssertEqual(implicitValue, MessagePackValue.nil) - } - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.nil), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, MessagePackValue.nil) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/StringTests.swift b/Tests/MessagePackTests/StringTests.swift deleted file mode 100644 index 07fb247..0000000 --- a/Tests/MessagePackTests/StringTests.swift +++ /dev/null @@ -1,85 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class StringTests: XCTestCase { - func testLiteralConversion() { - var implicitValue: MessagePackValue - - implicitValue = "Hello, world!" - XCTAssertEqual(implicitValue, .string("Hello, world!")) - - implicitValue = MessagePackValue(extendedGraphemeClusterLiteral: "Hello, world!") - XCTAssertEqual(implicitValue, .string("Hello, world!")) - - implicitValue = MessagePackValue(unicodeScalarLiteral: "Hello, world!") - XCTAssertEqual(implicitValue, .string("Hello, world!")) - } - - func testPackFixstr() { - let packed = Data([0xad, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21]) - XCTAssertEqual(MessagePackValue.pack(.string("Hello, world!")), packed) - } - - func testUnpackFixstr() { - let packed = Data([0xad, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21]) - - let unpacked = try? MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked?.value, .string("Hello, world!")) - XCTAssertEqual(unpacked?.remainder.count, 0) - } - - func testUnpackFixstrEmpty() throws { - let packed = Data([0xa0]) - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .string("")) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackStr8() { - let string = String(repeating: "*", count: 0x20) - XCTAssertEqual(MessagePackValue.pack(.string(string)), Data([0xd9, 0x20]) + string.data(using: .utf8)!) - } - - func testUnpackStr8() throws { - let string = String(repeating: "*", count: 0x20) - let packed = Data([0xd9, 0x20]) + string.data(using: .utf8)! - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .string(string)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackStr16() { - let string = String(repeating: "*", count: 0x1000) - XCTAssertEqual(MessagePackValue.pack(.string(string)), [0xda, 0x10, 0x00] + string.data(using: .utf8)!) - } - - func testUnpackStr16() throws { - let string = String(repeating: "*", count: 0x1000) - let packed = Data([0xda, 0x10, 0x00]) + string.data(using: .utf8)! - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .string(string)) - XCTAssertEqual(unpacked.remainder.count, 0) - } - - func testPackStr32() { - let string = String(repeating: "*", count: 0x10000) - XCTAssertEqual( - MessagePackValue.pack(.string(string)), - Data([0xdb, 0x00, 0x01, 0x00, 0x00]) + string.data(using: .utf8)! - ) - } - - func testUnpackStr32() throws { - let string = String(repeating: "*", count: 0x10000) - let packed = Data([0xdb, 0x00, 0x01, 0x00, 0x00]) + string.data(using: .utf8)! - - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, .string(string)) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/Tests/MessagePackTests/SubdataTests.swift b/Tests/MessagePackTests/SubdataTests.swift deleted file mode 100644 index 3d014cc..0000000 --- a/Tests/MessagePackTests/SubdataTests.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class SubdataTests: XCTestCase { - func testConversationToSubdata() { - let data = Data(repeating: 0, count: 0x20) - let subdata = Subdata(data: data) - XCTAssertEqual(subdata.base, data) - XCTAssertEqual(subdata.baseStartIndex, 0) - XCTAssertEqual(subdata.baseEndIndex, 0x20) - XCTAssertEqual(subdata.count, 0x20) - XCTAssertEqual(subdata.data, data) - XCTAssertFalse(subdata.isEmpty) - } - - func testConversationToSubdataWithExplicityIndexes() { - let data = Data(repeating: 0, count: 0x20) - let subdata = Subdata(data: data, startIndex: 0x10, endIndex: 0x11) - XCTAssertEqual(subdata.base, data) - XCTAssertEqual(subdata.baseStartIndex, 0x10) - XCTAssertEqual(subdata.baseEndIndex, 0x11) - XCTAssertEqual(subdata.count, 1) - XCTAssertFalse(subdata.isEmpty) - } - - func testConversationToEmptySubdata() { - let data = Data(repeating: 0, count: 0x20) - let subdata = Subdata(data: data, startIndex: 0x10, endIndex: 0x10) - XCTAssertEqual(subdata.base, data) - XCTAssertEqual(subdata.baseStartIndex, 0x10) - XCTAssertEqual(subdata.baseEndIndex, 0x10) - XCTAssertEqual(subdata.count, 0) - XCTAssertEqual(subdata.data, Data()) - XCTAssertTrue(subdata.isEmpty) - } -} diff --git a/Tests/MessagePackTests/TrueTests.swift b/Tests/MessagePackTests/TrueTests.swift deleted file mode 100644 index 45865bd..0000000 --- a/Tests/MessagePackTests/TrueTests.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import XCTest - -@testable import MessagePack - -class TrueTests: XCTestCase { - let packed = Data([0xc3]) - - func testLiteralConversion() { - let implicitValue: MessagePackValue = true - XCTAssertEqual(implicitValue, MessagePackValue.bool(true)) - } - - func testPack() { - XCTAssertEqual(MessagePackValue.pack(.bool(true)), packed) - } - - func testUnpack() throws { - let unpacked = try MessagePackValue.unpack(packed) - XCTAssertEqual(unpacked.value, MessagePackValue.bool(true)) - XCTAssertEqual(unpacked.remainder.count, 0) - } -} diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index d24b329..0000000 --- a/WORKSPACE +++ /dev/null @@ -1,37 +0,0 @@ -workspace(name = "com_github_mobilenativefoundation_xcbbuildserviceproxykit") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "build_bazel_rules_apple", - sha256 = "12865e5944f09d16364aa78050366aca9dc35a32a018fa35f5950238b08bf744", - url = "https://github.com/bazelbuild/rules_apple/releases/download/0.34.2/rules_apple.0.34.2.tar.gz", -) - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:extras.bzl", - "swift_rules_extra_dependencies", -) - -swift_rules_extra_dependencies() - -load( - "@com_github_mobilenativefoundation_xcbbuildserviceproxykit//:repositories.bzl", - "xcbbuildserviceproxykit_dependencies", -) - -xcbbuildserviceproxykit_dependencies() diff --git a/repositories.bzl b/repositories.bzl deleted file mode 100644 index 06adfe2..0000000 --- a/repositories.bzl +++ /dev/null @@ -1,142 +0,0 @@ -"""Definitions for handling Bazel repositories used by the -XCBBuildServiceProxyKit rules.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -# Make sure to update the versions used in the `Package.swift` file if you -# change them here - -def xcbbuildserviceproxykit_dependencies(): - "Fetches repositories that are dependencies of `XCBBuildServiceProxyKit`." - maybe( - http_archive, - name = "build_bazel_rules_swift", - sha256 = "a2fd565e527f83fb3f9eb07eb9737240e668c9242d3bc318712efa54a7deda97", - url = "https://github.com/bazelbuild/rules_swift/releases/download/0.27.0/rules_swift.0.27.0.tar.gz", - ) - - maybe( - http_archive, - name = "com_github_apple_swift_log", - build_file_content = """\ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "Logging", - srcs = glob(["Sources/Logging/**/*.swift"]), - visibility = ["//visibility:public"], -) -""", - sha256 = "de51662b35f47764b6e12e9f1d43e7de28f6dd64f05bc30a318cf978cf3bc473", - strip_prefix = "swift-log-1.4.2", - urls = [ - "https://github.com/apple/swift-log/archive/1.4.2.tar.gz", - ], - ) - - maybe( - http_archive, - name = "com_github_apple_swift_nio", - build_file_content = """\ -load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") - -swift_library( - name = "NIO", - srcs = glob(["Sources/NIO/**/*.swift"]), - visibility = ["//visibility:public"], - deps = [ - ":NIOCore", - ":NIOEmbedded", - ":NIOPosix", - ], -) - -swift_library( - name = "NIOCore", - srcs = glob(["Sources/NIOCore/**/*.swift"]), - deps = [ - ":CNIOLinux", - ":NIOConcurrencyHelpers", - ], -) - -swift_library( - name = "NIOEmbedded", - srcs = glob(["Sources/NIOEmbedded/**/*.swift"]), - deps = [ - ":NIOCore", - ":_NIODataStructures", - ], -) - -swift_library( - name = "NIOPosix", - srcs = glob(["Sources/NIOPosix/**/*.swift"]), - visibility = ["//visibility:public"], - deps = [ - ":CNIOLinux", - ":CNIODarwin", - ":NIOConcurrencyHelpers", - ":NIOCore", - ":_NIODataStructures", - ], -) - -swift_library( - name = "NIOConcurrencyHelpers", - srcs = glob(["Sources/NIOConcurrencyHelpers/**/*.swift"]), - deps = [ - ":CNIOAtomics", - ], -) - -swift_library( - name = "_NIODataStructures", - srcs = glob(["Sources/_NIODataStructures/**/*.swift"]), -) - -cc_library( - name = "CNIOAtomics", - srcs = glob([ - "Sources/CNIOAtomics/src/**/*.c", - "Sources/CNIOAtomics/src/**/*.h", - ]), - hdrs = glob([ - "Sources/CNIOAtomics/include/**/*.h", - ]), - includes = ["Sources/CNIOAtomics/include"], - tags = ["swift_module"], -) - -cc_library( - name = "CNIODarwin", - local_defines = ["__APPLE_USE_RFC_3542"], - srcs = glob([ - "Sources/CNIODarwin/**/*.c", - ]), - hdrs = glob([ - "Sources/CNIODarwin/include/**/*.h", - ]), - includes = ["Sources/CNIODarwin/include"], - tags = ["swift_module"], -) - -cc_library( - name = "CNIOLinux", - srcs = glob([ - "Sources/CNIOLinux/**/*.c", - ]), - hdrs = glob([ - "Sources/CNIOLinux/include/**/*.h", - ]), - includes = ["Sources/CNIOLinux/include"], - tags = ["swift_module"], -) -""", - sha256 = "fd0418e9cc64d5c05012b37147c819978ac162c5ec7aa874a488846f6b3a90e6", - strip_prefix = "swift-nio-2.40.0", - urls = [ - "https://github.com/apple/swift-nio/archive/2.40.0.tar.gz", - ], - )