diff --git a/changelog.md b/changelog.md index c4cc87c390..bc07100998 100644 --- a/changelog.md +++ b/changelog.md @@ -52,6 +52,7 @@ - [#4091](https://github.com/ignite/cli/pull/4091) Fix race conditions in the plugin logic - [#4128](https://github.com/ignite/cli/pull/4128) Check for duplicate proto fields in config - [#4184](https://github.com/ignite/cli/pull/4184) Set custom `InitChainer` because of manually registered modules +- [#4198](https://github.com/ignite/cli/pull/4198) Set correct prefix overwriting in `buf.gen.pulsar.yaml` ## [`v28.4.0`](https://github.com/ignite/cli/releases/tag/v28.4.0) diff --git a/ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml b/ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml.plush similarity index 84% rename from ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml rename to ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml.plush index e8fffdb284..b128e9403f 100644 --- a/ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml +++ b/ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml.plush @@ -7,12 +7,13 @@ version: v1 managed: enabled: true go_package_prefix: - default: cosmossdk.io/api + default: <%= ModulePath %>/api except: - buf.build/googleapis/googleapis - buf.build/cosmos/gogo-proto - buf.build/cosmos/cosmos-proto override: + buf.build/cosmos/cosmos-sdk: cosmossdk.io/api plugins: - name: go-pulsar out: ./api diff --git a/ignite/templates/app/proto_test.go b/ignite/templates/app/proto_test.go index 18d72ad0ba..0c4a8fe6e4 100644 --- a/ignite/templates/app/proto_test.go +++ b/ignite/templates/app/proto_test.go @@ -3,6 +3,7 @@ package app import ( "os" "path/filepath" + "strings" "testing" "github.com/stretchr/testify/require" @@ -13,7 +14,7 @@ func TestBufFiles(t *testing.T) { protoDir, err := os.ReadDir("files/{{protoDir}}") require.NoError(t, err) for _, e := range protoDir { - want = append(want, filepath.Join("{{protoDir}}", e.Name())) + want = append(want, filepath.Join("{{protoDir}}", strings.TrimSuffix(e.Name(), ".plush"))) } got, err := BufFiles() diff --git a/integration/app/cmd_proto_path_test.go b/integration/app/cmd_proto_path_test.go index ae2f207df1..6904d478d1 100644 --- a/integration/app/cmd_proto_path_test.go +++ b/integration/app/cmd_proto_path_test.go @@ -5,6 +5,7 @@ package app_test import ( "os" "path/filepath" + "strings" "testing" "github.com/stretchr/testify/require" @@ -58,6 +59,25 @@ var ( } ) +// TestGenerapAppCheckBufPulsarPath tests scaffolding a new chain and checks if the buf.gen.pulsar.yaml file is correct +func TestGenerapAppCheckBufPulsarPath(t *testing.T) { + var ( + env = envtest.New(t) + app = env.Scaffold("github.com/test/blog") + ) + + bufGenPulsarPath := filepath.Join(app.SourcePath(), "proto", "buf.gen.pulsar.yaml") + _, statErr := os.Stat(bufGenPulsarPath) + require.False(t, os.IsNotExist(statErr), "buf.gen.pulsar.yaml should be scaffolded") + + result, err := os.ReadFile(bufGenPulsarPath) + require.NoError(t, err) + + require.True(t, strings.Contains(string(result), "default: github.com/test/blog/api"), "buf.gen.pulsar.yaml should contain the correct api override") + + app.EnsureSteady() +} + func TestChangeProtoPath(t *testing.T) { var ( env = envtest.New(t)