Merge "Pass exportedFlags directly to Make"
diff --git a/android/module.go b/android/module.go
index 4fba1cf..3c09b3e 100644
--- a/android/module.go
+++ b/android/module.go
@@ -57,6 +57,7 @@
 	Host() bool
 	Device() bool
 	Darwin() bool
+	Windows() bool
 	Debug() bool
 	PrimaryArch() bool
 	Proprietary() bool
@@ -611,6 +612,10 @@
 	return a.target.Os == Darwin
 }
 
+func (a *androidBaseContextImpl) Windows() bool {
+	return a.target.Os == Windows
+}
+
 func (a *androidBaseContextImpl) Debug() bool {
 	return a.debug
 }
diff --git a/cc/binary.go b/cc/binary.go
index 637f6c7..2578311 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -204,7 +204,7 @@
 	if ctx.Host() && !binary.static() {
 		if !ctx.AConfig().IsEnvTrue("DISABLE_HOST_PIE") {
 			flags.LdFlags = append(flags.LdFlags, "-pie")
-			if ctx.Os() == android.Windows {
+			if ctx.Windows() {
 				flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
 			}
 		}
@@ -213,7 +213,7 @@
 	// MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
 	// all code is position independent, and then those warnings get promoted to
 	// errors.
-	if ctx.Os() != android.Windows {
+	if !ctx.Windows() {
 		flags.CFlags = append(flags.CFlags, "-fpie")
 	}
 
diff --git a/cc/library.go b/cc/library.go
index 953c37a..e9e796e 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -228,7 +228,7 @@
 	// MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
 	// all code is position independent, and then those warnings get promoted to
 	// errors.
-	if ctx.Os() != android.Windows {
+	if !ctx.Windows() {
 		flags.CFlags = append(flags.CFlags, "-fPIC")
 	}
 
@@ -462,7 +462,7 @@
 
 	builderFlags := flagsToBuilderFlags(flags)
 
-	if !ctx.Darwin() {
+	if !ctx.Darwin() && !ctx.Windows() {
 		// Optimize out relinking against shared libraries whose interface hasn't changed by
 		// depending on a table of contents file instead of the library itself.
 		tocPath := outputFile.RelPathString()
diff --git a/cc/linker.go b/cc/linker.go
index 07d9aa8..4d21d99 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -156,7 +156,7 @@
 		}
 	}
 
-	if ctx.Os() == android.Windows {
+	if ctx.Windows() {
 		deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
 	}
 
diff --git a/cc/stl.go b/cc/stl.go
index 43776f7..9e67145 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -60,7 +60,7 @@
 				ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", s)
 				return ""
 			}
-		} else if ctx.Os() == android.Windows {
+		} else if ctx.Windows() {
 			switch s {
 			case "libc++", "libc++_static", "libstdc++", "":
 				// libc++ is not supported on mingw
diff --git a/ui/build/make.go b/ui/build/make.go
index 89e03f7..a8d4483 100644
--- a/ui/build/make.go
+++ b/ui/build/make.go
@@ -89,6 +89,7 @@
 		// compiler wrappers set up by make
 		"CC_WRAPPER",
 		"CXX_WRAPPER",
+		"JAVAC_WRAPPER",
 
 		// ccache settings
 		"CCACHE_COMPILERCHECK",