From 83b25d4a197fb1751aaf06b02f545377a70284dd Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Sat, 28 Dec 2024 02:46:44 +0000 Subject: [PATCH 01/10] Update protobuf test to use jssuite from forked files --- closure/protobuf/test/BUILD | 6 +++--- closure/protobuf/test/legacy/BUILD | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/closure/protobuf/test/BUILD b/closure/protobuf/test/BUILD index 6883b290a..ff5149274 100644 --- a/closure/protobuf/test/BUILD +++ b/closure/protobuf/test/BUILD @@ -52,7 +52,7 @@ closure_js_test( ], deps = [ ":foo", - "@com_google_javascript_closure_library//closure/goog/testing:testsuite", + "//closure/testing/library:testsuite", ], ) @@ -95,7 +95,7 @@ closure_js_test( deps = [ ":baz", ":foo", - "@com_google_javascript_closure_library//closure/goog/testing:testsuite", + "//closure/testing/library:testsuite", ], ) @@ -131,6 +131,6 @@ closure_js_test( ], deps = [ ":bat", - "@com_google_javascript_closure_library//closure/goog/testing:testsuite", + "//closure/testing/library:testsuite", ], ) diff --git a/closure/protobuf/test/legacy/BUILD b/closure/protobuf/test/legacy/BUILD index 8c4c3ef5d..a88fdcdf2 100644 --- a/closure/protobuf/test/legacy/BUILD +++ b/closure/protobuf/test/legacy/BUILD @@ -40,7 +40,7 @@ closure_js_test( srcs = ["example_test.js"], deps = [ ":example_lib", - "@com_google_javascript_closure_library//closure/goog/testing:asserts", - "@com_google_javascript_closure_library//closure/goog/testing:jsunit", + "//closure/testing/library:testsuite", + "//closure/testing/library:jsunit", ], ) From db621a3ffd23a00da5bbc92d77e2d3430065492b Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Sat, 28 Dec 2024 02:50:27 +0000 Subject: [PATCH 02/10] Update bazel version --- .bazelversion | 1 + MODULE.bazel | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 .bazelversion create mode 100644 MODULE.bazel diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..815da58b7 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.4.1 diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..00bb18361 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,6 @@ +############################################################################### +# 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 +############################################################################### From de3b0d5259d30237f4f61d03cd6028b80a9dc19f Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Thu, 2 Jan 2025 20:35:31 +0000 Subject: [PATCH 03/10] Update protobuf test to use jssuite from forked files --- closure/protobuf/test/legacy/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/closure/protobuf/test/legacy/BUILD b/closure/protobuf/test/legacy/BUILD index a88fdcdf2..429d36902 100644 --- a/closure/protobuf/test/legacy/BUILD +++ b/closure/protobuf/test/legacy/BUILD @@ -40,7 +40,7 @@ closure_js_test( srcs = ["example_test.js"], deps = [ ":example_lib", - "//closure/testing/library:testsuite", + "//closure/testing/library:asserts", "//closure/testing/library:jsunit", ], ) From bf0b21cee688d6a564d56ff3f6482d637e8e5d15 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Thu, 2 Jan 2025 20:43:29 +0000 Subject: [PATCH 04/10] Update protobuf test to use jssuite from forked files and remove usage of assertHTMLEquals --- closure/protobuf/test/legacy/example_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js index 9029380f1..76ff518ed 100644 --- a/closure/protobuf/test/legacy/example_test.js +++ b/closure/protobuf/test/legacy/example_test.js @@ -20,5 +20,5 @@ goog.require('io.bazel.rules.closure.protobuf.Example'); function testExample() { var msg = new io.bazel.rules.closure.protobuf.Example('value'); msg.field(); - assertHTMLEquals('value', msg.field()); + assertEquals('value', msg.field()); } From 9a8548ebd3aeeb5f0bff13c2fecc0ea8358f9609 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 02:27:01 +0000 Subject: [PATCH 05/10] Remove legacy protobuf test --- closure/protobuf/test/legacy/BUILD | 46 -------------------- closure/protobuf/test/legacy/example.js | 45 ------------------- closure/protobuf/test/legacy/example.proto | 21 --------- closure/protobuf/test/legacy/example_test.js | 24 ---------- 4 files changed, 136 deletions(-) delete mode 100644 closure/protobuf/test/legacy/BUILD delete mode 100644 closure/protobuf/test/legacy/example.js delete mode 100644 closure/protobuf/test/legacy/example.proto delete mode 100644 closure/protobuf/test/legacy/example_test.js diff --git a/closure/protobuf/test/legacy/BUILD b/closure/protobuf/test/legacy/BUILD deleted file mode 100644 index 429d36902..000000000 --- a/closure/protobuf/test/legacy/BUILD +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2016 The Closure Rules Authors. All rights reserved. -# -# 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. - -package(default_testonly = True) - -licenses(["notice"]) - -load("//closure/compiler:closure_js_library.bzl", "closure_js_library") -load("//closure/protobuf:closure_js_proto_library.bzl", "closure_js_proto_library") -load("//closure/testing:closure_js_test.bzl", "closure_js_test") - -closure_js_proto_library( - name = "example_proto", - srcs = ["example.proto"], -) - -closure_js_library( - name = "example_lib", - srcs = ["example.js"], - suppress = ["useOfGoogProvide"], - deps = [ - ":example_proto", - ], -) - -closure_js_test( - name = "example_test", - timeout = "short", - srcs = ["example_test.js"], - deps = [ - ":example_lib", - "//closure/testing/library:asserts", - "//closure/testing/library:jsunit", - ], -) diff --git a/closure/protobuf/test/legacy/example.js b/closure/protobuf/test/legacy/example.js deleted file mode 100644 index 11db2beb6..000000000 --- a/closure/protobuf/test/legacy/example.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Closure Rules Authors. All rights reserved. -// -// 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. - -goog.provide('io.bazel.rules.closure.protobuf.Example'); - -goog.require('proto.io.bazel.rules.closure.protobuf.Message'); - - - -/** - * Example page. - * @param {string} field Value to set for "field". - * @constructor - * @final - */ -io.bazel.rules.closure.protobuf.Example = function(field) { - - /** - * Message - * @private {!proto.io.bazel.rules.closure.protobuf.Message} - * @const - */ - this.message_ = new proto.io.bazel.rules.closure.protobuf.Message(); - this.message_.setFoo(field); -}; - - -/** - * Return value of "field". - * @return {string} - */ -io.bazel.rules.closure.protobuf.Example.prototype.field = function() { - return this.message_.getFoo(); -}; diff --git a/closure/protobuf/test/legacy/example.proto b/closure/protobuf/test/legacy/example.proto deleted file mode 100644 index 92b87f632..000000000 --- a/closure/protobuf/test/legacy/example.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Closure Rules Authors. All rights reserved. -// -// 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. - -syntax = "proto3"; - -package io.bazel.rules.closure.protobuf; - -message Message { - string foo = 1; -} diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js deleted file mode 100644 index 76ff518ed..000000000 --- a/closure/protobuf/test/legacy/example_test.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Closure Rules Authors. All rights reserved. -// -// 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. - -goog.require('goog.testing.asserts'); -goog.require('goog.testing.jsunit'); -goog.require('io.bazel.rules.closure.protobuf.Example'); - - -function testExample() { - var msg = new io.bazel.rules.closure.protobuf.Example('value'); - msg.field(); - assertEquals('value', msg.field()); -} From a15a84a1c74c5fe2d8571713d9a5071cc348cd6f Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 18:34:54 +0000 Subject: [PATCH 06/10] Add back legacy test --- closure/protobuf/test/legacy/BUILD | 46 ++++++++++++++++++++ closure/protobuf/test/legacy/example.js | 45 +++++++++++++++++++ closure/protobuf/test/legacy/example.proto | 21 +++++++++ closure/protobuf/test/legacy/example_test.js | 23 ++++++++++ 4 files changed, 135 insertions(+) create mode 100644 closure/protobuf/test/legacy/BUILD create mode 100644 closure/protobuf/test/legacy/example.js create mode 100644 closure/protobuf/test/legacy/example.proto create mode 100644 closure/protobuf/test/legacy/example_test.js diff --git a/closure/protobuf/test/legacy/BUILD b/closure/protobuf/test/legacy/BUILD new file mode 100644 index 000000000..8c4c3ef5d --- /dev/null +++ b/closure/protobuf/test/legacy/BUILD @@ -0,0 +1,46 @@ +# Copyright 2016 The Closure Rules Authors. All rights reserved. +# +# 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. + +package(default_testonly = True) + +licenses(["notice"]) + +load("//closure/compiler:closure_js_library.bzl", "closure_js_library") +load("//closure/protobuf:closure_js_proto_library.bzl", "closure_js_proto_library") +load("//closure/testing:closure_js_test.bzl", "closure_js_test") + +closure_js_proto_library( + name = "example_proto", + srcs = ["example.proto"], +) + +closure_js_library( + name = "example_lib", + srcs = ["example.js"], + suppress = ["useOfGoogProvide"], + deps = [ + ":example_proto", + ], +) + +closure_js_test( + name = "example_test", + timeout = "short", + srcs = ["example_test.js"], + deps = [ + ":example_lib", + "@com_google_javascript_closure_library//closure/goog/testing:asserts", + "@com_google_javascript_closure_library//closure/goog/testing:jsunit", + ], +) diff --git a/closure/protobuf/test/legacy/example.js b/closure/protobuf/test/legacy/example.js new file mode 100644 index 000000000..11db2beb6 --- /dev/null +++ b/closure/protobuf/test/legacy/example.js @@ -0,0 +1,45 @@ +// Copyright 2016 The Closure Rules Authors. All rights reserved. +// +// 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. + +goog.provide('io.bazel.rules.closure.protobuf.Example'); + +goog.require('proto.io.bazel.rules.closure.protobuf.Message'); + + + +/** + * Example page. + * @param {string} field Value to set for "field". + * @constructor + * @final + */ +io.bazel.rules.closure.protobuf.Example = function(field) { + + /** + * Message + * @private {!proto.io.bazel.rules.closure.protobuf.Message} + * @const + */ + this.message_ = new proto.io.bazel.rules.closure.protobuf.Message(); + this.message_.setFoo(field); +}; + + +/** + * Return value of "field". + * @return {string} + */ +io.bazel.rules.closure.protobuf.Example.prototype.field = function() { + return this.message_.getFoo(); +}; diff --git a/closure/protobuf/test/legacy/example.proto b/closure/protobuf/test/legacy/example.proto new file mode 100644 index 000000000..92b87f632 --- /dev/null +++ b/closure/protobuf/test/legacy/example.proto @@ -0,0 +1,21 @@ +// Copyright 2016 The Closure Rules Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package io.bazel.rules.closure.protobuf; + +message Message { + string foo = 1; +} diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js new file mode 100644 index 000000000..66f39493e --- /dev/null +++ b/closure/protobuf/test/legacy/example_test.js @@ -0,0 +1,23 @@ +// Copyright 2016 The Closure Rules Authors. All rights reserved. +// +// 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. + +goog.require('goog.testing.asserts'); +goog.require('goog.testing.jsunit'); + + +function testExample() { + var msg = new io.bazel.rules.closure.protobuf.Example('value'); + msg.field(); + assertHTMLEquals('value', msg.field()); +} \ No newline at end of file From a4487280e538ea72abebf8c8ab5d18dd8e71e7fe Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 18:37:14 +0000 Subject: [PATCH 07/10] Add a blank line at the end of legacy example test --- .bazelversion | 1 - MODULE.bazel | 6 ------ closure/protobuf/test/legacy/example_test.js | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 .bazelversion delete mode 100644 MODULE.bazel diff --git a/.bazelversion b/.bazelversion deleted file mode 100644 index 815da58b7..000000000 --- a/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -7.4.1 diff --git a/MODULE.bazel b/MODULE.bazel deleted file mode 100644 index 00bb18361..000000000 --- a/MODULE.bazel +++ /dev/null @@ -1,6 +0,0 @@ -############################################################################### -# 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 -############################################################################### diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js index 66f39493e..2cc573a1d 100644 --- a/closure/protobuf/test/legacy/example_test.js +++ b/closure/protobuf/test/legacy/example_test.js @@ -20,4 +20,4 @@ function testExample() { var msg = new io.bazel.rules.closure.protobuf.Example('value'); msg.field(); assertHTMLEquals('value', msg.field()); -} \ No newline at end of file +} From 23cf7370553106142a330c76c58ff88487bf0212 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 19:10:44 +0000 Subject: [PATCH 08/10] Update legacy test to use forked jsunit and asserts --- closure/protobuf/test/legacy/BUILD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/closure/protobuf/test/legacy/BUILD b/closure/protobuf/test/legacy/BUILD index 8c4c3ef5d..429d36902 100644 --- a/closure/protobuf/test/legacy/BUILD +++ b/closure/protobuf/test/legacy/BUILD @@ -40,7 +40,7 @@ closure_js_test( srcs = ["example_test.js"], deps = [ ":example_lib", - "@com_google_javascript_closure_library//closure/goog/testing:asserts", - "@com_google_javascript_closure_library//closure/goog/testing:jsunit", + "//closure/testing/library:asserts", + "//closure/testing/library:jsunit", ], ) From 6e8ca8398c55ae2ee3f80bb8daccfe7ece6dfeb4 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 19:14:06 +0000 Subject: [PATCH 09/10] Update legacy test to use forked jsunit and asserts --- closure/protobuf/test/legacy/example_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js index 2cc573a1d..aaf7b63c4 100644 --- a/closure/protobuf/test/legacy/example_test.js +++ b/closure/protobuf/test/legacy/example_test.js @@ -19,5 +19,5 @@ goog.require('goog.testing.jsunit'); function testExample() { var msg = new io.bazel.rules.closure.protobuf.Example('value'); msg.field(); - assertHTMLEquals('value', msg.field()); + assertEquals('value', msg.field()); } From 04e467a381d0081792a829e582eb43b9fad235d3 Mon Sep 17 00:00:00 2001 From: Yuan Tian Date: Tue, 7 Jan 2025 19:59:49 +0000 Subject: [PATCH 10/10] Add back require line and remove additional msg.field() --- closure/protobuf/test/legacy/example_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/closure/protobuf/test/legacy/example_test.js b/closure/protobuf/test/legacy/example_test.js index aaf7b63c4..f95dcb678 100644 --- a/closure/protobuf/test/legacy/example_test.js +++ b/closure/protobuf/test/legacy/example_test.js @@ -14,10 +14,10 @@ goog.require('goog.testing.asserts'); goog.require('goog.testing.jsunit'); +goog.require('io.bazel.rules.closure.protobuf.Example'); function testExample() { var msg = new io.bazel.rules.closure.protobuf.Example('value'); - msg.field(); assertEquals('value', msg.field()); }