xref: /aosp_15_r20/external/angle/build/android/chromium_annotations.flags (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2022 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Worker# Contains flags related to annotations in //build/android that can be safely
6*8975f5c5SAndroid Build Coastguard Worker# shared with Cronet, and thus would be appropriate for third-party apps to
7*8975f5c5SAndroid Build Coastguard Worker# include.
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard Worker# Keep all annotation related attributes that can affect runtime
10*8975f5c5SAndroid Build Coastguard Worker-keepattributes RuntimeVisible*Annotations
11*8975f5c5SAndroid Build Coastguard Worker-keepattributes AnnotationDefault
12*8975f5c5SAndroid Build Coastguard Worker
13*8975f5c5SAndroid Build Coastguard Worker# Keeps for class level annotations.
14*8975f5c5SAndroid Build Coastguard Worker-keep,allowaccessmodification @org.chromium.build.annotations.UsedByReflection class ** {}
15*8975f5c5SAndroid Build Coastguard Worker
16*8975f5c5SAndroid Build Coastguard Worker# Keeps for method level annotations.
17*8975f5c5SAndroid Build Coastguard Worker-keepclasseswithmembers,allowaccessmodification class ** {
18*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.UsedByReflection <methods>;
19*8975f5c5SAndroid Build Coastguard Worker}
20*8975f5c5SAndroid Build Coastguard Worker-keepclasseswithmembers,allowaccessmodification class ** {
21*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.UsedByReflection <fields>;
22*8975f5c5SAndroid Build Coastguard Worker}
23*8975f5c5SAndroid Build Coastguard Worker
24*8975f5c5SAndroid Build Coastguard Worker# Never inline classes, methods, or fields with this annotation, but allow
25*8975f5c5SAndroid Build Coastguard Worker# shrinking and obfuscation.
26*8975f5c5SAndroid Build Coastguard Worker# Relevant to fields when they are needed to store strong references to objects
27*8975f5c5SAndroid Build Coastguard Worker# that are held as weak references by native code.
28*8975f5c5SAndroid Build Coastguard Worker-if @org.chromium.build.annotations.DoNotInline class * {
29*8975f5c5SAndroid Build Coastguard Worker    *** *(...);
30*8975f5c5SAndroid Build Coastguard Worker}
31*8975f5c5SAndroid Build Coastguard Worker-keep,allowobfuscation,allowaccessmodification class <1> {
32*8975f5c5SAndroid Build Coastguard Worker    *** <2>(...);
33*8975f5c5SAndroid Build Coastguard Worker}
34*8975f5c5SAndroid Build Coastguard Worker-keepclassmembers,allowobfuscation,allowaccessmodification class * {
35*8975f5c5SAndroid Build Coastguard Worker   @org.chromium.build.annotations.DoNotInline <methods>;
36*8975f5c5SAndroid Build Coastguard Worker}
37*8975f5c5SAndroid Build Coastguard Worker-keepclassmembers,allowobfuscation,allowaccessmodification class * {
38*8975f5c5SAndroid Build Coastguard Worker   @org.chromium.build.annotations.DoNotInline <fields>;
39*8975f5c5SAndroid Build Coastguard Worker}
40*8975f5c5SAndroid Build Coastguard Worker
41*8975f5c5SAndroid Build Coastguard Worker-alwaysinline class * {
42*8975f5c5SAndroid Build Coastguard Worker    @org.chromium.build.annotations.AlwaysInline *;
43*8975f5c5SAndroid Build Coastguard Worker}
44*8975f5c5SAndroid Build Coastguard Worker
45*8975f5c5SAndroid Build Coastguard Worker# Keep all logs (Log.VERBOSE = 2). R8 does not allow setting to 0.
46*8975f5c5SAndroid Build Coastguard Worker-maximumremovedandroidloglevel 1 class ** {
47*8975f5c5SAndroid Build Coastguard Worker   @org.chromium.build.annotations.DoNotStripLogs <methods>;
48*8975f5c5SAndroid Build Coastguard Worker}
49*8975f5c5SAndroid Build Coastguard Worker-maximumremovedandroidloglevel 1 @org.chromium.build.annotations.DoNotStripLogs class ** {
50*8975f5c5SAndroid Build Coastguard Worker   <methods>;
51*8975f5c5SAndroid Build Coastguard Worker}
52*8975f5c5SAndroid Build Coastguard Worker
53*8975f5c5SAndroid Build Coastguard Worker# Never merge classes horizontally or vertically with this annotation.
54*8975f5c5SAndroid Build Coastguard Worker# Relevant to classes being used as a key in maps or sets.
55*8975f5c5SAndroid Build Coastguard Worker-keep,allowaccessmodification,allowobfuscation,allowshrinking @org.chromium.build.annotations.DoNotClassMerge class *
56*8975f5c5SAndroid Build Coastguard Worker
57*8975f5c5SAndroid Build Coastguard Worker# Mark members annotated with IdentifierNameString as identifier name strings
58*8975f5c5SAndroid Build Coastguard Worker-identifiernamestring class * {
59*8975f5c5SAndroid Build Coastguard Worker    @org.chromium.build.annotations.IdentifierNameString *;
60*8975f5c5SAndroid Build Coastguard Worker}
61*8975f5c5SAndroid Build Coastguard Worker
62*8975f5c5SAndroid Build Coastguard Worker# Mark fields with this to help R8 figure out that they cannot be null.
63*8975f5c5SAndroid Build Coastguard Worker# Use assumevalues in addition to assumenosideeffects block because Google3 proguard cannot parse
64*8975f5c5SAndroid Build Coastguard Worker# assumenosideeffects blocks which overwrite return value.
65*8975f5c5SAndroid Build Coastguard Worker-assumevalues class ** {
66*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.AssumeNonNull *** *(...) return _NONNULL_;
67*8975f5c5SAndroid Build Coastguard Worker}
68*8975f5c5SAndroid Build Coastguard Worker-assumenosideeffects class ** {
69*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.AssumeNonNull *** *(...);
70*8975f5c5SAndroid Build Coastguard Worker}
71*8975f5c5SAndroid Build Coastguard Worker-assumevalues class ** {
72*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.AssumeNonNull *** * return _NONNULL_;
73*8975f5c5SAndroid Build Coastguard Worker}
74*8975f5c5SAndroid Build Coastguard Worker-assumenosideeffects class ** {
75*8975f5c5SAndroid Build Coastguard Worker  @org.chromium.build.annotations.AssumeNonNull *** *;
76*8975f5c5SAndroid Build Coastguard Worker}
77