Skip to content

Commit

Permalink
Workflow/update protos (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
njooma authored Aug 30, 2024
1 parent 4d1bd46 commit 4613357
Show file tree
Hide file tree
Showing 114 changed files with 6,449 additions and 4,861 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update_protos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run: make setup

- name: Update Proto Tag
run: sed -i -e "s/apiTag = 'v[0-9]*\.[0-9]*\.[0-9]*'/apiTag = '${{ github.event.client_payload.tag }}'" > lib/src/utils.dart
run: sed -i "s/apiTag = 'v[0-9]*\.[0-9]*\.[0-9]*'/apiTag = '${{ github.event.client_payload.tag }}'/" lib/src/utils.dart

- name: Generate buf
run: make buf
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,23 @@ endif

.PHONY: buf setup format test analyze

buf: buf.yaml buf.gen.yaml
buf:
rm -rf lib/src/gen
$(eval API_VERSION := $(shell grep 'const String apiTag' lib/src/utils.dart | awk -F "'" '{print $$2}'))
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/viamrobotics/goutils
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/viamrobotics/api:${API_VERSION}
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/googleapis/googleapis
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/any.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/duration.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/empty.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/struct.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/timestamp.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/wrappers.proto
buf generate buf.build/viamrobotics/goutils
buf generate buf.build/viamrobotics/api:${API_VERSION}
buf generate buf.build/googleapis/googleapis
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/any.proto
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/duration.proto
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/empty.proto
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/struct.proto
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/timestamp.proto
buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/wrappers.proto
# There's a bug in dart protoc where it doesn't understand that `call` is already taken
$(SED) 's/yield\* call(call, await request);/yield\* this\.call(call, await request);/g' ./lib/src/gen/proto/rpc/webrtc/v1/signaling.pbgrpc.dart
dart run tool/export_protos.dart

setup:
dart pub global activate protoc_plugin
dart pub global activate grpc
dart pub global activate cider

format:
Expand Down
10 changes: 6 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version: v1
version: v2
managed:
enabled: true
plugins:
- name: dart
- remote: buf.build/protocolbuffers/dart:v21.1.2
out: lib/src/gen
opt: grpc

opt:
- grpc
19 changes: 0 additions & 19 deletions buf.lock

This file was deleted.

10 changes: 0 additions & 10 deletions buf.yaml

This file was deleted.

24 changes: 12 additions & 12 deletions lib/src/gen/app/agent/v1/agent.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import 'dart:core' as $core;

import 'package:protobuf/protobuf.dart' as $pb;

import '../../../google/protobuf/duration.pb.dart' as $1;
import '../../../google/protobuf/struct.pb.dart' as $2;
import '../../../google/protobuf/duration.pb.dart' as $41;
import '../../../google/protobuf/struct.pb.dart' as $42;
import 'agent.pbenum.dart';

export 'agent.pbenum.dart';
Expand Down Expand Up @@ -100,7 +100,7 @@ class DeviceAgentConfigRequest extends $pb.GeneratedMessage {
class DeviceAgentConfigResponse extends $pb.GeneratedMessage {
factory DeviceAgentConfigResponse({
$core.Map<$core.String, DeviceSubsystemConfig>? subsystemConfigs,
$1.Duration? checkInterval,
$41.Duration? checkInterval,
}) {
final $result = create();
if (subsystemConfigs != null) {
Expand All @@ -117,7 +117,7 @@ class DeviceAgentConfigResponse extends $pb.GeneratedMessage {

static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'DeviceAgentConfigResponse', package: const $pb.PackageName(_omitMessageNames ? '' : 'viam.app.agent.v1'), createEmptyInstance: create)
..m<$core.String, DeviceSubsystemConfig>(1, _omitFieldNames ? '' : 'subsystemConfigs', entryClassName: 'DeviceAgentConfigResponse.SubsystemConfigsEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OM, valueCreator: DeviceSubsystemConfig.create, valueDefaultOrMaker: DeviceSubsystemConfig.getDefault, packageName: const $pb.PackageName('viam.app.agent.v1'))
..aOM<$1.Duration>(2, _omitFieldNames ? '' : 'checkInterval', subBuilder: $1.Duration.create)
..aOM<$41.Duration>(2, _omitFieldNames ? '' : 'checkInterval', subBuilder: $41.Duration.create)
..hasRequiredFields = false
;

Expand Down Expand Up @@ -149,23 +149,23 @@ class DeviceAgentConfigResponse extends $pb.GeneratedMessage {

/// how often this request should be repeated
@$pb.TagNumber(2)
$1.Duration get checkInterval => $_getN(1);
$41.Duration get checkInterval => $_getN(1);
@$pb.TagNumber(2)
set checkInterval($1.Duration v) { setField(2, v); }
set checkInterval($41.Duration v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasCheckInterval() => $_has(1);
@$pb.TagNumber(2)
void clearCheckInterval() => clearField(2);
@$pb.TagNumber(2)
$1.Duration ensureCheckInterval() => $_ensure(1);
$41.Duration ensureCheckInterval() => $_ensure(1);
}

class DeviceSubsystemConfig extends $pb.GeneratedMessage {
factory DeviceSubsystemConfig({
SubsystemUpdateInfo? updateInfo,
$core.bool? disable,
$core.bool? forceRestart,
$2.Struct? attributes,
$42.Struct? attributes,
}) {
final $result = create();
if (updateInfo != null) {
Expand All @@ -190,7 +190,7 @@ class DeviceSubsystemConfig extends $pb.GeneratedMessage {
..aOM<SubsystemUpdateInfo>(1, _omitFieldNames ? '' : 'updateInfo', subBuilder: SubsystemUpdateInfo.create)
..aOB(2, _omitFieldNames ? '' : 'disable')
..aOB(3, _omitFieldNames ? '' : 'forceRestart')
..aOM<$2.Struct>(4, _omitFieldNames ? '' : 'attributes', subBuilder: $2.Struct.create)
..aOM<$42.Struct>(4, _omitFieldNames ? '' : 'attributes', subBuilder: $42.Struct.create)
..hasRequiredFields = false
;

Expand Down Expand Up @@ -249,15 +249,15 @@ class DeviceSubsystemConfig extends $pb.GeneratedMessage {

/// arbitrary config sections
@$pb.TagNumber(4)
$2.Struct get attributes => $_getN(3);
$42.Struct get attributes => $_getN(3);
@$pb.TagNumber(4)
set attributes($2.Struct v) { setField(4, v); }
set attributes($42.Struct v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasAttributes() => $_has(3);
@$pb.TagNumber(4)
void clearAttributes() => clearField(4);
@$pb.TagNumber(4)
$2.Struct ensureAttributes() => $_ensure(3);
$42.Struct ensureAttributes() => $_ensure(3);
}

class HostInfo extends $pb.GeneratedMessage {
Expand Down
Loading

0 comments on commit 4613357

Please sign in to comment.