From 6f98b6c8a13ec8e7f6b716db42502919c5fde9d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:02:51 +0200 Subject: [PATCH 1/7] chore(deps): bump google.golang.org/grpc from 1.55.0 to 1.56.3 (#3714) --- go.mod | 2 +- go.sum | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 30e707dec6..066407690b 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,7 @@ require ( golang.org/x/text v0.13.0 golang.org/x/tools v0.9.1 golang.org/x/vuln v0.1.0 - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.3 gopkg.in/yaml.v2 v2.4.0 mvdan.cc/gofumpt v0.5.0 sigs.k8s.io/yaml v1.3.0 diff --git a/go.sum b/go.sum index 2905353ab7..11eead18fd 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,8 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbCEQ= -cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= +cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= +cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= @@ -1486,8 +1486,8 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= +golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1811,8 +1811,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 3050e6256f9312af0ace36d23b6b505f0b303447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jer=C3=B3nimo=20Albi?= Date: Fri, 27 Oct 2023 12:51:11 +0200 Subject: [PATCH 2/7] fix: correct invalid plugin hook check (#3716) * fix: correct invalid plugin hook check Co-authored-by: Tina Aliakbarpour <51127383+tinaaliakbarpour@users.noreply.github.com> * chore: update changelog --------- Co-authored-by: Tina Aliakbarpour <51127383+tinaaliakbarpour@users.noreply.github.com> --- changelog.md | 1 + ignite/cmd/plugin.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index b2f0f9c8bb..3c6ba3b648 100644 --- a/changelog.md +++ b/changelog.md @@ -35,6 +35,7 @@ - [#3631](https://github.com/ignite/cli/pull/3631) Fix unnecessary vue import in hooks/composables template - [#3655](https://github.com/ignite/cli/pull/3655) Re-enable TS client generation - [#3661](https://github.com/ignite/cli/pull/3661) Change `pkg/cosmosanalysis` to find Cosmos SDK runtime app registered modules +- [#3716](https://github.com/ignite/cli/pull/3716) Fix invalid plugin hook check ## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0) diff --git a/ignite/cmd/plugin.go b/ignite/cmd/plugin.go index ab1170a6ee..eb51cfb319 100644 --- a/ignite/cmd/plugin.go +++ b/ignite/cmd/plugin.go @@ -233,7 +233,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) } }() - if preRun != nil { + if postCmd != nil { err := postCmd(cmd, args) if err != nil { // dont return the error, log it and let execution continue to `Run` From 5743bbb683c396dae9d12d89512663a250994c5b Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Mon, 30 Oct 2023 14:24:25 +0100 Subject: [PATCH 3/7] add plush files to run the CI (#3719) Co-authored-by: Pantani --- .github/workflows/test-integration.yml | 1 + .github/workflows/test-lint.yml | 1 + .github/workflows/test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 7092742213..2e20e133d2 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -38,6 +38,7 @@ jobs: with: PATTERNS: | **/*.go + **/*.plush go.mod go.sum **/testdata/** diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 9da1c01b40..7d0f3d6b0a 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -23,6 +23,7 @@ jobs: with: PATTERNS: | **/*.go + **/*.plush go.mod go.sum diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3899d43f7f..723d669178 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: with: PATTERNS: | **/*.go + **/*.plush go.mod go.sum **/testdata/** From ae26f1839a131a5e5fc43578c0f33125cf448758 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:11:43 +0100 Subject: [PATCH 4/7] chore(deps): bump github.com/docker/docker (#3721) Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.1+incompatible to 24.0.7+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v24.0.1...v24.0.7) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 066407690b..7481359fae 100644 --- a/go.mod +++ b/go.mod @@ -162,7 +162,7 @@ require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.2.0 // indirect - github.com/docker/docker v24.0.1+incompatible // indirect + github.com/docker/docker v24.0.7+incompatible // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect diff --git a/go.sum b/go.sum index 11eead18fd..624e6325ba 100644 --- a/go.sum +++ b/go.sum @@ -379,8 +379,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUn github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v24.0.1+incompatible h1:NxN81beIxDlUaVt46iUQrYHD9/W3u9EGl52r86O/IGw= -github.com/docker/docker v24.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= From 54bb6b49e964de6a245e1763c6fd77fb90e75dbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:22:14 +0100 Subject: [PATCH 5/7] chore(deps): bump postcss from 8.4.21 to 8.4.31 in /docs (#3685) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Danilo Pantani --- docs/package.json | 2 +- docs/yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/package.json b/docs/package.json index 1c6777c7dc..018f10ac78 100644 --- a/docs/package.json +++ b/docs/package.json @@ -21,7 +21,7 @@ "autoprefixer": "^10.4.14", "clsx": "^1.2.1", "docusaurus-plugin-image-zoom": "^0.1.1", - "postcss": "^8.4.21", + "postcss": "^8.4.31", "postcss-import": "^15.1.0", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", diff --git a/docs/yarn.lock b/docs/yarn.lock index 0e67e05c3b..f3dfd7b93a 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -5302,7 +5302,7 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nanoid@^3.3.4: +nanoid@^3.3.6: version "3.3.6" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== @@ -6015,12 +6015,12 @@ postcss-zindex@^5.1.0: resolved "https://registry.yarnpkg.com/postcss-zindex/-/postcss-zindex-5.1.0.tgz#4a5c7e5ff1050bd4c01d95b1847dfdcc58a496ff" integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== -postcss@^8.0.9, postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.17, postcss@^8.4.19, postcss@^8.4.21: - version "8.4.21" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.21.tgz#c639b719a57efc3187b13a1d765675485f4134f4" - integrity sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg== +postcss@^8.0.9, postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.17, postcss@^8.4.19, postcss@^8.4.31: + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== dependencies: - nanoid "^3.3.4" + nanoid "^3.3.6" picocolors "^1.0.0" source-map-js "^1.0.2" From af33f162de7e176e44d82a676186fe814a8d4278 Mon Sep 17 00:00:00 2001 From: Clockwork Date: Thu, 2 Nov 2023 18:42:33 +0200 Subject: [PATCH 6/7] fix: Optimise ts-client generation (#3725) * fix: Optimise ts-client generation * chore: Update changelog --- changelog.md | 1 + ignite/pkg/cosmosgen/generate_openapi.go | 17 +++++++++++++---- .../programs/swagger-combine/swagger-combine.go | 9 +-------- ignite/templates/app/files/go.mod.plush | 2 +- .../templates/app/files/proto/buf.gen.sta.yaml | 1 + 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index 3c6ba3b648..e66c21b220 100644 --- a/changelog.md +++ b/changelog.md @@ -36,6 +36,7 @@ - [#3655](https://github.com/ignite/cli/pull/3655) Re-enable TS client generation - [#3661](https://github.com/ignite/cli/pull/3661) Change `pkg/cosmosanalysis` to find Cosmos SDK runtime app registered modules - [#3716](https://github.com/ignite/cli/pull/3716) Fix invalid plugin hook check +- [#3725](https://github.com/ignite/cli/pull/3725) Fix flaky TS client generation issues on linux ## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0) diff --git a/ignite/pkg/cosmosgen/generate_openapi.go b/ignite/pkg/cosmosgen/generate_openapi.go index f4897d5472..84623e6b68 100644 --- a/ignite/pkg/cosmosgen/generate_openapi.go +++ b/ignite/pkg/cosmosgen/generate_openapi.go @@ -12,6 +12,7 @@ import ( "github.com/ignite/cli/ignite/pkg/cache" "github.com/ignite/cli/ignite/pkg/cosmosanalysis/module" "github.com/ignite/cli/ignite/pkg/dirchange" + "github.com/ignite/cli/ignite/pkg/nodetime" swaggercombine "github.com/ignite/cli/ignite/pkg/nodetime/programs/swagger-combine" "github.com/ignite/cli/ignite/pkg/xos" ) @@ -39,7 +40,11 @@ func (g *generator) generateOpenAPISpec() error { }, } ) - + command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine) + if err != nil { + return err + } + defer cleanup() defer func() { for _, dir := range specDirs { os.RemoveAll(dir) @@ -157,7 +162,7 @@ func (g *generator) generateOpenAPISpec() error { } // combine specs into one and save to out. - if err := swaggercombine.Combine(g.ctx, conf, out); err != nil { + if err := swaggercombine.Combine(g.ctx, conf, command, out); err != nil { return err } @@ -174,6 +179,11 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error }, } ) + command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine) + if err != nil { + return err + } + defer cleanup() defer func() { for _, dir := range specDirs { @@ -242,7 +252,6 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error if err := os.MkdirAll(outDir, 0o766); err != nil { return err } - // combine specs into one and save to out. - return swaggercombine.Combine(g.ctx, conf, out) + return swaggercombine.Combine(g.ctx, conf, command, out) } diff --git a/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go b/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go index a1ec01ede4..2b0c3da375 100644 --- a/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go +++ b/ignite/pkg/nodetime/programs/swagger-combine/swagger-combine.go @@ -8,7 +8,6 @@ import ( "regexp" "github.com/ignite/cli/ignite/pkg/cmdrunner/exec" - "github.com/ignite/cli/ignite/pkg/nodetime" ) // Config represent swagger-combine config. @@ -81,13 +80,7 @@ func (c *Config) AddSpec(id, path string, makeUnique bool) error { // Combine combines openapi specs into one and saves to out path. // specs is a spec id-fs path pair. -func Combine(ctx context.Context, c Config, out string) error { - command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine) - if err != nil { - return err - } - defer cleanup() - +func Combine(ctx context.Context, c Config, command []string, out string) error { f, err := os.CreateTemp("", "*.json") if err != nil { return err diff --git a/ignite/templates/app/files/go.mod.plush b/ignite/templates/app/files/go.mod.plush index 578f6def14..6dab72199d 100644 --- a/ignite/templates/app/files/go.mod.plush +++ b/ignite/templates/app/files/go.mod.plush @@ -18,7 +18,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 diff --git a/ignite/templates/app/files/proto/buf.gen.sta.yaml b/ignite/templates/app/files/proto/buf.gen.sta.yaml index d8cea8b342..4444f5e75c 100644 --- a/ignite/templates/app/files/proto/buf.gen.sta.yaml +++ b/ignite/templates/app/files/proto/buf.gen.sta.yaml @@ -10,5 +10,6 @@ plugins: opt: - logtostderr=true - openapi_naming_strategy=simple + - ignore_comments=true - simple_operation_ids=false - json_names_for_fields=false From 897b1cc783eee9f9ffd6232584826938fc2b79e1 Mon Sep 17 00:00:00 2001 From: Clockwork Date: Fri, 3 Nov 2023 17:34:57 +0200 Subject: [PATCH 7/7] fix: Don't cache modules with tmp includes (#3729) * fix: Don't cache modules with tmp includes * chore: Add changelog --- changelog.md | 1 + ignite/pkg/cosmosgen/generate.go | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index e66c21b220..5581e423dc 100644 --- a/changelog.md +++ b/changelog.md @@ -37,6 +37,7 @@ - [#3661](https://github.com/ignite/cli/pull/3661) Change `pkg/cosmosanalysis` to find Cosmos SDK runtime app registered modules - [#3716](https://github.com/ignite/cli/pull/3716) Fix invalid plugin hook check - [#3725](https://github.com/ignite/cli/pull/3725) Fix flaky TS client generation issues on linux +- [#3729](https://github.com/ignite/cli/pull/3729) Fix broken generator due to caching /tmp include folders ## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0) diff --git a/ignite/pkg/cosmosgen/generate.go b/ignite/pkg/cosmosgen/generate.go index fd85995f57..05cc679089 100644 --- a/ignite/pkg/cosmosgen/generate.go +++ b/ignite/pkg/cosmosgen/generate.go @@ -80,7 +80,7 @@ func (g *generator) setup() (err error) { if err != nil { return err } - g.appIncludes, err = g.resolveIncludes(g.appPath) + g.appIncludes, _, err = g.resolveIncludes(g.appPath) if err != nil { return err } @@ -120,9 +120,10 @@ func (g *generator) setup() (err error) { } var includes []string + cacheable := true if len(modules) > 0 { // For versioning issues, we do dependency/includes resolution per module - includes, err = g.resolveIncludes(path) + includes, cacheable, err = g.resolveIncludes(path) if err != nil { return err } @@ -133,9 +134,10 @@ func (g *generator) setup() (err error) { Modules: modules, Includes: includes, } - - if err := moduleCache.Put(cacheKey, modulesInPath); err != nil { - return err + if cacheable { + if err := moduleCache.Put(cacheKey, modulesInPath); err != nil { + return err + } } } @@ -197,21 +199,21 @@ func (g *generator) generateBufIncludeFolder(modpath string) (string, error) { return protoPath, nil } -func (g *generator) resolveIncludes(path string) (paths []string, err error) { +func (g *generator) resolveIncludes(path string) (paths []string, cacheable bool, err error) { // Init paths with the global include paths for protoc paths, err = protocGlobalInclude() if err != nil { - return nil, err + return nil, false, err } // Check that the app proto directory exists protoPath := filepath.Join(path, g.protoDir) fi, err := os.Stat(protoPath) if err != nil && !os.IsNotExist(err) { - return nil, err + return nil, false, err } else if !fi.IsDir() { // Just return the global includes when a proto directory doesn't exist - return paths, nil + return paths, true, nil } // Add app's proto path to the list of proto paths @@ -220,7 +222,7 @@ func (g *generator) resolveIncludes(path string) (paths []string, err error) { // Check if a Buf config file is present bufPath, err := g.findBufPath(protoPath) if err != nil { - return nil, err + return nil, false, err } // When a Buf config exists export all protos needed @@ -228,17 +230,17 @@ func (g *generator) resolveIncludes(path string) (paths []string, err error) { if bufPath != "" { includePath, err := g.generateBufIncludeFolder(protoPath) if err != nil && !errors.Is(err, cosmosbuf.ErrProtoFilesNotFound) { - return nil, err + return nil, false, err } // Use exported files only when the path contains ".proto" files if includePath != "" { - return append(paths, includePath), nil + return append(paths, includePath), false, nil } } // By default use the configured directories - return append(paths, g.getProtoIncludeFolders(path)...), nil + return append(paths, g.getProtoIncludeFolders(path)...), true, nil } func (g *generator) discoverModules(path, protoDir string) ([]module.Module, error) {