Merge changes If90975c8,I2a873fc6

* changes:
  Use ctx.ModuleBuild for darwin ar
  Run gofmt
diff --git a/cc/binary.go b/cc/binary.go
index cd440ea..e982329 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -122,7 +122,7 @@
 				// version.
 				version := ctx.sdkVersion()
 				if version == "current" {
-					version = ctx.AConfig().PlatformSdkVersion()
+					version = getCurrentNdkPrebuiltVersion(ctx)
 				}
 
 				if binary.static() {
diff --git a/cc/cc.go b/cc/cc.go
index 28354a8..cff8d85 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1193,4 +1193,11 @@
 	return list[totalSkip:]
 }
 
+func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
+	if ctx.AConfig().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
+		return strconv.Itoa(config.NdkMaxPrebuiltVersionInt)
+	}
+	return ctx.AConfig().PlatformSdkVersion()
+}
+
 var Bool = proptools.Bool
diff --git a/cc/config/global.go b/cc/config/global.go
index 43ff975..a29afec 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -71,6 +71,8 @@
 	GccCppStdVersion          = "gnu++11"
 	ExperimentalCStdVersion   = "gnu11"
 	ExperimentalCppStdVersion = "gnu++1z"
+
+	NdkMaxPrebuiltVersionInt = 24
 )
 
 var pctx = android.NewPackageContext("android/soong/cc/config")
diff --git a/cc/library.go b/cc/library.go
index 12a866b..d6a85e9 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -424,7 +424,7 @@
 				// version.
 				version := ctx.sdkVersion()
 				if version == "current" {
-					version = ctx.AConfig().PlatformSdkVersion()
+					version = getCurrentNdkPrebuiltVersion(ctx)
 				}
 				deps.CrtBegin = "ndk_crtbegin_so." + version
 				deps.CrtEnd = "ndk_crtend_so." + version
diff --git a/cc/tidy.go b/cc/tidy.go
index 9dcc946..c31f5ae 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -77,6 +77,10 @@
 		flags.TidyFlags = append(flags.TidyFlags, headerFilter)
 	}
 
+	// We might be using the static analyzer through clang tidy.
+	// https://bugs.llvm.org/show_bug.cgi?id=32914
+	flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-D__clang_analyzer__")
+
 	tidyChecks := "-checks="
 	if checks := ctx.AConfig().TidyChecks(); len(checks) > 0 {
 		tidyChecks += checks
diff --git a/genrule/genrule.go b/genrule/genrule.go
index cb741b3..6807761 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -47,7 +47,7 @@
 	// $(location <label>): the path to the tool or tool_file with name <label>
 	// $(in): one or more input files
 	// $(out): a single output file
-	// $(deps): a file to which dependencies will be written, if the depfile property is set to true
+	// $(depfile): a file to which dependencies will be written, if the depfile property is set to true
 	// $(genDir): the sandbox directory for this tool; contains $(out)
 	// $$: a literal $
 	//
diff --git a/root.bp b/root.bp
index 4c29f4d..ee7c239 100644
--- a/root.bp
+++ b/root.bp
@@ -11,6 +11,7 @@
 optional_subdirs = [
     "art",
     "bionic",
+    "bootable/recovery",
     "build/kati",
     "build/tools/*",
     "dalvik",