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

Commit cb00f945 authored by Anton Hansson's avatar Anton Hansson
Browse files

Convert merged module lib stub to api.go

Bug: 169103987
Test: m framework-updatable-stubs-module_libs_api and diff intermediates
      folder before and after.
Merged-In: I6018791ae136bc764a6e846078c6bce59bcc123b
Change-Id: I6018791ae136bc764a6e846078c6bce59bcc123b
parent 05e944d8
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -140,27 +140,6 @@ filegroup {
    ],
}

java_library {
    name: "framework-updatable-stubs-module_libs_api",
    static_libs: [
        "android.net.ipsec.ike.stubs.module_lib",
        "framework-appsearch.stubs.module_lib",
        "framework-connectivity.stubs.module_lib",
        "framework-graphics.stubs.module_lib",
        "framework-media.stubs.module_lib",
        "framework-mediaprovider.stubs.module_lib",
        "framework-permission.stubs.module_lib",
        "framework-permission-s.stubs.module_lib",
        "framework-scheduling.stubs.module_lib",
        "framework-sdkextensions.stubs.module_lib",
        "framework-statsd.stubs.module_lib",
        "framework-tethering.stubs.module_lib",
        "framework-wifi.stubs.module_lib",
    ],
    sdk_version: "module_current",
    visibility: ["//visibility:private"],
}

java_library {
    name: "framework-all",
    installable: false,
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ bootstrap_go_package {
        "soong",
        "soong-android",
        "soong-genrule",
        "soong-java",
    ],
    srcs: ["api.go"],
    pluginFor: ["soong_build"],
+29 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import (

	"android/soong/android"
	"android/soong/genrule"
	"android/soong/java"
)

const art = "art.module.public.api"
@@ -73,6 +74,13 @@ type genruleProps struct {
	Visibility []string
}

type libraryProps struct {
	Name        *string
	Sdk_version *string
	Static_libs []string
	Visibility  []string
}

// Struct to pass parameters for the various merged [current|removed].txt file modules we create.
type MergedTxtDefinition struct {
	// "current.txt" or "removed.txt"
@@ -169,6 +177,25 @@ func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
	ctx.CreateModule(genrule.GenRuleFactory, &props)
}

func createMergedModuleLibStubs(ctx android.LoadHookContext, modules []string) {
	// The user of this module compiles against the "core" SDK, so remove core libraries to avoid dupes.
	modules = removeAll(modules, []string{art, conscrypt, i18n})
	props := libraryProps{}
	props.Name = proptools.StringPtr("framework-updatable-stubs-module_libs_api")
	props.Static_libs = appendStr(modules, ".stubs.module_lib")
	props.Sdk_version = proptools.StringPtr("module_current")
	props.Visibility = []string{"//frameworks/base"}
	ctx.CreateModule(java.LibraryFactory, &props)
}

func appendStr(modules []string, s string) []string {
	a := make([]string, 0, len(modules))
	for _, module := range modules {
		a = append(a, module+s)
	}
	return a
}

func createSrcs(base string, modules []string, tag string) []string {
	a := make([]string, 0, len(modules)+1)
	a = append(a, base)
@@ -246,6 +273,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {

	createMergedStubsSrcjar(ctx, bootclasspath)

	createMergedModuleLibStubs(ctx, bootclasspath)

	createMergedAnnotations(ctx, bootclasspath)

	createFilteredApiVersions(ctx, bootclasspath)