Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0fb4f4d
wip
kigawa01 Apr 21, 2025
a5df93f
Merge pull request #2 from Code-Sakura/dynamic-dom-rendering
kigawa01 Apr 21, 2025
429d895
Revert "fix: rendering"
kigawa01 Apr 21, 2025
69f472e
Merge pull request #3 from Code-Sakura/dynamic-dom-rendering
kigawa01 Apr 21, 2025
b6c34a2
add: tagGenerate
pnc-t Apr 28, 2025
628544b
add: tag
pnc-t May 13, 2025
fd791cc
add: tag
pnc-t May 13, 2025
8a29c19
update: tag_generate
pnc-t May 27, 2025
4c0570c
update: tag,category
pnc-t May 27, 2025
0e43e83
update: category
pnc-t May 27, 2025
4e909e2
update: ScriptSupportingElements → ScriptSupportingContent
pnc-t May 27, 2025
0cff74e
wp
kigawa01 May 29, 2025
a4cc171
update: hakate
kigawa01 Jun 15, 2025
65818a5
wp
kigawa01 Jun 19, 2025
01cefab
move key
kigawa01 Jun 20, 2025
f4e2014
add: css support
noma-t Jun 24, 2025
b24bc10
update: css sample
noma-t Jun 24, 2025
c042bc9
fix: import and unused property
noma-t Jun 24, 2025
31d8936
fix: suppress "unused" warning on required constants
noma-t Jun 24, 2025
f25585e
fix: remove unused interface
noma-t Jun 24, 2025
c8e60bd
fix: suppress "unused" warning on required constants
noma-t Jun 24, 2025
826fe36
add: event listener
kigawa01 Jun 24, 2025
97f7009
Changes
kigawa01 Jun 24, 2025
1833a85
Merge remote-tracking branch 'origin/tag' into feature/event
kigawa01 Jun 24, 2025
903edd2
Changes
kigawa01 Jun 24, 2025
e852e3d
fix: tag structure
kigawa01 Jun 24, 2025
8ffbdd5
wp
kigawa01 Jun 24, 2025
a55d216
update: add some css properties and pseudo classes
noma-t Jun 26, 2025
5fa5cc4
update: test css
noma-t Jun 26, 2025
02af11f
move key
kigawa01 Jun 29, 2025
4777b0d
refactor: replace content interfaces with DSL and integration equival…
kigawa01 Jun 29, 2025
5e4f12d
Merge pull request #4 from Code-Sakura/feature/event
kigawa01 Jul 1, 2025
830a495
wp
kigawa01 Jul 1, 2025
9ea464a
move key
kigawa01 Jul 1, 2025
9ae2a28
Merge remote-tracking branch 'origin/feature/event' into feature/event
kigawa01 Jul 1, 2025
b31ee15
add: click event
kigawa01 Jul 1, 2025
cb05ed4
Merge pull request #5 from Code-Sakura/feature/event
kigawa01 Jul 1, 2025
3c69211
Merge branch 'develop' into css
kigawa01 Jul 3, 2025
b30cd76
add: click event
kigawa01 Jul 3, 2025
3aa3365
refactor: replace `getCssManager()` with `cssManager` property and up…
kigawa01 Jul 3, 2025
4d250d1
Merge pull request #6 from Code-Sakura/css
kigawa01 Jul 3, 2025
fde221e
wp
kigawa01 Jul 8, 2025
4e360ab
wp
kigawa01 Jul 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
21 changes: 20 additions & 1 deletion .github/workflows/deploy_maven_central.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@

name: deploy maven central

# This workflow handles deployment to Maven Central
# Deployment occurs automatically in two scenarios:
# 1. When code is merged to the main branch
# 2. When a PR is opened or updated to merge to the main branch
# For releases, use branch naming convention: release/vx.x.x (e.g., release/v1.0.0)
# The version number will be extracted from the branch name

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
branches:
- main
workflow_dispatch:

jobs:
test:
if: github.ref != 'refs/heads/main'
uses: ./.github/workflows/test.yml
cd:
if: github.ref == 'refs/heads/main'
# Run on main branch or when a PR is targeting the main branch
if: github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main')
runs-on: ubuntu-latest

steps:
Expand All @@ -29,6 +43,11 @@ jobs:
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Display version info
run: |
echo "Branch name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Branch name from GITHUB_HEAD_REF: $GITHUB_HEAD_REF"
./gradlew -q printVersion
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
Expand Down
24 changes: 24 additions & 0 deletions .run/renlin_sample [allTests].run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="renlin:sample [allTests]" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/sample" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="allTests" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
24 changes: 24 additions & 0 deletions .run/renlin_sample [jsBrowserDevelopmentRun].run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="renlin:sample [jsBrowserDevelopmentRun]" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/sample" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-t" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="jsBrowserDevelopmentRun" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
2 changes: 2 additions & 0 deletions convention-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
plugins {
`kotlin-dsl`
}
fun pluginId(pluginName: String, version: String) = "$pluginName:$pluginName.gradle.plugin:$version"

dependencies {
implementation(libs.nexus.publish)
implementation(pluginId("org.jetbrains.kotlin.multiplatform", "2.1.0"))
}
45 changes: 45 additions & 0 deletions convention-plugins/src/main/kotlin/renlin.common.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")

}


kotlin {
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
js {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
sourceSets["commonMain"].dependencies {
implementation("net.kigawa:hakate:3.3.2")
}
sourceSets["commonTest"].dependencies {


}
sourceSets["jvmMain"].dependencies {

}
sourceSets["jvmTest"].dependencies {

}

sourceSets["jsMain"].dependencies {

}
sourceSets["jsTest"].dependencies {
}
}

59 changes: 56 additions & 3 deletions convention-plugins/src/main/kotlin/root.publication.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,67 @@ plugins {
}
object Conf {
const val GROUP = "net.kigawa"
const val VERSION = "1.0.0"
// Base version - will be modified based on branch name if available
const val BASE_VERSION = "1.0.1"
}

// Determine version based on branch name
// Branch naming convention for releases: release/vx.x.x (e.g., release/v1.0.0)
fun determineVersion(): String {
// Try to get branch name from different environment variables
// For pull requests, GITHUB_HEAD_REF contains the source branch name
// For direct pushes, GITHUB_REF_NAME contains the branch name
val branchName = System.getenv("GITHUB_HEAD_REF")
?: System.getenv("GITHUB_REF_NAME")
?: return Conf.BASE_VERSION

// For main branch, use the base version
if (branchName == "main") {
return Conf.BASE_VERSION
}

// For release branches in format 'release/vx.x.x', use the version from the branch name
val releasePattern = Regex("^release/v(\\d+\\.\\d+\\.\\d+)$")
val matchResult = releasePattern.find(branchName)
if (matchResult != null) {
// Extract version number from branch name
val versionFromBranch = matchResult.groupValues[1]
return versionFromBranch
}

// For other branches, use format: baseVersion-branchName-SNAPSHOT
// Replace any non-alphanumeric characters with dashes for Maven compatibility
val sanitizedBranchName = branchName.replace(Regex("[^a-zA-Z0-9]"), "-")
return "${Conf.BASE_VERSION}-${sanitizedBranchName}-SNAPSHOT"
}

val projectVersion = determineVersion()

group = Conf.GROUP
version = Conf.VERSION
version = projectVersion
allprojects {
apply(plugin = "renlin.common")
group = Conf.GROUP
version = Conf.VERSION
version = projectVersion
}

// Add a task to print the version (useful for debugging)
tasks.register("printVersion") {
doLast {
val branchName = System.getenv("GITHUB_HEAD_REF") ?: System.getenv("GITHUB_REF_NAME") ?: "unknown"
println("Project version: $version")
println("Determined from branch: $branchName")

// Check if it's a release branch
val releasePattern = Regex("^release/v(\\d+\\.\\d+\\.\\d+)$")
val isReleaseBranch = releasePattern.matches(branchName)
println("Is release branch format (release/vx.x.x): $isReleaseBranch")

if (isReleaseBranch) {
val versionFromBranch = releasePattern.find(branchName)?.groupValues?.get(1)
println("Version extracted from branch name: $versionFromBranch")
}
}
}

nexusPublishing {
Expand Down
28 changes: 28 additions & 0 deletions generate/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
alias(libs.plugins.kotlinMultiplatform)
}


repositories {
mavenCentral()
}

dependencies {
}

kotlin {
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
js {
browser {
binaries.executable()
}
}

}
43 changes: 43 additions & 0 deletions generate/src/jvmMain/kotlin/_Tag_generate.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import generator.DslGenerator
import generator.IntegrationGenerator
import generator.NativeGenerator
import generator.TagGenerator
import generator.UnionGenerator
import java.io.File

fun main() {
// 出力先ディレクトリ
val outputDir = "../renlin/src/commonMain/kotlin/net/kigawa/renlin/tag"
val categoryOutputDir = "../renlin/src/commonMain/kotlin/net/kigawa/renlin/w3c/category"
val categoryUnionOutputDir = "$categoryOutputDir/native"
val categoryIntegrationOutputDir = "$categoryOutputDir/integration"
val categoryDslOutputDir = "$categoryOutputDir/dsl"
val categoryNativeOutputDir = "$categoryOutputDir/native"
File(outputDir).mkdirs()
File(categoryOutputDir).mkdirs()
File(categoryUnionOutputDir).mkdirs()
File(categoryIntegrationOutputDir).mkdirs()
File(categoryDslOutputDir).mkdirs()
File(categoryNativeOutputDir).mkdirs()

val tagGenerator = TagGenerator(outputDir).also {
it.generate()
}
val unionGenerator = UnionGenerator(categoryUnionOutputDir).also {
it.generate()
}
val integrationGenerator = IntegrationGenerator(categoryIntegrationOutputDir).also {
it.generate()
}
val dslGenerator = DslGenerator(categoryDslOutputDir).also {
it.generate()
}
val nativeGenerator = NativeGenerator(categoryNativeOutputDir).also {
it.generate(unionGenerator.nativeCategories)
}

println("タグのコード生成が完了しました。")
println("生成されたUnionクラス: ${unionGenerator.processedUnions.size}")
println("生成されたIntegrationクラス: ${integrationGenerator.processedIntegrations.size}")
println("生成されたDSLクラス: ${dslGenerator.processedDsls.size}")
}
57 changes: 57 additions & 0 deletions generate/src/jvmMain/kotlin/generator/DslGenerator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package generator

import model.AllowedCategories
import tagCategories
import java.io.File

class DslGenerator(
val categoryDslOutputDir: String,
) {
val processedDsls = mutableSetOf<String>()
fun generate() {
// DSLクラスの生成
(tagCategories.map { it.allowedCategories } +
tagCategories.flatMap { it.allowedCategories.categories }.map { AllowedCategories(it) })
.filter { it.categories.isNotEmpty() }
.forEach { allowedCategories ->
val dslName = allowedCategories.connectedStr() + "Dsl"
if (!processedDsls.contains(dslName)) {
processedDsls.add(dslName)
val categories = allowedCategories.categories


val imports = mutableListOf<String>()

val fileContent = """
package net.kigawa.renlin.w3c.category.dsl

${imports.distinct().joinToString("\n ")}
${
if (allowedCategories.categories.size > 1)
"import net.kigawa.renlin.w3c.category.integration.${
allowedCategories.connectedStr("Integration")
}"
else "import net.kigawa.renlin.w3c.category.native.${
allowedCategories.connectedStr("Integration")
}"
}


/**
* DSL for ${categories.joinToString(", ")}
*/
interface ${dslName}<CATEGORY_DSL : ${allowedCategories.connectedStr("Integration")}>${
if (categories.size <= 1) ""
else (categories.filter { it.trim() != dslName.trim() }
.joinToString(separator = ",", prefix = ":")
{ "\n ${it}Dsl<CATEGORY_DSL>" })
}
""".trimIndent()

val file = File("$categoryDslOutputDir/${dslName}.kt")
file.writeText(fileContent)
println("Generated DSL: ${dslName}.kt")
}
}
}
}
Loading
Loading