Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modules/objectweb_asm/9.8/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = "objectweb_asm",
version = "9.8",
bazel_compatibility = [">=7.2.1"],
compatibility_level = 1,
)

bazel_dep(name = "rules_java", version = "8.16.1")
1 change: 1 addition & 0 deletions modules/objectweb_asm/9.8/overlay/MODULE.bazel
13 changes: 13 additions & 0 deletions modules/objectweb_asm/9.8/overlay/asm-analysis/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@rules_java//java:java_library.bzl", "java_library")

java_library(
name = "asm-analysis",
srcs = glob([
"src/main/java/org/objectweb/asm/**/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//asm",
"//asm-tree",
],
)
13 changes: 13 additions & 0 deletions modules/objectweb_asm/9.8/overlay/asm-commons/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@rules_java//java:java_library.bzl", "java_library")

java_library(
name = "asm-commons",
srcs = glob([
"src/main/java/org/objectweb/asm/**/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//asm",
"//asm-tree",
],
)
10 changes: 10 additions & 0 deletions modules/objectweb_asm/9.8/overlay/asm-tree/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@rules_java//java:java_library.bzl", "java_library")

java_library(
name = "asm-tree",
srcs = glob([
"src/main/java/org/objectweb/asm/**/*.java",
]),
visibility = ["//visibility:public"],
deps = ["//asm"],
)
14 changes: 14 additions & 0 deletions modules/objectweb_asm/9.8/overlay/asm-util/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@rules_java//java:java_library.bzl", "java_library")

java_library(
name = "asm-util",
srcs = glob([
"src/main/java/org/objectweb/asm/**/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//asm",
"//asm-analysis",
"//asm-tree",
],
)
9 changes: 9 additions & 0 deletions modules/objectweb_asm/9.8/overlay/asm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("@rules_java//java:java_library.bzl", "java_library")

java_library(
name = "asm",
srcs = glob([
"src/main/java/org/objectweb/asm/**/*.java",
]),
visibility = ["//visibility:public"],
)
20 changes: 20 additions & 0 deletions modules/objectweb_asm/9.8/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
matrix:
platform:
- debian11
- ubuntu2204
- macos
- macos_arm64
- windows
bazel:
- 8.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- '@objectweb_asm//asm'
- '@objectweb_asm//asm-analysis'
- '@objectweb_asm//asm-commons'
- '@objectweb_asm//asm-tree'
- '@objectweb_asm//asm-util'
13 changes: 13 additions & 0 deletions modules/objectweb_asm/9.8/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"url": "https://gitlab.ow2.org/asm/asm/-/archive/ASM_9_8/asm-ASM_9_8.tar.gz",
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I remember the archives generated by gitlab's archive endpoint change regularly depending on which CDN node you hit, which makes them unsuitable as BCR sources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does that also apply to non-gitlab.com instances?

If this URL won't work for BCR, and since mirroring it on the Bazel archive mirror also isn't allowed by BCR rules, how.would you recommend I proceed? Other options:

  • I copy this archive to my personal GitHub,
  • I use Maven-hosted source archives, resulting in six BCR packages for this project (one per build target)
  • Ask upstream for non-Maven source archive hosting

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know. We've had reliability issues with ARM's instance, but no checksum issues as far as I remember.

We are working on setting up an automated mirror which should make this much easier. You could also open a manual mirror request issue on the Bazel repo.

We should probably also formulate a clear vision/policy for simple Java modules in the BCR. If we add just a few, we may be risking one version violations if folks also consume Maven artifacts, perhaps unknowingly as transitive deps.

If we plan to add a significant portion of what's available on Maven, it would probably be better to start up a separate Java registry. In fact, such a registry could potentially be smart instead of static, fetching source archives from Maven, generating BUILD files based on the pom.xml on the fly and persistently caching the result so that it's guaranteed to be immutable. This could be a pretty efficient way to get Java source builds to work for real projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that the Bazel mirror can't be used for BCR source archives, see #2821 and the discussion it links to (cc @meteorcloudy).

If we can assume that gitlab.ow2.org doesn't have the same CDN-related reproducibility issues as gitlab.com, then it doesn't seem any worse than other sources of dynamically generated tarballs. Obviously a proper stable source archive would be better, but if that isn't available then this seems like the next best thing.

A project to automatically generate a BCR-compatible package registry from language-specific upstream hosting (e.g. Maven) sounds like it would have a lot of interesting work involved but I think I'd prefer a more conventional approach, even if the per-package toil is slightly higher.

Copy link
Member

Choose a reason for hiding this comment

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

In fact, such a registry could potentially be smart instead of static, fetching source archives from Maven, generating BUILD files based on the pom.xml on the fly and persistently caching the result

Isn't that rules_jvm_external? @jmillikin Why do we need this dependency as a bazel module?

Copy link
Member

Choose a reason for hiding this comment

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

OK, let me add some context here:

Bazel already depends on rules_jvm_external to pull in most of its java dependencies as prebuilt jars, this is the standard integration with Maven in Bazel. It offers two advantages: 1) No need to hand craft BUILD files 2) automatically resolve transitive dependencies (you don't need to worry about fetching asm when using chicory compiler). Of course, the con is that those are not built from sources, like @fmeum said, maybe we could work on rules_jvm_external to make that possible.

But at this point, I don't want to add another way to introduce java dependencies in Bazel. Previously I thought a Bazel module for Chicory was fine because it had no other java dependencies. Now that we do need it, I don't think this is a rabbit hole we should go into (what if there are more in future, we already had to patch chicory). If we do this, 1) there are extra maintenance burden for the community, 2) Such dependencies could be duplicated (asm already introduced via rules_jvm_external) and end up in the Bazel Java server deploy java, and may cause issues if there are version confilcts.

My suggestion is to use rules_jvm_external for all Java dependencies, and hopefully we could add build from source mode in rules_jvm_external and I would be more than happy to switch to it.

Copy link
Member

Choose a reason for hiding this comment

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

Here is the PR bazelbuild/bazel#27186, you should be able to add "com.dylibso.chicory:compiler:1.5.2" pretty easily

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll look into what it takes to add source build capabilities to RJE. Avoiding one version violations is the primary reason for having a single source of truth, which in the case of Java has undisputably become RJE. Since it resolves source jars alongside binary jars, it would even allow you to gradually migrate over.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for updating the Bazel build to match the new expectations around Java dependencies.

Should I keep this PR open, or close it?

If Bazel projects should use rules_java_external instead of bazel_dep for Java dependencies, should I consider existing Java BCR packages (e.g. chicory, javacc, javaparser) to be effectively orphaned? If so, I can send a follow-up PR to clear their maintainers lists.

Copy link
Member

Choose a reason for hiding this comment

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

If so, I can send a follow-up PR to clear their maintainers lists.

Yeah, I think that makes sense to me.

"strip_prefix": "asm-ASM_9_8",
"integrity": "sha256-42ahU83/PDhmLpxRsJkGxR+Gz1gcRpymp1MotmOIplM=",
"overlay": {
"MODULE.bazel": "sha256-r9d1lmdyyNclCTsseADV2UPXQdOGcBVVsS4y416Qmzk=",
"asm/BUILD.bazel": "sha256-Y62jUjFc6OYMATS0frNha2TSq9/3H/FPWD2GlnUacQE=",
"asm-analysis/BUILD.bazel": "sha256-E6J5qngotEWfQ1yLyhJ9NGO3Kv/NIT9L9ijjlr9Z8fs=",
"asm-commons/BUILD.bazel": "sha256-NKyeC98FHH6PWFRdTU1domk9oi4Huliy+VLA75iP6oU=",
"asm-tree/BUILD.bazel": "sha256-5Mn3RNCgl96Kn51CqGioPQqWooHfKxl35VCBKZUgO1I=",
"asm-util/BUILD.bazel": "sha256-B+3gZnwLPujb7WyvtgBbrlg7AZY/UHWlYS0GJ/YRczs="
}
}
18 changes: 18 additions & 0 deletions modules/objectweb_asm/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"homepage": "https://asm.ow2.io/",
"maintainers": [
{
"email": "[email protected]",
"github": "jmillikin",
"github_user_id": 646128,
"name": "John Millikin"
}
],
"repository": [
"https://gitlab.ow2.org/asm/asm"
],
"versions": [
"9.8"
],
"yanked_versions": {}
}
Loading