Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add neoeinstein-prost-crate v0.3.1 plugin #609

Merged
merged 5 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/community/neoeinstein-prost-crate/source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source:
crates:
crate_name: protoc-gen-prost-crate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
12 changes: 12 additions & 0 deletions plugins/community/neoeinstein-prost-crate/v0.3.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# syntax=docker/dockerfile:1.4
FROM rust:1.68.0-alpine3.17 as builder
cobbinma marked this conversation as resolved.
Show resolved Hide resolved
RUN apk add --no-cache musl-dev
WORKDIR /app
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/root/target \
cargo install protoc-gen-prost-crate --version 0.3.1 --locked --root /app

FROM gcr.io/distroless/static
COPY --from=builder /app/bin/protoc-gen-prost-crate /protoc-gen-prost-crate
USER nobody
ENTRYPOINT ["/protoc-gen-prost-crate"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: v1
name: buf.build/community/neoeinstein-prost-crate
plugin_version: v0.3.1
source_url: https://crates.io/crates/protoc-gen-prost-crate
description: Generates an include file and cargo manifest for turn-key crates.
output_languages:
- rust
spdx_license_id: Apache-2.0
license_url: https://github.com/neoeinstein/protoc-gen-prost/blob/1daacefaef6a5627d8a33d7258f58f972a845bba/LICENSE
7 changes: 4 additions & 3 deletions tests/plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ exec docker run --log-driver=none --rm -i {{.ImageName}}:{{.Version}} "$@"
// these plugins until the tests are updated to support running all plugin dependencies in sequence.
testOverrideOptions = map[string][]string{
"buf.build/community/neoeinstein-prost-serde": {"no_include"},
"buf.build/community/neoeinstein-prost-crate": {"no_features"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can you move this up one line to keep these plugin names sorted?

"buf.build/community/neoeinstein-tonic": {"no_include"},
}
)
Expand All @@ -74,7 +75,7 @@ func TestGeneration(t *testing.T) {
pluginDir := filepath.Join("testdata", pluginMeta.Name, pluginMeta.PluginVersion, image)
pluginGenDir := filepath.Join(pluginDir, "gen")
require.NoError(t, os.RemoveAll(pluginGenDir))
require.NoError(t, os.MkdirAll(pluginDir, 0755))
require.NoError(t, os.MkdirAll(pluginDir, 0o755))
require.NoError(t, createBufGenYaml(t, pluginDir, pluginMeta))
require.NoError(t, createProtocGenPlugin(t, pluginDir, pluginMeta))
bufCmd := exec.Command("buf", "generate", filepath.Join(imageDir, image+".bin.gz"))
Expand All @@ -98,7 +99,7 @@ func TestGeneration(t *testing.T) {
} else {
assert.Equal(t, existingPluginSum, genDirHash)
}
require.NoError(t, os.WriteFile(pluginImageSumFile, []byte(genDirHash+"\n"), 0644))
require.NoError(t, os.WriteFile(pluginImageSumFile, []byte(genDirHash+"\n"), 0o644))
})
}

Expand Down Expand Up @@ -190,7 +191,7 @@ func loadFilteredPlugins(t *testing.T) []*plugin.Plugin {

func createProtocGenPlugin(t *testing.T, basedir string, plugin *plugin.Plugin) error {
t.Helper()
protocGenPlugin, err := os.OpenFile(filepath.Join(basedir, "protoc-gen-plugin"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755)
protocGenPlugin, err := os.OpenFile(filepath.Join(basedir, "protoc-gen-plugin"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:DCZ732JowAJFMjglpvz8AyEHM5HYuJj57KBonu8zKeI=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1:bsHu+z5Flkt0AwoGW1dytSn92XZVnXOC5KkWoseGbE8=