Rename J2ClSuite annotation to a clearer name.
Since the annotation actually does not represent a test suite, but rather the input to our annotation processor the name should reflect this.
@@ -54,14 +54,14 @@ _TEMPLATE = """// THIS IS GENERATED CODE. DO NOT EDIT.
package %s;
-import com.google.j2cl.junit.J2ClSuiteClasses;
+import com.google.j2cl.junit.J2clTestInput;
/**
* J2cl java tests.
*
* @author Class generated by build rule j2cl_java_test.
*/
-@J2ClSuiteClasses({%s})
+@J2clTestInput({%s})
public class %s {
}
"""
@@ -83,6 +83,11 @@ _write_file = rule(
outputs={"out": "%{name}.java"},
)
+def _getClassName(name):
+ return name.title() + "__generated_j2cl_java_test_input"
+
+def _getFilename(name):
+ return _getClassName(name) + ".java"
def _generate_suite(name, package, srcs):
if len(srcs) == 0:
@@ -92,12 +97,13 @@ def _generate_suite(name, package, srcs):
for src in srcs:
full_qualified_classes += [_make_full_qualified(package, src) + ".class"]
BUILD_FILE = "//%s/BUILD (target: %s)" % (package, name),
+ class_name = _getClassName(name)
java_code = (
_TEMPLATE %
(BUILD_FILE, "j2cl_java_test", package,
",".join(full_qualified_classes),
- name.title() + "_generated_suite"))
- _write_file(name=name.title() + "_generated_suite", content=java_code)
+ class_name))
+ _write_file(name=class_name, content=java_code)
def j2cl_java_test(**kwargs):
@@ -122,7 +128,7 @@ def j2cl_java_test(**kwargs):
# add the generated suite to the java_srcs for the java_library so we see
# it in transpilation
kwargs["srcs"] = kwargs[
- "srcs"] + [base_name.title() + "_generated_suite.java"]
+ "srcs"] + [_getFilename(base_name)]
if not "deps" in kwargs:
kwargs["deps"] = []
kwargs["deps"] = kwargs[
