Loading Ravenwood.bp +12 −12 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ java_genrule { name: "framework-minus-apex.ravenwood-base", name: "framework-minus-apex.ravenwood-base", tools: ["hoststubgen"], tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + cmd: "$(location hoststubgen) " + "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + "@$(location :ravenwood-standard-options) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + Loading @@ -42,13 +42,13 @@ java_genrule { "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + "--policy-override-file $(location ravenwood/texts/framework-minus-apex-ravenwood-policies.txt) " + "--policy-override-file $(location :ravenwood-framework-policies) " + "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", srcs: [ srcs: [ ":framework-minus-apex-for-hoststubgen", ":framework-minus-apex-for-hoststubgen", "ravenwood/texts/framework-minus-apex-ravenwood-policies.txt", ":ravenwood-framework-policies", "ravenwood/texts/ravenwood-standard-options.txt", ":ravenwood-standard-options", "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", ":ravenwood-annotation-allowed-classes", ], ], out: [ out: [ "ravenwood.jar", "ravenwood.jar", Loading Loading @@ -118,7 +118,7 @@ java_genrule { name: "services.core.ravenwood-base", name: "services.core.ravenwood-base", tools: ["hoststubgen"], tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + cmd: "$(location hoststubgen) " + "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + "@$(location :ravenwood-standard-options) " + "--debug-log $(location hoststubgen_services.core.log) " + "--debug-log $(location hoststubgen_services.core.log) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + Loading @@ -130,13 +130,13 @@ java_genrule { "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--in-jar $(location :services.core-for-hoststubgen) " + "--in-jar $(location :services.core-for-hoststubgen) " + "--policy-override-file $(location ravenwood/texts/services.core-ravenwood-policies.txt) " + "--policy-override-file $(location :ravenwood-services-policies) " + "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", srcs: [ srcs: [ ":services.core-for-hoststubgen", ":services.core-for-hoststubgen", "ravenwood/texts/services.core-ravenwood-policies.txt", ":ravenwood-services-policies", "ravenwood/texts/ravenwood-standard-options.txt", ":ravenwood-standard-options", "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", ":ravenwood-annotation-allowed-classes", ], ], out: [ out: [ "ravenwood.jar", "ravenwood.jar", Loading ravenwood/Android.bp +32 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,38 @@ filegroup { visibility: ["//visibility:public"], visibility: ["//visibility:public"], } } filegroup { name: "ravenwood-services-policies", srcs: [ "texts/ravenwood-services-policies.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-framework-policies", srcs: [ "texts/ravenwood-framework-policies.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-standard-options", srcs: [ "texts/ravenwood-standard-options.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-annotation-allowed-classes", srcs: [ "texts/ravenwood-annotation-allowed-classes.txt", ], visibility: ["//visibility:public"], } java_library { java_library { name: "ravenwood-annotations-lib", name: "ravenwood-annotations-lib", srcs: [":ravenwood-annotations"], srcs: [":ravenwood-annotations"], Loading ravenwood/texts/framework-minus-apex-ravenwood-policies.txt→ravenwood/texts/ravenwood-framework-policies.txt +0 −0 File moved. View file ravenwood/texts/services.core-ravenwood-policies.txt→ravenwood/texts/ravenwood-services-policies.txt +0 −0 File moved. View file tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt +13 −13 Original line number Original line Diff line number Diff line Loading @@ -15,11 +15,11 @@ */ */ package com.android.hoststubgen.filters package com.android.hoststubgen.filters import com.android.hoststubgen.UnknownApiException import com.android.hoststubgen.addNonNullElement import com.android.hoststubgen.addNonNullElement import com.android.hoststubgen.asm.ClassNodes import com.android.hoststubgen.asm.ClassNodes import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.asm.toHumanReadableMethodName import com.android.hoststubgen.asm.toHumanReadableMethodName import com.android.hoststubgen.log // TODO: Validate all input names. // TODO: Validate all input names. Loading Loading @@ -48,30 +48,30 @@ class InMemoryOutputFilter( return mPolicies[getClassKey(className)] ?: super.getPolicyForClass(className) return mPolicies[getClassKey(className)] ?: super.getPolicyForClass(className) } } private fun ensureClassExists(className: String) { private fun checkClass(className: String) { if (classes.findClass(className) == null) { if (classes.findClass(className) == null) { throw UnknownApiException("Unknown class $className") log.w("Unknown class $className") } } } } private fun ensureFieldExists(className: String, fieldName: String) { private fun checkField(className: String, fieldName: String) { if (classes.findField(className, fieldName) == null) { if (classes.findField(className, fieldName) == null) { throw UnknownApiException("Unknown field $className.$fieldName") log.w("Unknown field $className.$fieldName") } } } } private fun ensureMethodExists( private fun checkMethod( className: String, className: String, methodName: String, methodName: String, descriptor: String descriptor: String ) { ) { if (classes.findMethod(className, methodName, descriptor) == null) { if (classes.findMethod(className, methodName, descriptor) == null) { throw UnknownApiException("Unknown method $className.$methodName$descriptor") log.w("Unknown method $className.$methodName$descriptor") } } } } fun setPolicyForClass(className: String, policy: FilterPolicyWithReason) { fun setPolicyForClass(className: String, policy: FilterPolicyWithReason) { ensureClassExists(className) checkClass(className) mPolicies[getClassKey(className)] = policy mPolicies[getClassKey(className)] = policy } } Loading @@ -81,7 +81,7 @@ class InMemoryOutputFilter( } } fun setPolicyForField(className: String, fieldName: String, policy: FilterPolicyWithReason) { fun setPolicyForField(className: String, fieldName: String, policy: FilterPolicyWithReason) { ensureFieldExists(className, fieldName) checkField(className, fieldName) mPolicies[getFieldKey(className, fieldName)] = policy mPolicies[getFieldKey(className, fieldName)] = policy } } Loading @@ -100,7 +100,7 @@ class InMemoryOutputFilter( descriptor: String, descriptor: String, policy: FilterPolicyWithReason, policy: FilterPolicyWithReason, ) { ) { ensureMethodExists(className, methodName, descriptor) checkMethod(className, methodName, descriptor) mPolicies[getMethodKey(className, methodName, descriptor)] = policy mPolicies[getMethodKey(className, methodName, descriptor)] = policy } } Loading @@ -110,8 +110,8 @@ class InMemoryOutputFilter( } } fun setRenameTo(className: String, methodName: String, descriptor: String, toName: String) { fun setRenameTo(className: String, methodName: String, descriptor: String, toName: String) { ensureMethodExists(className, methodName, descriptor) checkMethod(className, methodName, descriptor) ensureMethodExists(className, toName, descriptor) checkMethod(className, toName, descriptor) mRenames[getMethodKey(className, methodName, descriptor)] = toName mRenames[getMethodKey(className, methodName, descriptor)] = toName } } Loading @@ -121,7 +121,7 @@ class InMemoryOutputFilter( } } fun setNativeSubstitutionClass(from: String, to: String) { fun setNativeSubstitutionClass(from: String, to: String) { ensureClassExists(from) checkClass(from) // Native substitute classes may be provided from other jars, so we can't do this check. // Native substitute classes may be provided from other jars, so we can't do this check. // ensureClassExists(to) // ensureClassExists(to) Loading Loading
Ravenwood.bp +12 −12 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ java_genrule { name: "framework-minus-apex.ravenwood-base", name: "framework-minus-apex.ravenwood-base", tools: ["hoststubgen"], tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + cmd: "$(location hoststubgen) " + "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + "@$(location :ravenwood-standard-options) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + Loading @@ -42,13 +42,13 @@ java_genrule { "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + "--policy-override-file $(location ravenwood/texts/framework-minus-apex-ravenwood-policies.txt) " + "--policy-override-file $(location :ravenwood-framework-policies) " + "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", srcs: [ srcs: [ ":framework-minus-apex-for-hoststubgen", ":framework-minus-apex-for-hoststubgen", "ravenwood/texts/framework-minus-apex-ravenwood-policies.txt", ":ravenwood-framework-policies", "ravenwood/texts/ravenwood-standard-options.txt", ":ravenwood-standard-options", "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", ":ravenwood-annotation-allowed-classes", ], ], out: [ out: [ "ravenwood.jar", "ravenwood.jar", Loading Loading @@ -118,7 +118,7 @@ java_genrule { name: "services.core.ravenwood-base", name: "services.core.ravenwood-base", tools: ["hoststubgen"], tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + cmd: "$(location hoststubgen) " + "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + "@$(location :ravenwood-standard-options) " + "--debug-log $(location hoststubgen_services.core.log) " + "--debug-log $(location hoststubgen_services.core.log) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + Loading @@ -130,13 +130,13 @@ java_genrule { "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--gen-input-dump-file $(location hoststubgen_dump.txt) " + "--in-jar $(location :services.core-for-hoststubgen) " + "--in-jar $(location :services.core-for-hoststubgen) " + "--policy-override-file $(location ravenwood/texts/services.core-ravenwood-policies.txt) " + "--policy-override-file $(location :ravenwood-services-policies) " + "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", srcs: [ srcs: [ ":services.core-for-hoststubgen", ":services.core-for-hoststubgen", "ravenwood/texts/services.core-ravenwood-policies.txt", ":ravenwood-services-policies", "ravenwood/texts/ravenwood-standard-options.txt", ":ravenwood-standard-options", "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", ":ravenwood-annotation-allowed-classes", ], ], out: [ out: [ "ravenwood.jar", "ravenwood.jar", Loading
ravenwood/Android.bp +32 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,38 @@ filegroup { visibility: ["//visibility:public"], visibility: ["//visibility:public"], } } filegroup { name: "ravenwood-services-policies", srcs: [ "texts/ravenwood-services-policies.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-framework-policies", srcs: [ "texts/ravenwood-framework-policies.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-standard-options", srcs: [ "texts/ravenwood-standard-options.txt", ], visibility: ["//visibility:public"], } filegroup { name: "ravenwood-annotation-allowed-classes", srcs: [ "texts/ravenwood-annotation-allowed-classes.txt", ], visibility: ["//visibility:public"], } java_library { java_library { name: "ravenwood-annotations-lib", name: "ravenwood-annotations-lib", srcs: [":ravenwood-annotations"], srcs: [":ravenwood-annotations"], Loading
ravenwood/texts/framework-minus-apex-ravenwood-policies.txt→ravenwood/texts/ravenwood-framework-policies.txt +0 −0 File moved. View file
ravenwood/texts/services.core-ravenwood-policies.txt→ravenwood/texts/ravenwood-services-policies.txt +0 −0 File moved. View file
tools/hoststubgen/hoststubgen/src/com/android/hoststubgen/filters/InMemoryOutputFilter.kt +13 −13 Original line number Original line Diff line number Diff line Loading @@ -15,11 +15,11 @@ */ */ package com.android.hoststubgen.filters package com.android.hoststubgen.filters import com.android.hoststubgen.UnknownApiException import com.android.hoststubgen.addNonNullElement import com.android.hoststubgen.addNonNullElement import com.android.hoststubgen.asm.ClassNodes import com.android.hoststubgen.asm.ClassNodes import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.asm.toHumanReadableClassName import com.android.hoststubgen.asm.toHumanReadableMethodName import com.android.hoststubgen.asm.toHumanReadableMethodName import com.android.hoststubgen.log // TODO: Validate all input names. // TODO: Validate all input names. Loading Loading @@ -48,30 +48,30 @@ class InMemoryOutputFilter( return mPolicies[getClassKey(className)] ?: super.getPolicyForClass(className) return mPolicies[getClassKey(className)] ?: super.getPolicyForClass(className) } } private fun ensureClassExists(className: String) { private fun checkClass(className: String) { if (classes.findClass(className) == null) { if (classes.findClass(className) == null) { throw UnknownApiException("Unknown class $className") log.w("Unknown class $className") } } } } private fun ensureFieldExists(className: String, fieldName: String) { private fun checkField(className: String, fieldName: String) { if (classes.findField(className, fieldName) == null) { if (classes.findField(className, fieldName) == null) { throw UnknownApiException("Unknown field $className.$fieldName") log.w("Unknown field $className.$fieldName") } } } } private fun ensureMethodExists( private fun checkMethod( className: String, className: String, methodName: String, methodName: String, descriptor: String descriptor: String ) { ) { if (classes.findMethod(className, methodName, descriptor) == null) { if (classes.findMethod(className, methodName, descriptor) == null) { throw UnknownApiException("Unknown method $className.$methodName$descriptor") log.w("Unknown method $className.$methodName$descriptor") } } } } fun setPolicyForClass(className: String, policy: FilterPolicyWithReason) { fun setPolicyForClass(className: String, policy: FilterPolicyWithReason) { ensureClassExists(className) checkClass(className) mPolicies[getClassKey(className)] = policy mPolicies[getClassKey(className)] = policy } } Loading @@ -81,7 +81,7 @@ class InMemoryOutputFilter( } } fun setPolicyForField(className: String, fieldName: String, policy: FilterPolicyWithReason) { fun setPolicyForField(className: String, fieldName: String, policy: FilterPolicyWithReason) { ensureFieldExists(className, fieldName) checkField(className, fieldName) mPolicies[getFieldKey(className, fieldName)] = policy mPolicies[getFieldKey(className, fieldName)] = policy } } Loading @@ -100,7 +100,7 @@ class InMemoryOutputFilter( descriptor: String, descriptor: String, policy: FilterPolicyWithReason, policy: FilterPolicyWithReason, ) { ) { ensureMethodExists(className, methodName, descriptor) checkMethod(className, methodName, descriptor) mPolicies[getMethodKey(className, methodName, descriptor)] = policy mPolicies[getMethodKey(className, methodName, descriptor)] = policy } } Loading @@ -110,8 +110,8 @@ class InMemoryOutputFilter( } } fun setRenameTo(className: String, methodName: String, descriptor: String, toName: String) { fun setRenameTo(className: String, methodName: String, descriptor: String, toName: String) { ensureMethodExists(className, methodName, descriptor) checkMethod(className, methodName, descriptor) ensureMethodExists(className, toName, descriptor) checkMethod(className, toName, descriptor) mRenames[getMethodKey(className, methodName, descriptor)] = toName mRenames[getMethodKey(className, methodName, descriptor)] = toName } } Loading @@ -121,7 +121,7 @@ class InMemoryOutputFilter( } } fun setNativeSubstitutionClass(from: String, to: String) { fun setNativeSubstitutionClass(from: String, to: String) { ensureClassExists(from) checkClass(from) // Native substitute classes may be provided from other jars, so we can't do this check. // Native substitute classes may be provided from other jars, so we can't do this check. // ensureClassExists(to) // ensureClassExists(to) Loading