Skip to content

0.3.0

Choose a tag to compare

@github-actions github-actions released this 31 Aug 02:02
· 10 commits to main since this release
7c37ecc

No contract change. ocp.lock points at the same upstream commit as 0.2.0, and the generated
Kotlin and Swift are unchanged. Swift consumers have nothing to gain from this release.

Added

  • The Kotlin artifact now ships R8 keep rules, at META-INF/proguard/ocp-client-protocol.pro:

    -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
        <fields>;
    }
    

    protobuf-javalite ships no keep rules of its own, so until now every Android consumer had to
    write one, and the obvious -keep class * extends GeneratedMessageLite { *; } is far wider
    than javalite needs. javalite resolves fields reflectively — the schema built from
    newMessageInfo looks up java.lang.reflect.Field by the generated <name>_ field — while
    builders and message methods are reached from ordinary call sites, so R8 traces those without
    help. -keepclassmembers also does not keep the class, so a message type nothing references is
    still removed entirely.

    On upgrading, an Android consumer can delete its own protobuf keep rules. Dropping the wide
    pair from code-android-app cut 25,542 live methods and 568 live classes, and moved its R8
    optimization score from 89.3% to 96.3%.

    The rule is deliberately not scoped to com.codeinc.opencode.gen.**. The well-known types (Any, Timestamp,
    Duration, Struct) come from protobuf-javalite itself, and other dependencies ship generated
    messages with no rules of their own, so a package-scoped rule would leave those broken under R8
    full mode. Both contract packages ship identical rule text; R8 collapses them into one entry.