File: README.chromium

package info (click to toggle)
webkit2gtk 2.51.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 457,708 kB
  • sloc: cpp: 3,884,629; javascript: 198,661; ansic: 165,298; python: 49,171; asm: 21,849; ruby: 18,095; perl: 16,914; xml: 4,623; sh: 2,397; yacc: 2,356; java: 2,019; lex: 1,330; pascal: 372; makefile: 197
file content (98 lines) | stat: -rw-r--r-- 4,346 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Name: R8
URL: https://r8.googlesource.com/r8
Version: 3.0.33
License: BSD-3-Clause
License File: LICENSE
Security Critical: no
Shipped: no

Description:
lib/r8.jar
 - Contains R8 (proguard replacement) as well as D8 (dexer).
3pp
 - Contains code for 3pp-linux-amd64-packager to package and upload new versions of r8.
desugar_jdk_libs.json
 - Configuration for Java library desugaring.
 - Taken from
   //third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/
   inside the jar file, in META-INF/desugar/d8/desugar.json. License is also BSD
   3-Clause (the r8 version).

R8 is a proguard-like optimizer that also has the ability to dex.

Local Modifications:
* Refer to commit descriptions within "3pp/patches" directory.
* Added "playground" directory for quick "how does this optimize" tests.
* Removed references to ConcurrentHashMap and TimeZone#getTimeZone in desugar_jdk_libs.json.
* Added "java/src/org/chromium/build/CustomD8.java", custom_d8.jar, and BUILD.gn.
  * Used in "build/android/gyp/dex.py" to enable desugar dependencies.

Update Instructions:
* For the custom d8 jar:
  * This is required only when CustomD8.java changes.
  * Uncomment the flag --skip-custom-d8 in internal_rules.gni to avoid depending
    on the previously built custom_d8.jar.
autoninja -C out/Debug third_party/r8:custom_d8_java
cp out/Debug/obj/third_party/r8/custom_d8_java.javac.jar third_party/r8/custom_d8.jar

* For a new version of r8:
  * Find the latest successful run of the build bot:
    * https://ci.chromium.org/p/chromium/builders/ci/3pp-linux-amd64-packager
    * The bot autoruns every 6 hours. Ping a trooper to trigger it if you need it sooner.
      * https://luci-scheduler.appspot.com/jobs/chromium/3pp-linux-amd64-packager
  * Go to its log page and look under:
    * Expand "building chromium/third_party/r8" to see the CIPD instance ID.
  * Copy this instance ID to the r8 entry in //DEPS.
  * Update this file with the new version string and submit.

* If patching fails:
git clone https://r8.googlesource.com/r8
cd r8
  * Find latest tag:
git fetch origin --tags
git tag -l  # Often unnecessary as output from the fetch includes recent tags.
git checkout $TAG  # e.g. 3.0.25-dev, whichever tag failed patching.
  * Apply patches:
git checkout -b my_branch
git am $CHROMIUM_SRC/third_party/r8/patches/*.patch
  * Fix patch conflicts.
  * Save new patches. Change number if expecting more or fewer patches:
git format-patch -3 -o $CHROMIUM_SRC/third_party/r8/3pp/patches
  * Submit these fixed patches and the bot will automatically retry.

* Local development (see above for setting up the r8 repo):
  * Build
tools/gradle.py r8
  * Shrink (improves r8/d8 launch time):
java -jar build/libs/r8.jar --debug --classfile --output r8.jar \
    --lib $CHROMIUM_SRC/third_party/jdk/current --pg-conf src/main/keep.txt \
    --no-minification --no-desugaring build/libs/r8.jar
mv $CHROMIUM_SRC/third_party/r8/lib/r8.jar{,.bak}
cp r8.jar $CHROMIUM_SRC/third_party/r8/lib/r8.jar

* Update backported methods list:
cd $CHROMIUM_SRC
java -cp third_party/r8/lib/r8.jar com.android.tools.r8.BackportedMethodList --min-api 16 > third_party/r8/backported_methods.txt

* Update instructions for desugar_jdk_libs.json:
unzip -p third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/*.jar META-INF/desugar/d8/desugar.json > third_party/r8/desugar_jdk_libs.json
  * Remove all mentions of ConcurrentHashMap and TimeZone#getTimeZone and remove trailing commas.
  * Update //build/config/android/internal_rules.gni to point at the new .jar files:
    * desugar_jdk_libs-1.1.1.jar
    * desugar_jdk_libs_configuration-1.1.1.jar

How to file bugs against R8:
* Copy & paste the failing ninja command (starts with proguard.py), and add --dump-inputs.
  * This also works for dex.py, it produces d8inputs.zip
* File bug at go/r8bug
* Things to include (use discretion if some are not relevant):
  * src revision bug reproduces at
  * Repro steps (gn gen & autoninja commands)
    * Prefer enable_chrome_android_internal=false
  * The r8inputs.zip from --dump-inputs
  * Any relevant dexdump analysis

How to submit CLs to R8:
* Request to be added to their allowlist in order to upload CLs.
* After CLs are submitted, check the bots for build breakage.
  * https://ci.chromium.org/p/r8/g/main_all/console