Skip to content

Commit

Permalink
Add basic metadata protos (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Nov 14, 2018
1 parent 507b0f7 commit a9d54c1
Show file tree
Hide file tree
Showing 8 changed files with 905 additions and 1 deletion.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
ignore = E501, W503
exclude = *_pb2.py
7 changes: 7 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mypy]
python_version = 3.6
ignore_missing_imports = True


[mypy-synthtool.protos.*]
ignore_errors = True
9 changes: 8 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ def lint(session):
session.run('pip', 'install', '-e', '.')
session.run('black', '--check', 'synthtool', 'tests')
session.run('flake8', 'synthtool', 'tests')
session.run('mypy', '--ignore-missing-imports', 'synthtool')
session.run('mypy', 'synthtool')


@nox.session(python='3.6')
def test(session):
session.install('pytest')
session.run('pip', 'install', '-e', '.')
session.run('pytest', 'tests', *session.posargs)


@nox.session(python='3.6')
def generate_protos(session):
session.install("grpcio-tools")
session.run(
"python", "-m", "grpc_tools.protoc", "-Isynthtool/protos", "--python_out=synthtool/protos", "synthtool/protos/metadata.proto")
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"jinja2",
"packaging",
"requests",
"protobuf",
]

packages = setuptools.find_packages()
Expand Down
Empty file added synthtool/protos/__init__.py
Empty file.
75 changes: 75 additions & 0 deletions synthtool/protos/metadata.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2018 Google LLC
//
// 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
//
// https://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 yoshi.synth.metadata;

import "google/protobuf/timestamp.proto";


message Metadata {
google.protobuf.Timestamp update_time = 1;

repeated Source sources = 2;
repeated Destination destinations = 3;
}

message Source {
oneof source {
GitSource git = 1;
GeneratorSource generator = 2;
TemplateSource template = 3;
}
}

message GitSource {
string name = 1;
string remote = 2;
string sha = 3;

// If this Git is a mirror of an internal repository, such as google3 or
// Git-on-Borg, you can include an internal ref to it here.
string internal_ref = 4;
}

message GeneratorSource {
string name = 1;
string version = 2;
}

message TemplateSource {
string name = 1;
string origin = 2;
string version = 3;
}

message Destination {
oneof Destination {
ClientDestination client = 1;
FileSetDestination fileset = 2;
}
}

message ClientDestination {
string api_name = 1;
string api_version = 2;
string generator = 3;
string source = 4;
}

message FileSetDestination {
string source = 1;
repeated string files = 2;
}
Loading

0 comments on commit a9d54c1

Please sign in to comment.