diff options
author | zhangskz <sandyzhang@google.com> | 2024-04-05 11:50:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 11:50:46 -0400 |
commit | a0fb46544555bc42ed018fe93bc0fe0cffb2f3a7 (patch) | |
tree | 86322932eecd92d421ba49bbc92ad8d58b3b4684 | |
parent | a857c8e1f411db66fb34d6dc3c76e3f7c952d526 (diff) | |
parent | 6b1c2535dcc3be1c514ad400756c5a7aca7645f0 (diff) | |
download | protobuf-upstream-25.x.tar.gz |
Merge pull request #16388 from protocolbuffers/cp-manifest-jpmsupstream-25.x
Cherry-Pick Add Automatic-Module-Name (#14562)
-rw-r--r-- | .github/workflows/test_cpp.yml | 9 | ||||
-rw-r--r-- | .github/workflows/test_php.yml | 3 | ||||
-rw-r--r-- | build_defs/java_opts.bzl | 5 | ||||
-rw-r--r-- | java/core/BUILD.bazel | 2 | ||||
-rw-r--r-- | java/osgi/OsgiWrapper.java | 6 | ||||
-rw-r--r-- | java/osgi/osgi.bzl | 4 | ||||
-rw-r--r-- | java/util/BUILD.bazel | 1 |
7 files changed, 24 insertions, 6 deletions
diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 087b1ea81..83a1c2fcb 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -346,10 +346,11 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: include: - - name: MacOS CMake - os: macos-12 - flags: -DCMAKE_CXX_STANDARD=14 - cache-prefix: macos-cmake + # TODO: investigate and fix + # - name: MacOS CMake + # os: macos-12 + # flags: -DCMAKE_CXX_STANDARD=14 + # cache-prefix: macos-cmake - name: Windows CMake os: windows-2022 flags: >- diff --git a/.github/workflows/test_php.yml b/.github/workflows/test_php.yml index 391442d8a..d6ab3b5d5 100644 --- a/.github/workflows/test_php.yml +++ b/.github/workflows/test_php.yml @@ -151,7 +151,6 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: version: ['8.2'] - name: MacOS PHP ${{ matrix.version }} runs-on: macos-12 steps: @@ -167,7 +166,7 @@ jobs: run: brew install coreutils gd - name: Pin PHP version - uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # 2.26.0 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # 2.30.0 with: php-version: ${{ matrix.version }} diff --git a/build_defs/java_opts.bzl b/build_defs/java_opts.bzl index e9c04074e..2da4e5f6d 100644 --- a/build_defs/java_opts.bzl +++ b/build_defs/java_opts.bzl @@ -27,6 +27,7 @@ def protobuf_java_library(**kwargs): ) def protobuf_versioned_java_library( + automatic_module_name, bundle_description, bundle_name, bundle_symbolic_name, @@ -44,6 +45,9 @@ def protobuf_versioned_java_library( Args: bundle_description: (required) The Bundle-Description header defines a short description of this bundle. + automatic_module_name: (required) The Automatic-Module-Name header that represents + the name of the module when this bundle is used as an automatic + module. bundle_name: (required) The Bundle-Name header defines a readable name for this bundle. This should be a short, human-readable name that can contain spaces. @@ -65,6 +69,7 @@ def protobuf_versioned_java_library( """ osgi_java_library( javacopts = JAVA_OPTS, + automatic_module_name = automatic_module_name, bundle_doc_url = BUNDLE_DOC_URL, bundle_license = BUNDLE_LICENSE, bundle_version = PROTOBUF_JAVA_VERSION, diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index 70fe8faa2..b896c426b 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -136,6 +136,7 @@ protobuf_versioned_java_library( srcs = LITE_SRCS + [ ":gen_well_known_protos_javalite", ], + automatic_module_name = "com.google.protobuf", bundle_description = "Lite version of Protocol Buffers library. This " + "version is optimized for code size, but does not " + "guarantee API/ABI stability.", @@ -217,6 +218,7 @@ protobuf_versioned_java_library( ) + [ ":gen_well_known_protos_java", ], + automatic_module_name = "com.google.protobuf", bundle_description = "Core Protocol Buffers library. Protocol Buffers " + "are a way of encoding structured data in an " + "efficient yet extensible format.", diff --git a/java/osgi/OsgiWrapper.java b/java/osgi/OsgiWrapper.java index e917ae60f..c0690eb94 100644 --- a/java/osgi/OsgiWrapper.java +++ b/java/osgi/OsgiWrapper.java @@ -56,6 +56,11 @@ public final class OsgiWrapper implements Callable<Integer> { private String classpath; @Option( + names = {"--automatic_module_name"}, + description = "The automatic module name of the bundle") + private String automaticModuleName; + + @Option( names = {"--bundle_copyright"}, description = "Copyright string for the bundle") private String bundleCopyright; @@ -106,6 +111,7 @@ public final class OsgiWrapper implements Callable<Integer> { Analyzer analyzer = new Analyzer(); analyzer.setJar(bin); + analyzer.setProperty(Analyzer.AUTOMATIC_MODULE_NAME, automaticModuleName); analyzer.setProperty(Analyzer.BUNDLE_NAME, bundleName); analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, bundleSymbolicName); analyzer.setProperty(Analyzer.BUNDLE_VERSION, bundleVersion); diff --git a/java/osgi/osgi.bzl b/java/osgi/osgi.bzl index 40ee0842a..68600b5d7 100644 --- a/java/osgi/osgi.bzl +++ b/java/osgi/osgi.bzl @@ -23,6 +23,7 @@ load("@rules_java//java:defs.bzl", "java_library") # which is probably sub-optimal. def osgi_java_library( name, + automatic_module_name, bundle_description, bundle_doc_url, bundle_license, @@ -119,6 +120,7 @@ def osgi_java_library( # Repackage the jar with an OSGI manifest _osgi_jar( name = name, + automatic_module_name = automatic_module_name, bundle_description = bundle_description, bundle_doc_url = bundle_doc_url, bundle_license = bundle_license, @@ -141,6 +143,7 @@ def _run_osgi_wrapper(ctx, input_jar, classpath_jars, output_jar): args.add_joined("--classpath", classpath_jars, join_with = ":") args.add("--input_jar", input_jar.path) args.add("--output_jar", output_jar.path) + args.add("--automatic_module_name", ctx.attr.automatic_module_name) args.add("--bundle_copyright", ctx.attr.bundle_copyright) args.add("--bundle_description", ctx.attr.bundle_description) args.add("--bundle_doc_url", ctx.attr.bundle_doc_url) @@ -215,6 +218,7 @@ _osgi_jar = rule( "output_jar": "lib%{name}.jar", }, attrs = { + "automatic_module_name": attr.string(), "bundle_copyright": attr.string(), "bundle_description": attr.string(), "bundle_doc_url": attr.string(), diff --git a/java/util/BUILD.bazel b/java/util/BUILD.bazel index c6ab799a5..c8b9e7669 100644 --- a/java/util/BUILD.bazel +++ b/java/util/BUILD.bazel @@ -26,6 +26,7 @@ protobuf_versioned_java_library( srcs = glob([ "src/main/java/com/google/protobuf/util/*.java", ]), + automatic_module_name = "com.google.protobuf.util", bundle_description = "Utilities for Protocol Buffers", bundle_name = "Protocol Buffers [Util]", bundle_symbolic_name = "com.google.protobuf.util", |