Skip to content

Support pom-only dependencies#99

Merged
jin merged 9 commits into
masterfrom
pom-only
Apr 15, 2019
Merged

Support pom-only dependencies#99
jin merged 9 commits into
masterfrom
pom-only

Conversation

@jin

@jin jin commented Apr 5, 2019

Copy link
Copy Markdown
Collaborator

Fixes #98

Add a whitelist of artifacts that are "aggregators", that is, they only have a POM file and no jar.

If Coursier tells us that a particular artifact doesn't have a file, we generate a java_library instead, and re-export its deps.

Comment thread coursier.bzl
# The list of java_import/aar_import declaration strings to be joined at the end
all_imports = []

# A mapping of FQN to the artifact's sha256 checksum

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drive-by removal of the checksumming code

Comment thread coursier.bzl Outdated
# Iterate through the list of artifacts, and generate the target declaration strings.
for artifact in dep_tree["dependencies"]:
artifact_path = artifact["file"]
target_label = _escape(_strip_packaging_classifier(artifact["coord"]))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

instead of using the artifact path as the key to dedupe target generation, we use the target label as the key, since it's canonical and unique anyway

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@bazel-contrib bazel-contrib deleted a comment from googlebot Apr 8, 2019
@googlebot googlebot added cla: yes and removed cla: no labels Apr 8, 2019
@bazel-contrib bazel-contrib deleted a comment from googlebot Apr 8, 2019
@bazel-contrib bazel-contrib deleted a comment from googlebot Apr 8, 2019
@jin jin added this to the 2.0 milestone Apr 10, 2019
Comment thread coursier.bzl Outdated
Comment thread coursier.bzl
Comment thread private/special_artifacts.bzl
Comment thread coursier.bzl Outdated
@jin jin merged commit bcb1a49 into master Apr 15, 2019
@jin jin deleted the pom-only branch April 17, 2019 13:35
mattnworb added a commit to mattnworb/rules_jvm_external that referenced this pull request Aug 1, 2024
closes bazel-contrib#1206

Maven interprets a `<dependency>` (not in the `<dependencyManagement>`
section) with `type=pom` as adding all of those artifact's dependencies
(direct and transitive) to the current module's list of dependencies.

This commit modifies RJE to replicate that behavior, so that any
artifact which is directly referenced in `maven_install()` also has all
of its true transitive dependencies imported/installed into the Bazel
workspace.

The fix here is to append `pom` to the list of types passed to
coursier's `--artifact-types` flag so that it properly fetches/resolves
the type=pom artifact, and to append a condition to the if-else branch
meant to support direct dependencies with type=pom in `maven_install()`
(see bazel-contrib#99) to handle a transitive dependency on type=pom as well.
mattnworb added a commit to mattnworb/rules_jvm_external that referenced this pull request Aug 1, 2024
closes bazel-contrib#1206

Maven interprets a `<dependency>` (not in the `<dependencyManagement>`
section) with `type=pom` as adding all of those artifact's dependencies
(direct and transitive) to the current module's list of dependencies.

This commit modifies RJE to replicate that behavior, so that any
artifact which is directly referenced in `maven_install()` also has all
of its true transitive dependencies imported/installed into the Bazel
workspace.

The fix here is to append `pom` to the list of types passed to
coursier's `--artifact-types` flag so that it properly fetches/resolves
the type=pom artifact, and to append a condition to the if-else branch
meant to support direct dependencies with type=pom in `maven_install()`
(see bazel-contrib#99) to handle a transitive dependency on type=pom as well.
mattnworb added a commit to mattnworb/rules_jvm_external that referenced this pull request Aug 1, 2024
closes bazel-contrib#1206

Maven interprets a `<dependency>` (not in the `<dependencyManagement>`
section) with `type=pom` as adding all of those artifact's dependencies
(direct and transitive) to the current module's list of dependencies.

This commit modifies RJE to replicate that behavior, so that any
artifact which is directly referenced in `maven_install()` also has all
of its true transitive dependencies imported/installed into the Bazel
workspace.

The fix here is to append `pom` to the list of types passed to
coursier's `--artifact-types` flag so that it properly fetches/resolves
the type=pom artifact, and to append a condition to the if-else branch
meant to support direct dependencies with type=pom in `maven_install()`
(see bazel-contrib#99) to handle a transitive dependency on type=pom as well.
shs96c pushed a commit that referenced this pull request Aug 27, 2024
closes #1206

Maven interprets a `<dependency>` (not in the `<dependencyManagement>`
section) with `type=pom` as adding all of those artifact's dependencies
(direct and transitive) to the current module's list of dependencies.

This commit modifies RJE to replicate that behavior, so that any
artifact which is directly referenced in `maven_install()` also has all
of its true transitive dependencies imported/installed into the Bazel
workspace.

The fix here is to append `pom` to the list of types passed to
coursier's `--artifact-types` flag so that it properly fetches/resolves
the type=pom artifact, and to append a condition to the if-else branch
meant to support direct dependencies with type=pom in `maven_install()`
(see #99) to handle a transitive dependency on type=pom as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Special handling needed for pom-only dependencies

3 participants