Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b81e2c7 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5271441 from ee0311f6 to qt-release

Change-Id: I272f420bffb0f262455293df6c30eecfa01d8628
parents 0cc758e0 ee0311f6
Loading
Loading
Loading
Loading
+88 −53
Original line number Diff line number Diff line
@@ -329,7 +329,6 @@ func (class apexFileClass) NameInMake() string {
type apexFile struct {
	builtFile  android.Path
	moduleName string
	archType   android.ArchType
	installDir string
	class      apexFileClass
	module     android.Module
@@ -573,7 +572,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
			case sharedLibTag:
				if cc, ok := child.(*cc.Module); ok {
					fileToCopy, dirInApex := getCopyManifestForNativeLibrary(cc)
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, cc.Arch().ArchType, dirInApex, nativeSharedLib, cc, nil})
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeSharedLib, cc, nil})
					return true
				} else {
					ctx.PropertyErrorf("native_shared_libs", "%q is not a cc_library or cc_library_shared module", depName)
@@ -586,7 +585,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
						return true
					}
					fileToCopy, dirInApex := getCopyManifestForExecutable(cc)
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, cc.Arch().ArchType, dirInApex, nativeExecutable, cc, cc.Symlinks()})
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeExecutable, cc, cc.Symlinks()})
					return true
				} else {
					ctx.PropertyErrorf("binaries", "%q is not a cc_binary module", depName)
@@ -597,7 +596,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
					if fileToCopy == nil {
						ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
					} else {
						filesInfo = append(filesInfo, apexFile{fileToCopy, depName, java.Arch().ArchType, dirInApex, javaSharedLib, java, nil})
						filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, javaSharedLib, java, nil})
					}
					return true
				} else {
@@ -606,7 +605,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
			case prebuiltTag:
				if prebuilt, ok := child.(*android.PrebuiltEtc); ok {
					fileToCopy, dirInApex := getCopyManifestForPrebuiltEtc(prebuilt)
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, prebuilt.Arch().ArchType, dirInApex, etc, prebuilt, nil})
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, etc, prebuilt, nil})
					return true
				} else {
					ctx.PropertyErrorf("prebuilts", "%q is not a prebuilt_etc module", depName)
@@ -641,7 +640,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
					}
					depName := ctx.OtherModuleName(child)
					fileToCopy, dirInApex := getCopyManifestForNativeLibrary(cc)
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, cc.Arch().ArchType, dirInApex, nativeSharedLib, cc, nil})
					filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeSharedLib, cc, nil})
					return true
				}
			}
@@ -888,7 +887,7 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
			Input:  manifest,
			Output: copiedManifest,
		})
		a.filesInfo = append(a.filesInfo, apexFile{copiedManifest, ctx.ModuleName() + ".apex_manifest.json", android.Common, ".", etc, nil, nil})
		a.filesInfo = append(a.filesInfo, apexFile{copiedManifest, ctx.ModuleName() + ".apex_manifest.json", ".", etc, nil, nil})

		for _, fi := range a.filesInfo {
			dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
@@ -914,8 +913,6 @@ func (a *apexBundle) AndroidMk() android.AndroidMkData {
}

func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkData {
	// Only image APEXes can be flattened.
	if a.flattened && apexType.image() {
	return android.AndroidMkData{
		Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
			moduleNames := []string{}
@@ -924,11 +921,6 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
					moduleNames = append(moduleNames, fi.moduleName)
				}
			}
				fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
				fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
				fmt.Fprintln(w, "LOCAL_MODULE :=", name)
				fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
				fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")

			for _, fi := range a.filesInfo {
				if cc, ok := fi.module.(*cc.Module); ok && cc.Properties.HideFromMake {
@@ -937,14 +929,46 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
				fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
				fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
				fmt.Fprintln(w, "LOCAL_MODULE :=", fi.moduleName)
					fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString(), name, fi.installDir))
				if a.flattened {
					// /system/apex/<name>/{lib|framework|...}
					fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)",
						a.installDir.RelPathString(), name, fi.installDir))
				} else {
					// /apex/<name>/{lib|framework|...}
					fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(PRODUCT_OUT)",
						"apex", name, fi.installDir))
				}
				fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", fi.builtFile.String())
				fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.NameInMake())
				fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
					archStr := fi.archType.String()
				if fi.module != nil {
					archStr := fi.module.Target().Arch.ArchType.String()
					host := false
					switch fi.module.Target().Os.Class {
					case android.Host:
						if archStr != "common" {
							fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr)
						}
						host = true
					case android.HostCross:
						if archStr != "common" {
							fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr)
						}
						host = true
					case android.Device:
						if archStr != "common" {
							fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
						}
					}
					if host {
						makeOs := fi.module.Target().Os.String()
						if fi.module.Target().Os == android.Linux || fi.module.Target().Os == android.LinuxBionic {
							makeOs = "linux"
						}
						fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
						fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
					}
				}
				if fi.class == javaSharedLib {
					javaModule := fi.module.(*java.Library)
					// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar  Therefore
@@ -956,15 +980,25 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
					fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
					fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
					fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
				} else if fi.class == nativeSharedLib || fi.class == nativeExecutable {
					fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
					if cc, ok := fi.module.(*cc.Module); ok && cc.UnstrippedOutputFile() != nil {
						fmt.Fprintln(w, "LOCAL_SOONG_UNSTRIPPED_BINARY :=", cc.UnstrippedOutputFile().String())
					}
					fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
				} else {
					fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
					fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
				}
			}
			}}
			if a.flattened && apexType.image() {
				// Only image APEXes can be flattened.
				fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
				fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
				fmt.Fprintln(w, "LOCAL_MODULE :=", name)
				fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
				fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
			} else {
		return android.AndroidMkData{
			Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
				// zip-apex is the less common type so have the name refer to the image-apex
				// only and use {name}.zip if you want the zip-apex
				if apexType == zipApex && a.apexTypes == both {
@@ -979,13 +1013,14 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
				fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix())
				fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable())
				fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", String(a.properties.Key))
				fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " "))
				fmt.Fprintln(w, "include $(BUILD_PREBUILT)")

				if apexType == imageApex {
					fmt.Fprintln(w, "ALL_MODULES.$(LOCAL_MODULE).BUNDLE :=", a.bundleModuleFile.String())
				}
			}}
			}
		}}
}

func ApexBundleFactory() android.Module {
+20 −7
Original line number Diff line number Diff line
@@ -404,6 +404,15 @@ func (c *Module) OutputFile() android.OptionalPath {
	return c.outputFile
}

func (c *Module) UnstrippedOutputFile() android.Path {
	if library, ok := c.linker.(*libraryDecorator); ok {
		return library.unstrippedOutputFile
	} else if binary, ok := c.linker.(*binaryDecorator); ok {
		return binary.unstrippedOutputFile
	}
	return nil
}

func (c *Module) Init() android.Module {
	c.AddProperties(&c.Properties, &c.VendorProperties)
	if c.compiler != nil {
@@ -1166,15 +1175,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
			depTag = headerExportDepTag
		}
		if buildStubs {
			imageVariation := "core"
			if c.useVndk() {
				imageVariation = "vendor"
			} else if c.inRecovery() {
				imageVariation = "recovery"
			}
			actx.AddFarVariationDependencies([]blueprint.Variation{
				{Mutator: "arch", Variation: ctx.Target().String()},
				{Mutator: "image", Variation: imageVariation},
				{Mutator: "image", Variation: c.imageVariation()},
			}, depTag, lib)
		} else {
			actx.AddVariationDependencies(nil, depTag, lib)
@@ -1836,6 +1839,16 @@ func (c *Module) IsInstallableToApex() bool {
	return false
}

func (c *Module) imageVariation() string {
	variation := "core"
	if c.useVndk() {
		variation = "vendor"
	} else if c.inRecovery() {
		variation = "recovery"
	}
	return variation
}

//
// Defaults
//
+4 −2
Original line number Diff line number Diff line
@@ -787,7 +787,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
		}

		if mctx.Device() && runtimeLibrary != "" {
			if inList(runtimeLibrary, llndkLibraries) && !c.static() {
			if inList(runtimeLibrary, llndkLibraries) && !c.static() && c.useVndk() {
				runtimeLibrary = runtimeLibrary + llndkLibrarySuffix
			}

@@ -802,12 +802,14 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
				// static executable gets static runtime libs
				mctx.AddFarVariationDependencies([]blueprint.Variation{
					{Mutator: "link", Variation: "static"},
					{Mutator: "image", Variation: c.imageVariation()},
					{Mutator: "arch", Variation: mctx.Target().String()},
				}, staticDepTag, runtimeLibrary)
			} else if !c.static() {
				// dynamic executable and shared libs get shared runtime libs
				mctx.AddFarVariationDependencies([]blueprint.Variation{
					{Mutator: "link", Variation: "shared"},
					{Mutator: "image", Variation: c.imageVariation()},
					{Mutator: "arch", Variation: mctx.Target().String()},
				}, earlySharedDepTag, runtimeLibrary)
			}
+8 −8
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ type ModuleConfig struct {
	DexLocation     string // dex location on device
	BuildPath       string
	DexPath         string
	PreferCodeIntegrity bool
	UseEmbeddedDex  bool
	UncompressedDex bool
	HasApkLibraries bool
	PreoptFlags     []string
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ var testModuleConfig = ModuleConfig{
	DexLocation:            "",
	BuildPath:              "",
	DexPath:                "",
	PreferCodeIntegrity:    false,
	UseEmbeddedDex:         false,
	UncompressedDex:        false,
	HasApkLibraries:        false,
	PreoptFlags:            nil,
Loading