Change bool, and string properties to *bool, and *string for java,
python, and genrule.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
diff --git a/java/androidmk.go b/java/androidmk.go
index d3aadef..1c0526a 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -40,7 +40,7 @@
 						fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
 					}
 				}
-				fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", library.deviceProperties.Sdk_version)
+				fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(library.deviceProperties.Sdk_version))
 				fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String())
 			},
 		},
@@ -76,7 +76,7 @@
 			func(w io.Writer, outputFile android.Path) {
 				fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !proptools.Bool(prebuilt.properties.Installable))
 				fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
-				fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.properties.Sdk_version)
+				fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(prebuilt.properties.Sdk_version))
 			},
 		},
 	}
diff --git a/java/app.go b/java/app.go
index c2e9214..05cc975 100644
--- a/java/app.go
+++ b/java/app.go
@@ -32,14 +32,14 @@
 type androidAppProperties struct {
 	// path to a certificate, or the name of a certificate in the default
 	// certificate directory, or blank to use the default product certificate
-	Certificate string
+	Certificate *string
 
 	// paths to extra certificates to sign the apk with
 	Additional_certificates []string
 
 	// If set, create package-export.apk, which other packages can
 	// use to get PRODUCT-agnostic resource data like IDs and type definitions.
-	Export_package_resources bool
+	Export_package_resources *bool
 
 	// flags passed to aapt when creating the apk
 	Aaptflags []string
@@ -69,7 +69,7 @@
 	a.Module.deps(ctx)
 
 	if !proptools.Bool(a.properties.No_standard_libs) {
-		switch a.deviceProperties.Sdk_version { // TODO: Res_sdk_version?
+		switch String(a.deviceProperties.Sdk_version) { // TODO: Res_sdk_version?
 		case "current", "system_current", "":
 			ctx.AddDependency(ctx.Module(), frameworkResTag, "framework-res")
 		default:
@@ -90,7 +90,7 @@
 		a.aaptJavaFileList = aaptJavaFileList
 		// TODO(ccross):  export aapt generated java files as a src jar
 
-		if a.appProperties.Export_package_resources {
+		if Bool(a.appProperties.Export_package_resources) {
 			aaptPackageFlags := append([]string(nil), aaptFlags...)
 			var hasProduct bool
 			for _, f := range aaptPackageFlags {
@@ -135,7 +135,7 @@
 			"--product "+ctx.AConfig().ProductAAPTCharacteristics())
 	}
 
-	certificate := a.appProperties.Certificate
+	certificate := String(a.appProperties.Certificate)
 	if certificate == "" {
 		certificate = ctx.AConfig().DefaultAppCertificate(ctx).String()
 	} else if dir, _ := filepath.Split(certificate); dir == "" {
@@ -244,7 +244,7 @@
 		aaptDeps = append(aaptDeps, depFiles...)
 	})
 
-	sdkVersion := a.deviceProperties.Sdk_version
+	sdkVersion := String(a.deviceProperties.Sdk_version)
 	if sdkVersion == "" {
 		sdkVersion = ctx.AConfig().PlatformSdkVersion()
 	}
diff --git a/java/java.go b/java/java.go
index bb6e556..432e816 100644
--- a/java/java.go
+++ b/java/java.go
@@ -134,7 +134,7 @@
 	Dxflags []string `android:"arch_variant"`
 
 	// if not blank, set to the version of the sdk to compile against
-	Sdk_version string
+	Sdk_version *string
 
 	// directories to pass to aidl tool
 	Aidl_includes []string
@@ -307,7 +307,7 @@
 func (j *Module) deps(ctx android.BottomUpMutatorContext) {
 	if ctx.Device() {
 		if !proptools.Bool(j.properties.No_standard_libs) {
-			sdkDep := decodeSdkDep(ctx, j.deviceProperties.Sdk_version)
+			sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
 			if sdkDep.useDefaultLibs {
 				ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...)
 				if ctx.AConfig().TargetOpenJDK9() {
@@ -412,7 +412,7 @@
 func (j *Module) collectDeps(ctx android.ModuleContext) deps {
 	var deps deps
 
-	sdkDep := decodeSdkDep(ctx, j.deviceProperties.Sdk_version)
+	sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
 	if sdkDep.invalidVersion {
 		ctx.AddMissingDependencies([]string{sdkDep.module})
 	} else if sdkDep.useFiles {
@@ -493,14 +493,14 @@
 	}
 
 	// javaVersion flag.
-	sdk := sdkStringToNumber(ctx, j.deviceProperties.Sdk_version)
+	sdk := sdkStringToNumber(ctx, String(j.deviceProperties.Sdk_version))
 	if j.properties.Java_version != nil {
 		flags.javaVersion = *j.properties.Java_version
 	} else if ctx.Device() && sdk <= 23 {
 		flags.javaVersion = "1.7"
 	} else if ctx.Device() && sdk <= 26 || !ctx.AConfig().TargetOpenJDK9() {
 		flags.javaVersion = "1.8"
-	} else if ctx.Device() && j.deviceProperties.Sdk_version != "" && sdk == 10000 {
+	} else if ctx.Device() && String(j.deviceProperties.Sdk_version) != "" && sdk == 10000 {
 		// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
 		flags.javaVersion = "1.8"
 	} else {
@@ -783,11 +783,11 @@
 	}
 
 	var minSdkVersion string
-	switch j.deviceProperties.Sdk_version {
+	switch String(j.deviceProperties.Sdk_version) {
 	case "", "current", "test_current", "system_current":
 		minSdkVersion = strconv.Itoa(ctx.AConfig().DefaultAppTargetSdkInt())
 	default:
-		minSdkVersion = j.deviceProperties.Sdk_version
+		minSdkVersion = String(j.deviceProperties.Sdk_version)
 	}
 
 	dxFlags = append(dxFlags, "--min-sdk-version="+minSdkVersion)
@@ -903,7 +903,7 @@
 
 type binaryProperties struct {
 	// installable script to execute the resulting jar
-	Wrapper string
+	Wrapper *string
 }
 
 type Binary struct {
@@ -924,8 +924,8 @@
 
 	// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
 	// another build rule before the jar has been installed.
-	if j.binaryProperties.Wrapper != "" {
-		j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper).SourcePath
+	if String(j.binaryProperties.Wrapper) != "" {
+		j.wrapperFile = android.PathForModuleSrc(ctx, String(j.binaryProperties.Wrapper)).SourcePath
 	} else {
 		j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
 	}
@@ -970,7 +970,7 @@
 type ImportProperties struct {
 	Jars []string
 
-	Sdk_version string
+	Sdk_version *string
 
 	Installable *bool
 }
@@ -1084,3 +1084,6 @@
 
 	return module
 }
+
+var Bool = proptools.Bool
+var String = proptools.String