From 4c57a6484b61ed1a8610de3f1c3d9a97d7eb9a04 Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Wed, 3 Jan 2024 02:50:08 -0800 Subject: [PATCH] drop Bazel JS build PiperOrigin-RevId: 595345529 --- .github/workflows/build_test.yml | 15 ------ js/BUILD.bazel | 84 -------------------------------- js/WORKSPACE.bazel | 17 ------- js/jasmine-polyfill.js | 37 -------------- js/polyfill.js | 73 --------------------------- 5 files changed, 226 deletions(-) delete mode 100644 js/BUILD.bazel delete mode 100644 js/WORKSPACE.bazel delete mode 100644 js/jasmine-polyfill.js delete mode 100644 js/polyfill.js diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 44f4116..f5f5b58 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -159,10 +159,6 @@ jobs: build_system: bazel bazel_project: java - - name: bazel:js - build_system: bazel - bazel_project: js - - name: bazel:research build_system: bazel bazel_project: research @@ -182,11 +178,6 @@ jobs: bazel_project: java os: macos-latest - - name: bazel-osx:js - build_system: bazel - bazel_project: js - os: macos-latest - - name: bazel-osx:research build_system: bazel bazel_project: research @@ -208,12 +199,6 @@ jobs: bazel_project: java os: windows-latest - # TODO: blocked by Bazel Closure rules issue - #- name: bazel-win:js - # build_system: bazel - # bazel_project: js - # os: windows-latest - - name: bazel-win:research build_system: bazel bazel_project: research diff --git a/js/BUILD.bazel b/js/BUILD.bazel deleted file mode 100644 index d74e42c..0000000 --- a/js/BUILD.bazel +++ /dev/null @@ -1,84 +0,0 @@ -load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library", "closure_js_test") - -package( - default_visibility = ["//visibility:public"], -) - -licenses(["notice"]) # MIT - -# Not a real polyfill. Do NOT use for anything, but tests. -closure_js_library( - name = "polyfill", - srcs = ["polyfill.js"], - suppress = [ - "JSC_INVALID_OPERAND_TYPE", - "JSC_MISSING_JSDOC", - "JSC_STRICT_INEXISTENT_PROPERTY", - "JSC_TYPE_MISMATCH", - "JSC_UNKNOWN_EXPR_TYPE", - ], -) - -closure_js_library( - name = "jasmine-polyfill", - srcs = ["jasmine-polyfill.js"], - suppress = [ - "JSC_MISSING_JSDOC", - "JSC_UNKNOWN_EXPR_TYPE", - "JSC_MISSING_PROVIDE", - ], - deps = ["@io_bazel_rules_closure//closure/library:testing"], - testonly = True, -) - -# Do NOT use this artifact; it is for test purposes only. -closure_js_library( - name = "decode", - srcs = ["decode.js"], - suppress = ["JSC_USELESS_BLOCK"], - deps = [":polyfill"], -) - -closure_js_test( - name = "decode_test", - srcs = ["decode_test.js"], - entry_points = ["decode_test.js"], - suppress = ["moduleLoad"], - deps = [ - ":decode", - ":jasmine-polyfill", - ":polyfill", - ], -) - -closure_js_test( - name = "decode_synth_test", - srcs = ["decode_synth_test.js"], - entry_points = ["decode_synth_test.js"], - suppress = ["moduleLoad"], - deps = [ - ":decode", - ":jasmine-polyfill", - ":polyfill", - ], -) - -closure_js_library( - name = "test_data_js", - testonly = True, - srcs = ["test_data.js"], - suppress = ["lintChecks"], -) - -closure_js_test( - name = "bundle_test", - srcs = ["bundle_test.js"], - entry_points = ["bundle_test.js"], - suppress = ["moduleLoad"], - deps = [ - ":decode", - ":jasmine-polyfill", - ":polyfill", - ":test_data_js", - ], -) diff --git a/js/WORKSPACE.bazel b/js/WORKSPACE.bazel deleted file mode 100644 index 8e3b2af..0000000 --- a/js/WORKSPACE.bazel +++ /dev/null @@ -1,17 +0,0 @@ -workspace(name = "org_brotli_js") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "io_bazel_rules_closure", - sha256 = "d66deed38a0bb20581c15664f0ab62270af5940786855c7adc3087b27168b529", - strip_prefix = "rules_closure-0.11.0", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz", - "https://github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz", - ], -) - -load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains") -rules_closure_dependencies() -rules_closure_toolchains() diff --git a/js/jasmine-polyfill.js b/js/jasmine-polyfill.js deleted file mode 100644 index 805c55f..0000000 --- a/js/jasmine-polyfill.js +++ /dev/null @@ -1,37 +0,0 @@ -goog.require('goog.testing.TestCase'); -goog.require('goog.testing.asserts'); -goog.require('goog.testing.jsunit'); - -let test_case_; -/** @type{?function(): void} */ -let pending = null; - -function describe(caseName, callback) { - test_case_ = new goog.testing.TestCase(caseName); - callback(); - window['G_testRunner'].initialize(test_case_); -} - -function it(testName, callback) { - test_case_.add(new goog.testing.TestCase.Test(testName, callback)); -} - -/** - * @param {*} actual - * @constructor - */ -function Expect(actual) { - this.actual = actual; -} - -Expect.prototype.toEqual = function(expected) { - assertEquals(expected, this.actual); -}; - -/** - * @param {*} actual - * @returns {!Expect} - */ -function expect(actual) { - return new Expect(actual); -} diff --git a/js/polyfill.js b/js/polyfill.js deleted file mode 100644 index 9ff59cc..0000000 --- a/js/polyfill.js +++ /dev/null @@ -1,73 +0,0 @@ -if (!Int32Array.__proto__.from) { - Object.defineProperty(Int32Array.__proto__, 'from', { - value: function(obj) { - obj = Object(obj); - if (!obj['length']) { - return new this(0); - } - let typed_array = new this(obj.length); - for (let i = 0; i < typed_array.length; i++) { - typed_array[i] = obj[i]; - } - return typed_array; - } - }); -} - -if (!Array.prototype.copyWithin) { - Array.prototype.copyWithin = function(target, start, end) { - let O = Object(this); - let len = O.length >>> 0; - let to = target | 0; - let from = start | 0; - let count = Math.min(Math.min(end | 0, len) - from, len - to); - let direction = 1; - if (from < to && to < (from + count)) { - direction = -1; - from += count - 1; - to += count - 1; - } - while (count > 0) { - O[to] = O[from]; - from += direction; - to += direction; - count--; - } - return O; - }; -} - -if (!Array.prototype.fill) { - Object.defineProperty(Array.prototype, 'fill', { - value: function(value, start, end) { - end = end | 0; - let O = Object(this); - let k = start | 0; - while (k < end) { - O[k] = value; - k++; - } - return O; - } - }); -} - -if (!Int8Array.prototype.copyWithin) { - Int8Array.prototype.copyWithin = Array.prototype.copyWithin; -} - -if (!Int8Array.prototype.fill) { - Int8Array.prototype.fill = Array.prototype.fill; -} - -if (!Int32Array.prototype.fill) { - Int32Array.prototype.fill = Array.prototype.fill; -} - -if (!Int8Array.prototype.slice) { - Object.defineProperty(Int8Array.prototype, 'slice', { - value: function(begin, end) { - return new Int8Array(Array.prototype.slice.call(this, begin, end)); - } - }); -}