google / google/watchface

wff-optimizer: Add XML minify

Open
#81 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
71
Forks
10
Avg merge
4h 14m
Merged PRs (30d)
1

Description

What about adding watchface.xml minify tool? I think WFS uses something similar before bundling watchface.aab.

I wrote a Kotlin based solution for watchface.xml minification. Performance gains are marginal, of course, with wff xml minification, but it may help with watch face loading speeds slightly, when the comments, white spaces, etc. are removed.

Maybe some more methods to remove redundant (default) attributes like alpha="255", pivotX/Y="0.5", etc could be added in the future?

wff-minify.jar takes watchface.xml absolute path and rewrites the file at the moment. I'm currently speculating about the way how to properly implement it to the gradle build process.

Do you think something like this would be useful to have in [wff-optimizer](https://github.com/google/watchface/tree/main/tools/wff-optimizer) repo?

@alexclarke-g @garanj

Attaching compiled jar, source code & difference between untouched / minified watchface.xml.
[wff-minify.zip](https://github.com/user-attachments/files/19648253/wff-minify.zip)

Usage: `java -jar wff-minify.jar `

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.