Skip to content

bncummings/dwf-validator

 
 

Repository files navigation

DWF-Validator

A DSL based validator for the Declarative Watch Face format - used by WearOS devices for third-party watch faces.

Project Structure

dwf-validator/
├── dwf-validator/                        # Core validator library module
│   ├── src/
│   │   ├── commonMain/kotlin/            # Kotlin multiplatform common code
│   │   │   ├── constraint/               # Constraint generation logic
│   │   │   ├── error/                    # Error/Validation Result handling
│   │   │   ├── expression/               # Expression parser logic
│   │   │   └── specification/            # WFF specifications written in DSL
│   │   ├── jvmMain/kotlin/               # JVM-specific XML parsing
│   │   ├── jsMain/kotlin/                # JavaScript-specific XML parsing
│   │   ├── commonTest/                   # Common tests
│   │   ├── jvmTest/                      # JVM-specific tests
│   │   └── jsTest/                       # JavaScript-specific tests
│   └── build.gradle.kts                  # Validator module build config
│
└── dwf-validator-cli/                    # Command-Line Interface

Usage

The command line interface can be used as a jar file or through the gradle run command.

# use the cli as a standalone jar
java -jar dwf-validator-cli.jar --source <path-to-apk>

# run with gradle
gradle dwf-validator-cli:run --args="--source <path-to-apk>"

# or, from the project root directory:
./gradlew dwf-validator-cli:run --args="--source <path-to-apk>"

Output:

Validation Failed for file: /Users/bcummings/Dev/watchface-dwf-validator/dwf-validator-cli/src/main/resources/example-watchface.xml.

Global Errors:

WatchFace > Scene > PartDraw:
  -  Illegal Attribute Value:
        Attribute: "y" has illegal value: "three".

        Value must be an integer.

Command Line Options

Options:
  --source <path>     Path to DWF file to validate
  -x, --raw-xml       Reads raw xml file instead of apk

Example 1: Validate a DWF APK

java -jar dwf-validator-cli.jar --source <path-to-apk>

Note: The validator expects the raw XML to be located in dwf-apk/res/raw.

Example 2: Validate Raw XML

java -jar dwf-validator-cli.jar --raw-xml --source <path-to-apk>

License

This project is licensed under the Apache License, Version 2.0 (See the LICENSE). This license is inherited from the parent repository: google/watchface.

Note: This project was developed by and is property of Google.

About

DSL-Based Watch Face Validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%