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

Add various default options #9

Merged
merged 5 commits into from
Jan 29, 2023

Conversation

xsalefter
Copy link
Contributor

Attempt to fix: killbill/killbill-plugin-framework-java#82

  • Instead of exec-maven-plugin, create maven plugin, or separated script, I decided to give api-pojos more options and default value.
  • For example, If in your current directory, you have:
    • pojogen.jar
    • killbill-api project
    • killbill-plugin-framework-java project
      Then calling java -jar pojogen.jar will generate all interfaces classes in killbill-api to boilerplate subpackage in killbill-plugin-framework-java.
  • See README.md file more explanation and options.

Copy link
Member

@sbrossie sbrossie left a comment

Choose a reason for hiding this comment

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

I like the approach. I did not have time to really try it out but it looks good.

That being said, while enhancing the tool makes a lot of sense, I think we should still at point invest into a GH workflow so we can simply press a button and get that generated.

README.md Outdated Show resolved Hide resolved
@sbrossie
Copy link
Member

@xsalefter I merged the PR, but I think we should do a second pass:

  1. There are 2 different set of instructions, the one in the 'README' and the one under the doc. I think we should merge those 2 as this gets confusing. Either keep a top level README that points to more detailed instructions under doc, or remove the doc altogether.

  2. Regarding the setting.xml. I would suggest to check-in a version that works. Even better, if we could generate it - but if too much work, let's not do it. It needs to have all the packages acceptedPackages inside. I had created my own version at the time by grepping from all package name under api. I had gotten the following:

<?xml version="1.0" encoding="UTF-8"?>
<Settings>
  <sourceDirectories>
    <sourceDirectory>input/project/src/main/java</sourceDirectory>
  </sourceDirectories>
  <dependencyDirectories>
    <dependencyDirectory>input/lib</dependencyDirectory>
  </dependencyDirectories>
  <outputSubpackage>boilerplate</outputSubpackage>
  <outputClassPrefix></outputClassPrefix>
  <outputClassSuffix>Imp</outputClassSuffix>
  <outputDirectory>output/project/src/main/java</outputDirectory>
  <resourceDirectory>output/project/src/main/resources</resourceDirectory>
  <testDirectory>output/project/src/test/java</testDirectory>
  <acceptedPackages>
  </acceptedPackages>
    <package>org.killbill.billing.tenant</package>
    <package>org.killbill.billing.tenant.api</package>
    <package>org.killbill.billing.util</package>
    <package>org.killbill.billing.util.customfield</package>
    <package>org.killbill.billing.util.nodes</package>
    <package>org.killbill.billing.util.entity</package>
    <package>org.killbill.billing.util.audit</package>
    <package>org.killbill.billing.util.queue</package>
    <package>org.killbill.billing.util.callcontext</package>
    <package>org.killbill.billing.util.api</package>
    <package>org.killbill.billing.util.tag</package>
    <package>org.killbill.billing.security</package>
    <package>org.killbill.billing.security.api</package>
    <package>org.killbill.billing.payment</package>
    <package>org.killbill.billing.payment.plugin</package>
    <package>org.killbill.billing.payment.plugin.api</package>
    <package>org.killbill.billing.payment.api</package>
    <package>org.killbill.billing.catalog</package>
    <package>org.killbill.billing.catalog.api</package>
    <package>org.killbill.billing.catalog.api.rules</package>
    <package>org.killbill.billing.osgi</package>
    <package>org.killbill.billing.osgi.api</package>
    <package>org.killbill.billing.osgi.api.config</package>
    <package>org.killbill.billing.usage</package>
    <package>org.killbill.billing.usage.api</package>
    <package>org.killbill.billing.account</package>
    <package>org.killbill.billing.account.api</package>
    <package>org.killbill.billing.entitlement</package>
    <package>org.killbill.billing.entitlement.api</package>
    <package>org.killbill.billing.currency</package>
    <package>org.killbill.billing.currency.api</package>
    <package>org.killbill.billing.overdue</package>
    <package>org.killbill.billing.overdue.api</package>
    <package>org.killbill.billing.invoice</package>
    <package>org.killbill.billing.invoice.api</package>
    <package>org.killbill.billing.invoice.api.formatters</package>
  <acceptedInterfaces>
  </acceptedInterfaces>
  <comparableTypes>
    <type>org.joda.time.DateTime</type>
  </comparableTypes>
  <builderClass>Builder</builderClass>
  <resolverClass>Resolver</resolverClass>
  <moduleClass>Module</moduleClass>
</Settings>

To summarize, we should end up with one clear set of instructions to follow, and if we need additional files (e.g setting.xml), they should either be checked-in or even better generated by a tool - same or different tool.

@xsalefter
Copy link
Contributor Author

@sbrossie reviving old discussion. Sorry I just replied now:

  1. Yeah, I'll try to clean up documentation.

I would suggest to check-in a version that works

This src/main/resources/settings.xml is working and valid settings.xml file. It is a default settings.xml if user not specify any settings.xml file when generating, for example: java -jar pojogen.jar. It has small different with your version, for example:

yours: <sourceDirectory>input/project/src/main/java</sourceDirectory>.
checked in: <sourceDirectory>./killbill-api/src/main/java</sourceDirectory>

I need to changes input to ./killbill-api so that users don't have to set anything. Of course I need to make an assumption that user with work with this project structure:

    .
    ├── pojogen.jar
    ├── killbill-api                      # project root directory
    ├── killbill-plugin-framework-java    # project root directory

.... It needs to have all the packages acceptedPackages inside

It has the same accepted packages with yours.

@sbrossie
Copy link
Member

Looping Reshma, as she has a task to use the tool, so it will be great to see if the instructions are clear or not. @reshmabidikar Could you catch up on this discussion and work with Resa to improve the instructions. The goal is that when we need to use it, we don't have to think much... just follow the instructions.

@reshmabidikar
Copy link
Contributor

The current instructions are helpful and I was able to generate the POJOs without much effort.

However, I'm listing some areas of improvement here:

  1. Move Build instructions to the top of the Readme
  2. The Usage section can be restructured to something like this: https://github.com/killbill/killbill-ee/wiki/Support-tools#usage-1.
  3. Is example really required? If not, maybe it can be removed

@xsalefter xsalefter deleted the add_various_default_options branch May 2, 2023 02:57
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.

automate killbill-api implementation generation
3 participants