Skip to content

Adding the graphql-dgs-codegen-client-core module#174

Merged
berngp merged 1 commit intomasterfrom
feature/client-utils-module
Jun 30, 2021
Merged

Adding the graphql-dgs-codegen-client-core module#174
berngp merged 1 commit intomasterfrom
feature/client-utils-module

Conversation

@berngp
Copy link
Contributor

@berngp berngp commented Jun 24, 2021

What

This commit adds a new module, the graphql-dgs-codegen-client-core, that offers classes, and other artifacts, that complement the code generated by DGS Codegen.
The plugin, by default, will add the artifact automatically to the implementation scope.

As a Developer

As a Developer you will be able to leverage the graphql-dgs-codegen-client-core.
Optionally you have the option to disable the inclusion of such dependency by setting the codegen.clientCoreConventionsEnabled flag to false as follows.

codegen.clientCoreConventionsEnabled = true

or

codegen {
    clientCoreConventionsEnabled = true
}

@berngp berngp marked this pull request as draft June 24, 2021 17:35
@paulbakker
Copy link
Collaborator

THis needs a better name - these classes aren't utils, they are API classes that the generated code depends on. If you don't have these classes, it won't compile right?

And shouldn't this be on by default if client generation is enabled?

@paulbakker
Copy link
Collaborator

The PR also seems to include a bunch of reformatting :(

@berngp
Copy link
Contributor Author

berngp commented Jun 24, 2021

The PR also seems to include a bunch of reformatting :(

I did had to refactor the build.gradle files. The root build.gradle now shares configuration across the modules. I'm failing to see pure reformatting changes. Could you help me identify them so I can remove them.

@berngp
Copy link
Contributor Author

berngp commented Jun 24, 2021

THis needs a better name - these classes aren't utils, they are API classes that the generated code depends on. If you don't have these classes, it won't compile right?

And shouldn't this be on by default if client generation is enabled?

I agree that names are not ideal, probably we could use graphql-dgs-codegen-client-core instead. I also agree that folks will always need to use the module. Will flip to always on.

}
}

// fun apply(project: Project, optionalCodeUtilsVersion: Optional<String> = Optional.empty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Planning on removing this. The example that is commented intended to only add the dependency of the module if the it was not explicitly present.


private val pluginProperties: Optional<Properties> = try {
val props = Properties()
props.load(this.javaClass.classLoader.getResourceAsStream("META-INF/graphql-dgs-codegen-core.properties"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this?

Copy link
Contributor Author

@berngp berngp Jun 25, 2021

Choose a reason for hiding this comment

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

In order to add the dependency to the client-core module I need to infer its version. To do so I'm reading the build information, as provided by the nebula.info plugin of a dependency that I know its included by the plugin, in this case the graphql-dgs-codegen-core module.

berngp added a commit to Netflix/dgs-framework that referenced this pull request Jun 25, 2021
@berngp berngp changed the title Adding a graphql-dgs-codegen-client-utils Adding the graphql-dgs-codegen-client-core module Jun 25, 2021
@berngp berngp force-pushed the feature/client-utils-module branch from 8fa4f38 to 642e471 Compare June 25, 2021 07:11
@berngp
Copy link
Contributor Author

berngp commented Jun 25, 2021

Steps to follow...

  1. Release the DGS Framework 4.3.0-rc.6 or a later version.
  2. Merge this PR.
  3. Finish migrating the codgen code out of the DGS Framework by merging this other PR.

What
====

This commit adds a new module, the `graphql-dgs-codegen-client-core`, that offers classes, and other artifacts, that complement the code generated by _DGS Codegen_.
The plugin, by default, will add the artifact automatically to the _implementation_ scope.

As a Developer
=============

As a Developer you will be able to leverage the `graphql-dgs-codegen-client-core`.
Optionally you have the option to disable  the inclusion of such dependency by setting
the `codegen.clientCoreConventionsEnabled` flag to `false` as follows.

```
codegen.clientCoreConventionsEnabled = true
```

or

```
codegen {
    clientCoreConventionsEnabled = true
}
```
@berngp berngp force-pushed the feature/client-utils-module branch from 642e471 to 4cf3426 Compare June 30, 2021 19:18
@berngp berngp marked this pull request as ready for review June 30, 2021 19:22
@berngp berngp requested a review from paulbakker June 30, 2021 19:26
@berngp berngp merged commit fd44704 into master Jun 30, 2021
@berngp berngp deleted the feature/client-utils-module branch June 30, 2021 19:48
berngp added a commit to Netflix/dgs-framework that referenced this pull request Jul 1, 2021
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.

2 participants