[apple] Remove support for frameworks in libs

As configs now support both "frameworks" and "weak_frameworks",
remove support for frameworks from "libs", printing an error if
users try to assign Foo.framework to "libs".

Bug: chromium:1052560
Change-Id: I82a29aa16432e0659c18d9c1432692b090602e64
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/9240
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/docs/reference.md b/docs/reference.md
index ad1ef27..8fc86fd 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -3729,10 +3729,6 @@
         Expands to the list of system libraries to link to. Each will be
         prefixed by the "lib_switch".
 
-        As a special case to support Mac, libraries with names ending in
-        ".framework" will be added to the {{libs}} with "-framework" preceding
-        it, and the lib prefix will be ignored.
-
         Example: "-lfoo -lbar"
 
     {{output_dir}}
@@ -5699,12 +5695,6 @@
       "lib_dirs" so the given library is found. Your BUILD.gn file should not
       specify the switch (like "-l"): this will be encoded in the "lib_switch"
       of the tool.
-
-  Apple frameworks
-      System libraries ending in ".framework" will be special-cased: the switch
-      "-framework" will be prepended instead of the lib_switch, and the
-      ".framework" suffix will be trimmed. This is to support the way Mac links
-      framework dependencies.
 ```
 
 #### **Ordering of flags and values**
@@ -7347,7 +7337,7 @@
     group("a") {
       metadata = {
         my_files = [ "foo.cpp" ]
-        my_files_barrier [ ":b" ]
+        my_files_barrier = [ ":b" ]
       }
 
       deps = [ ":b", ":c" ]
@@ -7367,7 +7357,8 @@
 
     generated_file("metadata") {
       outputs = [ "$root_build_dir/my_files.json" ]
-      data_keys = [ "my_files", "my_extra_files" ]
+      data_keys = [ "my_files" ]
+      walk_keys = [ "my_files_barrier" ]
 
       deps = [ ":a" ]
     }
diff --git a/src/gn/format_test_data/048.gn b/src/gn/format_test_data/048.gn
index 7d39efb..2584b75 100644
--- a/src/gn/format_test_data/048.gn
+++ b/src/gn/format_test_data/048.gn
@@ -6,7 +6,7 @@
       "src/AddressBook/GTMABAddressBook.m",
     ]
 
-    libs = [
+    frameworks = [
       "AddressBook.framework",
       "AppKit.framework",
     ]
diff --git a/src/gn/format_test_data/048.golden b/src/gn/format_test_data/048.golden
index 7d39efb..2584b75 100644
--- a/src/gn/format_test_data/048.golden
+++ b/src/gn/format_test_data/048.golden
@@ -6,7 +6,7 @@
       "src/AddressBook/GTMABAddressBook.m",
     ]
 
-    libs = [
+    frameworks = [
       "AddressBook.framework",
       "AppKit.framework",
     ]
diff --git a/src/gn/function_toolchain.cc b/src/gn/function_toolchain.cc
index 0ff5d34..ac63c2e 100644
--- a/src/gn/function_toolchain.cc
+++ b/src/gn/function_toolchain.cc
@@ -661,10 +661,6 @@
         Expands to the list of system libraries to link to. Each will be
         prefixed by the "lib_switch".
 
-        As a special case to support Mac, libraries with names ending in
-        ".framework" will be added to the {{libs}} with "-framework" preceding
-        it, and the lib prefix will be ignored.
-
         Example: "-lfoo -lbar"
 
     {{output_dir}}
diff --git a/src/gn/ninja_binary_target_writer.cc b/src/gn/ninja_binary_target_writer.cc
index e12e836..4379ca0 100644
--- a/src/gn/ninja_binary_target_writer.cc
+++ b/src/gn/ninja_binary_target_writer.cc
@@ -333,17 +333,9 @@
   for (size_t i = 0; i < all_libs.size(); i++) {
     const LibFile& lib_file = all_libs[i];
     const std::string& lib_value = lib_file.value();
-    std::string_view framework_name = GetFrameworkName(lib_value);
     if (lib_file.is_source_file()) {
       out << " " << tool->linker_arg();
       path_output_.WriteFile(out, lib_file.source_file());
-    } else if (!framework_name.empty()) {
-      // Special-case libraries ending in ".framework" to support Mac: Add the
-      // -framework switch and don't add the extension to the output.
-      // TODO(crbug.com/gn/119): remove this once all code has been ported to
-      // use "frameworks" and "framework_dirs" instead.
-      out << " " << tool->framework_switch();
-      EscapeStringToStream(out, framework_name, lib_escape_opts);
     } else {
       out << " " << tool->lib_switch();
       EscapeStringToStream(out, lib_value, lib_escape_opts);
diff --git a/src/gn/value_extractors.cc b/src/gn/value_extractors.cc
index 74ea345..9eb7593 100644
--- a/src/gn/value_extractors.cc
+++ b/src/gn/value_extractors.cc
@@ -8,6 +8,7 @@
 
 #include "gn/build_settings.h"
 #include "gn/err.h"
+#include "gn/frameworks_utils.h"
 #include "gn/label.h"
 #include "gn/source_dir.h"
 #include "gn/source_file.h"
@@ -80,6 +81,11 @@
   bool operator()(const Value& v, LibFile* out, Err* err) const {
     if (!v.VerifyTypeIs(Value::STRING, err))
       return false;
+    if (!GetFrameworkName(v.string_value()).empty()) {
+      *err = Err(v, "Unsupported value in libs.",
+                 "Use frameworks to list framework dependencies.");
+      return false;
+    }
     if (v.string_value().find('/') == std::string::npos) {
       *out = LibFile(v.string_value());
     } else {
diff --git a/src/gn/variables.cc b/src/gn/variables.cc
index daabdb5..b543dd2 100644
--- a/src/gn/variables.cc
+++ b/src/gn/variables.cc
@@ -1408,12 +1408,6 @@
       "lib_dirs" so the given library is found. Your BUILD.gn file should not
       specify the switch (like "-l"): this will be encoded in the "lib_switch"
       of the tool.
-
-  Apple frameworks
-      System libraries ending in ".framework" will be special-cased: the switch
-      "-framework" will be prepended instead of the lib_switch, and the
-      ".framework" suffix will be trimmed. This is to support the way Mac links
-      framework dependencies.
 )" COMMON_ORDERING_HELP LIBS_AND_LIB_DIRS_ORDERING_HELP
     R"(
 Examples