| // Copyright (c) 2026, the R8 project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| syntax = "proto3"; |
| |
| package com.android.tools.r8.libanalyzer.proto; |
| |
| // Don't put all messages under the outer class. |
| option java_multiple_files = true; |
| |
| // Camel-case the outer class name (default is `Libraryanalysisresult`). |
| option java_outer_classname = "LibraryAnalysisResultProtos"; |
| |
| // Java package consistent with R8 convention. |
| option java_package = "com.android.tools.r8.libanalyzer.proto"; |
| |
| // Analysis result produced by the library analyzer. |
| message LibraryAnalysisResult { |
| D8CompileResult d8_compile_result = 1; |
| R8CompileResult r8_compile_result = 2; |
| ValidateConsumerKeepRulesResult validate_consumer_keep_rules_result = 3; |
| } |
| |
| message D8CompileResult { |
| int32 dex_size_bytes = 1; |
| } |
| |
| message R8CompileResult { |
| int32 dex_size_bytes = 1; |
| // Information about the R8 configuration, specifically the keep rules. |
| ConfigurationSummary configuration = 2; |
| // Information about the library's classes and how they are hit by keep rules. |
| ItemCollectionSummary classes = 3; |
| // Ditto, for fields. |
| ItemCollectionSummary fields = 4; |
| // Ditto, for methods. |
| ItemCollectionSummary methods = 5; |
| } |
| |
| message ConfigurationSummary { |
| // Keep rules and their blast radius. Useful for manual inspection. |
| repeated KeepRuleBlastRadiusSummary keep_rules = 1; |
| // Package wide keep rules and their blast radius. |
| repeated KeepRuleBlastRadiusSummary used_package_wide_keep_rules = 2; |
| // Unused package wide keep rules, i.e., rules with zero blast radius. |
| // These rules likely target packages not part of the current library. |
| repeated KeepRuleBlastRadiusSummary unused_package_wide_keep_rules = 3; |
| } |
| |
| message ItemCollectionSummary { |
| // Total number of items (classes, fields or methods) in the input. |
| int32 item_count = 1; |
| // Total number of items that are matched by one or more keep rules. |
| int32 kept_item_count = 2; |
| // Total number of items where obfuscation is prohibited. |
| int32 no_obfuscation_count = 3; |
| // Total number of items where optimization is prohibited. |
| int32 no_optimization_count = 4; |
| // Total number of items where shrinking is prohibited. |
| int32 no_shrinking_count = 5; |
| } |
| |
| message KeepRuleBlastRadiusSummary { |
| string source = 1; |
| int32 kept_item_count = 2; |
| bool no_obfuscation = 3; |
| bool no_optimization = 4; |
| bool no_shrinking = 5; |
| } |
| |
| message ValidateConsumerKeepRulesResult { |
| repeated BlockedConsumerKeepRule blocked_keep_rules = 1; |
| } |
| |
| message BlockedConsumerKeepRule { |
| string source = 1; |
| } |