Fix bug when building for Generic (iOS) Device

PiperOrigin-RevId: 199687667
diff --git a/src/TulsiGenerator/Scripts/bazel_build.py b/src/TulsiGenerator/Scripts/bazel_build.py
index 1b11836..75b1262 100755
--- a/src/TulsiGenerator/Scripts/bazel_build.py
+++ b/src/TulsiGenerator/Scripts/bazel_build.py
@@ -535,12 +535,14 @@
       self.update_symbol_cache = UpdateSymbolCache()
 
     # Target architecture.  Must be defined for correct setting of
-    # the --cpu flag
-    self.arch = os.environ.get('ARCHS')
-    if not self.arch:
+    # the --cpu flag. Note that Xcode will set multiple values in
+    # ARCHS when building for a Generic Device.
+    archs = os.environ.get('ARCHS')
+    if not archs:
       _PrintXcodeError('Tulsi requires env variable ARCHS to be '
                        'set.  Please file a bug against Tulsi.')
       sys.exit(1)
+    self.arch = archs.split()[-1]
 
     # Path into which generated artifacts should be copied.
     self.built_products_dir = os.environ['BUILT_PRODUCTS_DIR']