Skip to content

Commit 85de391

Browse files
authored
Remove remaining references and logic related to soy (#634)
1 parent 3c38a67 commit 85de391

File tree

6 files changed

+9
-221
lines changed

6 files changed

+9
-221
lines changed

README.md

Lines changed: 8 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
JavaScript | Templating | Stylesheets | Miscellaneous
44
--- | --- | --- | ---
5-
[closure_js_library] | [closure_js_template_library] | [closure_css_library] | [closure_js_proto_library]
6-
[closure_js_binary] | [closure_java_template_library] | [closure_css_binary] | [phantomjs_test]
7-
[closure_js_test] | [closure_py_template_library] | | [closure_proto_library] \(Experimental\)
5+
[closure_js_library] | [closure_css_library] | [closure_js_proto_library]
6+
[closure_js_binary] | [closure_css_binary] | [phantomjs_test]
7+
[closure_js_test] | [closure_proto_library] \(Experimental\)
88
| | | | [closure_grpc_web_library] \(Experimental\)
99

1010
## Overview
@@ -27,9 +27,7 @@ play games. It enforces a type system that can be stricter than Java. From a
2727
stylistic perspective, Closure is [verbose] like Java; there's no cryptic
2828
symbols or implicit behavior; the code says exactly what it's doing. This sets
2929
Closure apart from traditional JavaScript development, where terseness was
30-
favored over readability, because minifiers weren't very good. Furthermore, the
31-
Closure Library and Templates help you follow security best practices which will
32-
keep your users safe.
30+
favored over readability, because minifiers weren't very good.
3331

3432
### What's Included
3533

@@ -41,7 +39,6 @@ Closure Rules bundles the following tools and makes them "just work."
4139
transpiles [ECMASCRIPT6] to minified ES3 JavaScript that can run in any
4240
browser.
4341
- [Closure Library]: Google's core JavaScript libraries.
44-
- [Closure Templates]: Type-safe HTML templating system that compiles to both
4542
JavaScript and Java. This is one of the most secure templating systems
4643
available. It's where Google has put the most thought into preventing things
4744
like XSS attacks. It also supports i18n and l10n.
@@ -136,7 +133,6 @@ Please see the test directories within this project for concrete examples of usa
136133

137134
- [//closure/testing/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/testing/test)
138135
- [//closure/compiler/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/compiler/test)
139-
- [//closure/templates/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/templates/test)
140136
- [//closure/stylesheets/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/stylesheets/test)
141137
- [//closure/protobuf/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/protobuf/test)
142138

@@ -190,8 +186,7 @@ This rule can be referenced as though it were the following:
190186
list that image here, so it ends up in the webserver runfiles.
191187

192188
- **deps:** (List of [labels]; optional) Direct [dependency] list. These can
193-
point to [closure_js_library], [closure_js_template_library],
194-
[closure_css_library] and [closure_js_proto_library] rules.
189+
point to [closure_js_library], [closure_css_library] and [closure_js_proto_library] rules.
195190

196191
- **exports:** (List of [labels]; optional) Listing dependencies here will cause
197192
them to become *direct* dependencies in parent rules. This functions similarly
@@ -284,14 +279,14 @@ This rule can be referenced as though it were the following:
284279

285280
- **deps:** (List of [labels]; required) Direct dependency list. This attribute
286281
has the same meaning as it does in [closure_js_library]. These can point to
287-
[closure_js_library] and [closure_js_template_library] rules.
282+
[closure_js_library] rules.
288283

289284
- **css:** (Label; optional) CSS class renaming target, which must point to a
290285
[closure_css_binary] rule. This causes the CSS name mapping file generated by
291286
the CSS compiler to be included in the compiled JavaScript. This tells
292287
Closure Compiler how to minify CSS class names.
293288

294-
This attribute is required if any of JavaScript or template sources depend on
289+
This attribute is required if any of JavaScript sources depend on
295290
a [closure_css_library]. This rule will check that all the referenced CSS
296291
libraries are present in the CSS binary.
297292

@@ -499,158 +494,6 @@ This rule can be referenced as though it were the following:
499494
to report the result to the `harness`.
500495

501496

502-
## closure\_js\_template\_library
503-
504-
```starlark
505-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_template_library")
506-
closure_js_template_library(name, srcs, data, deps, globals, plugin_modules,
507-
should_generate_js_doc,
508-
should_generate_soy_msg_defs,
509-
bidi_global_dir,
510-
soy_msgs_are_external,
511-
defs)
512-
```
513-
514-
Compiles Closure templates to JavaScript source files.
515-
516-
This rule is necessary in order to render Closure templates from within
517-
JavaScript code.
518-
519-
This rule pulls in a transitive dependency on the Closure Library.
520-
521-
The documentation on using Closure Templates can be found
522-
[here][Closure Templates].
523-
524-
For additional help on using some of these attributes, please see the output of
525-
the following:
526-
527-
bazel run @com_google_template_soy//:SoyToJsSrcCompiler -- --help
528-
529-
#### Implicit Output Targets
530-
531-
- *src*.js: A separate JavaScript source file is generated for each file listed
532-
under `srcs`. The filename will be the same as the template with a `.js`
533-
suffix. For example `foo.soy` would become `foo.soy.js`.
534-
535-
#### Rule Polymorphism
536-
537-
This rule can be referenced as though it were the following:
538-
539-
- [filegroup]: `srcs` will be the generated JS output files and `data` will
540-
contain all transitive JS sources and data.
541-
542-
- [closure_js_library]: `srcs` will be the generated JS output files, `data`
543-
will contain the transitive data, `deps` will contain necessary libraries, and
544-
`no_closure_library` will be `False`.
545-
546-
### Arguments
547-
548-
- **name:** ([Name]; required) A unique name for this rule.
549-
550-
- **srcs:** (List of [labels]; required) A list of `.soy` source files that
551-
represent this library.
552-
553-
- **data:** (List of [labels]; optional) Runfiles directly referenced by Soy
554-
sources in this rule. For example, if the template has an `<img src=foo.png>`
555-
tag, then the data attribute of its rule should be set to `["foo.png"]` so the
556-
image is available in the web server runfiles.
557-
558-
- **deps:** (List of [labels]; optional) List of [closure_js_library],
559-
[closure_js_template_library] and [closure_js_proto_library] targets which
560-
define symbols referenced by the template.
561-
562-
- **globals:** (List of [labels]; optional) List of text files containing symbol
563-
definitions that are only considered at compile-time. For example, this file
564-
might look as follows:
565-
566-
com.foo.bar.Debug.PRODUCTION = 0
567-
com.foo.bar.Debug.DEBUG = 1
568-
com.foo.bar.Debug.RAW = 2
569-
570-
- **plugin_modules:** (List of [labels]; optional; default is `[]`) Passed along
571-
verbatim to the SoyToJsSrcCompiler above.
572-
573-
- **should_generate_js_doc:** (Boolean; optional; default is `True`) Passed
574-
along verbatim to the SoyToJsSrcCompiler above.
575-
576-
- **should_generate_soy_msg_defs:** (Boolean; optional; default is `False`)
577-
Passed along verbatim to the SoyToJsSrcCompiler above.
578-
579-
- **bidi_global_dir:** (Integer; optional; default is `1`)
580-
Passed along verbatim to the SoyToJsSrcCompiler above.
581-
Valid values are 1 (LTR) or -1 (RTL).
582-
583-
- **soy_msgs_are_external:** (Boolean; optional; default is `False`) Passed
584-
along verbatim to the SoyToJsSrcCompiler above.
585-
586-
- **defs:** (List of strings; optional) Passed along verbatim to the
587-
SoyToJsSrcCompiler above.
588-
589-
## closure\_java\_template\_library
590-
591-
```starlark
592-
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_java_template_library")
593-
closure_java_template_library(name, srcs, data, deps, java_package)
594-
```
595-
596-
Compiles Closure templates to Java source files.
597-
598-
This rule is necessary in order to serve Closure templates from a Java backend.
599-
600-
Unlike [closure_js_template_library], globals are not specified by this rule.
601-
They get added at runtime by your Java code when serving templates.
602-
603-
This rule pulls in a transitive dependency on Guava, Guice, and ICU4J.
604-
605-
The documentation on using Closure Templates can be found
606-
[here][Closure Templates].
607-
608-
For additional help on using some of these attributes, please see the output of
609-
the following:
610-
611-
bazel run @com_google_template_soy//:SoyParseInfoGenerator -- --help
612-
613-
#### Implicit Output Targets
614-
615-
- SrcSoyInfo.java: A separate Java source file is generated for each file
616-
listed under `srcs`. The filename will be the same as the template, converted
617-
to upper camel case, with a `SoyInfo.java` suffix. For example `foo_bar.soy`
618-
would become `FooBarSoyInfo.java`.
619-
620-
#### Rule Polymorphism
621-
622-
This rule can be referenced as though it were the following:
623-
624-
- [filegroup]: `srcs` will be the compiled jar file and `data` will contain all
625-
transitive data.
626-
627-
- [java_library]: `srcs` will be the generated Java source files, and `data`
628-
will contain the transitive data.
629-
630-
### Arguments
631-
632-
- **name:** ([Name]; required) A unique name for this rule.
633-
634-
- **srcs:** (List of [labels]; required) A list of `.soy` source files that
635-
represent this library.
636-
637-
- **data:** (List of [labels]; optional) Runfiles directly referenced by Soy
638-
sources in this rule. For example, if the template has an `<img src=foo.png>`
639-
tag, then the data attribute of its rule should be set to `["foo.png"]` so the
640-
image is available in the web server runfiles.
641-
642-
- **deps:** (List of [labels]; optional) Soy files to parse but not to generate
643-
outputs for.
644-
645-
- **java_package:** (List of [labels]; required) The package for the Java files
646-
that are generated, e.g. `"com.foo.soy"`.
647-
648-
649-
## closure\_py\_template\_library
650-
651-
TODO
652-
653-
654497
## closure\_css\_library
655498

656499
```starlark
@@ -665,8 +508,7 @@ This rule does not compile your stylesheets; it is used in conjunction with
665508

666509
This rule should be referenced by any [closure_js_library] rule whose sources
667510
contain a `goog.getCssName('foo')` call if `foo` is a CSS class name defined by
668-
this rule. The same concept applies to [closure_js_template_library] rules that
669-
contain `{css('foo')}` expressions.
511+
this rule.
670512

671513
#### Rule Polymorphism
672514

@@ -783,10 +625,6 @@ This rule can be referenced as though it were the following:
783625
target, so the build system can verify (at compile time) that your CSS and
784626
JS binaries are both being compiled in a harmonious way.
785627

786-
You'll also need update your templates to say `{css('foo-bar')}` in place of
787-
class names. The [closure_js_template_library] must also depend on the
788-
appropriate CSS library.
789-
790628
- **debug:** (Boolean; optional; default is `False`) Enables debug mode, which
791629
causes the compiled stylesheet to be pretty printed. If `renaming = True` then
792630
class names will be renamed, but still readable to humans.
@@ -844,9 +682,6 @@ Defines a set of Protocol Buffer files.
844682

845683
- *name*.js: A generated protocol buffer JavaScript library.
846684

847-
- *name*.descriptor: A protoc FileDescriptorsSet representation of the .proto
848-
files.
849-
850685
#### Rule Polymorphism
851686

852687
This rule can be referenced as though it were the following:
@@ -909,7 +744,6 @@ This rule can be referenced as though it were the following:
909744
[Closure Compiler]: https://developers.google.com/closure/compiler/
910745
[Closure Library]: https://developers.google.com/closure/library/
911746
[Closure Stylesheets]: https://github.com/google/closure-stylesheets
912-
[Closure Templates]: https://developers.google.com/closure/templates/
913747
[Closure Tools]: https://developers.google.com/closure/
914748
[Closure coding conventions]: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/ClosureCodingConvention.java
915749
[ECMASCRIPT6]: http://es6-features.org/
@@ -928,14 +762,11 @@ This rule can be referenced as though it were the following:
928762
[closure_css_binary]: #closure_css_binary
929763
[closure_css_library]: #closure_css_library
930764
[closure_grpc_web_library]: https://github.com/grpc/grpc-web/blob/9b7b2d5411c486aa646ba2491cfd894d5352775b/bazel/closure_grpc_web_library.bzl#L149
931-
[closure_java_template_library]: #closure_java_template_library
932765
[closure_js_binary]: #closure_js_binary
933766
[closure_js_library]: #closure_js_library
934767
[closure_js_proto_library]: #closure_js_proto_library
935-
[closure_js_template_library]: #closure_js_template_library
936768
[closure_js_test]: #closure_js_test
937769
[closure_proto_library]: #closure_proto_library
938-
[closure_py_template_library]: #closure_py_template_library
939770
[coffeescript]: http://coffeescript.org/
940771
[compiler-issue]: https://github.com/google/closure-compiler/issues/new
941772
[css-sourcemap]: https://developer.chrome.com/devtools/docs/css-preprocessors

closure/compiler/closure_js_library.bzl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def _closure_js_library_impl(
102102
includes = (),
103103
exports = depset(),
104104
deps_stylesheets = [],
105-
internal_descriptors = depset(),
106105
no_closure_library = False,
107106
internal_expect_failure = False,
108107
artifact_suffix = "",
@@ -299,9 +298,6 @@ def _closure_js_library_impl(
299298
unusable_type_definition = unusable_type_definition,
300299
)
301300

302-
if type(internal_descriptors) == "list":
303-
internal_descriptors = depset(internal_descriptors)
304-
305301
# We now export providers to any parent Target. This is considered a public
306302
# interface because other Skylark rules can be designed to do things with
307303
# this data. Other Skylark rules can even export their own provider with the
@@ -336,11 +332,6 @@ def _closure_js_library_impl(
336332
# within any given transitive closure, no namespace collisions
337333
# exist. These MUST NOT begin with "/" or ".", or contain "..".
338334
modules = depset(modules, transitive = [js.modules]),
339-
# NestedSet<File> of all protobuf definitions in the transitive
340-
# closure. It is used so Closure Templates can have information about
341-
# the structure of protobufs so they can be easily rendered in .soy
342-
# files with type safety. See closure_js_template_library.bzl.
343-
descriptors = depset(transitive = [js.descriptors, internal_descriptors]),
344335
# NestedSet<Label> of all closure_css_library rules in the transitive
345336
# closure. This is used by closure_js_binary can guarantee the
346337
# completeness of goog.getCssName() substitutions.
@@ -395,7 +386,6 @@ def _closure_js_library(ctx):
395386
getattr(ctx.attr, "includes", []),
396387
extract_providers(ctx.attr.exports, ClosureJsLibraryInfo),
397388
extract_providers(ctx.attr.deps, ClosureCssLibraryInfo),
398-
ctx.files.internal_descriptors,
399389
ctx.attr.no_closure_library,
400390
ctx.attr.internal_expect_failure,
401391
"", # artifact_suffix
@@ -447,7 +437,6 @@ closure_js_library = rule(
447437
"language": attr.string(),
448438

449439
# internal only
450-
"internal_descriptors": attr.label_list(allow_files = True),
451440
"internal_expect_failure": attr.bool(default = False),
452441
}, **CLOSURE_JS_TOOLCHAIN_ATTRS),
453442
# TODO(yannic): Deprecate.

closure/private/defs.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CSS_FILE_TYPE = [".css", ".gss"]
1919
HTML_FILE_TYPE = [".html"]
2020
JS_FILE_TYPE = [".js"]
2121
JS_TEST_FILE_TYPE = ["_test.js"]
22-
SOY_FILE_TYPE = [".soy"]
2322

2423
JS_LANGUAGE_IN = "STABLE"
2524
JS_LANGUAGE_OUT_DEFAULT = "ECMASCRIPT5"
@@ -92,11 +91,6 @@ closure. These are generated from the source file path relative to
9291
the longest matching root prefix. It is used to guarantee that
9392
within any given transitive closure, no namespace collisions
9493
exist. These MUST NOT begin with "/" or ".", or contain "..".""",
95-
"descriptors": """
96-
NestedSet<File> of all protobuf definitions in the transitive
97-
closure. It is used so Closure Templates can have information about
98-
the structure of protobufs so they can be easily rendered in .soy
99-
files with type safety. See closure_js_template_library.bzl.""",
10094
"stylesheets": """
10195
NestedSet<Label> of all closure_css_library rules in the transitive
10296
closure. This is used by closure_js_binary can guarantee the
@@ -156,7 +150,6 @@ def collect_js(
156150
ijs_files = []
157151
infos = []
158152
modules = []
159-
descriptors = []
160153
stylesheets = []
161154
js_module_roots = []
162155
has_closure_library = False
@@ -165,7 +158,6 @@ def collect_js(
165158
ijs_files.append(getattr(dep, "ijs_files", depset()))
166159
infos.append(getattr(dep, "infos", depset()))
167160
modules.append(getattr(dep, "modules", depset()))
168-
descriptors.append(getattr(dep, "descriptors", depset()))
169161
stylesheets.append(getattr(dep, "stylesheets", depset()))
170162
js_module_roots.append(getattr(dep, "js_module_roots", depset()))
171163
has_closure_library = (
@@ -188,7 +180,6 @@ def collect_js(
188180
ijs_files = depset(transitive = ijs_files),
189181
infos = depset(transitive = infos),
190182
modules = depset(transitive = modules),
191-
descriptors = depset(transitive = descriptors),
192183
stylesheets = depset(transitive = stylesheets),
193184
has_closure_library = has_closure_library,
194185
)

closure/protobuf/closure_js_proto_library.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def closure_js_proto_library(
5050

5151
cmd += ["-I%s" % i for i in _collect_includes(srcs)]
5252
cmd.append("--js_out=%s:$(@D)" % ",".join(js_out_options))
53-
cmd.append("--descriptor_set_out=$(@D)/%s.descriptor" % name)
5453
cmd += ["$(locations " + src + ")" for src in srcs]
5554

5655
native.genrule(
@@ -59,7 +58,7 @@ def closure_js_proto_library(
5958
testonly = testonly,
6059
visibility = ["//visibility:private"],
6160
message = "Generating JavaScript Protocol Buffer file",
62-
outs = [name + ".js", name + ".descriptor"],
61+
outs = [name + ".js"],
6362
tools = [protocbin],
6463
cmd = " ".join(cmd),
6564
)
@@ -72,7 +71,6 @@ def closure_js_proto_library(
7271
str(Label("@com_google_javascript_closure_library//closure/goog/array")),
7372
str(Label("//closure/protobuf:jspb")),
7473
],
75-
internal_descriptors = [name + ".descriptor"],
7674
suppress = suppress + [
7775
"missingProperties",
7876
"unusedLocalVariables",

0 commit comments

Comments
 (0)