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

Commit a71fe150 authored by Greg Kaiser's avatar Greg Kaiser Committed by Gerrit Code Review
Browse files

Merge changes from topic "revert-1302576-NGVCIVIIJO"

* changes:
  Revert "Detect invalid arch specific properties in snapshot"
  Revert "Adds support for 'ignored-on-host'"
  Revert "Fix snapshot of a host/device cc_library with stubs"
parents 50fc599b e509447c
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -342,24 +342,9 @@ type SdkMemberType interface {
	//
	// * The variant property structs are analysed to find exported (capitalized) fields which
	//   have common values. Those fields are cleared and the common value added to the common
	//   properties.
	//
	//   A field annotated with a tag of `sdk:"keep"` will be treated as if it
	//   properties. A field annotated with a tag of `sdk:"keep"` will be treated as if it
	//   was not capitalized, i.e. not optimized for common values.
	//
	//   A field annotated with a tag of `android:"arch_variant"` will be allowed to have
	//   values that differ by arch, fields not tagged as such must have common values across
	//   all variants.
	//
	// * Additional field tags can be specified on a field that will ignore certain values
	//   for the purpose of common value optimization. A value that is ignored must have the
	//   default value for the property type. This is to ensure that significant value are not
	//   ignored by accident. The purpose of this is to allow the snapshot generation to reflect
	//   the behavior of the runtime. e.g. if a property is ignored on the host then a property
	//   that is common for android can be treated as if it was common for android and host as
	//   the setting for host is ignored anyway.
	//   * `sdk:"ignored-on-host" - this indicates the property is ignored on the host variant.
	//
	// * The sdk module type populates the BpModule structure, creating the arch specific
	//   structure and calls AddToPropertySet(...) on the properties struct to add the member
	//   specific properties in the correct place in the structure.
+6 −10
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ type nativeLibInfoProperties struct {
	// The list of possibly common exported include dirs.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedIncludeDirs android.Paths `android:"arch_variant"`
	ExportedIncludeDirs android.Paths

	// The list of arch specific exported generated include dirs.
	//
@@ -322,31 +322,27 @@ type nativeLibInfoProperties struct {
	// The list of possibly common exported system include dirs.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedSystemIncludeDirs android.Paths `android:"arch_variant"`
	ExportedSystemIncludeDirs android.Paths

	// The list of possibly common exported flags.
	//
	// This field is exported as its contents may not be arch specific.
	ExportedFlags []string `android:"arch_variant"`
	ExportedFlags []string

	// The set of shared libraries
	//
	// This field is exported as its contents may not be arch specific.
	SharedLibs []string `android:"arch_variant"`
	SharedLibs []string

	// The set of system shared libraries. Note nil and [] are semantically
	// distinct - see BaseLinkerProperties.System_shared_libs.
	//
	// This field is exported as its contents may not be arch specific.
	SystemSharedLibs []string `android:"arch_variant"`
	SystemSharedLibs []string

	// The specific stubs version for the lib variant, or empty string if stubs
	// are not in use.
	//
	// Marked 'ignored-on-host' as the StubsVersion() from which this is initialized is
	// not set on host and the stubs.versions property which this is written to is does
	// not vary by arch so cannot be android specific.
	StubsVersion string `sdk:"ignored-on-host"`
	StubsVersion string

	// outputFile is not exported as it is always arch specific.
	outputFile android.Path
+1 −1
Original line number Diff line number Diff line
@@ -1906,7 +1906,7 @@ func (mt *librarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMembe
type librarySdkMemberProperties struct {
	android.SdkMemberPropertiesBase

	JarToExport     android.Path `android:"arch_variant"`
	JarToExport     android.Path
	AidlIncludeDirs android.Paths
}

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

func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
	result := testSdkWithCc(t, `
		sdk {
			name: "mysdk",
			host_supported: true,
			native_shared_libs: ["stubslib"],
		}

		cc_library {
			name: "internaldep",
			host_supported: true,
		}

		cc_library {
			name: "stubslib",
			host_supported: true,
			shared_libs: ["internaldep"],
			stubs: {
				symbol_file: "some/where/stubslib.map.txt",
				versions: ["1", "2", "3"],
			},
		}
	`)

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

cc_prebuilt_library_shared {
    name: "mysdk_stubslib@current",
    sdk_member_name: "stubslib",
    host_supported: true,
    installable: false,
    stubs: {
        versions: ["3"],
    },
    target: {
        android_arm64: {
            srcs: ["android/arm64/lib/stubslib.so"],
        },
        android_arm: {
            srcs: ["android/arm/lib/stubslib.so"],
        },
        linux_glibc_x86_64: {
            srcs: ["linux_glibc/x86_64/lib/stubslib.so"],
        },
        linux_glibc_x86: {
            srcs: ["linux_glibc/x86/lib/stubslib.so"],
        },
    },
}

cc_prebuilt_library_shared {
    name: "stubslib",
    prefer: false,
    host_supported: true,
    stubs: {
        versions: ["3"],
    },
    target: {
        android_arm64: {
            srcs: ["android/arm64/lib/stubslib.so"],
        },
        android_arm: {
            srcs: ["android/arm/lib/stubslib.so"],
        },
        linux_glibc_x86_64: {
            srcs: ["linux_glibc/x86_64/lib/stubslib.so"],
        },
        linux_glibc_x86: {
            srcs: ["linux_glibc/x86/lib/stubslib.so"],
        },
    },
}

sdk_snapshot {
    name: "mysdk@current",
    host_supported: true,
    native_shared_libs: ["mysdk_stubslib@current"],
}
`))
}
+6 −32
Original line number Diff line number Diff line
@@ -226,8 +226,8 @@ func TestSDkInstall(t *testing.T) {
}

type EmbeddedPropertiesStruct struct {
	S_Embedded_Common    string `android:"arch_variant"`
	S_Embedded_Different string `android:"arch_variant"`
	S_Embedded_Common    string
	S_Embedded_Different string
}

type testPropertiesStruct struct {
@@ -235,11 +235,11 @@ type testPropertiesStruct struct {
	private     string
	Public_Kept string `sdk:"keep"`
	S_Common    string
	S_Different string `android:"arch_variant"`
	S_Different string
	A_Common    []string
	A_Different []string `android:"arch_variant"`
	A_Different []string
	F_Common    *bool
	F_Different *bool `android:"arch_variant"`
	F_Different *bool
	EmbeddedPropertiesStruct
}

@@ -289,12 +289,9 @@ func TestCommonValueOptimization(t *testing.T) {
	}

	extractor := newCommonValueExtractor(common)
	extractor.extractCommonProperties(common, structs)

	h := TestHelper{t}

	err := extractor.extractCommonProperties(common, structs)
	h.AssertDeepEquals("unexpected error", nil, err)

	h.AssertDeepEquals("common properties not correct",
		&testPropertiesStruct{
			name:        "common",
@@ -349,26 +346,3 @@ func TestCommonValueOptimization(t *testing.T) {
		},
		structs[1])
}

func TestCommonValueOptimization_InvalidArchSpecificVariants(t *testing.T) {
	common := &testPropertiesStruct{name: "common"}
	structs := []propertiesContainer{
		&testPropertiesStruct{
			name:     "struct-0",
			S_Common: "should-be-but-is-not-common0",
		},
		&testPropertiesStruct{
			name:     "struct-1",
			S_Common: "should-be-but-is-not-common1",
		},
	}

	extractor := newCommonValueExtractor(common)

	h := TestHelper{t}

	err := extractor.extractCommonProperties(common, structs)
	h.AssertErrorMessageEquals("unexpected error", `field "S_Common" is not tagged as "arch_variant" but has arch specific properties:
    "struct-0" has value "should-be-but-is-not-common0"
    "struct-1" has value "should-be-but-is-not-common1"`, err)
}
Loading