diff --git a/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/BUILD b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/BUILD index 80fcfbb824..23f6253bbb 100644 --- a/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/BUILD +++ b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/BUILD @@ -1,3 +1,4 @@ +load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") load( "//transpiler/javatests/com/google/j2cl/integration:integration_test.bzl", "integration_test", @@ -8,10 +9,36 @@ package( licenses = ["notice"], ) +closure_js_library( + name = "zoo", + srcs = ["Zoo.js"], + deps = ["//:jre"], +) + +alias( + name = "zoo-j2cl", + actual = ":zoo", +) + +alias( + name = "zoo-j2wasm", + actual = ":zoo", +) + integration_test( name = "systemgetproperty", - srcs = glob(["*.java"]), + srcs = glob( + [ + "*.java", + "*.js", + ], + exclude = ["Zoo.js"], + ), + closure_defines = { + "zoo": "buzz", + }, # This test is specific to J2CL's implementation of System.getProperty(). enable_jvm_test = False, enable_kt = False, + deps = [":zoo"], ) diff --git a/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Main.native.js b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Main.native.js new file mode 100644 index 0000000000..1ce8d56e61 --- /dev/null +++ b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Main.native.js @@ -0,0 +1,2 @@ +/** @suppress {extraRequire} */ +goog.require('systemgetproperty.Zoo'); diff --git a/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Zoo.js b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Zoo.js new file mode 100644 index 0000000000..fdb8c19dc9 --- /dev/null +++ b/transpiler/javatests/com/google/j2cl/integration/java/systemgetproperty/Zoo.js @@ -0,0 +1,21 @@ +// Copyright 2025 Google Inc. +// +// 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 +// +// https://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.module('systemgetproperty.Zoo'); + +const jre = goog.require('jre'); + +/** @define {string} */ +const localZoo = goog.define('zoo', 'default'); +jre.addSystemPropertyFromGoogDefine('zoo', localZoo); \ No newline at end of file