Skip to content

Commit

Permalink
chore: add java package to protos
Browse files Browse the repository at this point in the history
This option must be defined at the proto level in order to have an
import path that is reasonably usable

Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
eddiezane authored and smira committed Aug 26, 2024
1 parent 8234808 commit 5ba1df4
Show file tree
Hide file tree
Showing 58 changed files with 261 additions and 160 deletions.
1 change: 1 addition & 0 deletions api/cluster/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package cluster;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/cluster";
option java_package = "dev.talos.api.cluster";

import "common/common.proto";
import "google/protobuf/duration.proto";
Expand Down
1 change: 1 addition & 0 deletions api/common/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package common;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/common";
option java_package = "dev.talos.api.common";

import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";
Expand Down
1 change: 1 addition & 0 deletions api/inspect/inspect.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package inspect;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/inspect";
option java_package = "dev.talos.api.inspect";

import "common/common.proto";
import "google/protobuf/empty.proto";
Expand Down
1 change: 1 addition & 0 deletions api/machine/machine.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package machine;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/machine";
option java_package = "dev.talos.api.machine";

import "common/common.proto";
import "google/protobuf/any.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/config/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package resource.config;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/config";
option java_package = "dev.talos.api.resource.config";

// MessageConfigSpec is the spec for the config.MachineConfig resource.
message MachineConfigSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/block/block.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.block;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/block";
option java_package = "dev.talos.api.resource.definitions.block";

// DeviceSpec is the spec for devices status.
message DeviceSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/cluster/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.cluster;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/cluster";
option java_package = "dev.talos.api.resource.definitions.cluster";

import "common/common.proto";
import "resource/definitions/enums/enums.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/cri/cri.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.cri;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/cri";
option java_package = "dev.talos.api.resource.definitions.cri";

import "google/protobuf/struct.proto";

Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/enums/enums.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.enums;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/enums";
option java_package = "dev.talos.api.resource.definitions.enums";

// MachineType represents a machine type.
enum MachineType {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/etcd/etcd.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.etcd;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/etcd";
option java_package = "dev.talos.api.resource.definitions.etcd";

import "common/common.proto";

Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/extensions/extensions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.extensions;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/extensions";
option java_package = "dev.talos.api.resource.definitions.extensions";

// Compatibility describes extension compatibility.
message Compatibility {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/files/files.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.files;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/files";
option java_package = "dev.talos.api.resource.definitions.files";

// EtcFileSpecSpec describes status of rendered secrets.
message EtcFileSpecSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/hardware/hardware.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.hardware;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/hardware";
option java_package = "dev.talos.api.resource.definitions.hardware";

// MemoryModuleSpec represents a single Memory.
message MemoryModuleSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/k8s/k8s.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.k8s;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/k8s";
option java_package = "dev.talos.api.resource.definitions.k8s";

import "common/common.proto";
import "google/protobuf/struct.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/kubeaccess/kubeaccess.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.kubeaccess;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/kubeaccess";
option java_package = "dev.talos.api.resource.definitions.kubeaccess";

// ConfigSpec describes KubeSpan configuration..
message ConfigSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/kubespan/kubespan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.kubespan;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/kubespan";
option java_package = "dev.talos.api.resource.definitions.kubespan";

import "common/common.proto";
import "google/protobuf/timestamp.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/network/network.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.network;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/network";
option java_package = "dev.talos.api.resource.definitions.network";

import "common/common.proto";
import "google/protobuf/duration.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/perf/perf.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.perf;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/perf";
option java_package = "dev.talos.api.resource.definitions.perf";

// CPUSpec represents the last CPU stats snapshot.
message CPUSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/proto/proto.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.proto;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/proto";
option java_package = "dev.talos.api.resource.definitions.proto";

// LinuxIDMapping specifies UID/GID mappings.
message LinuxIDMapping {
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/runtime/runtime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.runtime;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/runtime";
option java_package = "dev.talos.api.resource.definitions.runtime";

import "common/common.proto";
import "google/protobuf/duration.proto";
Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/secrets/secrets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.secrets;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/secrets";
option java_package = "dev.talos.api.resource.definitions.secrets";

import "common/common.proto";

Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/siderolink/siderolink.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.siderolink;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/siderolink";
option java_package = "dev.talos.api.resource.definitions.siderolink";

import "common/common.proto";

Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/time/time.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.time;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/time";
option java_package = "dev.talos.api.resource.definitions.time";

import "google/protobuf/duration.proto";

Expand Down
1 change: 1 addition & 0 deletions api/resource/definitions/v1alpha1/v1alpha1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package talos.resource.definitions.v1alpha1;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/v1alpha1";
option java_package = "dev.talos.api.resource.definitions.v1alpha1";

// ServiceSpec describe service state.
message ServiceSpec {
Expand Down
1 change: 1 addition & 0 deletions api/resource/network/device_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package resource.network;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/network";
option java_package = "dev.talos.api.resource.network";

// DeviceConfigSpecSpec is the spec for the network.DeviceConfigSpec resource.
message DeviceConfigSpecSpec {
Expand Down
1 change: 1 addition & 0 deletions api/security/security.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package securityapi;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/security";
option java_package = "dev.talos.api.security";

// The security service definition.
service SecurityService {
Expand Down
1 change: 1 addition & 0 deletions api/storage/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package storage;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/storage";
option java_package = "dev.talos.api.storage";

import "common/common.proto";
import "google/protobuf/empty.proto";
Expand Down
1 change: 1 addition & 0 deletions api/time/time.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package time;

option go_package = "github.com/siderolabs/talos/pkg/machinery/api/time";
option java_package = "dev.talos.api.time";

import "common/common.proto";
import "google/protobuf/empty.proto";
Expand Down
3 changes: 2 additions & 1 deletion hack/structprotogen/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ type ConstBlocks []ConstBlock
func (b *ConstBlocks) FormatProtoFile(w io.Writer) error {
fmt.Fprint(w, "syntax = \"proto3\";\n\n")
fmt.Fprint(w, "package talos.resource.definitions.enums;\n\n")
fmt.Fprint(w, `option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/enums";`+"\n\n")
fmt.Fprint(w, `option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/enums";`+"\n")
fmt.Fprint(w, `option java_package = "dev.talos.api.resource.definitions.enums";`+"\n\n")

for _, block := range *b {
for _, comment := range block.CommentLines {
Expand Down
6 changes: 4 additions & 2 deletions hack/structprotogen/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func (p *Pkg) WriteDebug(w io.Writer) {

fmt.Fprint(w, "syntax = \"proto3\";\n\n")
fmt.Fprintf(w, "package talos.resource.definitions.%s; // %s\n\n", p.Name, p.GoPkg)
fmt.Fprintf(w, "option go_package = \"github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/%s\";\n\n", pkgName) // TODO: insert proper path
fmt.Fprintf(w, "option go_package = \"github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/%s\";\n", pkgName) // TODO: insert proper path
fmt.Fprintf(w, "option java_package = \"dev.talos.api.resource.definitions.%s\";\n\n", pkgName)

if p.imports.Len() > 0 {
for i := 0; i < p.imports.Len(); i++ {
Expand All @@ -88,7 +89,8 @@ func (p *Pkg) Format(w io.Writer) {

fmt.Fprint(w, "syntax = \"proto3\";\n\n")
fmt.Fprintf(w, "package talos.resource.definitions.%s;\n\n", p.Name)
fmt.Fprintf(w, "option go_package = \"github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/%s\";\n\n", pkgName) // TODO: insert proper path
fmt.Fprintf(w, "option go_package = \"github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/%s\";\n", pkgName) // TODO: insert proper path
fmt.Fprintf(w, "option java_package = \"dev.talos.api.resource.definitions.%s\";\n\n", pkgName)

if p.imports.Len() > 0 {
for i := 0; i < p.imports.Len(); i++ {
Expand Down
12 changes: 7 additions & 5 deletions pkg/machinery/api/cluster/cluster.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions pkg/machinery/api/common/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/machinery/api/inspect/inspect.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/machinery/api/machine/machine.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/machinery/api/resource/config/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions pkg/machinery/api/resource/definitions/block/block.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5ba1df4

Please sign in to comment.