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

Commit 649d8174 authored by Colin Cross's avatar Colin Cross
Browse files

Require libraries in header_libs to be cc_library_header

Allowing header_libs to refer to a cc_library, cc_library_static
or cc_library_shared was unintentional, make it an error.

Fixes: 173252016
Test: m checkbuild
Change-Id: I9f7986f6ca37deddf1f208b15a87d3c0cff25585
parent d3b30670
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2446,7 +2446,14 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {

			switch {
			case libDepTag.header():
				// nothing
				if !ctx.OtherModuleHasProvider(dep, HeaderLibraryInfoProvider) {
					if !ctx.Config().AllowMissingDependencies() {
						ctx.ModuleErrorf("module %q is not a header library", depName)
					} else {
						ctx.AddMissingDependencies([]string{depName})
					}
					return
				}
			case libDepTag.shared():
				if !ctx.OtherModuleHasProvider(dep, SharedLibraryInfoProvider) {
					if !ctx.Config().AllowMissingDependencies() {
+16 −10
Original line number Diff line number Diff line
@@ -940,6 +940,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,

	ctx.CheckbuildFile(outputFile)

	if library.static() {
		ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
			StaticLibrary: outputFile,
			ReuseObjects:  library.reuseObjects,
@@ -950,6 +951,11 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
				Transitive(deps.TranstiveStaticLibrariesForOrdering).
				Build(),
		})
	}

	if library.header() {
		ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})
	}

	return outputFile
}
+7 −0
Original line number Diff line number Diff line
@@ -125,6 +125,13 @@ type StaticLibraryInfo struct {

var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{})

// HeaderLibraryInfo is a marker provider that identifies a module as a header library.
type HeaderLibraryInfo struct {
}

// HeaderLibraryInfoProvider is a marker provider that identifies a module as a header library.
var HeaderLibraryInfoProvider = blueprint.NewProvider(HeaderLibraryInfo{})

// FlagExporterInfo is a provider to propagate transitive library information
// pertaining to exported include paths and flags.
type FlagExporterInfo struct {
+6 −0
Original line number Diff line number Diff line
@@ -190,6 +190,12 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
		}
	}

	if p.header() {
		ctx.SetProvider(HeaderLibraryInfoProvider, HeaderLibraryInfo{})

		return nil
	}

	return nil
}