Loading ravenwood/Android.bp +17 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ filegroup { srcs: [ "texts/ravenwood-common-policies.txt", ], visibility: ["//visibility:private"], visibility: [":__subpackages__"], } filegroup { Loading @@ -43,6 +43,22 @@ filegroup { visibility: ["//visibility:private"], } filegroup { name: "ravenwood-standard-annotations", srcs: [ "texts/ravenwood-standard-annotations.txt", ], visibility: [":__subpackages__"], } filegroup { name: "ravenizer-standard-options", srcs: [ "texts/ravenizer-standard-options.txt", ], visibility: [":__subpackages__"], } filegroup { name: "ravenwood-annotation-allowed-classes", srcs: [ Loading ravenwood/Framework.bp +12 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ genrule_defaults { ":ravenwood-common-policies", ":ravenwood-framework-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ":ravenwood-annotation-allowed-classes", ], out: [ Loading @@ -44,6 +45,7 @@ genrule_defaults { framework_minus_apex_cmd = "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--out-jar $(location ravenwood.jar) " + "--in-jar $(location :framework-minus-apex-for-host) " + Loading Loading @@ -178,6 +180,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_services.core.log) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + Loading @@ -196,6 +199,7 @@ java_genrule { ":ravenwood-common-policies", ":ravenwood-services-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ":ravenwood-annotation-allowed-classes", ], out: [ Loading Loading @@ -247,6 +251,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " + "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " + Loading @@ -265,6 +270,7 @@ java_genrule { ":ravenwood-common-policies", ":icu-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -301,6 +307,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-configinfrastructure.log) " + "--stats-file $(location framework-configinfrastructure_stats.csv) " + Loading @@ -319,6 +326,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-configinfrastructure-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -355,6 +363,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-statsd.log) " + "--stats-file $(location framework-statsd_stats.csv) " + Loading @@ -373,6 +382,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-statsd-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -409,6 +419,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-graphics.log) " + "--stats-file $(location framework-graphics_stats.csv) " + Loading @@ -427,6 +438,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-graphics-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading ravenwood/tests/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodJdkPatchTest.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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 com.android.ravenwoodtest.bivalenttest.ravenizer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import android.system.ErrnoException; import android.system.Os; import android.system.OsConstants; import org.junit.Test; import java.io.FileDescriptor; import java.util.LinkedHashMap; import java.util.regex.Pattern; public class RavenwoodJdkPatchTest { @Test public void testUnicodeRegex() { var pattern = Pattern.compile("\\w+"); assertTrue(pattern.matcher("über").matches()); } @Test public void testLinkedHashMapEldest() { var map = new LinkedHashMap<String, String>(); map.put("a", "b"); map.put("x", "y"); assertEquals(map.entrySet().iterator().next(), map.eldest()); } @Test public void testFileDescriptorGetSetInt() throws ErrnoException { FileDescriptor fd = Os.open("/dev/zero", OsConstants.O_RDONLY, 0); try { int fdRaw = fd.getInt$(); assertNotEquals(-1, fdRaw); fd.setInt$(-1); assertEquals(-1, fd.getInt$()); fd.setInt$(fdRaw); Os.close(fd); assertEquals(-1, fd.getInt$()); } finally { Os.close(fd); } } } ravenwood/texts/ravenizer-standard-options.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line # File containing standard options to Ravenizer for Ravenwood # Keep all classes / methods / fields in tests and its target --default-keep --delete-finals # Include standard annotations @jar:texts/ravenwood-standard-annotations.txt # Apply common policies --policy-override-file jar:texts/ravenwood-common-policies.txt ravenwood/texts/ravenwood-standard-annotations.txt 0 → 100644 +37 −0 Original line number Diff line number Diff line # Standard annotations. # Note, each line is a single argument, so we need newlines after each `--xxx-annotation`. --keep-annotation android.ravenwood.annotation.RavenwoodKeep --keep-annotation android.ravenwood.annotation.RavenwoodKeepPartialClass --keep-class-annotation android.ravenwood.annotation.RavenwoodKeepWholeClass --throw-annotation android.ravenwood.annotation.RavenwoodThrow --remove-annotation android.ravenwood.annotation.RavenwoodRemove --ignore-annotation android.ravenwood.annotation.RavenwoodIgnore --partially-allowed-annotation android.ravenwood.annotation.RavenwoodPartiallyAllowlisted --substitute-annotation android.ravenwood.annotation.RavenwoodReplace --redirect-annotation android.ravenwood.annotation.RavenwoodRedirect --redirection-class-annotation android.ravenwood.annotation.RavenwoodRedirectionClass --class-load-hook-annotation android.ravenwood.annotation.RavenwoodClassLoadHook --keep-static-initializer-annotation android.ravenwood.annotation.RavenwoodKeepStaticInitializer Loading
ravenwood/Android.bp +17 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ filegroup { srcs: [ "texts/ravenwood-common-policies.txt", ], visibility: ["//visibility:private"], visibility: [":__subpackages__"], } filegroup { Loading @@ -43,6 +43,22 @@ filegroup { visibility: ["//visibility:private"], } filegroup { name: "ravenwood-standard-annotations", srcs: [ "texts/ravenwood-standard-annotations.txt", ], visibility: [":__subpackages__"], } filegroup { name: "ravenizer-standard-options", srcs: [ "texts/ravenizer-standard-options.txt", ], visibility: [":__subpackages__"], } filegroup { name: "ravenwood-annotation-allowed-classes", srcs: [ Loading
ravenwood/Framework.bp +12 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ genrule_defaults { ":ravenwood-common-policies", ":ravenwood-framework-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ":ravenwood-annotation-allowed-classes", ], out: [ Loading @@ -44,6 +45,7 @@ genrule_defaults { framework_minus_apex_cmd = "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_framework-minus-apex.log) " + "--out-jar $(location ravenwood.jar) " + "--in-jar $(location :framework-minus-apex-for-host) " + Loading Loading @@ -178,6 +180,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_services.core.log) " + "--stats-file $(location hoststubgen_services.core_stats.csv) " + Loading @@ -196,6 +199,7 @@ java_genrule { ":ravenwood-common-policies", ":ravenwood-services-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ":ravenwood-annotation-allowed-classes", ], out: [ Loading Loading @@ -247,6 +251,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " + "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " + Loading @@ -265,6 +270,7 @@ java_genrule { ":ravenwood-common-policies", ":icu-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -301,6 +307,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-configinfrastructure.log) " + "--stats-file $(location framework-configinfrastructure_stats.csv) " + Loading @@ -319,6 +326,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-configinfrastructure-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -355,6 +363,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-statsd.log) " + "--stats-file $(location framework-statsd_stats.csv) " + Loading @@ -373,6 +382,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-statsd-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading Loading @@ -409,6 +419,7 @@ java_genrule { tools: ["hoststubgen"], cmd: "$(location hoststubgen) " + "@$(location :ravenwood-standard-options) " + "@$(location :ravenwood-standard-annotations) " + "--debug-log $(location framework-graphics.log) " + "--stats-file $(location framework-graphics_stats.csv) " + Loading @@ -427,6 +438,7 @@ java_genrule { ":ravenwood-common-policies", ":framework-graphics-ravenwood-policies", ":ravenwood-standard-options", ":ravenwood-standard-annotations", ], out: [ "ravenwood.jar", Loading
ravenwood/tests/bivalenttest/test/com/android/ravenwoodtest/bivalenttest/ravenizer/RavenwoodJdkPatchTest.java 0 → 100644 +63 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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 com.android.ravenwoodtest.bivalenttest.ravenizer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import android.system.ErrnoException; import android.system.Os; import android.system.OsConstants; import org.junit.Test; import java.io.FileDescriptor; import java.util.LinkedHashMap; import java.util.regex.Pattern; public class RavenwoodJdkPatchTest { @Test public void testUnicodeRegex() { var pattern = Pattern.compile("\\w+"); assertTrue(pattern.matcher("über").matches()); } @Test public void testLinkedHashMapEldest() { var map = new LinkedHashMap<String, String>(); map.put("a", "b"); map.put("x", "y"); assertEquals(map.entrySet().iterator().next(), map.eldest()); } @Test public void testFileDescriptorGetSetInt() throws ErrnoException { FileDescriptor fd = Os.open("/dev/zero", OsConstants.O_RDONLY, 0); try { int fdRaw = fd.getInt$(); assertNotEquals(-1, fdRaw); fd.setInt$(-1); assertEquals(-1, fd.getInt$()); fd.setInt$(fdRaw); Os.close(fd); assertEquals(-1, fd.getInt$()); } finally { Os.close(fd); } } }
ravenwood/texts/ravenizer-standard-options.txt 0 → 100644 +13 −0 Original line number Diff line number Diff line # File containing standard options to Ravenizer for Ravenwood # Keep all classes / methods / fields in tests and its target --default-keep --delete-finals # Include standard annotations @jar:texts/ravenwood-standard-annotations.txt # Apply common policies --policy-override-file jar:texts/ravenwood-common-policies.txt
ravenwood/texts/ravenwood-standard-annotations.txt 0 → 100644 +37 −0 Original line number Diff line number Diff line # Standard annotations. # Note, each line is a single argument, so we need newlines after each `--xxx-annotation`. --keep-annotation android.ravenwood.annotation.RavenwoodKeep --keep-annotation android.ravenwood.annotation.RavenwoodKeepPartialClass --keep-class-annotation android.ravenwood.annotation.RavenwoodKeepWholeClass --throw-annotation android.ravenwood.annotation.RavenwoodThrow --remove-annotation android.ravenwood.annotation.RavenwoodRemove --ignore-annotation android.ravenwood.annotation.RavenwoodIgnore --partially-allowed-annotation android.ravenwood.annotation.RavenwoodPartiallyAllowlisted --substitute-annotation android.ravenwood.annotation.RavenwoodReplace --redirect-annotation android.ravenwood.annotation.RavenwoodRedirect --redirection-class-annotation android.ravenwood.annotation.RavenwoodRedirectionClass --class-load-hook-annotation android.ravenwood.annotation.RavenwoodClassLoadHook --keep-static-initializer-annotation android.ravenwood.annotation.RavenwoodKeepStaticInitializer