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

Commit e64490da authored by John Wu's avatar John Wu
Browse files

[Ravenwood] Move stats generation out of critical path

Move stats generation into its own genrule outside of the bytecode
processing pipeline to improve efficiency.

We also take the chance to clean up Framework.bp.

Bug: 292141694
Flag: EXEMPT host side change only
Test: f/b/r/scripts/run-ravenwood-tests.sh
Change-Id: Ibe09d88f3f3b5dc8f5fc29e8be2bdd3a712538f5
parent b9e6e0b5
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -314,21 +314,25 @@ sh_test_host {
    src: "scripts/ravenwood-stats-checker.sh",
    test_suites: ["general-tests"],
    device_common_data: [
        ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_apis.csv}",
        ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_keep_all.txt}",
        ":framework-minus-apex.ravenwood-base_all{hoststubgen_framework-minus-apex_dump.txt}",
        ":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_apis.csv}",
        ":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_keep_all.txt}",
        ":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_dump.txt}",

        ":services.core.ravenwood-base{hoststubgen_services.core_apis.csv}",
        ":services.core.ravenwood-base{hoststubgen_services.core_keep_all.txt}",
        ":services.core.ravenwood-base{hoststubgen_services.core_dump.txt}",
        ":services.core.ravenwood-stats{hoststubgen_services.core_apis.csv}",
        ":services.core.ravenwood-stats{hoststubgen_services.core_keep_all.txt}",
        ":services.core.ravenwood-stats{hoststubgen_services.core_dump.txt}",

        ":framework-configinfrastructure.ravenwood-base{framework-configinfrastructure_apis.csv}",
        ":framework-configinfrastructure.ravenwood-base{framework-configinfrastructure_keep_all.txt}",
        ":framework-configinfrastructure.ravenwood-base{framework-configinfrastructure_dump.txt}",
        ":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_apis.csv}",
        ":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_keep_all.txt}",
        ":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_dump.txt}",

        ":framework-statsd.ravenwood-base{framework-statsd_apis.csv}",
        ":framework-statsd.ravenwood-base{framework-statsd_keep_all.txt}",
        ":framework-statsd.ravenwood-base{framework-statsd_dump.txt}",
        ":framework-statsd.ravenwood-stats{framework-statsd_apis.csv}",
        ":framework-statsd.ravenwood-stats{framework-statsd_keep_all.txt}",
        ":framework-statsd.ravenwood-stats{framework-statsd_dump.txt}",

        ":framework-graphics.ravenwood-stats{framework-graphics_apis.csv}",
        ":framework-graphics.ravenwood-stats{framework-graphics_keep_all.txt}",
        ":framework-graphics.ravenwood-stats{framework-graphics_dump.txt}",
    ],
}

+200 −172

File changed.

Preview size limit exceeded, changes collapsed.

+90 −82

File changed.

Preview size limit exceeded, changes collapsed.

+0 −11
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.hoststubgen

import com.android.hoststubgen.asm.ClassNodes
import com.android.hoststubgen.dumper.ApiDumper
import com.android.hoststubgen.filters.FilterPolicy
import com.android.hoststubgen.filters.printAsTextPolicy
import java.io.FileOutputStream
@@ -65,16 +64,6 @@ class HostStubGen(val options: HostStubGenOptions) {
            options.numShards.get,
            options.shard.get,
        )

        options.apiListFile.ifSet {
            log.iTime("API list file created at $it") {
                PrintWriter(it).use { pw ->
                    // TODO, when dumping a jar that's not framework-minus-apex.jar, we need to feed
                    // framework-minus-apex.jar so that we can dump inherited methods from it.
                    ApiDumper(pw, allClasses, null, processor.filter).dump()
                }
            }
        }
    }

    /**
+1 −8
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@ class HostStubGenOptions(

    var cleanUpOnError: SetOnce<Boolean> = SetOnce(false),

    var apiListFile: SetOnce<String?> = SetOnce(null),

    var numShards: IntSetOnce = IntSetOnce(1),
    var shard: IntSetOnce = IntSetOnce(0),
) : HostStubGenClassProcessorOptions() {
@@ -69,9 +67,7 @@ class HostStubGenOptions(
            "-h", "--help" -> TODO("Help is not implemented yet")

            "--in-jar" -> inJar.set(nextArg()).ensureFileExists()
            // We support both arguments because some AOSP dependencies
            // still use the old argument
            "--out-jar", "--out-impl-jar" -> outJar.set(nextArg())
            "--out-jar" -> outJar.set(nextArg())

            "--clean-up-on-error" -> cleanUpOnError.set(true)
            "--no-clean-up-on-error" -> cleanUpOnError.set(false)
@@ -79,8 +75,6 @@ class HostStubGenOptions(
            "--gen-input-dump-file" -> inputJarDumpFile.set(nextArg())
            "--gen-keep-all-file" -> inputJarAsKeepAllFile.set(nextArg())

            "--supported-api-list-file" -> apiListFile.set(nextArg())

            "--num-shards" -> numShards.set(nextArg()).also {
                if (it < 1) {
                    throw ArgumentsException("$option must be positive integer")
@@ -105,7 +99,6 @@ class HostStubGenOptions(
            inputJarDumpFile=$inputJarDumpFile,
            inputJarAsKeepAllFile=$inputJarAsKeepAllFile,
            cleanUpOnError=$cleanUpOnError,
            apiListFile=$apiListFile,
            numShards=$numShards,
            shard=$shard,
        """.trimIndent() + '\n' + super.dumpFields()
Loading