[go: nahoru, domu]

siso: pass ios_sdk_path and mac_sdk_path from gn

Bug: b/323091468
Change-Id: Ibddb9833bbb03a1ff773a87d5f06bb8efd29fd26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5666079
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Richard Wang <richardwa@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Cr-Commit-Position: refs/heads/main@{#1321991}
diff --git a/build/config/ios/ios_sdk.gni b/build/config/ios/ios_sdk.gni
index ff3e26f..3593dc7 100644
--- a/build/config/ios/ios_sdk.gni
+++ b/build/config/ios/ios_sdk.gni
@@ -153,3 +153,6 @@
 # This variable corresponds to the test bundle identifier.
 shared_bundle_id_for_test_apps =
     "$ios_app_bundle_id_prefix.chrome.unittests.dev"
+
+_sdk_root = rebase_path(ios_sdk_path, root_build_dir)
+ios_sdk_logs = [ "ios_sdk_path=${_sdk_root}" ]
diff --git a/build/config/mac/mac_sdk.gni b/build/config/mac/mac_sdk.gni
index 09902c6..2be0168 100644
--- a/build/config/mac/mac_sdk.gni
+++ b/build/config/mac/mac_sdk.gni
@@ -141,3 +141,6 @@
   # TODO(thakis): Do this at the uses of this variable instead.
   mac_bin_path = rebase_path(mac_bin_path, root_build_dir)
 }
+
+_sdk_root = rebase_path(mac_sdk_path, root_build_dir)
+mac_sdk_logs = [ "mac_sdk_path=${_sdk_root}" ]
diff --git a/build/config/siso/clang_mac.star b/build/config/siso/clang_mac.star
index 53a59b3..b63f3e84 100644
--- a/build/config/siso/clang_mac.star
+++ b/build/config/siso/clang_mac.star
@@ -38,35 +38,17 @@
     # which is not complex enough to handle C preprocessor tricks
     # and need system include dirs when using deps log of -MMD.
     # need to add new entries when new version is used.
-    # TODO: b/323091468 - get sysroot, ios_sdk_path from gn
-    fg[ctx.fs.canonpath("./sdk/xcode_links/MacOSX14.2.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
-    fg[ctx.fs.canonpath("./sdk/xcode_links/iPhoneSimulator17.2.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
-
-    # https://b.corp.google.com/issues/332652041#comment2
-    fg[ctx.fs.canonpath("./sdk/xcode_links/MacOSX14.4.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
-    fg[ctx.fs.canonpath("./sdk/xcode_links/iPhoneSimulator17.4.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
-
-    # https://chromium-review.googlesource.com/c/chromium/src/+/5568662
-    fg[ctx.fs.canonpath("./sdk/xcode_links/MacOSX14.5.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
-    fg[ctx.fs.canonpath("./sdk/xcode_links/iPhoneSimulator17.5.sdk") + ":headers"] = {
-        "type": "glob",
-        "includes": sdk_includes,
-    }
+    gn_logs_data = gn_logs.read(ctx)
+    if gn_logs_data.get("mac_sdk_path"):
+        fg[ctx.fs.canonpath("./" + gn_logs_data.get("mac_sdk_path")) + ":headers"] = {
+            "type": "glob",
+            "includes": sdk_includes,
+        }
+    if gn_logs_data.get("ios_sdk_path"):
+        fg[ctx.fs.canonpath("./" + gn_logs_data.get("ios_sdk_path")) + ":headers"] = {
+            "type": "glob",
+            "includes": sdk_includes,
+        }
 
     fg[ctx.fs.canonpath("./sdk/xcode_links/iPhoneSimulator.platform/Developer/Library/Frameworks") + ":headers"] = {
         "type": "glob",
diff --git a/build/gn_logs.gni b/build/gn_logs.gni
index 213b093..76e2da4 100644
--- a/build/gn_logs.gni
+++ b/build/gn_logs.gni
@@ -9,4 +9,13 @@
 build_gn_logs = [ "### compiler.gni ###" ] + compiler_logs
 build_gn_logs += [ "" ]
 
+if (target_os == "ios") {
+  import("//build/config/ios/ios_sdk.gni")
+  import("//build/config/mac/mac_sdk.gni")
+  build_gn_logs += [ "### ios_sdk.gni ###" ] + ios_sdk_logs
+  build_gn_logs += [ "" ]
+  build_gn_logs += [ "### mac_sdk.gni ###" ] + mac_sdk_logs
+  build_gn_logs += [ "" ]
+}
+
 build_gn_logs += [ "#### get_concurrent_links.py ####" ] + concurrent_links_logs