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

Commit 1a1e1f88 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Propagate unique_host_soname to cc_library prebuilts."

parents 977dc228 47ed3522
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -124,6 +124,14 @@ func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext,
	if stl != nil {
		pbm.AddProperty("stl", proptools.String(stl))
	}

	if lib, ok := ccModule.linker.(*libraryDecorator); ok {
		uhs := lib.Properties.Unique_host_soname
		if uhs != nil {
			pbm.AddProperty("unique_host_soname", proptools.Bool(uhs))
		}
	}

	return pbm
}

+80 −0
Original line number Diff line number Diff line
@@ -1976,3 +1976,83 @@ sdk_snapshot {
}
`))
}

func TestUniqueHostSoname(t *testing.T) {
	// b/145598135 - Generating host snapshots for anything other than linux is not supported.
	SkipIfNotLinux(t)

	result := testSdkWithCc(t, `
		sdk {
			name: "mysdk",
			host_supported: true,
			native_shared_libs: ["mylib"],
		}

		cc_library {
			name: "mylib",
			host_supported: true,
			unique_host_soname: true,
		}
	`)

	result.CheckSnapshot("mysdk", "",
		checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.

cc_prebuilt_library_shared {
    name: "mysdk_mylib@current",
    sdk_member_name: "mylib",
    host_supported: true,
    installable: false,
    unique_host_soname: true,
    target: {
        android_arm64: {
            srcs: ["android/arm64/lib/mylib.so"],
        },
        android_arm: {
            srcs: ["android/arm/lib/mylib.so"],
        },
        linux_glibc_x86_64: {
            srcs: ["linux_glibc/x86_64/lib/mylib-host.so"],
        },
        linux_glibc_x86: {
            srcs: ["linux_glibc/x86/lib/mylib-host.so"],
        },
    },
}

cc_prebuilt_library_shared {
    name: "mylib",
    prefer: false,
    host_supported: true,
    unique_host_soname: true,
    target: {
        android_arm64: {
            srcs: ["android/arm64/lib/mylib.so"],
        },
        android_arm: {
            srcs: ["android/arm/lib/mylib.so"],
        },
        linux_glibc_x86_64: {
            srcs: ["linux_glibc/x86_64/lib/mylib-host.so"],
        },
        linux_glibc_x86: {
            srcs: ["linux_glibc/x86/lib/mylib-host.so"],
        },
    },
}

sdk_snapshot {
    name: "mysdk@current",
    host_supported: true,
    native_shared_libs: ["mysdk_mylib@current"],
}
`),
		checkAllCopyRules(`
.intermediates/mylib/android_arm64_armv8-a_shared/mylib.so -> android/arm64/lib/mylib.so
.intermediates/mylib/android_arm_armv7-a-neon_shared/mylib.so -> android/arm/lib/mylib.so
.intermediates/mylib/linux_glibc_x86_64_shared/mylib-host.so -> linux_glibc/x86_64/lib/mylib-host.so
.intermediates/mylib/linux_glibc_x86_shared/mylib-host.so -> linux_glibc/x86/lib/mylib-host.so
`),
	)
}