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

Support Java code generation from WSDL files #14545

Merged
merged 11 commits into from
Mar 4, 2022

Conversation

alonsodomin
Copy link
Contributor

@alonsodomin alonsodomin commented Feb 21, 2022

This closes #14523. Still pending for the changes needed to support codegen in compiled languages but the rules for triggering the generation and orchestration of the jvm process that generate the final code shouldn't change much.

This is just a minimal implementation as there could additional enhancements done later (meaning, adding support for more features or customisations).

In the other hand, I'm slightly doubtful of the usability of the module feature (i.e. generate a module-info.java file): An scenario in which I see them useful is for cases in which a team/company has developed some SOAP services and uses the WSDL of those services to generate client SDKs that then publishes or shares to other parties. Not too sure if others find this as too niche.

A clear future enhancement to this PR would be to add support for loading XSD files too. Would it be a reasonable approach to have a xsd_sources target as well?

@alonsodomin alonsodomin marked this pull request as ready for review February 21, 2022 20:09
@stuhood
Copy link
Member

stuhood commented Feb 28, 2022

Sorry for the delayed review here! Actually consuming this one will be blocked by #14258, which is on my plate for (hopefully) next week. I'll make sure to loop back around on it then.

@stuhood stuhood self-requested a review February 28, 2022 21:55
@stuhood
Copy link
Member

stuhood commented Mar 3, 2022

Sorry for the continued delay here! @Eric-Arellano is going to be picking up the codegen investigation. Have also requested a review from @tdyas, who has experience in this area.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

This seems landable, but I'll leave it up to @Eric-Arellano and @tdyas to decide whether to enable shipping it in the binary now (same question as #14407 basically).

src/python/pants/backend/codegen/soap/java/extra_fields.py Outdated Show resolved Hide resolved
src/python/pants/backend/codegen/soap/java/jaxws.py Outdated Show resolved Hide resolved
src/python/pants/backend/codegen/soap/java/rules.py Outdated Show resolved Hide resolved


class WsdlSourceTarget(Target):
alias = "wsdl_source"
Copy link
Member

Choose a reason for hiding this comment

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

Are the semantics of wsdl such that it always makes sense to compile file-at-a-time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does as in a way each WSDL has a targetNamespace attribute which could be different or that you may be interested in overriding using the jvm_package / jvm_module fields.

Also when having a few WSDL files in the same folder and those WSDLs have embedded XSDs with names that may colide. Treating them individually helps removing class name collisions as at the moment can not guarantee those XSDs are defining the same types (could probably be added later but this was a first go at it).

src/python/pants/backend/codegen/soap/java/register.py Outdated Show resolved Hide resolved
@alonsodomin
Copy link
Contributor Author

I removed the register.py file after reading the conversation in #14407, a follow up PR can be made later to include the SOAP codegen when that one gets merged.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

@stuhood stuhood merged commit fbbfce0 into pantsbuild:main Mar 4, 2022
@stuhood stuhood mentioned this pull request Mar 14, 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.

Add support for generating Java sources from WSDL definitions
2 participants