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

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

[HostStubGen] Remove stub usage in HSG tests

We no longer use the stub functionality in hoststubgen. Before removing
all functionality in the code, we first remove stub usage in tests.

Bug: 292141694
Flag: EXEMPT host test change only
Test: atest hoststubgen-test-tiny-test tiny-framework-dump-test
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh
Change-Id: Ib7ca961882fa645c7ca7d026bcb9f569d9f088b0
parent 1566e17e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -6,8 +6,6 @@
--default-throw

# Uncomment below lines to enable each feature.
# --enable-non-stub-method-check
--no-non-stub-method-check

#--default-method-call-hook
#    com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
+2 −6
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ java_binary_host {

java_test_host {
    name: "hoststubgentest",
    // main_class: "com.android.hoststubgen.Main",
    srcs: ["test/**/*.kt"],
    static_libs: [
        "hoststubgen",
@@ -143,8 +142,7 @@ hoststubgen_common_options = "$(location hoststubgen) " +
    // "--policy-override-file $(location framework-policy-override.txt) " +
    "@$(location :hoststubgen-standard-options) " +

    "--out-stub-jar $(location host_stub.jar) " +
    "--out-impl-jar $(location host_impl.jar) " +
    "--out-impl-jar $(location host.jar) " +

    // "--keep-all-classes " + // Used it for an experiment. See KeepAllClassesFilter.
    "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
@@ -159,10 +157,8 @@ genrule_defaults {
    srcs: [
        ":hoststubgen-standard-options",
    ],
    // Create two jar files.
    out: [
        "host_stub.jar",
        "host_impl.jar",
        "host.jar",

        // Following files are created just as FYI.
        "hoststubgen_keep_all.txt",
+0 −43
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.hosttest.annotation;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
 * QUESTIONS ABOUT IT.
 *
 * Mark a class, field or a method as "Stub", meaning tests can see the APIs.
 * When applied to a class, it will _not_ affect the visibility of its members. They need to be
 * individually marked.
 *
 * <p>In order to expose a class and all its members, use {@link HostSideTestWholeClassStub}
 * instead.
 *
 * @hide
 */
@Target({TYPE, FIELD, METHOD, CONSTRUCTOR})
@Retention(RetentionPolicy.CLASS)
public @interface HostSideTestStub {
}
+0 −35
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.hosttest.annotation;

import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * THIS ANNOTATION IS EXPERIMENTAL. REACH OUT TO g/ravenwood BEFORE USING IT, OR YOU HAVE ANY
 * QUESTIONS ABOUT IT.
 *
 * Same as {@link HostSideTestStub} but it'll change the visibility of all its members too.
 *
 * @hide
 */
@Target({TYPE})
@Retention(RetentionPolicy.CLASS)
public @interface HostSideTestWholeClassStub {
}
+0 −7
Original line number Diff line number Diff line
@@ -3,8 +3,6 @@
--debug

# Uncomment below lines to enable each feature.
--enable-non-stub-method-check
# --no-non-stub-method-check

#--default-method-call-hook
#    com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall
@@ -13,15 +11,10 @@

# Standard annotations.
# Note, each line is a single argument, so we need newlines after each `--xxx-annotation`.
--stub-annotation
    android.hosttest.annotation.HostSideTestStub

--keep-annotation
    android.hosttest.annotation.HostSideTestKeep

--stub-class-annotation
    android.hosttest.annotation.HostSideTestWholeClassStub

--keep-class-annotation
    android.hosttest.annotation.HostSideTestWholeClassKeep

Loading