Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
79bdc16
Bump our dependencies the latest snapshots using Kotlin 2.1.0, and th…
ShreckYe Dec 2, 2024
c7795f7
Add `mavenLocal()` for our snapshot dependencies (both build dependen…
ShreckYe Dec 2, 2024
23b4cf1
Bump our Gradle plugins to the latest stable version and remove the e…
ShreckYe Dec 3, 2024
a62f8df
Merge branch 'kotlin-2.1.0-gradlew-v8.11.1-and-above' into dependent-…
ShreckYe Dec 3, 2024
62f0178
Merge branch 'main' into dependent-on-snapshots
ShreckYe Dec 4, 2024
f4e2d0a
Try bumping all dependencies to the latest (including snapshots for o…
ShreckYe Sep 20, 2025
521c1c9
Merge branch 'main' into dev
ShreckYe Sep 20, 2025
95f5dc1
Fix the incompatible AGP version
ShreckYe Sep 21, 2025
780f893
Run `kotlinUpgradeYarnLock`
ShreckYe Sep 21, 2025
a565a2c
Replace all my developer info invocations
ShreckYe Sep 21, 2025
a46656c
Run `kotlinWasmUpgradeYarnLock`
ShreckYe Sep 22, 2025
be95590
Try bumping Compose to v1.10.0-alpha01 to resolve build errors
ShreckYe Sep 22, 2025
b0289a4
Remove the Maven repository for Kobweb since it's published to Maven …
ShreckYe Sep 25, 2025
96a15e4
Try resolving the `org.jetbrains.kotlin.util.FileAnalysisException` u…
ShreckYe Sep 29, 2025
d904e2a
Try resolving the `org.jetbrains.kotlin.util.FileAnalysisException` u…
ShreckYe Sep 29, 2025
ce01282
Revert "Try bumping Compose to v1.10.0-alpha01 to resolve build errors"
ShreckYe Sep 29, 2025
3046d8a
`./gradlew wrapper --gradle-version=9.1.0 && ./gradlew wrapper`
ShreckYe Sep 29, 2025
eafafa1
Initial plan
Copilot Sep 29, 2025
55f4924
Add comprehensive .github/copilot-instructions.md for repository onbo…
Copilot Sep 29, 2025
d8fc4f8
Merge branch 'dev' into copilot/fix-1e12ff10-bb36-42db-8915-7914dc2c7a25
ShreckYe Sep 29, 2025
dbdd173
Update .github/copilot-instructions.md with latest dependency version…
Copilot Sep 29, 2025
69a4768
Bump `binary-compatibility-validator` to 0.18.1
ShreckYe Sep 29, 2025
8bedebe
Merge branch 'dev' into copilot/fix-1e12ff10-bb36-42db-8915-7914dc2c7a25
ShreckYe Sep 29, 2025
b745de0
Update `copilot-instructions.md` correspondingly
ShreckYe Sep 29, 2025
1fb222d
Clean up copilot instructions: remove comment-only code block and red…
Copilot Sep 29, 2025
d8557f6
Enhance .github/copilot-instructions.md with patterns from kotlin-com…
Copilot Sep 29, 2025
d805058
Remove redundant "Essential Repository Setup" section
Copilot Sep 29, 2025
898b6c7
Fix offline build statements and remove inappropriate tool_calling se…
Copilot Sep 29, 2025
25220db
Address feedback: fix technical inaccuracies and remove version-speci…
Copilot Sep 29, 2025
65493fe
Refocus publishToMavenLocal guidance for coding agents rather than hu…
Copilot Sep 29, 2025
851bbcb
Prioritize ./gradlew build over publishToMavenLocal in build validation
Copilot Sep 29, 2025
3e6fc59
Merge pull request #62 from huanshankeji/copilot/fix-1e12ff10-bb36-42…
ShreckYe Sep 29, 2025
4f033d3
Run the AGP Upgrade Assistant
ShreckYe Sep 30, 2025
a57bb84
Bump AGP more to 8.12.3
ShreckYe Sep 30, 2025
909f6d8
Try bumping AGP to 8.13.0 again which doesn't work and remove the com…
ShreckYe Sep 30, 2025
f76f6a1
Initial plan
Copilot Sep 30, 2025
6663e75
Add reference to Kotlin code style guide in copilot-instructions.md
Copilot Sep 30, 2025
cdf9c13
Merge pull request #65 from huanshankeji/copilot/fix-4074dc2a-57f1-43…
ShreckYe Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 198 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Copilot Instructions for Compose Multiplatform HTML Unified

## Repository Overview

**Compose Multiplatform HTML Unified** is a Kotlin Multiplatform library that provides unified Compose Multiplatform wrappers of common and Material Design APIs for both **rendering-based Compose UI** (Android, desktop JVM, iOS, web Kotlin/Wasm) and **DOM-based Compose HTML**. This library was previously named "Compose Multiplatform Material".

### Repository Statistics
- **Size**: Medium-large multiplatform project with ~15 modules
- **Language**: Kotlin (multiplatform)
- **Build System**: Gradle with Kotlin DSL
- **Target Platforms**: JVM, Android, iOS, JS (DOM), Wasm-JS (Canvas)
- **Key Dependencies**: Compose Multiplatform, Kobweb Silk, Material Web Components

## Build Instructions and Environment Setup

### Prerequisites
- **JDK 17**: Required (as specified in GitHub Actions workflows)
- **Network Access**: Required for initial builds to download Android Gradle Plugin and other dependencies
- **Gradle 9.1.0**: Automatically handled by wrapper

**IMPORTANT**: Initial builds require internet access for dependency resolution. Once dependencies are cached, subsequent builds can use `--offline` flag if needed.

**IMPORTANT**: If the project uses snapshot dependencies of other `com.huanshankeji` libraries, especially in a branch other than `main` such as `dev`, refer to the setup instructions at <https://github.com/huanshankeji/.github/blob/main/dev-instructions.md#about-snapshot-dependencies-of-our-library-projects>.

### Build Commands (In Order)

#### 1. Basic Project Setup
```bash
./gradlew --version # Verify Gradle 9.1.0 and JDK 17
```

#### 2. Publishing to Local Maven (Primary Development Command)
```bash
./gradlew publishToMavenLocal
```
**Important**: Always run `publishToMavenLocal` first when making changes, as mentioned in CONTRIBUTING.md. This ensures libraries compile correctly and validates the build process.

#### 3. Running Tests and Checks (Essential Commands - validated and working)
```bash
./gradlew check
```
**Note**: The project has "limited number of tests" according to CONTRIBUTING.md, but this validates what exists.

#### 4. Building Demo Applications
```bash
# Build the side-by-side demo (used for GitHub Pages)
./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution

# Individual platform builds
./gradlew jsBrowserDistribution # JS DOM version
./gradlew wasmJsBrowserDistribution # Wasm-JS Canvas version
```

### Build Configuration Details

#### Memory Requirements
- **Gradle JVM**: 2GB memory allocated via `org.gradle.jvmargs=-Xmx2G` in gradle.properties (required for Wasm compilation)

#### Common Build Issues and Workarounds

1. **Network Connectivity**: Initial builds require internet access for Android Gradle Plugin (8.11.2) and other dependencies. If build fails with network errors, ensure internet connectivity.

2. **Memory Issues**: If Wasm compilation fails with OOM, the memory is already optimized in gradle.properties.

3. **Kotlin/JS Store**: The `kotlin-js-store` directory may be generated during JS builds - this should be committed when updated automatically by Gradle commands.

4. **Gradle Daemon**: May timeout on first runs. Use `--no-daemon` flag if needed: `./gradlew check --no-daemon`

### Build Timing and Known Issues

**Timing Expectations**:
- First build: 5-10 minutes (includes dependency resolution and Wasm compilation)
- Subsequent builds: 1-3 minutes
- `publishToMavenLocal`: 3-5 minutes
- `check` execution: 2-5 minutes (limited tests)
- Demo builds: 2-4 minutes

**Common Issues**:
- **Wasm Compilation**: Requires 2GB+ heap memory (pre-configured in gradle.properties)
- **Network Dependencies**: Initial builds require internet access for dependency resolution
- **Platform-specific builds**: Some targets may be disabled on certain OS (use `--continue` flag)

## Project Architecture and Layout

### Module Structure
```
├── common/ # Core APIs, layouts, modifiers (foundation equivalent)
├── material-icons-core/ # Icon system core
├── material2/ # Material Design 2 components
├── material3/ # Material Design 3 components
├── navigation/ # Navigation support (experimental)
├── lifecycle-viewmodel/ # ViewModel support (experimental)
├── demo/ # Demonstration application
└── buildSrc/ # Build configuration and dependencies
```

### Key Configuration Files
- **buildSrc/src/main/kotlin/VersionsAndDependencies.kt**: All dependency versions
- **buildSrc/src/main/kotlin/common-conventions.gradle.kts**: Shared build configuration
- **buildSrc/src/main/kotlin/lib-conventions.gradle.kts**: Library-specific configuration
- **gradle.properties**: JVM memory settings for Gradle (increase if OOM occurs) and Kotlin MPP configuration
- **settings.gradle.kts**: Project structure and repository configuration

### Source Set Structure (Per Module)
```
src/
├── commonMain/ # Shared APIs across all platforms
├── composeUiMain/ # Compose UI targets (JVM, Android, iOS, Wasm)
├── composeUiExceptAndroidMain/ # Compose UI excluding Android
├── androidMain/ # Android-specific implementations
├── jsMain/ # JS DOM implementations (Kobweb/HTML)
├── jvmMain/ # Desktop JVM implementations
└── iosMain/ # iOS-specific implementations
```

### Dependencies and External Integration

#### Required External Repositories
```kotlin
repositories {
mavenCentral()
google() // For Android components
}
```

**Note**: All dependencies are available from standard repositories. If working with snapshot dependencies of other `com.huanshankeji` libraries, additional setup may be required as per organization instructions.

#### Key Dependencies
- **Kotlin**: 2.2.20 with Compose Compiler
- **Compose Multiplatform**: 1.9.0
- **Android Gradle Plugin**: 8.11.2
- **Kobweb**: 0.23.3 (now on Maven Central)
- **Compose HTML Material**: 0.4.1-SNAPSHOT
- **Binary Compatibility Validator**: 0.18.1 (enabled)

### Platform-Specific Implementation Patterns

#### Compose UI Platforms (Android, JVM, iOS, Wasm)
- Delegate directly to official `androidx.compose` APIs
- Located in `composeUiMain` source sets

#### JS DOM Platform
- Built on **Kobweb Silk** (provides Modifier system and layouts)
- Uses **Material Web Components** via Compose HTML Material
- Located in `jsMain` source sets
- Requires CSS imports for Material Icons

### Development Patterns and Conventions

#### API Structure
- **Common APIs**: Defined in `commonMain`, expect/actual pattern for platform differences
- **Ext Components**: Components in `ext` packages don't follow androidx.compose APIs exactly but provide more idiomatic platform-specific wrappers
- **Parameter Naming**: Parameters with "JsDom" or "ComposeUi" suffixes are platform-specific

#### Code Quality and Validation
- **Binary Compatibility**: Enforced via org.jetbrains.kotlinx.binary-compatibility-validator plugin
- **Limited Testing**: Project acknowledges "limited number of tests"

**Code Style:**
- Follow [our Kotlin code style guide](https://github.com/huanshankeji/.github/blob/main/kotlin-code-style.md) for all Kotlin code contributions

#### Architecture Notes
- **Multi-module**: Each feature area is a separate Gradle subproject
- **Expect/Actual Pattern**: Platform-specific implementations using Kotlin Multiplatform patterns
- **Convention Plugins**: Custom build logic in `buildSrc` for consistency across modules
- **Target Platforms**: Sophisticated setup targeting 6+ platforms with different implementation strategies

### Root Directory Files
```
.gitignore # Standard exclusions plus .kotlin, local.properties
build.gradle.kts # Root build file with binary compatibility validator
CHANGELOG.md # Detailed version history with breaking changes
CODE_OF_CONDUCT.md # Standard code of conduct
CONTRIBUTING.md # Development guidelines and contribution process
gradle.properties # Memory settings and Kotlin configuration
LEGACY_README.md # Previous project name reference
LICENSE # Apache 2.0 license
README.md # Comprehensive API documentation and usage guide
settings.gradle.kts # Project structure and dependency management
```

## Validation Steps for Changes

1. **Build Validation**: Run `./gradlew build` or `./gradlew publishToMavenLocal` to ensure libraries compile
2. **Test Validation**: Run `./gradlew check` to validate existing tests pass
3. **Demo Validation**: Build demo with `./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution`
4. **CI Simulation**: Test on multiple platforms if possible (the CI runs on Ubuntu, macOS, Windows)
5. **Binary Compatibility**: The kotlinx binary compatibility validator will catch API breaks

## Important Notes for Agents

- **Trust These Instructions**: Only perform additional searches if information here is incomplete or incorrect
- **Network Dependency**: Initial builds require internet access for dependency resolution
- **Memory Requirements**: Ensure adequate memory for Wasm compilation (2GB JVM heap configured)
- **Limited Test Coverage**: Don't expect comprehensive test suites - focus on build and demo validation
- **Platform Complexity**: This is a sophisticated multiplatform project with 6+ target platforms and complex expect/actual patterns

**Trust these instructions**: This information has been validated through actual command execution and file inspection. Only search for additional information if these instructions are incomplete or found to be incorrect.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,6 @@ kotlin {

View [all the artifacts on Maven Central](https://search.maven.org/search?q=g:com.huanshankeji%20AND%20a:compose-multiplatform-*).

This project depends on [Kobweb](https://github.com/varabyte/kobweb) which is not published to Maven Central yet, so you have to add the following Maven repository:

```kotlin
repositories {
mavenCentral()
maven("https://us-central1-maven.pkg.dev/varabyte-repos/public")
}
```

### Material Symbols & Icons on JS

See [the corresponding section in Compose HTML Material](https://github.com/huanshankeji/compose-html-material?tab=readme-ov-file#material-symbols--icons) for configuring Material Icons on JS.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tasks.wrapper {
}

plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.18.1"
}

apiValidation {
Expand Down
12 changes: 6 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ plugins {
}

repositories {
//mavenLocal() // comment out when not needed
mavenLocal() // TODO comment out when not needed so the build is always reproducible by others
gradlePluginPortal()
google()
mavenCentral()
}

dependencies {
val kotlinVersion = "2.2.0-RC2"
val kotlinVersion = "2.2.20"
implementation(kotlin("gradle-plugin", kotlinVersion))
implementation("org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.compose:compose-gradle-plugin:1.8.1")
implementation("com.huanshankeji.team:gradle-plugins:0.9.0") // don't use a snapshot version in a main branch
implementation("com.android.tools.build:gradle:8.10.1")
implementation("com.huanshankeji:common-gradle-dependencies:0.9.0-20241203") // don't use a snapshot version in a main branch
implementation("org.jetbrains.compose:compose-gradle-plugin:1.9.0")
implementation("com.huanshankeji.team:gradle-plugins:0.10.0-SNAPSHOT") // TODO don't use a snapshot version in a main branch
implementation("com.android.tools.build:gradle:8.12.3")
implementation("com.huanshankeji:common-gradle-dependencies:0.10.0-20250918-SNAPSHOT") // TODO don't use a snapshot version in a main branch
}
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/VersionsAndDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object DependencyVersions {
// https://slack-chats.kotlinlang.org/t/27579160/after-updating-to-1-8-0-rc01-package-androidx-compose-materi
// https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.8.0-rc01
const val composeMultiplatformMaterialIconsExtended = "1.7.3"
val kobweb = "0.19.2"
val huanshankejiComposeHtml = "0.4.0" // don't use a snapshot version in a main branch
val kobweb = "0.23.3"
val huanshankejiComposeHtml = "0.4.1-SNAPSHOT" // TODO don't use a snapshot version in a main branch
val kmdc = "0.1.2"
val materialSymbols = "0.25.1"
val materialSymbols = "0.35.2"
}
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ plugins {
}

repositories {
//mavenLocal() // commented out so the build is always reproducible by others // put back if needed when depending on a snapshot
mavenLocal() // TODO comment out when not needed so the build is always reproducible by others
mavenCentral()
google()
maven("https://us-central1-maven.pkg.dev/varabyte-repos/public") // for Kobweb
}

group = "com.huanshankeji"
Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.huanshankeji.team.`Shreck Ye`
import com.huanshankeji.team.ShreckYe
import com.huanshankeji.team.pomForTeamDefaultOpenSource
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

Expand Down Expand Up @@ -74,6 +74,6 @@ publishing.publications.withType<MavenPublication> {
"Unified Compose Multiplatform common wrappers $FOR_COMPOSE_TARGETS_IN_TITLE",
"Common wrappers of components (including layouts) and modifiers $FOR_COMPOSE_TARGETS_IN_DESCRIPTION"
) {
`Shreck Ye`()
ShreckYe()
}
}
2 changes: 1 addition & 1 deletion common/legacy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ publishing.publications.withType<MavenPublication> {
"This legacy module depends on `com.huanshankeji:compose-html-common` instead of Kobweb Silk " +
"and its components use the `ModifierOrAttrsScope` class to configure styles."
) {
`Shreck Ye`()
ShreckYe()
}
}
*/
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 0 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

Expand Down Expand Up @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

Expand Down
3 changes: 1 addition & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
Loading
Loading