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

Commit 91de3b1c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5286292 from c1556fec to qt-release

Change-Id: If4be3167776260a3cd5f7acd9c8093bde60cdbd3
parents 783c4b25 c1556fec
Loading
Loading
Loading
Loading
+24 −20
Original line number Diff line number Diff line
@@ -484,7 +484,6 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
		{Mutator: "arch", Variation: "android_common"},
	}, javaLibTag, a.properties.Java_libs...)

	if !ctx.Config().FlattenApex() || ctx.Config().UnbundledBuild() {
	if String(a.properties.Key) == "" {
		ctx.ModuleErrorf("key is missing")
		return
@@ -496,7 +495,6 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
		ctx.AddDependency(ctx.Module(), certificateTag, cert)
	}
}
}

func (a *apexBundle) Srcs() android.Paths {
	if file, ok := a.outputFiles[imageApex]; ok {
@@ -540,6 +538,7 @@ func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fil
	case "lib64":
		dirInApex = "lib64"
	}
	dirInApex = filepath.Join(dirInApex, cc.RelativeInstallPath())
	if !cc.Arch().Native {
		dirInApex = filepath.Join(dirInApex, cc.Arch().ArchType.String())
	}
@@ -564,6 +563,8 @@ func getCopyManifestForNativeLibrary(cc *cc.Module, handleSpecialLibs bool) (fil
}

func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
	// TODO(b/123721777) respect relative_install_path also for binaries
	// dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
	dirInApex = "bin"
	fileToCopy = cc.OutputFile().Path()
	return
@@ -687,7 +688,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	})

	a.flattened = ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
	if !a.flattened && keyFile == nil {
	if keyFile == nil {
		ctx.PropertyErrorf("key", "private_key for %q could not be found", String(a.properties.Key))
		return
	}
@@ -724,11 +725,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
		a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, zipApex)
	}
	if a.apexTypes.image() {
		if ctx.Config().FlattenApex() {
			a.buildFlattenedApex(ctx)
		} else {
		// Build rule for unflattened APEX is created even when ctx.Config().FlattenApex()
		// is true. This is to support referencing APEX via ":<module_name" syntax
		// in other modules. It is in AndroidMk where the selection of flattened
		// or unflattened APEX is made.
		a.buildUnflattenedApex(ctx, keyFile, pubKeyFile, certificate, imageApex)
		}
		a.buildFlattenedApex(ctx)
	}
}

@@ -907,7 +909,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, keyFile and
	})

	// Install to $OUT/soong/{target,host}/.../apex
	if a.installable() {
	if a.installable() && !ctx.Config().FlattenApex() {
		ctx.InstallFile(android.PathForModuleInstall(ctx, "apex"), ctx.ModuleName()+suffix, a.outputFiles[apexType])
	}
}
@@ -927,12 +929,14 @@ func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {
		})
		a.filesInfo = append(a.filesInfo, apexFile{copiedManifest, ctx.ModuleName() + ".apex_manifest.json", ".", etc, nil, nil})

		if ctx.Config().FlattenApex() {
			for _, fi := range a.filesInfo {
				dir := filepath.Join("apex", ctx.ModuleName(), fi.installDir)
				ctx.InstallFile(android.PathForModuleInstall(ctx, dir), fi.builtFile.Base(), fi.builtFile)
			}
		}
	}
}

func (a *apexBundle) AndroidMk() android.AndroidMkData {
	writers := []android.AndroidMkData{}
+32 −1
Original line number Diff line number Diff line
@@ -615,7 +615,10 @@ func TestFilesInSubDir(t *testing.T) {
		apex {
			name: "myapex",
			key: "myapex.key",
			native_shared_libs: ["mylib"],
			binaries: ["mybin"],
			prebuilts: ["myetc"],
			compile_multilib: "both",
		}

		apex_key {
@@ -629,15 +632,43 @@ func TestFilesInSubDir(t *testing.T) {
			src: "myprebuilt",
			sub_dir: "foo/bar",
		}

		cc_library {
			name: "mylib",
			srcs: ["mylib.cpp"],
			relative_install_path: "foo/bar",
			system_shared_libs: [],
			stl: "none",
		}

		cc_binary {
			name: "mybin",
			srcs: ["mylib.cpp"],
			relative_install_path: "foo/bar",
			system_shared_libs: [],
			static_executable: true,
			stl: "none",
		}
	`)

	generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("generateFsConfig")
	dirs := strings.Split(generateFsRule.Args["exec_paths"], " ")

	// Ensure that etc, etc/foo, and etc/foo/bar are all listed
	// Ensure that the subdirectories are all listed
	ensureListContains(t, dirs, "etc")
	ensureListContains(t, dirs, "etc/foo")
	ensureListContains(t, dirs, "etc/foo/bar")
	ensureListContains(t, dirs, "lib64")
	ensureListContains(t, dirs, "lib64/foo")
	ensureListContains(t, dirs, "lib64/foo/bar")
	ensureListContains(t, dirs, "lib")
	ensureListContains(t, dirs, "lib/foo")
	ensureListContains(t, dirs, "lib/foo/bar")

	// TODO(b/123721777) respect relative path for binaries
	// ensureListContains(t, dirs, "bin")
	// ensureListContains(t, dirs, "bin/foo")
	// ensureListContains(t, dirs, "bin/foo/bar")
}

func TestUseVendor(t *testing.T) {
+0 −5
Original line number Diff line number Diff line
@@ -63,11 +63,6 @@ func (m *apexKey) installable() bool {
}

func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	if ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() {
		// Flattened APEXes are not signed
		return
	}

	m.public_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Public_key))
	m.private_key_file = ctx.Config().ApexKeyDir(ctx).Join(ctx, String(m.properties.Private_key))

+3 −3
Original line number Diff line number Diff line
@@ -317,9 +317,9 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
	builderFlags := flagsToBuilderFlags(flags)

	if binary.stripper.needsStrip(ctx) {
		// b/80093681, GNU strip/objcopy bug.
		// Use llvm-{strip,objcopy} when clang lld is used.
		builderFlags.stripUseLlvmStrip = binary.baseLinker.useClangLld(ctx)
		if ctx.Darwin() {
			builderFlags.stripUseGnuStrip = true
		}
		strippedOutputFile := outputFile
		outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
		binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
+3 −3
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ type builderFlags struct {
	stripKeepSymbols       bool
	stripKeepMiniDebugInfo bool
	stripAddGnuDebuglink   bool
	stripUseLlvmStrip      bool
	stripUseGnuStrip       bool

	protoDeps        android.Paths
	protoFlags       string
@@ -821,8 +821,8 @@ func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
	if flags.stripKeepSymbols {
		args += " --keep-symbols"
	}
	if flags.stripUseLlvmStrip {
		args += " --use-llvm-strip"
	if flags.stripUseGnuStrip {
		args += " --use-gnu-strip"
	}

	ctx.Build(pctx, android.BuildParams{
Loading