mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Split maven dependencies into dev vs local (#20549)
Closes #20549
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/20549 from protocolbuffers:maven-split a8b30b4f96
PiperOrigin-RevId: 733361548
This commit is contained in:
parent
716d062d4c
commit
e045fc60cf
10 changed files with 1462 additions and 1175 deletions
11
.github/workflows/test_bazel.yml
vendored
11
.github/workflows/test_bazel.yml
vendored
|
|
@ -39,6 +39,17 @@ jobs:
|
|||
with:
|
||||
ref: ${{ inputs.safe-checkout }}
|
||||
|
||||
# rules_jvm_external doesn't support Java 8, which is the default version
|
||||
# on some github runners. When this is selected, it results in some
|
||||
# opaque errors about coursier (see
|
||||
# https://github.com/bazel-contrib/rules_jvm_external/issues/1337).
|
||||
- name: Pin to Java 11
|
||||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
|
||||
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
|
||||
- name: Windows startup flags
|
||||
if: ${{ runner.os == 'Windows' && (!matrix.continuous-only || inputs.continuous-run) }}
|
||||
working-directory: examples
|
||||
|
|
|
|||
28
MODULE.bazel
28
MODULE.bazel
|
|
@ -92,16 +92,11 @@ crate.spec(
|
|||
crate.from_specs()
|
||||
use_repo(crate, crate_index = "crates")
|
||||
|
||||
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
|
||||
maven.install(
|
||||
protobuf_maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
|
||||
protobuf_maven.install(
|
||||
name = "protobuf_maven",
|
||||
artifacts = [
|
||||
"com.google.caliper:caliper:1.0-beta-3",
|
||||
"com.google.code.findbugs:jsr305:3.0.2",
|
||||
"com.google.code.gson:gson:2.8.9",
|
||||
"com.google.errorprone:error_prone_annotations:2.5.1",
|
||||
"com.google.j2objc:j2objc-annotations:2.8",
|
||||
"com.google.guava:guava:32.0.1-jre",
|
||||
"com.google.guava:guava-testlib:32.0.1-jre",
|
||||
"com.google.testparameterinjector:test-parameter-injector:1.18",
|
||||
"com.google.truth:truth:1.1.2",
|
||||
|
|
@ -115,7 +110,24 @@ maven.install(
|
|||
"https://repo.maven.apache.org/maven2",
|
||||
],
|
||||
)
|
||||
use_repo(maven, "protobuf_maven")
|
||||
use_repo(protobuf_maven, "protobuf_maven")
|
||||
|
||||
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
|
||||
maven.install(
|
||||
name = "maven",
|
||||
artifacts = [
|
||||
"com.google.code.findbugs:jsr305:3.0.2",
|
||||
"com.google.code.gson:gson:2.8.9",
|
||||
"com.google.errorprone:error_prone_annotations:2.5.1",
|
||||
"com.google.j2objc:j2objc-annotations:2.8",
|
||||
"com.google.guava:guava:32.0.1-jre",
|
||||
],
|
||||
repositories = [
|
||||
"https://repo1.maven.org/maven2",
|
||||
"https://repo.maven.apache.org/maven2",
|
||||
],
|
||||
)
|
||||
use_repo(maven, "maven")
|
||||
|
||||
# Development dependencies
|
||||
bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True)
|
||||
|
|
|
|||
30
WORKSPACE
30
WORKSPACE
|
|
@ -65,7 +65,7 @@ rules_jvm_external_setup()
|
|||
load("@rules_jvm_external//:defs.bzl", "maven_install")
|
||||
|
||||
maven_install(
|
||||
name = "protobuf_maven",
|
||||
name = "maven",
|
||||
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
|
||||
# For updating instructions, see:
|
||||
# https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
|
||||
|
|
@ -76,10 +76,34 @@ maven_install(
|
|||
],
|
||||
)
|
||||
|
||||
load("@protobuf_maven//:defs.bzl", "pinned_maven_install")
|
||||
|
||||
load("@maven//:defs.bzl", "pinned_maven_install")
|
||||
pinned_maven_install()
|
||||
|
||||
maven_install(
|
||||
name = "protobuf_maven",
|
||||
artifacts = [
|
||||
"com.google.caliper:caliper:1.0-beta-3",
|
||||
"com.google.guava:guava-testlib:32.0.1-jre",
|
||||
"com.google.testparameterinjector:test-parameter-injector:1.18",
|
||||
"com.google.truth:truth:1.1.2",
|
||||
"junit:junit:4.13.2",
|
||||
"org.mockito:mockito-core:4.3.1",
|
||||
"biz.aQute.bnd:biz.aQute.bndlib:6.4.0",
|
||||
"info.picocli:picocli:4.6.3",
|
||||
],
|
||||
# For updating instructions, see:
|
||||
# https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
|
||||
maven_install_json = "//:maven_dev_install.json",
|
||||
repositories = [
|
||||
"https://repo1.maven.org/maven2",
|
||||
"https://repo.maven.apache.org/maven2",
|
||||
],
|
||||
)
|
||||
|
||||
load("@protobuf_maven//:defs.bzl", pinned_protobuf_maven_install = "pinned_maven_install")
|
||||
pinned_protobuf_maven_install()
|
||||
|
||||
|
||||
# For `cc_proto_blacklist_test` and `build_test`.
|
||||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
// See README.md for information and build instructions.
|
||||
|
||||
import com.example.tutorial.protos.AddressBook;
|
||||
import com.example.tutorial.protos.Person;
|
||||
import com.google.protobuf.util.Timestamps;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
|
||||
class AddPerson {
|
||||
|
|
@ -51,6 +51,7 @@ class AddPerson {
|
|||
}
|
||||
|
||||
person.addPhones(phoneNumber);
|
||||
person.setLastUpdated(Timestamps.now());
|
||||
}
|
||||
|
||||
return person.build();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,10 @@ java_binary(
|
|||
name = "add_person_java",
|
||||
srcs = ["AddPerson.java"],
|
||||
main_class = "AddPerson",
|
||||
deps = [":addressbook_java_proto"],
|
||||
deps = [
|
||||
":addressbook_java_proto",
|
||||
"@com_google_protobuf//java/util",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
|
|
@ -112,7 +115,10 @@ java_binary(
|
|||
name = "add_person_java_lite",
|
||||
srcs = ["AddPerson.java"],
|
||||
main_class = "AddPerson",
|
||||
deps = [":addressbook_java_lite_proto"],
|
||||
deps = [
|
||||
":addressbook_java_lite_proto",
|
||||
"@com_google_protobuf//java/util",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ http_archive(
|
|||
],
|
||||
)
|
||||
|
||||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
|
||||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps", "PROTOBUF_MAVEN_ARTIFACTS")
|
||||
|
||||
protobuf_deps()
|
||||
|
||||
|
|
@ -59,3 +59,19 @@ load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolch
|
|||
rules_cc_dependencies()
|
||||
|
||||
rules_cc_toolchains()
|
||||
|
||||
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
|
||||
rules_jvm_external_deps()
|
||||
|
||||
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
|
||||
rules_jvm_external_setup()
|
||||
|
||||
load("@rules_jvm_external//:defs.bzl", "maven_install")
|
||||
maven_install(
|
||||
name = "maven",
|
||||
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
|
||||
repositories = [
|
||||
"https://repo1.maven.org/maven2",
|
||||
"https://repo.maven.apache.org/maven2",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ java_library(
|
|||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//java/core",
|
||||
"@protobuf_maven//:com_google_code_findbugs_jsr305",
|
||||
"@protobuf_maven//:com_google_code_gson_gson",
|
||||
"@protobuf_maven//:com_google_errorprone_error_prone_annotations",
|
||||
"@protobuf_maven//:com_google_guava_guava",
|
||||
"@protobuf_maven//:com_google_j2objc_j2objc_annotations",
|
||||
"@maven//:com_google_code_findbugs_jsr305",
|
||||
"@maven//:com_google_code_gson_gson",
|
||||
"@maven//:com_google_errorprone_error_prone_annotations",
|
||||
"@maven//:com_google_guava_guava",
|
||||
"@maven//:com_google_j2objc_j2objc_annotations",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
1364
maven_dev_install.json
Normal file
1364
maven_dev_install.json
Normal file
File diff suppressed because it is too large
Load diff
1153
maven_install.json
1153
maven_install.json
File diff suppressed because it is too large
Load diff
|
|
@ -35,19 +35,11 @@ load("//python/dist:python_downloads.bzl", "python_nuget_package", "python_sourc
|
|||
load("//python/dist:system_python.bzl", "system_python")
|
||||
|
||||
PROTOBUF_MAVEN_ARTIFACTS = [
|
||||
"com.google.caliper:caliper:1.0-beta-3",
|
||||
"com.google.code.findbugs:jsr305:3.0.2",
|
||||
"com.google.code.gson:gson:2.8.9",
|
||||
"com.google.errorprone:error_prone_annotations:2.5.1",
|
||||
"com.google.j2objc:j2objc-annotations:2.8",
|
||||
"com.google.guava:guava:32.0.1-jre",
|
||||
"com.google.guava:guava-testlib:32.0.1-jre",
|
||||
"com.google.testparameterinjector:test-parameter-injector:1.18",
|
||||
"com.google.truth:truth:1.1.2",
|
||||
"junit:junit:4.13.2",
|
||||
"org.mockito:mockito-core:4.3.1",
|
||||
"biz.aQute.bnd:biz.aQute.bndlib:6.4.0",
|
||||
"info.picocli:picocli:4.6.3",
|
||||
]
|
||||
|
||||
def _github_archive(repo, commit, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue