Have the instrumentation visitor only run on sources
this is necessary because the VeLogValidationPass doesn't run on deps which in turn is done for performance reasons.
@@ -19,6 +19,7 @@ package com.google.template.soy.jssrc.internal;
import com.google.common.base.Strings;
import com.google.template.soy.base.SourceLocation;
import com.google.template.soy.base.internal.IdGenerator;
+import com.google.template.soy.base.internal.SoyFileKind;
import com.google.template.soy.basetree.CopyState;
import com.google.template.soy.error.ErrorReporter;
import com.google.template.soy.exprtree.FunctionNode;
@@ -41,6 +42,7 @@ import com.google.template.soy.soytree.IfNode;
import com.google.template.soy.soytree.LetContentNode;
import com.google.template.soy.soytree.PrintNode;
import com.google.template.soy.soytree.RawTextNode;
+import com.google.template.soy.soytree.SoyFileNode;
import com.google.template.soy.soytree.SoyFileSetNode;
import com.google.template.soy.soytree.SoyNode;
import com.google.template.soy.soytree.SoyNode.ParentSoyNode;
@@ -82,6 +84,16 @@ final class VeLogInstrumentationVisitor extends AbstractSoyNodeVisitor<Void> {
new DesugarHtmlNodesPass().run(node, templateRegistry);
}
+ @Override
+ protected void visitSoyFileNode(SoyFileNode node) {
+ // only instrument source files, deps haven't had the logging passes run so the logging ids
+ // aren't available. Also, it is pointless.
+ if (node.getSoyFileKind() != SoyFileKind.SRC) {
+ return;
+ }
+ super.visitSoyFileNode(node);
+ }
+
/** Adds data-soylog attribute to the top-level DOM node in this {velog} block. */
@Override
protected void visitVeLogNode(VeLogNode node) {
