[cobalt] Fix BUILD.gn to not expect fuchsia gni files

This is similar to previous change f3191da which was undone by 16e9935,
preventing Cobalt from updating to the latest boringssl version. We now
need to update in order to get the recent conversion warning changes
done by shayba@.

BUG: 55352
BUG: 59275
Change-Id: Ie4d931106873d9cb56dd3907f1f2ceb9e2fd1a33
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/boringssl/+/430717
Reviewed-by: Zach Bush <zmbush@google.com>
Commit-Queue: Cameron Dale <camrdale@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index b129feb..dd0b46d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3,11 +3,14 @@
 # found in the LICENSE file.
 
 import("//build/fuzzing/fuzzer.gni")
-import("//build/package.gni")
-import("//build/test/test_package.gni")
 import("BUILD.generated.gni")
 import("BUILD.generated_tests.gni")
 
+if (is_fuchsia) {
+  import("//build/package.gni")
+  import("//build/test/test_package.gni")
+}
+
 ################################################################################
 # Public targets
 
@@ -44,17 +47,19 @@
   # TODO(fxb/58162): delete the below and fix compiler warnings
   configs += [ "//build/config:Wno-conversion" ]
 
-  # TODO(46910): UBSan has found an instance of undefined behavior in this target.
-  # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
-  configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
+  if (is_fuchsia) {
+    # TODO(46910): UBSan has found an instance of undefined behavior in this target.
+    # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
+    configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
 
-  # TODO(60545): profile instrumentation significantly affects performance.
-  configs += [ "//build/config:no_profile" ]
+    # TODO(60545): profile instrumentation significantly affects performance.
+    configs += [ "//build/config:no_profile" ]
 
-  # boringssl should always be optimized for speed because otherwise performance is significantly
-  # worse, impacting pave and boot times on debug builds (fxb/55456)
-  configs -= [ "//build/config:default_optimize" ]
-  configs += [ "//build/config:optimize_speed" ]
+    # boringssl should always be optimized for speed because otherwise performance is significantly
+    # worse, impacting pave and boot times on debug builds (fxb/55456)
+    configs -= [ "//build/config:default_optimize" ]
+    configs += [ "//build/config:optimize_speed" ]
+  }
 }
 
 target(default_library_type, "ssl") {
@@ -67,10 +72,12 @@
   # TODO(fxb/58162): delete the below and fix compiler warnings
   configs += [ "//build/config:Wno-conversion" ]
 
-  # boringssl should always be optimized for speed because otherwise performance is significantly
-  # worse, impacting pave and boot times on debug builds (fxb/55456)
-  configs -= [ "//build/config:default_optimize" ]
-  configs += [ "//build/config:optimize_speed" ]
+  if (is_fuchsia) {
+    # boringssl should always be optimized for speed because otherwise performance is significantly
+    # worse, impacting pave and boot times on debug builds (fxb/55456)
+    configs -= [ "//build/config:default_optimize" ]
+    configs += [ "//build/config:optimize_speed" ]
+  }
 }
 
 source_set("crypto_unsafe") {
@@ -83,9 +90,11 @@
   # TODO(fxb/58162): delete the below and fix compiler warnings
   configs += [ "//build/config:Wno-conversion" ]
 
-  # TODO(46910): UBSan has found an instance of undefined behavior in this target.
-  # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
-  configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
+  if (is_fuchsia) {
+    # TODO(46910): UBSan has found an instance of undefined behavior in this target.
+    # Disable UBSan for this target temporarily until it is migrated into CI/CQ.
+    configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ]
+  }
 }
 
 source_set("ssl_unsafe") {
@@ -152,25 +161,27 @@
 ##############
 # Unit tests #
 ##############
-unittest_package("boringssl_tests") {
-  deps = [
-    ":crypto_test",
-    ":ssl_test",
-  ]
-  tests = [
-    {
-      name = "crypto_test"
+if (is_fuchsia) {
+  unittest_package("boringssl_tests") {
+    deps = [
+      ":crypto_test",
+      ":ssl_test",
+    ]
+    tests = [
+      {
+        name = "crypto_test"
 
-      # This test takes a long time to run, and it is included in every subset
-      # of the Fuchsia build.
-      # TODO(bgoldman): Find a way to skip this test when runtests is set to
-      # skip "large" tests.
-      disabled = true
-    },
-    {
-      name = "ssl_test"
-    },
-  ]
+        # This test takes a long time to run, and it is included in every subset
+        # of the Fuchsia build.
+        # TODO(bgoldman): Find a way to skip this test when runtests is set to
+        # skip "large" tests.
+        disabled = true
+      },
+      {
+        name = "ssl_test"
+      },
+    ]
+  }
 }
 
 group("tests") {