composewebview-development

构建、测试和格式化 ComposeWebView 多平台库。处理 Android、iOS、桌面(JVM)和 Web(JS)平台。用于构建、测试、运行 Spotless 格式化或检查特定平台代码。支持 expect/actual 工作流程。

📖 中文导读:构建、测试和格式化 ComposeWebView 多平台库。处理 Android、iOS、桌面(JVM)和 Web(JS)平台。用于构建、测试、运行 Spotless 格式化或检查特定平台代码。支持 expect/actual 工作流程。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: composewebview-development description: Builds, tests, and formats ComposeWebView multiplatform library. Handles Android, iOS, Desktop (JVM), and Web (JS) platforms. Use when building, testing, running Spotless formatting, or checking platform-specific code. Supports expect/actual pattern workflows.

ComposeWebView Development Workflow

This skill automates building, testing, and formatting for the ComposeWebView multiplatform library across Android, iOS, Desktop (JVM), Web (JS), and Web (WASM) platforms.

Quick Commands

Format Code (REQUIRED before commits)

./gradlew spotlessApply

Run All Tests

./gradlew :compose-webview:allTests

Build All Platforms

bash .agent/skills/development/scripts/build_all.sh

Check Implementation Status

bash .agent/skills/development/scripts/platform_status.sh

Platform-Specific Workflows

Android

# Build
./gradlew :compose-webview:assembleDebug

# Test
./gradlew :compose-webview:testDebugUnitTest

# Lint
./gradlew lintDebug

iOS

# Link (build)
./gradlew :compose-webview:linkIosSimulatorArm64

# Test
./gradlew :compose-webview:iosSimulatorArm64Test

Desktop (JVM)

# Compile
./gradlew :compose-webview:compileKotlinDesktop

# Test
./gradlew :compose-webview:desktopTest

Web (JS)

# Compile
./gradlew :compose-webview:compileKotlinJs

# Test
./gradlew :compose-webview:jsTest

Web (WASM)

# Compile
./gradlew :compose-webview:compileKotlinWasmJs

# Test
./gradlew :compose-webview:wasmJsTest

Adding New Features

ComposeWebView uses the expect/actual pattern for multiplatform code. Follow these steps:

  1. Define in Common: Add expect declaration in commonMain/kotlin/com/parkwoocheol/composewebview/

    expect class PlatformFeature {
        fun doSomething(): String
    }
    
  2. Implement per Platform: Add actual implementation in each platform's source set

    • androidMain/ - Android WebView implementation
    • iosMain/ - WKWebView implementation
    • desktopMain/ - CEF (Chromium Embedded Framework) implementation
    • jsMain/ - Web/JS implementation
    • wasmJsMain/ - WASM implementation
  3. Verify Completeness: Run platform status check

    bash .agent/skills/development/scripts/platform_status.sh
    
  4. Test: Run platform-specific tests

    bash .agent/skills/development/scripts/test_all.sh
    
  5. Format: MUST run Spotless before committing

    ./gradlew spotlessApply
    

See reference/platform_specifics.md for detailed platform patterns and constraints.

Code Templates

Creating expect/actual

Use the template: templates/ExpectActualTemplate.kt.template

Creating Composables

Use the template: templates/ComposableTemplate.kt.template

Gradle Tasks Reference

For a complete list of available Gradle tasks, see reference/gradle_tasks.md.

Common Tasks

Clean Build

./gradlew clean

Build and Test Everything

bash .agent/skills/development/scripts/test_all.sh

Check Code Formatting (without applying)

bash .agent/skills/development/scripts/format_check.sh

Platform Constraints

iOS (WKWebView)

  • Limited zoom control
  • Strict security policies
  • Requires message handlers for JSBridge

Desktop (CEF via KCEF)

  • Asynchronous initialization required
  • SwingPanel integration
  • Platform-specific threading considerations

Web (JS)

  • IFrame-based implementation
  • postMessage bridge for communication
  • Limited native features

See detailed constraints in reference/platform_specifics.md.

Scripts

This skill provides the following automation scripts:

  • build_all.sh: Builds all platforms sequentially with error handling
  • test_all.sh: Runs comprehensive test suite across all platforms
  • format_check.sh: Checks Spotless formatting (for CI/pre-commit hooks)
  • platform_status.sh: Reports expect/actual implementation completeness

All scripts are located in scripts/ and can be run from the project root.

Troubleshooting

Build Failures

  1. Clean Gradle cache: ./gradlew clean
  2. Invalidate caches: rm -rf .gradle
  3. Check Java version: java -version (should be 17+)

Test Failures

  1. Run specific platform tests to isolate issues
  2. Check platform-specific logs
  3. Verify all expect/actual pairs are implemented

Formatting Issues

Run ./gradlew spotlessApply to auto-fix formatting issues.

  • Architecture: See .agent/knowledge/architecture.md for design patterns
  • Commands: See .agent/knowledge/commands.md for workflow reference
  • Code Style: See .agent/knowledge/code_style.md for coding conventions