You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/06/02 07:09:53 UTC
[GitHub] [incubator-gobblin] mockitoguy opened a new pull request #3022: Correct handling of 'special' dependencies in poms
mockitoguy opened a new pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022
Dependencies declared with target configurations need extra work to get them correctly mapped to pom files. Pom files are lossy when compared to Gradle or Ivy model of dependencies.
Added 'all' module that enables customers to declare a single dependency and get all directly consumable Gobblin artifacts.
Tested by running './gradlew publishToMavenLocal' and inspecting the build output and the generated pom files.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] vikrambohra commented on a change in pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
vikrambohra commented on a change in pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#discussion_r434060264
##########
File path: gradle/scripts/bintrayPublishing.gradle
##########
@@ -52,6 +52,42 @@ subprojects{
artifact javadocJar
pom pomAttributes
+
+ pom.withXml {
+ //Ensures that correct dependencies are in the pom when subproject declares a project dependency
+ // with specific target configuration (restClient, dataTemplate, etc.)
+ //Needed because pom model is lossy and does not carry the 'configuration' information
+ def dependenciesNode = it.asNode().dependencies[0]
+ def removed = [] as Set; def added = [] //helps auditing
+ configurations.runtime.allDependencies.each { d ->
+ def confToPom = ['restClient': 'rest-client', 'dataTemplate': 'data-template']
+ if (d instanceof ProjectDependency && confToPom.containsKey(d.targetConfiguration)) {
+ boolean dependsOnMainModule = configurations.runtime.allDependencies.any {
+ it.name == d.name && it.targetConfiguration == 'default'
+ }
+ if (!dependsOnMainModule) {
+ //subproject declares a dependency on target configuration (i.e. path: 'gobblin-rest-api', configuration: 'restClient')
+ // but does not declare a dependency on the 'default' artifact (i.e. 'gobblin-rest-api')
+ //we need to remove the 'default' artifact from the pom file
+ def mainModuleNode = dependenciesNode.find { it.artifactId.text() == d.name }
+ dependenciesNode.remove(mainModuleNode)
+ removed.add(d.name)
+ }
+
+ //adding explicit dependency on the artifact that corresponds to given target configuration
+ // (i.e. 'gobblin-rest-api-rest-client')
+ def dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('groupId', d.group)
+ def newArtifactId = d.name + "-" + confToPom[d.targetConfiguration]
+ dependencyNode.appendNode('artifactId', newArtifactId)
+ dependencyNode.appendNode('version', d.version)
+ added.add(newArtifactId)
+ }
+ }
+ if (added || removed) {
+ logger.lifecycle("Updated pom dependencies in {}, added: {}, removed: {}", project.path, added, removed)
+ }
+ }
Review comment:
Based on spot check. Looks like the dependency exclusion rules are only applied to the newly created (gobblin-rest-api-rest-client etc) dependencies in the POM. But does the initial POM have the dependency exclusion rules as well?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] codecov-commenter commented on pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#issuecomment-637754452
# [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=h1) Report
> Merging [#3022](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/93f9a817ff9cc259734eec81e4cb7408aab8cc98&el=desc) will **increase** coverage by `36.44%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #3022 +/- ##
=============================================
+ Coverage 9.28% 45.72% +36.44%
- Complexity 1695 9293 +7598
=============================================
Files 1951 1951
Lines 74222 74241 +19
Branches 8213 8215 +2
=============================================
+ Hits 6888 33948 +27060
+ Misses 66659 37118 -29541
- Partials 675 3175 +2500
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [.../org/apache/gobblin/writer/AvroHdfsDataWriter.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3dyaXRlci9BdnJvSGRmc0RhdGFXcml0ZXIuamF2YQ==) | `77.77% <0.00%> (ø)` | `5.00% <0.00%> (+1.00%)` | |
| [...gobblin/service/monitoring/JobStatusRetriever.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NlcnZpY2UvbW9uaXRvcmluZy9Kb2JTdGF0dXNSZXRyaWV2ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `2.00% <0.00%> (+2.00%)` | |
| [...gobblin/azkaban/AzkabanGobblinYarnAppLauncher.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1tb2R1bGVzL2dvYmJsaW4tYXprYWJhbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ29iYmxpbi9hemthYmFuL0F6a2FiYW5Hb2JibGluWWFybkFwcExhdW5jaGVyLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [...ata/management/copy/hive/HivePartitionFileSet.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvaGl2ZS9IaXZlUGFydGl0aW9uRmlsZVNldC5qYXZh) | `0.94% <0.00%> (+0.94%)` | `1.00% <0.00%> (+1.00%)` | |
| [...ain/java/org/apache/gobblin/runtime/TaskState.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvVGFza1N0YXRlLmphdmE=) | `81.97% <0.00%> (+1.16%)` | `32.00% <0.00%> (ø%)` | |
| [...pache/gobblin/runtime/GobblinMultiTaskAttempt.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvR29iYmxpbk11bHRpVGFza0F0dGVtcHQuamF2YQ==) | `57.32% <0.00%> (+1.25%)` | `28.00% <0.00%> (+2.00%)` | |
| [...in/java/org/apache/gobblin/util/FileListUtils.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi11dGlsaXR5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3V0aWwvRmlsZUxpc3RVdGlscy5qYXZh) | `71.42% <0.00%> (+1.29%)` | `28.00% <0.00%> (ø%)` | |
| [...in/source/extractor/extract/kafka/KafkaSource.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1tb2R1bGVzL2dvYmJsaW4ta2Fma2EtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NvdXJjZS9leHRyYWN0b3IvZXh0cmFjdC9rYWZrYS9LYWZrYVNvdXJjZS5qYXZh) | `1.34% <0.00%> (+1.34%)` | `1.00% <0.00%> (+1.00%)` | |
| [...ava/org/apache/gobblin/runtime/MultiConverter.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvTXVsdGlDb252ZXJ0ZXIuamF2YQ==) | `83.60% <0.00%> (+1.63%)` | `9.00% <0.00%> (+1.00%)` | |
| [...rg/apache/gobblin/runtime/FsDatasetStateStore.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvRnNEYXRhc2V0U3RhdGVTdG9yZS5qYXZh) | `73.80% <0.00%> (+1.78%)` | `35.00% <0.00%> (+1.00%)` | |
| ... and [1022 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=footer). Last update [93f9a81...7acce32](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] codecov-commenter edited a comment on pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#issuecomment-637754452
# [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=h1) Report
> Merging [#3022](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/93f9a817ff9cc259734eec81e4cb7408aab8cc98&el=desc) will **increase** coverage by `36.44%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #3022 +/- ##
=============================================
+ Coverage 9.28% 45.72% +36.44%
- Complexity 1695 9293 +7598
=============================================
Files 1951 1951
Lines 74222 74241 +19
Branches 8213 8215 +2
=============================================
+ Hits 6888 33948 +27060
+ Misses 66659 37118 -29541
- Partials 675 3175 +2500
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [.../org/apache/gobblin/writer/AvroHdfsDataWriter.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3dyaXRlci9BdnJvSGRmc0RhdGFXcml0ZXIuamF2YQ==) | `77.77% <0.00%> (ø)` | `5.00% <0.00%> (+1.00%)` | |
| [...gobblin/service/monitoring/JobStatusRetriever.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NlcnZpY2UvbW9uaXRvcmluZy9Kb2JTdGF0dXNSZXRyaWV2ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `2.00% <0.00%> (+2.00%)` | |
| [...gobblin/azkaban/AzkabanGobblinYarnAppLauncher.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1tb2R1bGVzL2dvYmJsaW4tYXprYWJhbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ29iYmxpbi9hemthYmFuL0F6a2FiYW5Hb2JibGluWWFybkFwcExhdW5jaGVyLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
| [...ata/management/copy/hive/HivePartitionFileSet.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvaGl2ZS9IaXZlUGFydGl0aW9uRmlsZVNldC5qYXZh) | `0.94% <0.00%> (+0.94%)` | `1.00% <0.00%> (+1.00%)` | |
| [...ain/java/org/apache/gobblin/runtime/TaskState.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvVGFza1N0YXRlLmphdmE=) | `81.97% <0.00%> (+1.16%)` | `32.00% <0.00%> (ø%)` | |
| [...pache/gobblin/runtime/GobblinMultiTaskAttempt.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvR29iYmxpbk11bHRpVGFza0F0dGVtcHQuamF2YQ==) | `57.32% <0.00%> (+1.25%)` | `28.00% <0.00%> (+2.00%)` | |
| [...in/java/org/apache/gobblin/util/FileListUtils.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi11dGlsaXR5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3V0aWwvRmlsZUxpc3RVdGlscy5qYXZh) | `71.42% <0.00%> (+1.29%)` | `28.00% <0.00%> (ø%)` | |
| [...in/source/extractor/extract/kafka/KafkaSource.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1tb2R1bGVzL2dvYmJsaW4ta2Fma2EtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3NvdXJjZS9leHRyYWN0b3IvZXh0cmFjdC9rYWZrYS9LYWZrYVNvdXJjZS5qYXZh) | `1.34% <0.00%> (+1.34%)` | `1.00% <0.00%> (+1.00%)` | |
| [...ava/org/apache/gobblin/runtime/MultiConverter.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvTXVsdGlDb252ZXJ0ZXIuamF2YQ==) | `83.60% <0.00%> (+1.63%)` | `9.00% <0.00%> (+1.00%)` | |
| [...rg/apache/gobblin/runtime/FsDatasetStateStore.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvRnNEYXRhc2V0U3RhdGVTdG9yZS5qYXZh) | `73.80% <0.00%> (+1.78%)` | `35.00% <0.00%> (+1.00%)` | |
| ... and [1022 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3022/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=footer). Last update [93f9a81...7acce32](https://codecov.io/gh/apache/incubator-gobblin/pull/3022?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] mockitoguy commented on a change in pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
mockitoguy commented on a change in pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#discussion_r434077864
##########
File path: gradle/scripts/bintrayPublishing.gradle
##########
@@ -52,6 +52,42 @@ subprojects{
artifact javadocJar
pom pomAttributes
+
+ pom.withXml {
+ //Ensures that correct dependencies are in the pom when subproject declares a project dependency
+ // with specific target configuration (restClient, dataTemplate, etc.)
+ //Needed because pom model is lossy and does not carry the 'configuration' information
+ def dependenciesNode = it.asNode().dependencies[0]
+ def removed = [] as Set; def added = [] //helps auditing
+ configurations.runtime.allDependencies.each { d ->
+ def confToPom = ['restClient': 'rest-client', 'dataTemplate': 'data-template']
+ if (d instanceof ProjectDependency && confToPom.containsKey(d.targetConfiguration)) {
+ boolean dependsOnMainModule = configurations.runtime.allDependencies.any {
+ it.name == d.name && it.targetConfiguration == 'default'
+ }
+ if (!dependsOnMainModule) {
+ //subproject declares a dependency on target configuration (i.e. path: 'gobblin-rest-api', configuration: 'restClient')
+ // but does not declare a dependency on the 'default' artifact (i.e. 'gobblin-rest-api')
+ //we need to remove the 'default' artifact from the pom file
+ def mainModuleNode = dependenciesNode.find { it.artifactId.text() == d.name }
+ dependenciesNode.remove(mainModuleNode)
+ removed.add(d.name)
+ }
+
+ //adding explicit dependency on the artifact that corresponds to given target configuration
+ // (i.e. 'gobblin-rest-api-rest-client')
+ def dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('groupId', d.group)
+ def newArtifactId = d.name + "-" + confToPom[d.targetConfiguration]
+ dependencyNode.appendNode('artifactId', newArtifactId)
+ dependencyNode.appendNode('version', d.version)
+ added.add(newArtifactId)
+ }
+ }
+ if (added || removed) {
+ logger.lifecycle("Updated pom dependencies in {}, added: {}, removed: {}", project.path, added, removed)
+ }
+ }
Review comment:
They are applied to all dependencies: https://gist.github.com/mockitoguy/662dc4d0f444ee082c3ccc65d9526f35
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] mockitoguy closed pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
mockitoguy closed pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] vikrambohra commented on a change in pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
vikrambohra commented on a change in pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#discussion_r434000422
##########
File path: gobblin-all/build.gradle
##########
@@ -0,0 +1,12 @@
+description = """Artifact that depends on all other, directly consumable artifacts.
+Useful for resolving all Gobblin dependencies that customers need."""
+
+apply plugin: "java"
+
+dependencies {
+ //TODO: list all dependencies that are directly consumable
+ compile project(":gobblin-api")
+ compile project(":gobblin-rest-service:gobblin-rest-api")
+ compile project(path: ':gobblin-rest-service:gobblin-rest-api', configuration: 'restClient')
+ compile project(path: ':gobblin-rest-service:gobblin-rest-api', configuration: 'dataTemplate')
+}
Review comment:
Please add all gobblin modules provided on slack
##########
File path: gradle/scripts/bintrayPublishing.gradle
##########
@@ -52,6 +52,42 @@ subprojects{
artifact javadocJar
pom pomAttributes
+
+ pom.withXml {
+ //Ensures that correct dependencies are in the pom when subproject declares a project dependency
+ // with specific target configuration (restClient, dataTemplate, etc.)
+ //Needed because pom model is lossy and does not carry the 'configuration' information
+ def dependenciesNode = it.asNode().dependencies[0]
+ def removed = [] as Set; def added = [] //helps auditing
+ configurations.runtime.allDependencies.each { d ->
+ def confToPom = ['restClient': 'rest-client', 'dataTemplate': 'data-template']
+ if (d instanceof ProjectDependency && confToPom.containsKey(d.targetConfiguration)) {
+ boolean dependsOnMainModule = configurations.runtime.allDependencies.any {
+ it.name == d.name && it.targetConfiguration == 'default'
+ }
+ if (!dependsOnMainModule) {
+ //subproject declares a dependency on target configuration (i.e. path: 'gobblin-rest-api', configuration: 'restClient')
+ // but does not declare a dependency on the 'default' artifact (i.e. 'gobblin-rest-api')
+ //we need to remove the 'default' artifact from the pom file
+ def mainModuleNode = dependenciesNode.find { it.artifactId.text() == d.name }
+ dependenciesNode.remove(mainModuleNode)
+ removed.add(d.name)
+ }
+
+ //adding explicit dependency on the artifact that corresponds to given target configuration
+ // (i.e. 'gobblin-rest-api-rest-client')
+ def dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('groupId', d.group)
+ def newArtifactId = d.name + "-" + confToPom[d.targetConfiguration]
+ dependencyNode.appendNode('artifactId', newArtifactId)
+ dependencyNode.appendNode('version', d.version)
+ added.add(newArtifactId)
+ }
+ }
+ if (added || removed) {
+ logger.lifecycle("Updated pom dependencies in {}, added: {}, removed: {}", project.path, added, removed)
+ }
+ }
Review comment:
Thanks for this. It looks clean. Can you verify if the generated pom also adds global dependency exclusions? (scripts/gradle/globalDependencies.gradle)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] mockitoguy commented on pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
mockitoguy commented on pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#issuecomment-637636580
Travis CI failure is due to test flakiness.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-gobblin] vikrambohra commented on a change in pull request #3022: Correct handling of 'special' dependencies in poms
Posted by GitBox <gi...@apache.org>.
vikrambohra commented on a change in pull request #3022:
URL: https://github.com/apache/incubator-gobblin/pull/3022#discussion_r434103000
##########
File path: gradle/scripts/bintrayPublishing.gradle
##########
@@ -52,6 +52,42 @@ subprojects{
artifact javadocJar
pom pomAttributes
+
+ pom.withXml {
+ //Ensures that correct dependencies are in the pom when subproject declares a project dependency
+ // with specific target configuration (restClient, dataTemplate, etc.)
+ //Needed because pom model is lossy and does not carry the 'configuration' information
+ def dependenciesNode = it.asNode().dependencies[0]
+ def removed = [] as Set; def added = [] //helps auditing
+ configurations.runtime.allDependencies.each { d ->
+ def confToPom = ['restClient': 'rest-client', 'dataTemplate': 'data-template']
+ if (d instanceof ProjectDependency && confToPom.containsKey(d.targetConfiguration)) {
+ boolean dependsOnMainModule = configurations.runtime.allDependencies.any {
+ it.name == d.name && it.targetConfiguration == 'default'
+ }
+ if (!dependsOnMainModule) {
+ //subproject declares a dependency on target configuration (i.e. path: 'gobblin-rest-api', configuration: 'restClient')
+ // but does not declare a dependency on the 'default' artifact (i.e. 'gobblin-rest-api')
+ //we need to remove the 'default' artifact from the pom file
+ def mainModuleNode = dependenciesNode.find { it.artifactId.text() == d.name }
+ dependenciesNode.remove(mainModuleNode)
+ removed.add(d.name)
+ }
+
+ //adding explicit dependency on the artifact that corresponds to given target configuration
+ // (i.e. 'gobblin-rest-api-rest-client')
+ def dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('groupId', d.group)
+ def newArtifactId = d.name + "-" + confToPom[d.targetConfiguration]
+ dependencyNode.appendNode('artifactId', newArtifactId)
+ dependencyNode.appendNode('version', d.version)
+ added.add(newArtifactId)
+ }
+ }
+ if (added || removed) {
+ logger.lifecycle("Updated pom dependencies in {}, added: {}, removed: {}", project.path, added, removed)
+ }
+ }
Review comment:
+1 LGTM
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org