Merge pull request #79 from agluszak:system_library

PiperOrigin-RevId: 333279551
Change-Id: I6fdf5aca5881b271d30f5acbad48e0c1ae281237
diff --git a/CODEOWNERS b/CODEOWNERS
index 1a40092..a9dcf6d 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -1 +1 @@
-* @hlopko @scentini @oquenchil
\ No newline at end of file
+* @oquenchil @c-mita @comius
diff --git a/cc/system_library.bzl b/cc/system_library.bzl
index 41f286e..f87bb35 100644
--- a/cc/system_library.bzl
+++ b/cc/system_library.bzl
@@ -111,12 +111,12 @@
     cmd = """
           print | \\
           {} -Wp,-v -x c++ - -fsyntax-only 2>&1 | \\
-          sed -n -e '/^\s\+/p' | \\
+          sed -n -e '/^\\s\\+/p' | \\
           sed -e 's/^[ \t]*//'
           """.format(compiler)
     system_includes = _execute_bash(repo_ctx, cmd).split("\n")
     all_includes = (override_paths + includes +
-        system_includes + additional_paths)
+                    system_includes + additional_paths)
 
     for directory in all_includes:
         cmd = """
@@ -138,9 +138,17 @@
     shared_lib_names = repo_ctx.attr.shared_lib_names
 
     static_lib_name, static_lib_path = _find_lib_path(
-        repo_ctx, repo_name, static_lib_names, lib_path_hints)
+        repo_ctx,
+        repo_name,
+        static_lib_names,
+        lib_path_hints,
+    )
     shared_lib_name, shared_lib_path = _find_lib_path(
-        repo_ctx, repo_name, shared_lib_names, lib_path_hints)
+        repo_ctx,
+        repo_name,
+        shared_lib_names,
+        lib_path_hints,
+    )
 
     if not static_lib_path and not shared_lib_path:
         fail("Library {} could not be found".format(repo_name))
@@ -215,9 +223,9 @@
         remote_static_library = "remote/" + static_lib_name
         link_library_command = """
 mkdir -p $(RULEDIR)/remote && cp {path} $(RULEDIR)/{lib}""".format(
-                path = static_lib_path,
-                lib = remote_static_library,
-            )
+            path = static_lib_path,
+            lib = remote_static_library,
+        )
         remote_static_library_param = """
 static_library = "remote_link_static_library","""
         link_remote_static_lib_genrule = """
@@ -227,21 +235,21 @@
      cmd = {link_library_command}
 )
 """.format(
-                link_library_command = repr(link_library_command),
-                remote_static_library = remote_static_library,
-            )
+            link_library_command = repr(link_library_command),
+            remote_static_library = remote_static_library,
+        )
 
     if shared_lib_path:
         repo_ctx.symlink(shared_lib_path, shared_lib_name)
         shared_library_param = "shared_library = \"{}\",".format(
-            shared_lib_name
-            )
+            shared_lib_name,
+        )
         remote_shared_library = "remote/" + shared_lib_name
         link_library_command = """
 mkdir -p $(RULEDIR)/remote && cp {path} $(RULEDIR)/{lib}""".format(
-                path = shared_lib_path,
-                lib = remote_shared_library,
-            )
+            path = shared_lib_path,
+            lib = remote_shared_library,
+        )
         remote_shared_library_param = """
 shared_library = "remote_link_shared_library","""
         link_remote_shared_lib_genrule = """
@@ -251,9 +259,9 @@
         cmd = {link_library_command}
 )
 """.format(
-                link_library_command = repr(link_library_command),
-                remote_shared_library = remote_shared_library,
-            )
+            link_library_command = repr(link_library_command),
+            remote_shared_library = remote_shared_library,
+        )
 
     repo_ctx.file(
         "BUILD",
diff --git a/tests/system_library/BUILD b/tests/system_library/BUILD
index 1343d16..5990b35 100644
--- a/tests/system_library/BUILD
+++ b/tests/system_library/BUILD
@@ -4,7 +4,7 @@
     srcs = ["system_library_test.sh"],
     data = [
         ":unittest.bash",
+        "//cc:system_library.bzl",
         "@bazel_tools//tools/bash/runfiles",
-        "//cc:system_library.bzl"
     ],
 )