Skip to content

Commit

Permalink
Cherry pick #1425 - protobuf lite into 0.29.x (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyfroehlich authored Jul 26, 2024
1 parent 2cf118c commit cd9a8de
Show file tree
Hide file tree
Showing 35 changed files with 76 additions and 73 deletions.
19 changes: 3 additions & 16 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ publishing {
}
}
}

/**
* Serde gen task
*
Expand Down Expand Up @@ -103,12 +104,18 @@ project.sourceSets.main { proto { srcDir(rootProject.layout.projectDirectory.dir

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${libs.versions.protoc.get()}" }
generateProtoTasks { all().forEach { it.builtins { id("kotlin") } } }
generateProtoTasks {
all().forEach {
it.builtins {
get("java").option("lite")
id("kotlin") { option("lite") }
}
}
}
}

dependencies {
api(libs.javax.annotationApi)
implementation(libs.kotlin.stdlib)
implementation(libs.protobuf.kotlin)
api(libs.protobuf.java.util)
implementation(libs.protobuf.kotlin.lite)
}
2 changes: 1 addition & 1 deletion designcompose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ dependencies {
implementation(libs.guavaAndroid)
implementation(libs.androidx.tracing.ktx)
implementation(libs.androidx.compose.runtime.tracing)
implementation(libs.protobuf.kotlin)
implementation(libs.protobuf.kotlin.lite)

debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.test.manifest)
Expand Down
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ roborazzi-compose = {module = "io.github.takahirom.roborazzi:roborazzi-compose",
roborazzi-junit = {module = "io.github.takahirom.roborazzi:roborazzi-junit-rule", version.ref = "roborazzi"}
spotless-plugin-gradle = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protoc"}
protobuf-kotlin = {module = "com.google.protobuf:protobuf-kotlin", version.ref = "protoc"}
protobuf-java-util = { module = "com.google.protobuf:protobuf-java-util", version.ref = "protoc"}
protobuf-kotlin-lite = {module = "com.google.protobuf:protobuf-kotlin-lite", version.ref = "protoc"}


[plugins]
Expand Down
4 changes: 2 additions & 2 deletions proto/android_interface/jni_layout.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.android_interface;

import "definition/layout/layout_node.proto";

option java_package = "com.android.designcompose.android_interface";

option java_multiple_files = true;
option java_package = "com.android.designcompose.android_interface";
option optimize_for = LITE_RUNTIME;

// A list of Figma nodes to register for layout
message LayoutNodeList {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/design_compose_definition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package designcompose.definition;
import "definition/element/variable.proto";
import "definition/view/view.proto";

option java_package = "com.android.designcompose.definition";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition";
option optimize_for = LITE_RUNTIME;

// A serialized Figma design document, containing views, images, component sets,
// version, ID, and variable map. It's used for storing and loading Figma
Expand Down
2 changes: 2 additions & 0 deletions proto/definition/element/color.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ syntax = "proto3";

package designcompose.definition.element;

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// Color represents a color value within a design, encoded as RGBA (Red, Green,
// Blue, Alpha) where each component is an 8-bit integer. Alpha determines
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/element/font.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.element;

import "definition/element/variable.proto";

option java_package = "com.android.designcompose.definition.element";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// FontWeight specifies the visual thickness of a typeface. It's represented
// numerically, usually ranging from 100 (thin) to 900 (black). Common values
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/element/geometry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.element;

import "google/protobuf/empty.proto";

option java_package = "com.android.designcompose.definition.element";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// Size encapsulates the dimensions of an element, expressed as width and height
// values. These values typically represent pixels or density-independent pixels
Expand Down
3 changes: 2 additions & 1 deletion proto/definition/element/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ syntax = "proto3";

package designcompose.definition.element;

option java_package = "com.android.designcompose.definition.element";
option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// A message used to identify a specific node within a design document. It
// supports different ways to specify the node, including by its ID, name,
Expand Down
2 changes: 1 addition & 1 deletion proto/definition/element/path.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package designcompose.definition.element;
import "definition/modifier/background.proto";

option java_package = "com.android.designcompose.definition.element";

option java_multiple_files = true;
option optimize_for = LITE_RUNTIME;

// Path represents a complex shape in a design, defined by a series of commands
// (e.g., move, line, curve) and associated numerical data. It determines the
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/element/variable.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.element;

import "definition/element/color.proto";

option java_package = "com.android.designcompose.definition.element";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// Holds the value of a variable, whichever type it is.
message VariableValue {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/element/view_shape.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.element;

import "definition/element/variable.proto";

option java_package = "com.android.designcompose.definition.element";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.element";
option optimize_for = LITE_RUNTIME;

// Represents the geometric shape of a visual element, such as a rectangle,
// ellipse, or a custom path. It determines the boundaries of the element and
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/interaction/pointer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.interaction;

option java_package = "com.android.designcompose.definition.interaction";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.interaction";
option optimize_for = LITE_RUNTIME;

// Determines how a UI element responds to user interactions like taps, clicks,
// and hovers. It can be set to "Auto" for default behavior, "None" to disable
Expand Down
2 changes: 2 additions & 0 deletions proto/definition/interaction/reaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import "definition/element/geometry.proto";
import "definition/interaction/transition.proto";
import "google/protobuf/empty.proto";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.interaction";
option optimize_for = LITE_RUNTIME;

// Various actions that can be triggered
message Action {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/interaction/transition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ syntax = "proto3";

package designcompose.definition.interaction;

option java_package = "com.android.designcompose.definition.interaction";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.interaction";
option optimize_for = LITE_RUNTIME;

// The type of easing to perform in a transition.
message Easing {
Expand Down
3 changes: 2 additions & 1 deletion proto/definition/layout/display.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ syntax = "proto3";

package designcompose.definition.layout;

option java_package = "com.android.designcompose.definition.layout";
option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.layout";
option optimize_for = LITE_RUNTIME;

// Configures whether a view is displayed using a Flexbox layout or not at all.
enum Display {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/layout/grid.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.layout;

option java_package = "com.android.designcompose.definition.layout";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.layout";
option optimize_for = LITE_RUNTIME;

// Represents a span for a node within a grid layout.
message GridSpan {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/layout/layout_node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.layout;

import "definition/layout/layout_style.proto";

option java_package = "com.android.designcompose.definition.layout";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.layout";
option optimize_for = LITE_RUNTIME;

// A representation of a Figma node to register for layout.
message LayoutNode {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/layout/layout_style.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import "definition/element/geometry.proto";
import "definition/layout/grid.proto";
import "definition/layout/positioning.proto";

option java_package = "com.android.designcompose.definition.layout";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.layout";
option optimize_for = LITE_RUNTIME;

/* This message defines the layout style of a Figma node. It includes various
* properties that control the node's position, size, and spacing, as well as
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/layout/positioning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.layout;

option java_package = "com.android.designcompose.definition.layout";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.layout";
option optimize_for = LITE_RUNTIME;

// Controls how items are aligned on the cross axis within a single line (row or
// column) of the container. The cross axis is the axis perpendicular to the
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/background.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import "definition/element/color.proto";
import "definition/modifier/filter.proto";
import "definition/modifier/matrix_transform.proto";

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// The background of a node
message Background {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/blend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.modifier;

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// Various supported Blend types
enum BlendMode {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.modifier;

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// Various filters that can be applied and their intensity
message FilterOp {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/matrix_transform.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.modifier;

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// Represents a 3D affine transformation, which is a combination of
// translation, rotation, scaling, and shearing in 3D space. It's used to
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/shadow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.modifier;

import "definition/element/color.proto";

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// Shadows can be applied to the border box, or the stroke box.
//
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/modifier/text.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.modifier;

import "definition/element/color.proto";

option java_package = "com.android.designcompose.definition.modifier";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.modifier";
option optimize_for = LITE_RUNTIME;

// Horizontal text alignment. This value aligns the text within its bounds.
enum TextAlign {
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/plugin/frame_extras.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package designcompose.definition.plugin;

import "definition/element/color.proto";

option java_package = "com.android.designcompose.definition.plugin";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.plugin";
option optimize_for = LITE_RUNTIME;

// Some frame properties are only available through the plugin API and are
// needed to implement Reactions properly. They're included in this FrameExtras
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/plugin/meter_data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package designcompose.definition.plugin;

option java_package = "com.android.designcompose.definition.plugin";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.plugin";
option optimize_for = LITE_RUNTIME;

// Represents data for a rotation meter, including whether it's enabled, its
// start and end angles, whether it's discrete, and the discrete value.
Expand Down
4 changes: 2 additions & 2 deletions proto/definition/view/component.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import "definition/view/text_style.proto";
import "definition/view/view_style.proto";
import "google/protobuf/empty.proto";

option java_package = "com.android.designcompose.definition.view";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.view";
option optimize_for = LITE_RUNTIME;

// Figma component properties can be "overridden" in the UI. These overrides
// are applied in the node tree we get back from Figma, so we don't have to
Expand Down
3 changes: 2 additions & 1 deletion proto/definition/view/node_style.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ import "definition/modifier/shadow.proto";
import "definition/modifier/text.proto";
import "definition/plugin/meter_data.proto";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.view";
option optimize_for = LITE_RUNTIME;

option java_multiple_files = true;

// Contains all of the styleable parameters accepted by the Rect and Text
// components.
Expand Down
Loading

0 comments on commit cd9a8de

Please sign in to comment.