From 833edb6bb0ebf558dd00bebd616edd499da6d9d8 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 17 Dec 2025 15:21:51 -0700 Subject: [PATCH 1/8] Replace Node.js version header generator with C++ implementation Replaces the Node.js-based generate-version-header.js script with a C++ implementation to eliminate the Node.js runtime dependency from the build process. The new C++ tool reads package.json and generates the same version.h header file. Also fixes Closure Compiler errors under strict mode in extension_field_binary_info.js and map.js by properly assigning goog.requireType calls to const variables instead of using standalone goog.requireType calls. Changes: - Add generator/generate-version-header.cc with C++ implementation - Remove generate-version-header.js - Update generator/BUILD.bazel to use cc_binary instead of Node.js script - Add rules_cc dependency to MODULE.bazel - Update BUILD.bazel to remove deleted script from exports_files - Fix goog.requireType usage in extension_field_binary_info.js and map.js --- BUILD.bazel | 27 +++++----- MODULE.bazel | 3 +- extension_field_binary_info.js | 10 ++-- generate-version-header.js | 14 ----- generator/BUILD.bazel | 19 ++++--- generator/generate-version-header.cc | 79 ++++++++++++++++++++++++++++ map.js | 32 +++++------ 7 files changed, 127 insertions(+), 57 deletions(-) delete mode 100644 generate-version-header.js create mode 100644 generator/generate-version-header.cc diff --git a/BUILD.bazel b/BUILD.bazel index 6604d3a..7461adb 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -6,7 +6,7 @@ load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix") load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip") load("//:protobuf_javascript_release.bzl", "package_naming") -exports_files(["generate-version-header.js", "package.json"]) +exports_files(["package.json"]) config_setting( name = "x64_x86_windows", @@ -36,13 +36,13 @@ config_setting( package_naming( name = "protobuf_javascript_pkg_naming", platform = select({ - ":k8": "linux-x86_64", # currently the only supported build type in Github Actions + ":k8": "linux-x86_64", # currently the only supported build type in Github Actions ":x64_x86_windows": "win32", ":x64_windows": "win64", ":darwin_arm64": "osx-aarch_64", ":darwin_x86_64": "osx-x86_64", - "//conditions:default": "" # continues with current behavior when no --cpu is specified allowing existing internal builds to function - }) + "//conditions:default": "", # continues with current behavior when no --cpu is specified allowing existing internal builds to function + }), ) pkg_files( @@ -54,15 +54,18 @@ pkg_files( pkg_files( name = "dist_files", - srcs = glob([ - "google/protobuf/*.js", - "google/protobuf/compiler/*.js" - ], allow_empty = True) + [ - "google-protobuf.js", - "package.json", - "README.md", + srcs = glob( + [ + "google/protobuf/*.js", + "google/protobuf/compiler/*.js", + ], + allow_empty = True, + ) + [ "LICENSE.md", "LICENSE-asserts.md", + "README.md", + "google-protobuf.js", + "package.json", ], strip_prefix = strip_prefix.from_root(""), ) @@ -93,5 +96,5 @@ filegroup( srcs = [ ":dist_tar", ":dist_zip", - ] + ], ) diff --git a/MODULE.bazel b/MODULE.bazel index 2576f46..3acc005 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,5 +1,6 @@ module(name = "protobuf_javascript", version = "4.0.1") +bazel_dep(name = "abseil-cpp", version = "20250512.1") bazel_dep(name = "protobuf", version = "33.0", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_cc", version = "0.2.15") bazel_dep(name = "rules_pkg", version = "1.0.1") -bazel_dep(name = "abseil-cpp", version = "20250512.1") diff --git a/extension_field_binary_info.js b/extension_field_binary_info.js index 4f79100..e8adeb1 100644 --- a/extension_field_binary_info.js +++ b/extension_field_binary_info.js @@ -36,15 +36,15 @@ goog.module('jspb.ExtensionFieldBinaryInfo'); goog.module.declareLegacyNamespace(); const ExtensionFieldInfo = goog.require('jspb.ExtensionFieldInfo'); -goog.requireType('jspb.BinaryReader'); -goog.requireType('jspb.BinaryWriter'); +const BinaryReader = goog.requireType('jspb.BinaryReader'); +const BinaryWriter = goog.requireType('jspb.BinaryWriter'); /** * Stores binary-related information for a single extension field. * @param {!ExtensionFieldInfo} fieldInfo - * @param {function(this:jspb.BinaryReader,number,?,?)} binaryReaderFn - * @param {function(this:jspb.BinaryWriter,number,?) - * |function(this:jspb.BinaryWriter,number,?,?,?,?,?)} binaryWriterFn + * @param {function(this:BinaryReader,number,?,?)} binaryReaderFn + * @param {function(this:BinaryWriter,number,?) + * |function(this:BinaryWriter,number,?,?,?,?,?)} binaryWriterFn * @param {function(?,?)=} opt_binaryMessageSerializeFn * @param {function(?,?)=} opt_binaryMessageDeserializeFn * @param {boolean=} opt_isPacked diff --git a/generate-version-header.js b/generate-version-header.js deleted file mode 100644 index c21ca67..0000000 --- a/generate-version-header.js +++ /dev/null @@ -1,14 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -const version = require('./package.json').version; -const headerContent = `// Generated by generate-version-header.js -#ifndef PROTOBUF_JAVASCRIPT_VERSION_H__ -#define PROTOBUF_JAVASCRIPT_VERSION_H__ - -const char* const kProtobufJavascriptVersion = "${version}"; - -#endif // PROTOBUF_JAVASCRIPT_VERSION_H__ -`; - -fs.writeFileSync(process.argv[2], headerContent); diff --git a/generator/BUILD.bazel b/generator/BUILD.bazel index ac7756d..0c42d0f 100644 --- a/generator/BUILD.bazel +++ b/generator/BUILD.bazel @@ -1,9 +1,16 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary") + +cc_binary( + name = "generate-version-header", + srcs = ["generate-version-header.cc"], +) + genrule( name = "generate_version_header", srcs = ["//:package.json"], outs = ["version.h"], - cmd = "node $(location //:generate-version-header.js) $(OUTS)", - tools = ["//:generate-version-header.js"], + cmd = "$(location :generate-version-header) $(location //:package.json) $(OUTS)", + tools = [":generate-version-header"], ) cc_binary( @@ -18,15 +25,13 @@ cc_binary( ], visibility = ["//visibility:public"], deps = [ + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", "@com_google_protobuf//:protobuf", + "@com_google_protobuf//:protoc_lib", "@com_google_protobuf//src/google/protobuf/compiler:code_generator", "@com_google_protobuf//src/google/protobuf/io", "@com_google_protobuf//src/google/protobuf/io:printer", "@com_google_protobuf//src/google/protobuf/io:tokenizer", - "@com_google_protobuf//:protoc_lib", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", ], ) - - diff --git a/generator/generate-version-header.cc b/generator/generate-version-header.cc new file mode 100644 index 0000000..adca0da --- /dev/null +++ b/generator/generate-version-header.cc @@ -0,0 +1,79 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include + +std::string ReadPackageVersion(const std::string& package_json_path) { + std::ifstream file(package_json_path); + if (!file.is_open()) { + std::cerr << "Error: Could not open " << package_json_path << std::endl; + exit(1); + } + + std::stringstream buffer; + buffer << file.rdbuf(); + std::string content = buffer.str(); + + // Simple regex to extract version field from package.json + std::regex version_regex(R"#("version"\s*:\s*"([^"]+)")#"); + std::smatch match; + + if (std::regex_search(content, match, version_regex)) { + return match[1].str(); + } + + std::cerr << "Error: Could not find version in " << package_json_path + << std::endl; + exit(1); +} + +void GenerateHeaderFile(const std::string& output_path, + const std::string& version) { + std::ofstream file(output_path); + if (!file.is_open()) { + std::cerr << "Error: Could not write to " << output_path << std::endl; + exit(1); + } + + file << "// Generated by generate-version-header.cc\n" + << "#ifndef PROTOBUF_JAVASCRIPT_VERSION_H__\n" + << "#define PROTOBUF_JAVASCRIPT_VERSION_H__\n" + << "\n" + << "const char* const kProtobufJavascriptVersion = \"" << version + << "\";\n" + << "\n" + << "#endif // PROTOBUF_JAVASCRIPT_VERSION_H__\n"; +} + +int main(int argc, char* argv[]) { + if (argc != 3) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return 1; + } + + std::string package_json_path = argv[1]; + std::string output_path = argv[2]; + + std::string version = ReadPackageVersion(package_json_path); + GenerateHeaderFile(output_path, version); + + std::cout << "Generated " << output_path << " with version " << version + << std::endl; + + return 0; +} diff --git a/map.js b/map.js index e46087c..394d1d1 100644 --- a/map.js +++ b/map.js @@ -68,12 +68,8 @@ goog.module('jspb.Map'); goog.module.declareLegacyNamespace(); - const asserts = goog.require('jspb.asserts'); - -goog.requireType('jspb.BinaryReader'); -goog.requireType('jspb.BinaryWriter'); - +const BinaryReader = goog.requireType('jspb.BinaryReader'); /** @@ -268,13 +264,13 @@ const ArrayIteratorIterable_ = function (arr) { /** @override @final */ ArrayIteratorIterable_.prototype.next = function () { if (this.idx_ < this.arr_.length) { - return {done: false, value: this.arr_[this.idx_++]}; + return { done: false, value: this.arr_[this.idx_++] }; } else { - return {done: true, value: undefined}; + return { done: true, value: undefined }; } }; -if (typeof(Symbol) != 'undefined') { +if (typeof (Symbol) != 'undefined') { /** @override */ ArrayIteratorIterable_.prototype[Symbol.iterator] = function () { return this; @@ -488,17 +484,17 @@ Map.prototype.has = function (key) { * we should default it to 0. * @template K, V * @param {!Map} map - * @param {!jspb.BinaryReader} reader - * @param {function(this:jspb.BinaryReader):K} keyReaderFn + * @param {!BinaryReader} reader + * @param {function(this:BinaryReader):K} keyReaderFn * The method on BinaryReader that reads type K from the stream. * - * @param {function(this:jspb.BinaryReader):V| - * function(this:jspb.BinaryReader,V, - * function(V,!jspb.BinaryReader))} valueReaderFn + * @param {function(this:BinaryReader):V| + * function(this:BinaryReader,V, + * function(V,!BinaryReader))} valueReaderFn * The method on BinaryReader that reads type V from the stream. May be * readMessage, in which case the second callback arg form is used. * - * @param {?function(V,!jspb.BinaryReader)=} opt_valueReaderCallback + * @param {?function(V,!BinaryReader)=} opt_valueReaderCallback * The BinaryReader parsing callback for type V, if V is a message type * * @param {K=} opt_defaultKey @@ -514,8 +510,8 @@ Map.prototype.has = function (key) { * */ Map.deserializeBinary = function (map, reader, keyReaderFn, valueReaderFn, - opt_valueReaderCallback, opt_defaultKey, - opt_defaultValue) { + opt_valueReaderCallback, opt_defaultKey, + opt_defaultValue) { var key = opt_defaultKey; var value = opt_defaultValue; @@ -540,8 +536,8 @@ Map.deserializeBinary = function (map, reader, keyReaderFn, valueReaderFn, valueReaderFn.call(reader, value, opt_valueReaderCallback); } else { value = - (/** @type {function(this:jspb.BinaryReader):?} */ (valueReaderFn)) - .call(reader); + (/** @type {function(this:BinaryReader):?} */ (valueReaderFn)) + .call(reader); } } } From e19560faf2a8df4adb20df3f7793ec64bdb1134b Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 17 Dec 2025 17:57:12 -0700 Subject: [PATCH 2/8] Add BCR boilerplate --- .bcr/metadata.template.json | 20 +++ .bcr/presubmit.yml | 12 ++ .bcr/source.template.json | 5 + .github/workflows/publish.yaml | 36 ++++ .github/workflows/release.yaml | 35 ++++ .github/workflows/release_prep.sh | 28 +++ MODULE.bazel.lock | 115 +----------- e2e/bcr/.bazelrc | 1 + e2e/bcr/BUILD.bazel | 30 ++++ e2e/bcr/MODULE.bazel | 6 + e2e/bcr/MODULE.bazel.lock | 290 ++++++++++++++++++++++++++++++ e2e/bcr/README.md | 6 + e2e/bcr/simple.proto | 39 ++++ e2e/bcr/simple_js_test.sh | 5 + 14 files changed, 519 insertions(+), 109 deletions(-) create mode 100644 .bcr/metadata.template.json create mode 100644 .bcr/presubmit.yml create mode 100644 .bcr/source.template.json create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/release.yaml create mode 100755 .github/workflows/release_prep.sh create mode 100644 e2e/bcr/.bazelrc create mode 100644 e2e/bcr/BUILD.bazel create mode 100644 e2e/bcr/MODULE.bazel create mode 100644 e2e/bcr/MODULE.bazel.lock create mode 100644 e2e/bcr/README.md create mode 100644 e2e/bcr/simple.proto create mode 100755 e2e/bcr/simple_js_test.sh diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 0000000..5ba5cc4 --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,20 @@ +{ + "homepage": "https://github.com/protocolbuffers/protobuf-javascript", + "maintainers": [ + { + "name": "Stephanie DiBenedetto", + "email": "dibenede@google.com", + "github": "dibenede" + }, + { + "name": "Paul Cody", + "email": "pcj@stack.build", + "github": "pcj" + } + ], + "repository": [ + "github:protocolbuffers/protobuf-javascript" + ], + "versions": [], + "yanked_versions": {} +} \ No newline at end of file diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 0000000..9502a9e --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,12 @@ +bcr_test_module: + module_path: "e2e/bcr" + matrix: + platform: ["debian11", "ubuntu2404", "macos"] + bazel: [7.x, 8.x] + tasks: + run_tests: + name: "Run test module" + platform: ${{ platform }} + bazel: ${{ bazel }} + test_targets: + - "//..." diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 0000000..7dd7b58 --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{TAG}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz" +} \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..b010868 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,36 @@ +# Publish new releases to Bazel Central Registry. +name: Publish to BCR +on: + # Run the publish workflow after a successful release + # Will be triggered from the release.yaml workflow + workflow_call: + inputs: + tag_name: + required: true + type: string + secrets: + publish_token: + required: true + # In case of problems, let release engineers retry by manually dispatching + # the workflow from the GitHub UI + workflow_dispatch: + inputs: + tag_name: + description: git tag being released + required: true + type: string +jobs: + publish: + uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.2.3 + with: + draft: false + tag_name: ${{ inputs.tag_name }} + # GitHub repository which is a fork of the upstream where the Pull Request will be opened. + registry_fork: protocolbuffers/bazel-central-registry + permissions: + attestations: write + contents: write + id-token: write + secrets: + # Necessary to push to the BCR fork, and to open a pull request against a registry + publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c55d525 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +# Cut a release whenever a new tag is pushed to the repo. +name: Release +on: + # Can be triggered from the tag.yaml workflow + workflow_call: + inputs: + tag_name: + required: true + type: string + secrets: + publish_token: + required: true + # Or, developers can manually push a tag from their clone + push: + tags: + - "v*.*.*" +permissions: + id-token: write + attestations: write + contents: write +jobs: + release: + uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.3 + with: + prerelease: false + release_files: protobuf-javascript-*.tar.gz + tag_name: ${{ inputs.tag_name || github.ref_name }} + secrets: inherit + publish: + needs: release + uses: ./.github/workflows/publish.yaml + with: + tag_name: ${{ inputs.tag_name || github.ref_name }} + secrets: + publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh new file mode 100755 index 0000000..0abe321 --- /dev/null +++ b/.github/workflows/release_prep.sh @@ -0,0 +1,28 @@ + +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +# Set by GH actions, see +# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables +readonly TAG=$1 +# The prefix is chosen to match what GitHub generates for source archives. +# This guarantees that users can easily switch from a released artifact to a source archive +# with minimal differences in their code (e.g. strip_prefix remains the same) +readonly PREFIX="protobuf_javascript-${TAG}" +readonly ARCHIVE="${PREFIX}.tar.gz" + +# NB: configuration for 'git archive' is in /.gitattributes +git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE +SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') + +# The stdout of this program will be used as the top of the release notes for this release. +cat << EOF +## Using bzlmod with Bazel 7 or later: + +Add to your \`MODULE.bazel\` file: + +\`\`\`starlark +bazel_dep(name = "protobuf_javascript", version = "${TAG}") +\`\`\` +EOF diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index c7f541f..be3d31c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,5 +1,5 @@ { - "lockFileVersion": 18, + "lockFileVersion": 24, "registryFileHashes": { "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", @@ -25,6 +25,7 @@ "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b", "https://bcr.bazel.build/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d", "https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9", "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", "https://bcr.bazel.build/modules/bazel_features/1.33.0/MODULE.bazel": "8b8dc9d2a4c88609409c3191165bccec0e4cb044cd7a72ccbe826583303459f6", @@ -101,7 +102,8 @@ "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", - "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c", + "https://bcr.bazel.build/modules/rules_cc/0.2.15/MODULE.bazel": "6a0a4a75a57aa6dc888300d848053a58c6b12a29f89d4304e1c41448514ec6e8", + "https://bcr.bazel.build/modules/rules_cc/0.2.15/source.json": "197965c6dcca5c98a9288f93849e2e1c69d622e71b0be8deb524e22d48c88e32", "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", @@ -176,111 +178,6 @@ "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" }, "selectedYankedVersions": {}, - "moduleExtensions": { - "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { - "general": { - "bzlTransitiveDigest": "OlvsB0HsvxbR8ZN+J9Vf00X/+WVz/Y/5Xrq2LgcVfdo=", - "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "com_github_jetbrains_kotlin_git": { - "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", - "attributes": { - "urls": [ - "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" - ], - "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" - } - }, - "com_github_jetbrains_kotlin": { - "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", - "attributes": { - "git_repository_name": "com_github_jetbrains_kotlin_git", - "compiler_version": "1.9.23" - } - }, - "com_github_google_ksp": { - "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", - "attributes": { - "urls": [ - "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" - ], - "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", - "strip_version": "1.9.23-1.0.20" - } - }, - "com_github_pinterest_ktlint": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", - "attributes": { - "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", - "urls": [ - "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" - ], - "executable": true - } - }, - "rules_android": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", - "strip_prefix": "rules_android-0.1.1", - "urls": [ - "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" - ] - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_kotlin+", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@rules_python+//python/uv:uv.bzl%uv": { - "general": { - "bzlTransitiveDigest": "PmZM/pIkZKEDDL68TohlKJrWPYKL5VwUw3MA7kmm6fk=", - "usagesDigest": "p80sy6cYQuWxx5jhV3fOTu+N9EyIUFG9+F7UC/nhXic=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "uv": { - "repoRuleId": "@@rules_python+//python/uv/private:uv_toolchains_repo.bzl%uv_toolchains_repo", - "attributes": { - "toolchain_type": "'@@rules_python+//python/uv:uv_toolchain_type'", - "toolchain_names": [ - "none" - ], - "toolchain_implementations": { - "none": "'@@rules_python+//python:none'" - }, - "toolchain_compatible_with": { - "none": [ - "@platforms//:incompatible" - ] - }, - "toolchain_target_settings": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_python+", - "bazel_tools", - "bazel_tools" - ], - [ - "rules_python+", - "platforms", - "platforms" - ] - ] - } - } - } + "moduleExtensions": {}, + "facts": {} } diff --git a/e2e/bcr/.bazelrc b/e2e/bcr/.bazelrc new file mode 100644 index 0000000..53485cb --- /dev/null +++ b/e2e/bcr/.bazelrc @@ -0,0 +1 @@ +build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 diff --git a/e2e/bcr/BUILD.bazel b/e2e/bcr/BUILD.bazel new file mode 100644 index 0000000..3ce71f9 --- /dev/null +++ b/e2e/bcr/BUILD.bazel @@ -0,0 +1,30 @@ +load("@protobuf//bazel:proto_library.bzl", "proto_library") +load("@rules_shell//shell:sh_test.bzl", "sh_test") + +proto_library( + name = "simple_proto", + srcs = ["simple.proto"], +) + +genrule( + name = "simple_js", + srcs = [":simple_proto"], + outs = ["simple.js"], + cmd = """ +$(location @protobuf//:protoc) \ + --descriptor_set_in=$(location :simple_proto) \ + --plugin=protoc-gen-js=$(location @protobuf_javascript//generator:protoc-gen-js) \ + --js_out=$(RULEDIR) \ + simple.proto +""", + tools = [ + "@protobuf//:protoc", + "@protobuf_javascript//generator:protoc-gen-js", + ], +) + +sh_test( + name = "simple_js_test", + srcs = ["simple_js_test.sh"], + data = [":simple.js"], +) diff --git a/e2e/bcr/MODULE.bazel b/e2e/bcr/MODULE.bazel new file mode 100644 index 0000000..70387b9 --- /dev/null +++ b/e2e/bcr/MODULE.bazel @@ -0,0 +1,6 @@ +"MODULE.bazel file for bcr smoke test" + +bazel_dep(name = "rules_shell", version = "0.6.1") +bazel_dep(name = "protobuf", version = "33.0") +bazel_dep(name = "protobuf_javascript", version = "0.0.0", dev_dependency = True) +local_path_override(module_name = "protobuf_javascript", path = "../..") diff --git a/e2e/bcr/MODULE.bazel.lock b/e2e/bcr/MODULE.bazel.lock new file mode 100644 index 0000000..d3a3927 --- /dev/null +++ b/e2e/bcr/MODULE.bazel.lock @@ -0,0 +1,290 @@ +{ + "lockFileVersion": 24, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.2/MODULE.bazel": "73939767a4686cd9a520d16af5ab440071ed75cec1a876bf2fcfaf1f71987a16", + "https://bcr.bazel.build/modules/abseil-cpp/20250127.1/MODULE.bazel": "c4a89e7ceb9bf1e25cf84a9f830ff6b817b72874088bf5141b314726e46a57c1", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/MODULE.bazel": "d209fdb6f36ffaf61c509fcc81b19e81b411a999a934a032e10cd009a0226215", + "https://bcr.bazel.build/modules/abseil-cpp/20250512.1/source.json": "d725d73707d01bb46ab3ca59ba408b8e9bd336642ca77a2269d4bfb8bbfd413d", + "https://bcr.bazel.build/modules/apple_support/1.11.1/MODULE.bazel": "1843d7cd8a58369a444fc6000e7304425fba600ff641592161d9f15b179fb896", + "https://bcr.bazel.build/modules/apple_support/1.15.1/MODULE.bazel": "a0556fefca0b1bb2de8567b8827518f94db6a6e7e7d632b4c48dc5f865bc7c85", + "https://bcr.bazel.build/modules/apple_support/1.23.1/MODULE.bazel": "53763fed456a968cf919b3240427cf3a9d5481ec5466abc9d5dc51bc70087442", + "https://bcr.bazel.build/modules/apple_support/1.23.1/source.json": "d888b44312eb0ad2c21a91d026753f330caa48a25c9b2102fae75eb2b0dcfdd2", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.21.0/MODULE.bazel": "675642261665d8eea09989aa3b8afb5c37627f1be178382c320d1b46afba5e3b", + "https://bcr.bazel.build/modules/bazel_features/1.27.0/MODULE.bazel": "621eeee06c4458a9121d1f104efb80f39d34deff4984e778359c60eaf1a8cb65", + "https://bcr.bazel.build/modules/bazel_features/1.28.0/MODULE.bazel": "4b4200e6cbf8fa335b2c3f43e1d6ef3e240319c33d43d60cc0fbd4b87ece299d", + "https://bcr.bazel.build/modules/bazel_features/1.3.0/MODULE.bazel": "cdcafe83ec318cda34e02948e81d790aab8df7a929cec6f6969f13a489ccecd9", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.33.0/MODULE.bazel": "8b8dc9d2a4c88609409c3191165bccec0e4cb044cd7a72ccbe826583303459f6", + "https://bcr.bazel.build/modules/bazel_features/1.33.0/source.json": "13617db3930328c2cd2807a0f13d52ca870ac05f96db9668655113265147b2a6", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.8.1/MODULE.bazel": "88ade7293becda963e0e3ea33e7d54d3425127e0a326e0d17da085a5f1f03ff6", + "https://bcr.bazel.build/modules/bazel_skylib/1.8.1/source.json": "7ebaefba0b03efe59cac88ed5bbc67bcf59a3eff33af937345ede2a38b2d368a", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/googletest/1.15.2/MODULE.bazel": "6de1edc1d26cafb0ea1a6ab3f4d4192d91a312fd2d360b63adaa213cd00b2108", + "https://bcr.bazel.build/modules/googletest/1.17.0/MODULE.bazel": "dbec758171594a705933a29fcf69293d2468c49ec1f2ebca65c36f504d72df46", + "https://bcr.bazel.build/modules/googletest/1.17.0/source.json": "38e4454b25fc30f15439c0378e57909ab1fd0a443158aa35aec685da727cd713", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.6/MODULE.bazel": "2f8d20d3b7d54143213c4dfc3d98225c42de7d666011528dc8fe91591e2e17b0", + "https://bcr.bazel.build/modules/jsoncpp/1.9.6/source.json": "a04756d367a2126c3541682864ecec52f92cdee80a35735a3cb249ce015ca000", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/MODULE.bazel": "6f7b417dcc794d9add9e556673ad25cb3ba835224290f4f848f8e2db1e1fca74", + "https://bcr.bazel.build/modules/nlohmann_json/3.6.1/source.json": "f448c6e8963fdfa7eb831457df83ad63d3d6355018f6574fb017e8169deb43a9", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0-rc3/MODULE.bazel": "33c2dfa286578573afc55a7acaea3cada4122b9631007c594bf0729f41c8de92", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.1/MODULE.bazel": "557c3457560ff49e122ed76c0bc3397a64af9574691cb8201b4e46d4ab2ecb95", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/protobuf/33.0/MODULE.bazel": "c5270efb4aad37a2f893536076518793f409ea7df07a06df995d848d1690f21c", + "https://bcr.bazel.build/modules/protobuf/33.0/source.json": "cd7ac80ad863190b9151281a85acc11d77b5bde2ba56443a7215da2d4ace6da3", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/MODULE.bazel": "e6f4c20442eaa7c90d7190d8dc539d0ab422f95c65a57cc59562170c58ae3d34", + "https://bcr.bazel.build/modules/pybind11_bazel/2.12.0/source.json": "6900fdc8a9e95866b8c0d4ad4aba4d4236317b5c1cd04c502df3f0d33afed680", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/MODULE.bazel": "b4963dda9b31080be1905ef085ecd7dd6cd47c05c79b9cdf83ade83ab2ab271a", + "https://bcr.bazel.build/modules/re2/2024-07-02.bcr.1/source.json": "2ff292be6ef3340325ce8a045ecc326e92cbfab47c7cbab4bd85d28971b97ac4", + "https://bcr.bazel.build/modules/re2/2024-07-02/MODULE.bazel": "0eadc4395959969297cbcf31a249ff457f2f1d456228c67719480205aa306daa", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_apple/3.16.0/MODULE.bazel": "0d1caf0b8375942ce98ea944be754a18874041e4e0459401d925577624d3a54a", + "https://bcr.bazel.build/modules/rules_apple/3.16.0/source.json": "d8b5fe461272018cc07cfafce11fe369c7525330804c37eec5a82f84cd475366", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.17/MODULE.bazel": "2ae1d8f4238ec67d7185d8861cb0a2cdf4bc608697c331b95bf990e69b62e64a", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.2.15/MODULE.bazel": "6a0a4a75a57aa6dc888300d848053a58c6b12a29f89d4304e1c41448514ec6e8", + "https://bcr.bazel.build/modules/rules_cc/0.2.15/source.json": "197965c6dcca5c98a9288f93849e2e1c69d622e71b0be8deb524e22d48c88e32", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615", + "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc", + "https://bcr.bazel.build/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017", + "https://bcr.bazel.build/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939", + "https://bcr.bazel.build/modules/rules_java/8.6.1/MODULE.bazel": "f4808e2ab5b0197f094cabce9f4b006a27766beb6a9975931da07099560ca9c2", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.7/MODULE.bazel": "e717beabc4d091ecb2c803c2d341b88590e9116b8bf7947915eeb33aab4f96dd", + "https://bcr.bazel.build/modules/rules_jvm_external/6.7/source.json": "5426f412d0a7fc6b611643376c7e4a82dec991491b9ce5cb1cfdd25fe2e92be4", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/MODULE.bazel": "1e5b502e2e1a9e825eef74476a5a1ee524a92297085015a052510b09a1a09483", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel": "002d62d9108f75bb807cd56245d45648f38275cb3a99dcd45dfb864c5d74cb96", + "https://bcr.bazel.build/modules/rules_proto/7.1.0/source.json": "39f89066c12c24097854e8f57ab8558929f9c8d474d34b2c00ac04630ad8940e", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.33.2/MODULE.bazel": "3e036c4ad8d804a4dad897d333d8dce200d943df4827cb849840055be8d2e937", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/1.6.0/MODULE.bazel": "7e04ad8f8d5bea40451cf80b1bd8262552aa73f841415d20db96b7241bd027d8", + "https://bcr.bazel.build/modules/rules_python/1.6.0/source.json": "e980f654cf66ec4928672f41fc66c4102b5ea54286acf4aecd23256c84211be6", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", + "https://bcr.bazel.build/modules/rules_shell/0.6.1/MODULE.bazel": "72e76b0eea4e81611ef5452aa82b3da34caca0c8b7b5c0c9584338aa93bae26b", + "https://bcr.bazel.build/modules/rules_shell/0.6.1/source.json": "20ec05cd5e592055e214b2da8ccb283c7f2a421ea0dc2acbf1aa792e11c03d0c", + "https://bcr.bazel.build/modules/rules_swift/1.16.0/MODULE.bazel": "4a09f199545a60d09895e8281362b1ff3bb08bbde69c6fc87aff5b92fcc916ca", + "https://bcr.bazel.build/modules/rules_swift/2.1.1/MODULE.bazel": "494900a80f944fc7aa61500c2073d9729dff0b764f0e89b824eb746959bc1046", + "https://bcr.bazel.build/modules/rules_swift/2.1.1/source.json": "40fc69dfaac64deddbb75bd99cdac55f4427d9ca0afbe408576a65428427a186", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.2/MODULE.bazel": "fc152419aa2ea0f51c29583fab1e8c99ddefd5b3778421845606ee628629e0e5", + "https://bcr.bazel.build/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216", + "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "5e463fbfba7b1701d957555ed45097d7f984211330106ccd1352c6e0af0dcf91", + "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/source.json": "32bd87e5f4d7acc57c5b2ff7c325ae3061d5e242c0c4c214ae87e0f1c13e54cb", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "rL/34P1aFDq2GqVC2zCFgQ8nTuOC6ziogocpvG50Qz8=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_python+//python/uv:uv.bzl%uv": { + "general": { + "bzlTransitiveDigest": "8vT1ddXtljNxYD0tJkksqzeKE6xqx4Ix+tXthAppjTI=", + "usagesDigest": "p80sy6cYQuWxx5jhV3fOTu+N9EyIUFG9+F7UC/nhXic=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "uv": { + "repoRuleId": "@@rules_python+//python/uv/private:uv_toolchains_repo.bzl%uv_toolchains_repo", + "attributes": { + "toolchain_type": "'@@rules_python+//python/uv:uv_toolchain_type'", + "toolchain_names": [ + "none" + ], + "toolchain_implementations": { + "none": "'@@rules_python+//python:none'" + }, + "toolchain_compatible_with": { + "none": [ + "@platforms//:incompatible" + ] + }, + "toolchain_target_settings": {} + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python+", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python+", + "platforms", + "platforms" + ] + ] + } + } + }, + "facts": {} +} diff --git a/e2e/bcr/README.md b/e2e/bcr/README.md new file mode 100644 index 0000000..28a7ce8 --- /dev/null +++ b/e2e/bcr/README.md @@ -0,0 +1,6 @@ +# e2e/bcr + +This directory is used during the bazel-central-registry presubmit phase (see +). It is a smoke test to check that protobuf_javascript +can be depended on as a module, can build the generator, and used as a protoc +plugin. diff --git a/e2e/bcr/simple.proto b/e2e/bcr/simple.proto new file mode 100644 index 0000000..ce38262 --- /dev/null +++ b/e2e/bcr/simple.proto @@ -0,0 +1,39 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2025 Google Inc. All rights reserved. +// https://protobuf.dev/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package e2e.bcr; + +message Simple { + string a_string = 1; + string a_repeated_string = 2; + bool a_boolean = 3; +} diff --git a/e2e/bcr/simple_js_test.sh b/e2e/bcr/simple_js_test.sh new file mode 100755 index 0000000..87c1db0 --- /dev/null +++ b/e2e/bcr/simple_js_test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +file ./simple.js +echo "PASS" From f43209bd76e40c0e20f0f7b4c1e51cfeda3db941 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 17 Dec 2025 18:25:06 -0700 Subject: [PATCH 3/8] Add //:javascript target --- BUILD.bazel | 38 ++++++++++++++++++++++++++++++++++++++ e2e/bcr/BUILD.bazel | 9 ++++++++- e2e/bcr/simple_js_test.sh | 22 ++++++++++++++++++++-- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 7461adb..b64b057 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -98,3 +98,41 @@ filegroup( ":dist_zip", ], ) + +filegroup( + name = "javascript", + srcs = [ + "asserts.js", + "binary/any_field_type.js", + "binary/arith.js", + "binary/binary_constants.js", + "binary/bytesource.js", + "binary/bytesource_alias.js", + "binary/decoder.js", + "binary/decoder_alias.js", + "binary/encoder.js", + "binary/encoder_alias.js", + "binary/errors.js", + "binary/internal_buffer.js", + "binary/reader.js", + "binary/reader_alias.js", + "binary/repeated_field_type.js", + "binary/scalar_field_type.js", + "binary/test_utils.js", + "binary/utf8.js", + "binary/utils.js", + "binary/writer.js", + "binary/writer_alias.js", + "bytestring.js", + "debug.js", + "extension_field_binary_info.js", + "extension_field_info.js", + "internal_bytes.js", + "internal_options.js", + "internal_public.js", + "map.js", + "message.js", + "unsafe_bytestring.js", + ], + visibility = ["//visibility:public"], +) diff --git a/e2e/bcr/BUILD.bazel b/e2e/bcr/BUILD.bazel index 3ce71f9..ed76e1a 100644 --- a/e2e/bcr/BUILD.bazel +++ b/e2e/bcr/BUILD.bazel @@ -26,5 +26,12 @@ $(location @protobuf//:protoc) \ sh_test( name = "simple_js_test", srcs = ["simple_js_test.sh"], - data = [":simple.js"], + args = [ + "$(location :simple.js)", + "$(locations @protobuf_javascript//:javascript)", + ], + data = [ + ":simple.js", + "@protobuf_javascript//:javascript", + ], ) diff --git a/e2e/bcr/simple_js_test.sh b/e2e/bcr/simple_js_test.sh index 87c1db0..0ee4fcc 100755 --- a/e2e/bcr/simple_js_test.sh +++ b/e2e/bcr/simple_js_test.sh @@ -1,5 +1,23 @@ #!/bin/bash set -euo pipefail -file ./simple.js -echo "PASS" +# Check that we received arguments +if [ $# -eq 0 ]; then + echo "FAIL: No arguments provided" + exit 1 +fi + +# Verify each arg is a readable file +for arg in "$@"; do + if [ ! -f "$arg" ]; then + echo "FAIL: $arg is not a file" + exit 1 + fi + + if [ ! -s "$arg" ]; then + echo "FAIL: $arg is empty" + exit 1 + fi +done + +echo "PASS: Verified $# file(s)" From 26f3edf8a08f31a69dbec4acaec100c34afe72d4 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 17 Dec 2025 18:27:53 -0700 Subject: [PATCH 4/8] Add patch to remove dist-related bazel targets from root BUILD file --- .bcr/patches/remove-dist.patch | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .bcr/patches/remove-dist.patch diff --git a/.bcr/patches/remove-dist.patch b/.bcr/patches/remove-dist.patch new file mode 100644 index 0000000..c18d015 --- /dev/null +++ b/.bcr/patches/remove-dist.patch @@ -0,0 +1,88 @@ +diff --git a/BUILD.bazel b/BUILD.bazel +index b64b057..a7d6524 100644 +--- a/BUILD.bazel ++++ b/BUILD.bazel +@@ -2,10 +2,6 @@ + # + # See also code generation logic under generator/ + +-load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix") +-load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip") +-load("//:protobuf_javascript_release.bzl", "package_naming") +- + exports_files(["package.json"]) + + config_setting( +@@ -33,72 +29,6 @@ config_setting( + values = {"cpu": "darwin_x86_64"}, + ) + +-package_naming( +- name = "protobuf_javascript_pkg_naming", +- platform = select({ +- ":k8": "linux-x86_64", # currently the only supported build type in Github Actions +- ":x64_x86_windows": "win32", +- ":x64_windows": "win64", +- ":darwin_arm64": "osx-aarch_64", +- ":darwin_x86_64": "osx-x86_64", +- "//conditions:default": "", # continues with current behavior when no --cpu is specified allowing existing internal builds to function +- }), +-) +- +-pkg_files( +- name = "plugin_files", +- srcs = ["//generator:protoc-gen-js"], +- attributes = pkg_attributes(mode = "0555"), +- prefix = "bin/", +-) +- +-pkg_files( +- name = "dist_files", +- srcs = glob( +- [ +- "google/protobuf/*.js", +- "google/protobuf/compiler/*.js", +- ], +- allow_empty = True, +- ) + [ +- "LICENSE.md", +- "LICENSE-asserts.md", +- "README.md", +- "google-protobuf.js", +- "package.json", +- ], +- strip_prefix = strip_prefix.from_root(""), +-) +- +-pkg_tar( +- name = "dist_tar", +- srcs = [ +- ":dist_files", +- ":plugin_files", +- ], +- extension = "tar.gz", +- package_file_name = "protobuf-javascript-{version}-{platform}.tar.gz", +- package_variables = ":protobuf_javascript_pkg_naming", +-) +- +-pkg_zip( +- name = "dist_zip", +- srcs = [ +- ":dist_files", +- ":plugin_files", +- ], +- package_file_name = "protobuf-javascript-{version}-{platform}.zip", +- package_variables = ":protobuf_javascript_pkg_naming", +-) +- +-filegroup( +- name = "dist_all", +- srcs = [ +- ":dist_tar", +- ":dist_zip", +- ], +-) +- + filegroup( + name = "javascript", + srcs = [ From a53abc0f69438cd804a2dbedb35b1c83a8798285 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 17 Dec 2025 18:41:28 -0700 Subject: [PATCH 5/8] Mark rules_pkg as a dev dependency --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 3acc005..2471611 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -3,4 +3,4 @@ module(name = "protobuf_javascript", version = "4.0.1") bazel_dep(name = "abseil-cpp", version = "20250512.1") bazel_dep(name = "protobuf", version = "33.0", repo_name = "com_google_protobuf") bazel_dep(name = "rules_cc", version = "0.2.15") -bazel_dep(name = "rules_pkg", version = "1.0.1") +bazel_dep(name = "rules_pkg", version = "1.0.1", dev_dependency = True) From 98b057c4b5a44fd7c58f5c61fe6829fd35fa5f14 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 18 Dec 2025 13:29:40 -0700 Subject: [PATCH 6/8] bcr: remove non-google maintainer --- .bcr/metadata.template.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json index 5ba5cc4..3ef3419 100644 --- a/.bcr/metadata.template.json +++ b/.bcr/metadata.template.json @@ -5,11 +5,6 @@ "name": "Stephanie DiBenedetto", "email": "dibenede@google.com", "github": "dibenede" - }, - { - "name": "Paul Cody", - "email": "pcj@stack.build", - "github": "pcj" } ], "repository": [ From 5bfec7b4fb629e68033551a47059b205fe0e9a8f Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 18 Dec 2025 13:33:56 -0700 Subject: [PATCH 7/8] Remove version string in MODULE.bazel --- MODULE.bazel | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 2471611..4f76f54 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,4 +1,6 @@ -module(name = "protobuf_javascript", version = "4.0.1") +"Bazel module that provides protoc-gen-js." + +module(name = "protobuf_javascript", version = "0.0.0") # updated by release action bazel_dep(name = "abseil-cpp", version = "20250512.1") bazel_dep(name = "protobuf", version = "33.0", repo_name = "com_google_protobuf") From 2a2a9425e48536e6e8f89319e2d6b5eef628a848 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 18 Dec 2025 16:29:56 -0700 Subject: [PATCH 8/8] Add e2e/bcr to bazelignore Also add .bazelrc configuration to disallow auto-importing previously native symbols (e.g. sh_binary) --- .bazelignore | 1 + .bazelrc | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .bazelignore diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000..eac1fc4 --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +e2e/bcr diff --git a/.bazelrc b/.bazelrc index 74109e9..7d6623d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,6 @@ build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 +build:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 build:dbg --compilation_mode=dbg @@ -29,12 +30,12 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr build --features=layering_check common --enable_platform_specific_config -build:windows --cxxopt=/std:c++17 -build:windows --host_cxxopt=/std:c++17 - common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 # Allow building with MSVC, which is being deprecated. # See: https://github.com/protocolbuffers/protobuf/issues/20085 build --define=protobuf_allow_msvc=true + +# To facilitate testing in bazelci incompatible flags +build --incompatible_autoload_externally= \ No newline at end of file