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

feat(java): CDKv2 support #1447

Merged
merged 12 commits into from
Jan 2, 2022
Merged

feat(java): CDKv2 support #1447

merged 12 commits into from
Jan 2, 2022

Conversation

msessa
Copy link
Contributor

@msessa msessa commented Jan 1, 2022

Fixes #1446

Allow a java app to use CDKv2.

  • Java cdk app now makes use of the core AwsCdkDeps helper class
  • AwsCdkDeps is extended by AwsCdkDepsJava and AwsCdkDepsJs in order to handle different package names but retain all the other logic
  • Default MainClass has been changed from org.acme.App to org.acme.MyApp to avoid conflicting with the App class from cdk
  • Sample code generation can be disabled by the user (or otherwise provided by sub-classes)

BREAKING CHANGE: cdkVersion parameter of AwsCdkJavaApp no longer support caret (eg: "^1.136.0" ). That behavior is now controlled on whether cdkVersionPinning is set to true or false.

  • java: addCdkDependency method of AwsCdkJavaApp now expects fully qualified package names (eg: software.amazon.awscdk/aws-lambda).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Jan 1, 2022

Codecov Report

Merging #1447 (ecc1444) into main (d90284c) will increase coverage by 0.76%.
The diff coverage is 97.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1447      +/-   ##
==========================================
+ Coverage   88.06%   88.82%   +0.76%     
==========================================
  Files         132      136       +4     
  Lines        5109     5198      +89     
  Branches     1207     1195      -12     
==========================================
+ Hits         4499     4617     +118     
+ Misses        610      581      -29     
Impacted Files Coverage Δ
src/awscdk/cdk-config.ts 100.00% <ø> (ø)
src/cdk/consts.ts 100.00% <ø> (+36.36%) ⬆️
src/github/github-project.ts 100.00% <ø> (ø)
src/java/java-project.ts 100.00% <ø> (ø)
src/javascript/prettier.ts 87.75% <87.75%> (ø)
src/awscdk/awscdk-deps.ts 91.76% <90.90%> (+0.09%) ⬆️
src/awscdk/awscdk-app-java.ts 100.00% <100.00%> (ø)
src/awscdk/awscdk-app-ts.ts 92.53% <100.00%> (ø)
src/awscdk/awscdk-construct.ts 73.52% <100.00%> (ø)
src/awscdk/awscdk-deps-java.ts 100.00% <100.00%> (ø)
... and 30 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d12b72...ecc1444. Read the comment docs.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Nice! See some comments.

src/awscdk/awscdk-app-java.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-app-java.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-app-java.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps-java.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
Co-authored-by: Elad Ben-Israel <benisrae@amazon.com>
@msessa
Copy link
Contributor Author

msessa commented Jan 2, 2022

Thanks for the review @eladb. I'll address the items shortly.

On a side note, I've been struggling with an issue when trying to extend the interface AwsCdkJavaAppOptions in this PR from a projen extension:

jsii-pacmak fails to produce a java package with this error:

#STDOUT> [ERROR] /private/var/folders/kn/44xzkcmx7g52s0tcdg2nhdfm0000gn/T/npm-packoV4b2v/_service-victoria_projen-templates/src/main/java/au/gov/vic/service/projen_templates/ExtendedJavaProjectOptions.java:[2900,9] method does not override or implement a method from a supertype

The error goes away if I remove AwsCdkDepsCommonOptions from the extended interfaces in AwsCdkJavaAppOptions

Any idea what would cause that?

@msessa msessa requested a review from eladb January 2, 2022 09:01
@msessa
Copy link
Contributor Author

msessa commented Jan 2, 2022

Actually to answer my above question I think it's because I'm working with local packages and yarn links.

I'll see if it's still an issue once this PR is merged.

@eladb eladb changed the title feat: CDKv2 support for Java App feat(java): CDKv2 support Jan 2, 2022
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Outdated Show resolved Hide resolved
@msessa msessa requested a review from eladb January 2, 2022 11:30
src/awscdk/awscdk-deps-js.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps-java.ts Outdated Show resolved Hide resolved
src/awscdk/awscdk-deps.ts Show resolved Hide resolved
@msessa msessa requested a review from eladb January 2, 2022 13:12
@mergify mergify bot merged commit 1020d0a into projen:main Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java CDK App doesn't support CDKv2
3 participants