[escher] Fix Scenic GLSLang build error

This CL makes it easier for clients of Escher to
include it as a dependency without having to know
which version of Escher to use (e.g. with or without
glsl support). Clients can simply include "escher" and
the correct version will be included automatically (based
on fx set build flags).

Clients that always need a specific version of Escher can
instead depend on either "escher_with_glslang" or
"escher_no_glslang" depending on their needs.

Change-Id: I11f34c146d439f84dc4155a8aa7ba4e47e70fd76
diff --git a/src/ui/examples/escher/common/BUILD.gn b/src/ui/examples/escher/common/BUILD.gn
index cefb7eb..526348c 100644
--- a/src/ui/examples/escher/common/BUILD.gn
+++ b/src/ui/examples/escher/common/BUILD.gn
@@ -40,7 +40,7 @@
     "demo.cc",
     "demo.h",
   ]
-  public_deps = [ "//src/ui/lib/escher:escher" ]
+  public_deps = [ "//src/ui/lib/escher:escher_with_glslang" ]
 }
 
 source_set("demo_harness_fuchsia") {
@@ -80,5 +80,5 @@
 source_set("headers") {
   visibility = [ ":*" ]
   sources = [ "demo_harness.h" ]
-  public_deps = [ "//src/ui/lib/escher:escher" ]
+  public_deps = [ "//src/ui/lib/escher:escher_with_glslang" ]
 }
diff --git a/src/ui/examples/shadertoy/service/BUILD.gn b/src/ui/examples/shadertoy/service/BUILD.gn
index 6833592..4d8e749 100644
--- a/src/ui/examples/shadertoy/service/BUILD.gn
+++ b/src/ui/examples/shadertoy/service/BUILD.gn
@@ -35,7 +35,7 @@
     "//src/lib/fxl",
     "//src/lib/vulkan",
     "//src/ui/examples/escher/common",
-    "//src/ui/lib/escher:escher",
+    "//src/ui/lib/escher:escher_with_glslang",
     "//src/ui/lib/glm_workaround",
     "//zircon/public/lib/async-loop-cpp",
     "//zircon/public/lib/async-loop-default",
diff --git a/src/ui/lib/escher/BUILD.gn b/src/ui/lib/escher/BUILD.gn
index b5073f7..462078b 100644
--- a/src/ui/lib/escher/BUILD.gn
+++ b/src/ui/lib/escher/BUILD.gn
@@ -472,7 +472,7 @@
   }
 }
 
-escher_library("escher") {
+escher_library("escher_with_glslang") {
   use_runtime_glsl = true
 }
 
@@ -480,6 +480,14 @@
   use_runtime_glsl = false
 }
 
+source_set("escher") {
+  if (escher_use_runtime_glsl) {
+    public_deps = [ "//src/ui/lib/escher:escher_with_glslang" ]
+  } else {
+    public_deps = [ "//src/ui/lib/escher:escher_no_glslang" ]
+  }
+}
+
 group("unittests") {
   testonly = true
   deps = [ "//src/ui/lib/escher/test:escher_unittests" ]
diff --git a/src/ui/lib/escher/test/BUILD.gn b/src/ui/lib/escher/test/BUILD.gn
index aa22f5c..a25a142 100644
--- a/src/ui/lib/escher/test/BUILD.gn
+++ b/src/ui/lib/escher/test/BUILD.gn
@@ -200,8 +200,13 @@
       "vk_debug_report_collector.h",
     ]
     public_deps = [ ":gtest_vulkan" ]
+
+    # Explicitly check for runtime glsl here instead of simply
+    # doing "public_deps += [ "//src/ui/lib/escher" ] and letting
+    # it set automatically, so that we can have tests with and without
+    # glsl, regardless of what the rest of Scenic is doing.
     if (gtest_escher_library_use_runtime_glsl) {
-      public_deps += [ "//src/ui/lib/escher" ]
+      public_deps += [ "//src/ui/lib/escher:escher_with_glslang" ]
     } else {
       public_deps += [ "//src/ui/lib/escher:escher_no_glslang" ]
     }
diff --git a/src/ui/scenic/lib/gfx/BUILD.gn b/src/ui/scenic/lib/gfx/BUILD.gn
index cc5ae8b..42a5c8b4 100644
--- a/src/ui/scenic/lib/gfx/BUILD.gn
+++ b/src/ui/scenic/lib/gfx/BUILD.gn
@@ -2,7 +2,6 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//src/ui/lib/escher/build_args.gni")
 import("//third_party/flatbuffers/flatbuffer.gni")
 
 declare_args() {
@@ -33,15 +32,6 @@
   ]
 }
 
-# Use build flag to determine which version of escher is used.
-source_set("escher_maybe_with_glsl") {
-  if (escher_use_runtime_glsl) {
-    public_deps = [ "//src/ui/lib/escher" ]
-  } else {
-    public_deps = [ "//src/ui/lib/escher:escher_no_glslang" ]
-  }
-}
-
 # These sources (all part of :gfx) are especially performance-sensitive, so we
 # apply full optimization in debug as well as --release.
 source_set("gfx_always_optimized") {
@@ -55,7 +45,7 @@
     "-O3",
   ]
   public_configs = [ ":common_include_dirs" ]
-  public_deps = [ ":escher_maybe_with_glsl" ]
+  public_deps = [ "//src/ui/lib/escher" ]
 
   deps = [
     "//sdk/lib/images/cpp",
@@ -294,8 +284,8 @@
   ]
   deps = [
     # TODO(SCN-1398): Needed by wrap/unwrap.  Move to separate source_set?
-    ":escher_maybe_with_glsl",
     "//src/lib/fxl",
+    "//src/ui/lib/escher",
   ]
 }
 
diff --git a/src/ui/scenic/lib/scenic/BUILD.gn b/src/ui/scenic/lib/scenic/BUILD.gn
index 93089a3..70d4aa3 100644
--- a/src/ui/scenic/lib/scenic/BUILD.gn
+++ b/src/ui/scenic/lib/scenic/BUILD.gn
@@ -35,7 +35,7 @@
     "//sdk/lib/sys/cpp",
     "//src/lib/fsl",
     "//src/lib/inspect_deprecated",
-    "//src/ui/lib/escher:escher_no_glslang",
+    "//src/ui/lib/escher",
     "//src/ui/scenic/lib/gfx:view_focuser_registry",
     "//src/ui/scenic/lib/scheduling:frame_scheduler",
     "//zircon/public/lib/trace",
diff --git a/src/ui/tools/paper_shader_compiler/BUILD.gn b/src/ui/tools/paper_shader_compiler/BUILD.gn
index 6ef6828..68fc116 100644
--- a/src/ui/tools/paper_shader_compiler/BUILD.gn
+++ b/src/ui/tools/paper_shader_compiler/BUILD.gn
@@ -8,7 +8,8 @@
   sources = [ "main.cc" ]
 
   deps = [
-    "//src/ui/lib/escher:escher",
+    # Shader precompiler should always be built with glslang.
+    "//src/ui/lib/escher:escher_with_glslang",
     "//src/ui/lib/escher/shaders/util:shader_utils",
     "//third_party/shaderc:libshaderc",
   ]