Skip to content

Refactor local Skia build to Gradle/Kotlin#1163

Merged
MatkovIvan merged 2 commits intomasterfrom
ivan.matkov/build-local-skia-gradle
Feb 16, 2026
Merged

Refactor local Skia build to Gradle/Kotlin#1163
MatkovIvan merged 2 commits intomasterfrom
ivan.matkov/build-local-skia-gradle

Conversation

@MatkovIvan
Copy link
Member

@MatkovIvan MatkovIvan commented Feb 15, 2026

Previously:

  • The bash script required specifying SKIA_VERSION separately from gradle.properties, leading to version mismatches
  • Script hardcoded SKIA_TARGET default to iosSim, requiring manual override on non-macOS systems

This change:

  • Added skiaVersionFromEnvOrProperties property and printSkiaVersion task. The bash script now queries Gradle for the version instead of maintaining its own default.
  • Target platform now defaults to current OS (hostOs.id) instead of hardcoded iosSim.
  • Introduced BuildLocalSkiaTask that handles Python build script invocation, architecture detection, and validation.
  • Added SkiaTarget enum centralizing platform-specific Gradle flags and architecture mappings.
  • Simplified bash script: Now focuses solely on git operations (clone/checkout skia-pack), delegating all build logic to Gradle.

Usage

# Version from gradle.properties, target auto-detected from OS
./build-with-local-skia.sh

# Override either via environment variables
SKIA_VERSION=m138-80d088a-2 SKIA_TARGET=iosSim ./build-with-local-skia.sh

# Or use Gradle tasks directly
./gradlew prepareLocalSkiaBuild -Pskia.target=linux

Replace bash logic with type-safe Gradle tasks:
- Add SkiaTarget enum for platform mapping
- Add BuildLocalSkiaTask for build orchestration
- Add SkikoGradleProperties for shared property names
- Add Gradle tasks: buildSkiaLocally, detectSkiaDir, printSkiaVersion
- Improve build-with-local-skia.sh structure and error handling

Benefits:
- Type-safe configuration with compile-time validation
- Reuses existing Gradle infrastructure
- IDE support (autocomplete, navigation, refactoring)
- Better error handling and logging
- Reduced bash script complexity
@MatkovIvan MatkovIvan requested review from eymar and igordmn February 15, 2026 19:50
Address all code review issues identified in the Gradle/Kotlin refactoring:

Critical fixes:
- Add validation for skia-pack directory structure and Python scripts
- Improve git checkout error handling with explicit failures
- Replace subprocess Gradle invocation with separate build/publish steps

Improvements:
- Separate skia.pack.dir and skia.dir parameters for clarity
- Make version format validation fail-fast instead of warning
@MatkovIvan MatkovIvan force-pushed the ivan.matkov/build-local-skia-gradle branch from f5abcde to ceb63c8 Compare February 16, 2026 11:36
@MatkovIvan MatkovIvan merged commit 3451c14 into master Feb 16, 2026
19 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/build-local-skia-gradle branch February 16, 2026 16:12
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.

2 participants