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

build(plugin-keychain-vault): fix gradle error Redeclaration: ResponseType #2730

Closed
petermetz opened this issue Oct 2, 2023 · 1 comment · Fixed by #2732
Closed

build(plugin-keychain-vault): fix gradle error Redeclaration: ResponseType #2730

petermetz opened this issue Oct 2, 2023 · 1 comment · Fixed by #2732
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file dependent
Milestone

Comments

@petermetz
Copy link
Contributor

petermetz commented Oct 2, 2023

Description

cd packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/

Then run the build:

$ gradle build

> Task :compileKotlin FAILED
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (3, 12): Redeclaration: ResponseType
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (7, 11): Redeclaration: Response
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (14, 7): Redeclaration: Success
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (20, 7): Redeclaration: Informational
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (26, 7): Redeclaration: Redirection
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (31, 7): Redeclaration: ClientError
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt: (38, 7): Redeclaration: ServerError
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (3, 12): Redeclaration: ResponseType
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (7, 11): Redeclaration: Response
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (14, 7): Redeclaration: Success
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (20, 7): Redeclaration: Informational
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (26, 7): Redeclaration: Redirection
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (31, 7): Redeclaration: ClientError
e: /****/cacti/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt: (38, 7): Redeclaration: ServerError

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
1 actionable task: 1 executed

List of Kotlin API client projects we have:

./packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated

./packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated

./packages/cactus-plugin-consortium-manual/src/main/kotlin/generated

./packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated

./packages/cactus-plugin-odap-hermes/src/main/kotlin/generated

./packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated

./packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated

./packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated

./packages/cactus-plugin-keychain-memory/src/main/kotlin/generated

./packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated

./packages/cactus-plugin-keychain-vault/src/main/kotlin/generated

./packages/cactus-cmd-api-server/src/main/kotlin/generated

./packages/cactus-core-api/src/main/kotlin/generated

./extensions/cactus-plugin-object-store-ipfs/src/main/kotlin/generated

./examples/cactus-example-supply-chain-business-logic-plugin/src/main/kotlin/generated

./examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated

Depends on #2729

@petermetz petermetz added bug Something isn't working dependencies Pull requests that update a dependency file labels Oct 2, 2023
@petermetz petermetz added this to the v2.0.0 milestone Oct 2, 2023
@petermetz petermetz self-assigned this Oct 2, 2023
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

This PR/issue depends on:

petermetz added a commit to petermetz/cacti that referenced this issue Oct 2, 2023
…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.

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 hyperledger-cacti#2730

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

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this issue Oct 2, 2023
…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 hyperledger-cacti#2730

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

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz moved this from In Progress to In review in Cacti_Scrum_Project_v2_Release Oct 2, 2023
petermetz added a commit to petermetz/cacti that referenced this issue Oct 5, 2023
…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 hyperledger-cacti#2730

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

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@github-project-automation github-project-automation bot moved this from In review to Done in Cacti_Scrum_Project_v2_Release Oct 16, 2023
sandeepnRES pushed a commit to sandeepnRES/cacti that referenced this issue Dec 21, 2023
…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 hyperledger-cacti#2730

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

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file dependent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant