Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROTOCONV] Convert the Kotlin code to Proto #1886

Merged
merged 50 commits into from
Jan 13, 2025
Merged

Conversation

timothyfroehlich
Copy link
Member

@timothyfroehlich timothyfroehlich commented Dec 18, 2024

No description provided.

This will cause syntax errors across the codebase, but will mean that
converting code in a file should clear those errors. As an example,
replacing all instances of the Serde NodeStyle with the Proto NodeStyle
means that this line of code is now an error:
<!-- start git-machete generated -->

# Based on PR #1879

## Chain of upstream PRs as of 2024-12-18

* PR #1879:
  `feature/protoconv` ← `wb/froeht/swap-dcd-to-proto`

  * **PR #1874 (THIS ONE)**:
    `wb/froeht/swap-dcd-to-proto` ← `wb/froeht/test-convert`

<!-- end git-machete generated -->

If you open SquooshLayout in Android Studio you'll see that there's no
errors listed. Of course everything else needs to be converted too, so
nothing will compile.
timothyfroehlich and others added 8 commits December 18, 2024 19:04
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-18

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1888 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/convert-variablemanager`

<!-- end git-machete generated -->


There's still a few syntax issues because the `toColor()` function
hasn't been converted yet.

Also included a configuration file for the CamelCase plugin that
disables the naming schemes that we aren't using.
MathUtils calls one Utils api. Double check when #1916 merged.
Also need to update ProtoUtils StrokeWeight functions.

Fixes: #1889
timothyfroehlich and others added 6 commits December 19, 2024 16:47
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-18

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1917 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/1895-doccontent`

<!-- end git-machete generated -->
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-18

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1919 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/1899-interactionstate`

<!-- end git-machete generated -->
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-19

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1927 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/1898-framerender`

<!-- end git-machete generated -->
yiqunw700 and others added 6 commits December 20, 2024 11:17
…1933)

<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-20

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1933 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/1900-KeyInjectManager`

<!-- end git-machete generated -->
rylin8 and others added 3 commits January 6, 2025 13:41
Fix mergeStyles() function to take values from base style by default,
and from override view style if set. Fix opacity value when rendering.
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2024-12-30

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1956 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/fix-shader`

<!-- end git-machete generated -->
Copy link

github-actions bot commented Jan 6, 2025

Snapshot diff report vs base branch: main
Last updated: Mon Jan 13 11:33:51 PST 2025, Sha: 4d37cb2
No differences detected

timothyfroehlich and others added 4 commits January 6, 2025 11:57
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2025-01-06

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1959 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/format-protoconv`

<!-- end git-machete generated -->
The FrameRender change is not related. Just feel cleaner to put it that
way.
@timothyfroehlich timothyfroehlich marked this pull request as ready for review January 8, 2025 18:20
@timothyfroehlich timothyfroehlich requested review from rylin8, yiqunw700 and iamralpht and removed request for yiqunw700 January 8, 2025 18:20
@timothyfroehlich timothyfroehlich self-assigned this Jan 8, 2025
rylin8 and others added 2 commits January 9, 2025 20:09
Remove unused code
Change builders to copy()
<!-- start git-machete generated -->

# Based on PR #1886

## Chain of upstream PRs as of 2025-01-09

* PR #1886:
  `main` ← `feature/protoconv`

  * **PR #1964 (THIS ONE)**:
    `feature/protoconv` ← `wb/froeht/improve-docserializationtest`

<!-- end git-machete generated -->

This change modifies the test setup for `DocSerializationTest` to
improve its robustness and coverage.

- Removes `showStandardStreams = true` from the roborazzi gradle config,
to quiet down the amount of console spam
- Adds the validation assets directory to the test resources for the
common module.
- Replaces the single `loadSaveLoadHelloWorld` test with a parameterized
test `LoadSaveLoadAllDocsTest` to make it easier to see which docs
aren't passing
- Removes the
`VariantAnimationTimelineTestDoc_vJRf4zxY4QX4zzSSUd1nJ5.dcf` file. The
test is disabled right now ( #1945 ) so the dcf wasn't being updated and
was failing to decode.
…conversion code (#1965)

With this change we're able to fully remove serde-reflection from the
code base.

This involved a decent amount of refactoring and cleanup of old work to
get things right. My goal with the refactoring was to keep the packages
cleanly separated and to work towards having the ability to build a
DesignCompose app without including anything related to Live Update.
Ultimately I could see the dc_jni crate being split into the layout and
fetch portions, which would compile into their own separate libraries,
and merged in with figma_import and layout.

Some of the messages related to both the doc fetching and layout
processing were a bit scattered and were declared in crates that didn't
actually use them. Before this change the `dc_jni` crate didn't have any
of its own proto messages, it was pulling the ones it needed (Layout
conversion related) from other crates (both `dc_bundle` and `layout`).
The new Convert Request/Response messages would only be used by
`dc_jni`, so it made sense to add a build.rs file to it so that the
generated messages would be native to that crate, rather than being part
of an unrelated crate.

While making that change it made sense to rearrange the proto messages
related to the android interface, so I moved the layout related messages
into a `layout_interface` proto package and put the new Convert messages
into the `live_update` package.

In addition, the layout code had really only been half converted to
proto, we were still parsing them and then converting them into the
original Rust structs. That's all cleaned up now.

We had been manually generating a json string which was decoded into the
ConvertRequest on the rust side, so I converted the ConvertRequest to
Proto and removed the json code. It didn't make sense to use proto on
one side and not the other. It'd probably be cleaner to change the
`jniFetchDoc` method to just send a single proto message instead of the
ConvertRequest, doc_id, version_id and proxy configuration, but that can
be cleaned up another day.

I also decided not to convert the image_session from json to proto
because we don't actually do anything with it on the Kotlin side other
than writing it into the .dcf. I'm simply including the json in the
proto message and removing the redundant storage of the session's bytes
in the docContent class.


Admittedly this PR is bigger than it strictly needed to be. I can split
it into some smaller PRs if requested. I'm sure there's some additional
cleanup that could be done as well, including simplifying the
`jniFetchDoc` function and turning ProxyConfig into a proto struct.
…Mac" (#1972)

Reverts #1966

Will reintroduce once we've merged the feature branch to main.
Fixes #1945: Add functions to VariantTransitionContext that allow access
to the view names.
@timothyfroehlich timothyfroehlich merged commit ee08cce into main Jan 13, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert Kotlin code to use the native protobuf classes instead of serdegen versions
4 participants