Skip to content

Commit

Permalink
Add bzlmod and rules_jvm_external
Browse files Browse the repository at this point in the history
  • Loading branch information
guw committed Jan 7, 2025
1 parent 59c57ba commit f5ea6ff
Show file tree
Hide file tree
Showing 10 changed files with 340 additions and 64 deletions.
File renamed without changes.
36 changes: 30 additions & 6 deletions bundles/testdata/workspaces/002/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
module(
name = "testdata_workspaces_002",
)

bazel_dep(name = "rules_java", version = "8.6.3")
bazel_dep(name = "rules_jvm_external", version = "6.6")

maven_deps = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven_deps.artifact(
testonly = True,
artifact = "junit",
group = "junit",
version = "4.13.2",
)
maven_deps.install(
name = "maven_deps",
artifacts = [
"com.google.guava:guava:33.4.0-jre",
"junit:junit:4.13.2",
"org.apache.commons:commons-lang3:jar:3.17.0",
],
fail_if_repin_required = True,
fetch_sources = True,
generate_compat_repositories = False,
lock_file = "@//:maven_install.json",
resolver = "maven",
strict_visibility = True,
version_conflict_policy = "pinned",
)
use_repo(maven_deps, "maven_deps")
27 changes: 0 additions & 27 deletions bundles/testdata/workspaces/002/WORKSPACE

This file was deleted.

243 changes: 243 additions & 0 deletions bundles/testdata/workspaces/002/maven_install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": -772885195,
"__RESOLVED_ARTIFACTS_HASH": -1746335676,
"artifacts": {
"com.google.code.findbugs:jsr305": {
"shasums": {
"jar": "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7",
"sources": "1c9e85e272d0708c6a591dc74828c71603053b48cc75ae83cce56912a2aa063b"
},
"version": "3.0.2"
},
"com.google.errorprone:error_prone_annotations": {
"shasums": {
"jar": "77440e270b0bc9a249903c5a076c36a722c4886ca4f42675f2903a1c53ed61a5",
"sources": "7e117e0931cb2cb4226372af336189b49edb79969d120ec958a6df0beacb0612"
},
"version": "2.36.0"
},
"com.google.guava:failureaccess": {
"shasums": {
"jar": "8a8f81cf9b359e3f6dfa691a1e776985c061ef2f223c9b2c80753e1b458e8064",
"sources": "dd3bfa5e2ec5bc5397efb2c3cef044c192313ff77089573667ff97a60c6978e0"
},
"version": "1.0.2"
},
"com.google.guava:guava": {
"shasums": {
"jar": "b918c98a7e44dbe94ebd9fe3e40cddaadb5a93e6a78eb6008b42df237241e538",
"sources": "55ef6603b6ab1f6e3ae810b127561650ed682eb5f3fb50a212a658a74087b457"
},
"version": "33.4.0-jre"
},
"com.google.guava:listenablefuture": {
"shasums": {
"jar": "b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99"
},
"version": "9999.0-empty-to-avoid-conflict-with-guava"
},
"com.google.j2objc:j2objc-annotations": {
"shasums": {
"jar": "88241573467ddca44ffd4d74aa04c2bbfd11bf7c17e0c342c94c9de7a70a7c64",
"sources": "bd60019a0423c3a025ef6ab24fe0761f5f45ffb48a8cca74a01b678de1105d38"
},
"version": "3.0.0"
},
"junit:junit": {
"shasums": {
"jar": "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3",
"sources": "34181df6482d40ea4c046b063cb53c7ffae94bdf1b1d62695bdf3adf9dea7e3a"
},
"version": "4.13.2"
},
"org.apache.commons:commons-lang3": {
"shasums": {
"jar": "6ee731df5c8e5a2976a1ca023b6bb320ea8d3539fbe64c8a1d5cb765127c33b4",
"sources": "5fdcac21ad329766054a95367d7583dfcdca737d221d5e01a5f2a198c04c6b18"
},
"version": "3.17.0"
},
"org.checkerframework:checker-qual": {
"shasums": {
"jar": "3fbc2e98f05854c3df16df9abaa955b91b15b3ecac33623208ed6424640ef0f6",
"sources": "d6bdee58964cd05aabfca4e44947d3cbdada6bf617ed618b62b3b0d5a21de339"
},
"version": "3.43.0"
},
"org.hamcrest:hamcrest-core": {
"shasums": {
"jar": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9",
"sources": "e223d2d8fbafd66057a8848cc94222d63c3cedd652cc48eddc0ab5c39c0f84df"
},
"version": "1.3"
}
},
"dependencies": {
"com.google.guava:guava": [
"com.google.code.findbugs:jsr305",
"com.google.errorprone:error_prone_annotations",
"com.google.guava:failureaccess",
"com.google.guava:listenablefuture",
"com.google.j2objc:j2objc-annotations",
"org.checkerframework:checker-qual"
],
"junit:junit": [
"org.hamcrest:hamcrest-core"
]
},
"packages": {
"com.google.code.findbugs:jsr305": [
"javax.annotation",
"javax.annotation.concurrent",
"javax.annotation.meta"
],
"com.google.errorprone:error_prone_annotations": [
"com.google.errorprone.annotations",
"com.google.errorprone.annotations.concurrent"
],
"com.google.guava:failureaccess": [
"com.google.common.util.concurrent.internal"
],
"com.google.guava:guava": [
"com.google.common.annotations",
"com.google.common.base",
"com.google.common.base.internal",
"com.google.common.cache",
"com.google.common.collect",
"com.google.common.escape",
"com.google.common.eventbus",
"com.google.common.graph",
"com.google.common.hash",
"com.google.common.html",
"com.google.common.io",
"com.google.common.math",
"com.google.common.net",
"com.google.common.primitives",
"com.google.common.reflect",
"com.google.common.util.concurrent",
"com.google.common.xml",
"com.google.thirdparty.publicsuffix"
],
"com.google.j2objc:j2objc-annotations": [
"com.google.j2objc.annotations"
],
"junit:junit": [
"junit.extensions",
"junit.framework",
"junit.runner",
"junit.textui",
"org.junit",
"org.junit.experimental",
"org.junit.experimental.categories",
"org.junit.experimental.max",
"org.junit.experimental.results",
"org.junit.experimental.runners",
"org.junit.experimental.theories",
"org.junit.experimental.theories.internal",
"org.junit.experimental.theories.suppliers",
"org.junit.function",
"org.junit.internal",
"org.junit.internal.builders",
"org.junit.internal.management",
"org.junit.internal.matchers",
"org.junit.internal.requests",
"org.junit.internal.runners",
"org.junit.internal.runners.model",
"org.junit.internal.runners.rules",
"org.junit.internal.runners.statements",
"org.junit.matchers",
"org.junit.rules",
"org.junit.runner",
"org.junit.runner.manipulation",
"org.junit.runner.notification",
"org.junit.runners",
"org.junit.runners.model",
"org.junit.runners.parameterized",
"org.junit.validator"
],
"org.apache.commons:commons-lang3": [
"org.apache.commons.lang3",
"org.apache.commons.lang3.arch",
"org.apache.commons.lang3.builder",
"org.apache.commons.lang3.compare",
"org.apache.commons.lang3.concurrent",
"org.apache.commons.lang3.concurrent.locks",
"org.apache.commons.lang3.event",
"org.apache.commons.lang3.exception",
"org.apache.commons.lang3.function",
"org.apache.commons.lang3.math",
"org.apache.commons.lang3.mutable",
"org.apache.commons.lang3.reflect",
"org.apache.commons.lang3.stream",
"org.apache.commons.lang3.text",
"org.apache.commons.lang3.text.translate",
"org.apache.commons.lang3.time",
"org.apache.commons.lang3.tuple",
"org.apache.commons.lang3.util"
],
"org.checkerframework:checker-qual": [
"org.checkerframework.checker.builder.qual",
"org.checkerframework.checker.calledmethods.qual",
"org.checkerframework.checker.compilermsgs.qual",
"org.checkerframework.checker.fenum.qual",
"org.checkerframework.checker.formatter.qual",
"org.checkerframework.checker.guieffect.qual",
"org.checkerframework.checker.i18n.qual",
"org.checkerframework.checker.i18nformatter.qual",
"org.checkerframework.checker.index.qual",
"org.checkerframework.checker.initialization.qual",
"org.checkerframework.checker.interning.qual",
"org.checkerframework.checker.lock.qual",
"org.checkerframework.checker.mustcall.qual",
"org.checkerframework.checker.nullness.qual",
"org.checkerframework.checker.optional.qual",
"org.checkerframework.checker.propkey.qual",
"org.checkerframework.checker.regex.qual",
"org.checkerframework.checker.signature.qual",
"org.checkerframework.checker.signedness.qual",
"org.checkerframework.checker.tainting.qual",
"org.checkerframework.checker.units.qual",
"org.checkerframework.common.aliasing.qual",
"org.checkerframework.common.initializedfields.qual",
"org.checkerframework.common.reflection.qual",
"org.checkerframework.common.returnsreceiver.qual",
"org.checkerframework.common.subtyping.qual",
"org.checkerframework.common.util.count.report.qual",
"org.checkerframework.common.value.qual",
"org.checkerframework.dataflow.qual",
"org.checkerframework.framework.qual"
],
"org.hamcrest:hamcrest-core": [
"org.hamcrest",
"org.hamcrest.core",
"org.hamcrest.internal"
]
},
"repositories": {
"https://repo1.maven.org/maven2/": [
"com.google.code.findbugs:jsr305",
"com.google.code.findbugs:jsr305:jar:sources",
"com.google.errorprone:error_prone_annotations",
"com.google.errorprone:error_prone_annotations:jar:sources",
"com.google.guava:failureaccess",
"com.google.guava:failureaccess:jar:sources",
"com.google.guava:guava",
"com.google.guava:guava:jar:sources",
"com.google.guava:listenablefuture",
"com.google.j2objc:j2objc-annotations",
"com.google.j2objc:j2objc-annotations:jar:sources",
"junit:junit",
"junit:junit:jar:sources",
"org.apache.commons:commons-lang3",
"org.apache.commons:commons-lang3:jar:sources",
"org.checkerframework:checker-qual",
"org.checkerframework:checker-qual:jar:sources",
"org.hamcrest:hamcrest-core",
"org.hamcrest:hamcrest-core:jar:sources"
]
},
"services": {},
"skipped": [],
"version": "2"
}
21 changes: 21 additions & 0 deletions bundles/testdata/workspaces/002/module2/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@rules_java//java:defs.bzl", "java_library")

java_library (
name = "module2",
srcs = glob(["java/src/**/*.java"]),
visibility = ["//module1:__pkg__"],
deps = [
"//module3",
"@maven_deps//:org_apache_commons_commons_lang3"
]
)

java_test(
name = "module2-test",
srcs = ["java/test/library/GreetingTest.java"],
test_class = "library.GreetingTest",
deps = [
"module2",
"@maven_deps//:junit_junit",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package library;

import log.Logger;

public class Greeting {

public String greet(String name) {
Logger.logDebug("Greeting.greet");
return "Hello ".concat(name);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package library;

import org.junit.Assert;
import org.junit.Test;

public class GreetingTest {
@Test
public void testGreet() {
Assert.assertEquals("Hello JUnit", new Greeting().greet("JUnit"));
}
}
7 changes: 7 additions & 0 deletions bundles/testdata/workspaces/002/module3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("@rules_java//java:defs.bzl", "java_library")

java_library (
name = "module3",
srcs = glob(["java/src/**/*.java"]),
visibility = ["//module1:__pkg__", "//module2:__pkg__"]
)
16 changes: 16 additions & 0 deletions bundles/testdata/workspaces/002/module3/java/src/log/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package log;

import java.time.Instant;

public final class Logger {

private Logger() {
throw new RuntimeException();
}

public static void logDebug(String message) {
String output = String.format("[DEBUG] %s", message);
System.out.println(output);
}

}
Loading

0 comments on commit f5ea6ff

Please sign in to comment.