desugar_globals output is not reproducible (zip entry order varies)

オープン
#610 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

@TrapsterDK がすでに取り組んでいます。

2026年11月28日 から。

  • #611 @TrapsterDK による — オープン
  • #614 @paladine による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
android, java, shell

調査の方向性

Start with the //tools/android:desugar_globals and desugar_globals_classes genrules in tools/android/BUILD, then run the issue’s GlobalSyntheticsGenerator reproduction command. The work is done when both genrules enable deterministic mode and repeated runs produce identical .globals output that can be remote-cached. Note that linked PR #611 already proposes this change.

索引モデルが issue の本文から書いたものです。

説明

//tools/android:desugar_globals is not reproducible. The genrule runs R8's GlobalSyntheticsGenerator and the entry order of the .globals zip it writes changes from run to run. The zip is the input of desugar_globals_dex_archive, so the same source tree gives different outputs and misses the remote cache.

Reproduce with the R8 version rules_android pins (com.android.tools:r8:9.3.16), without Bazel. The command line is the one in tools/android/BUILD:

curl -sSLO https://maven.google.com/com/android/tools/r8/9.3.16/r8-9.3.16.jar
for i in 1 2 3 4 5 6 7 8; do
  java -Dcom.android.tools.r8.disableLambdaMethodAnnotations \
    -cp r8-9.3.16.jar com.android.tools.r8.GlobalSyntheticsGenerator \
    --min-api 23 --output run$i.globals
done
sha256sum run*.globals | cut -d' ' -f1 | sort | uniq -c

Actual: 8 runs gave 4 different hashes (3/3/1/1). unzip -Z1 shows the same six entries in different orders, for example RecordTag.global first in one run and DesugarVarHandle$0.global first in another.

Expected: the same bytes on every run.

Adding -Dcom.android.tools.r8.deterministicdebugging=1 to the command makes all 8 runs identical (one hash, 8/8).

The --classfile variant used by desugar_globals_classes produced identical output in 12 runs here, but it runs the same generator.

Environment: Linux x86_64, OpenJDK 25, rules_android main (5a9ce60), same behavior expected for 0.8.1.

I will send a PR that sets the flag on both genrules.

Assisted by Claude.

主要言語
Java
スター
205
フォーク
113
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bazelbuild/rules_android のほかの issue

bazelbuild/rules_android の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。