Skip to content

Commit

Permalink
build(plugin-keychain-vault): fix gradle error Redeclaration: Respons…
Browse files Browse the repository at this point in the history
…eType

Primary change:
---------------

1. The codegen script now runs the clean script prior to its own
execution automatically (so that we don't forget to run it).
If we don't run the clean script prior to the code generation, then
the code generation doesn't delete old files just dumps the new ones
next to the old ones which leads to problems after upgrading the generator:
A newer version of the generator usually ships with different templates
that have restructured their code files so we end up with duplicates
breaking the build (unless we do a clean prior to codegen).

As for the actual build issue that this task was about:
It was a cross-cutting concern because the root cause of it was that
we were not cleaning up properly prior to the codegen task but this
applied to all the 2 or so dozen kotlin projects that we generate.

So as part of the solution I've ran the clean script and ran codegen
again which now produces code that builds without issues.

Secondary changes:
-----------------

Modified the clean script in the root project the following ways:
1. It is now cleaning up generated kotlin OpenAPI code as well
(previously it was not doing this at all despite what the name of the
script might suggest...)
2. It excludes all the openapi-generator-ignore files from being deleted
which has the beneficial side-effect that they do not get re-generated
with their default contents which would be missing files that we want
to ignore in addition to them.
3. The clean script NO LONGER DELETES the
`src/main/typescript/generated/proto/protoc-gen-ts` sub-folder of the
cmd-api-server package because the contents of it were not being re-
generated by the `codegen` script for some reason. This is something
to be fixed properly in the future but for now I just had to cut my
losses and make it work.

This depends on the PR being merged above because they both touch on
the generated code but in different ways. If we merged this one first,
the other one would have its diff emptied out (stealing the show).

[skip ci]

Fixes #2730

Depends on https://github.com/hyperledger/cacti/pull/2729

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Oct 16, 2023
1 parent b9c5c34 commit 117426c
Show file tree
Hide file tree
Showing 79 changed files with 2 additions and 3,020 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"start:example-carbon-accounting": "CONFIG_FILE=examples/cactus-example-carbon-accounting-backend/example-config.json node examples/cactus-example-carbon-accounting-backend/dist/lib/main/typescript/carbon-accounting-app-cli.js",
"start:example-cbdc-bridging-app": "node -r ts-node/register examples/cactus-example-cbdc-bridging-backend/dist/lib/main/typescript/cbdc-bridging-app-cli.js dotenv_config_path=examples/cactus-example-cbdc-bridging-backend/process.env",
"purge-build-cache": "del-cli .build-cache/*",
"clean": "npm run purge-build-cache && del-cli \"./{packages,examples,extensions}/cactus-*/{dist,.nyc_output,src/main/proto/generated/*,src/main/typescript/generated/proto/protoc-gen-ts/*,src/main/typescript/generated/openapi/typescript-axios/*,src/main-server/kotlin/gen/kotlin-spring/src/**/{model,api}/*}\"",
"clean": "npm run purge-build-cache && del-cli \"./{packages,examples,extensions}/cactus-*/{dist,.nyc_output,src/main/kotlin/generated/openapi/kotlin-client/*,src/main/proto/generated/*,src/main/typescript/generated/openapi/typescript-axios/*,src/main-server/kotlin/gen/kotlin-spring/src/**/{model,api}/*}\" \"!**/.openapi-generator-ignore\"",
"lint": "eslint '*/*/src/**/*.{js,ts}' --quiet --fix && cspell \"*/*/src/**/*.{js,ts}\"",
"tsc": "tsc --build --verbose",
"codegen": "run-s 'codegen:warmup-*' codegen:lerna codegen:cleanup",
Expand Down
Loading

0 comments on commit 117426c

Please sign in to comment.