Skip to content

Commit a3e488f

Browse files
authored
Site (#51)
* create logo & banner * bump gradle * adjust libs / buildSrc after Gradle bump * a bit of docs refactoring * bump kotlin * a bit of docs refactoring * more docs refactoring (prepping for sites) * bump gradleNodePlugin * rename 'subproject' convention plugin to 'base' * update EmptySerializersModule -> EmptySerializersModule() * create conventions/configurations/tasks for sharing Knit md files * create site with Docusaurus * new GHA to deploy the site * rm GitHub pages plugin * create text-less icon * reduce/amend log output in GHA and tests * fix serializer import in test * remove docusaurusBuild from build task * random yarn.lock update * always enable TS Compile tests in GHA (so the Actions run faster)
1 parent 3497060 commit a3e488f

File tree

76 files changed

+24936
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+24936
-655
lines changed

.github/workflows/deploy-site.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy Site
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
tags:
8+
- "v[0-9]+.[0-9]+.[0-9]+"
9+
10+
11+
concurrency:
12+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
13+
cancel-in-progress: true
14+
15+
16+
jobs:
17+
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout the repo
22+
uses: actions/checkout@v3
23+
24+
- name: Setup JDK
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: temurin
28+
java-version: 11
29+
30+
- uses: gradle/gradle-build-action@v2
31+
with:
32+
gradle-home-cache-cleanup: true
33+
34+
- name: Run :site:build
35+
run: ./gradlew :site:build
36+
37+
- uses: actions/upload-pages-artifact@v1
38+
with:
39+
path: $GITHUB_WORKSPACE/site/build
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
permissions:
45+
pages: write # to deploy to Pages
46+
id-token: write # to verify the deployment originates from an appropriate source
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v1

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [ ubuntu-latest, macos-11, windows-latest ]
24-
tsCompileTests: [ true, false ]
2524
fail-fast: false
2625
uses: ./.github/workflows/gradle_task.yml
2726
with:
2827
runs-on: ${{ matrix.os }}
2928
gradle-task: >-
30-
check -Pkxstsgen_enableTsCompileTests=${{ matrix.tsCompileTests }} --info --stacktrace
29+
check -Pkxstsgen_enableTsCompileTests=true --stacktrace

build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
idea
55
id("me.qoomon.git-versioning")
66
id("org.jetbrains.kotlinx.kover")
7+
buildsrc.convention.base
78
}
89

910

@@ -22,8 +23,8 @@ gitVersioning.apply {
2223

2324

2425
tasks.wrapper {
25-
gradleVersion = "7.5.1"
26-
distributionType = Wrapper.DistributionType.ALL
26+
gradleVersion = "7.6"
27+
distributionType = Wrapper.DistributionType.BIN
2728
}
2829

2930

@@ -36,6 +37,7 @@ idea {
3637
".idea",
3738
"gradle/kotlin-js-store",
3839
"gradle/wrapper",
40+
"site/.docusaurus",
3941
)
4042
}
4143
}

buildSrc/build.gradle.kts

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
idea
54
`kotlin-dsl`
6-
kotlin("jvm") version embeddedKotlinVersion
75
}
86

97

108
dependencies {
11-
implementation(enforcedPlatform(libs.kotlin.bom))
12-
implementation("org.jetbrains.kotlin:kotlin-serialization")
13-
// implementation("org.jetbrains.kotlin:kotlin-reflect")
14-
15-
implementation(libs.kotlin.gradlePlugin)
16-
implementation(libs.kotlinSymbolProcessing.gradlePlugin)
17-
18-
implementation(libs.kotest.gradlePlugin)
19-
20-
implementation(libs.kotlinx.kover.gradlePlugin)
21-
22-
implementation(libs.kotlinx.knit.gradlePlugin)
23-
24-
implementation(libs.gradleNodePlugin)
25-
26-
implementation(libs.gitVersioningPlugin)
9+
implementation(platform(libs.kotlin.bom))
10+
11+
implementation(libs.gradlePlugin.kotlin)
12+
implementation(libs.gradlePlugin.kotlinSerialization)
13+
implementation(libs.gradlePlugin.gitVersioning)
14+
implementation(libs.gradlePlugin.gradleNode)
15+
implementation(libs.gradlePlugin.kotlinxKover)
16+
implementation(libs.gradlePlugin.kotlinxKnit)
17+
implementation(libs.gradlePlugin.kotest)
18+
implementation(libs.gradlePlugin.kotlinSymbolProcessing)
19+
20+
implementation("org.jetbrains:markdown:0.3.5")
21+
implementation("org.jetbrains.kotlinx:kotlinx-html:0.8.0")
2722
}
2823

2924

3025
tasks.withType<KotlinCompile>().configureEach {
31-
3226
kotlinOptions {
3327
jvmTarget = libs.versions.jvmTarget.get()
3428
apiVersion = libs.versions.kotlinTarget.get()
@@ -42,25 +36,17 @@ tasks.withType<KotlinCompile>().configureEach {
4236
)
4337
}
4438

39+
4540
kotlin {
4641
jvmToolchain {
47-
(this as JavaToolchainSpec).languageVersion.set(
42+
languageVersion.set(
4843
libs.versions.jvmTarget.map {
49-
JavaLanguageVersion.of(
50-
it.substringAfter(".")
51-
)
44+
JavaLanguageVersion.of(it)
5245
}
5346
)
5447
}
55-
56-
kotlinDslPluginOptions {
57-
jvmTarget.set(libs.versions.jvmTarget)
58-
}
5948
}
6049

61-
idea {
62-
module {
63-
isDownloadSources = true
64-
isDownloadJavadoc = true
65-
}
50+
kotlinDslPluginOptions {
51+
jvmTarget.set(libs.versions.jvmTarget)
6652
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package buildsrc.config
2+
3+
import org.gradle.api.artifacts.Configuration
4+
import org.gradle.api.attributes.AttributeContainer
5+
import org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE
6+
import org.gradle.api.model.ObjectFactory
7+
import org.gradle.kotlin.dsl.named
8+
9+
/** Mark this [Configuration] as one that will be consumed by other subprojects. */
10+
fun Configuration.asProvider(
11+
visible: Boolean = false
12+
) {
13+
isVisible = visible
14+
isCanBeResolved = false
15+
isCanBeConsumed = true
16+
}
17+
18+
/** Mark this [Configuration] as one that will consume (also known as 'resolving') artifacts from other subprojects */
19+
fun Configuration.asConsumer(
20+
visible: Boolean = false
21+
) {
22+
isVisible = visible
23+
isCanBeResolved = true
24+
isCanBeConsumed = false
25+
}
26+
27+
28+
fun AttributeContainer.knitDocsAttributes(objects: ObjectFactory): AttributeContainer =
29+
attribute(USAGE_ATTRIBUTE, objects.named("kxs-ts-gen.knit-docs"))

buildSrc/src/main/kotlin/buildsrc/config/kmm.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
1414
* gradle dir, next to the version-catalog.
1515
*/
1616
fun Project.relocateKotlinJsStore() {
17-
1817
afterEvaluate {
1918
rootProject.extensions.findByType<YarnRootExtension>()?.apply {
2019
lockFileDirectory = project.rootDir.resolve("gradle/kotlin-js-store")
2120
}
2221
}
23-
2422
}
2523

2624

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package buildsrc.convention
2+
3+
import buildsrc.config.KxsTsGenBuildSettings
4+
import java.time.Duration
5+
import org.gradle.api.tasks.testing.logging.TestLogEvent
6+
7+
plugins {
8+
base
9+
}
10+
11+
if (project != rootProject) {
12+
project.group = rootProject.group
13+
project.version = rootProject.version
14+
}
15+
16+
extensions.create<KxsTsGenBuildSettings>(KxsTsGenBuildSettings.NAME)
17+
18+
tasks.withType<Test>().configureEach {
19+
timeout.set(Duration.ofMinutes(10))
20+
21+
testLogging {
22+
// don't log console output - it's too noisy
23+
showCauses = false
24+
showExceptions = false
25+
showStackTraces = false
26+
showStandardStreams = false
27+
events(
28+
// only log test outcomes
29+
TestLogEvent.PASSED,
30+
TestLogEvent.FAILED,
31+
TestLogEvent.SKIPPED,
32+
// TestLogEvent.STARTED,
33+
// TestLogEvent.STANDARD_ERROR,
34+
// TestLogEvent.STANDARD_OUT,
35+
)
36+
}
37+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package buildsrc.convention
2+
3+
import buildsrc.config.asConsumer
4+
import buildsrc.config.asProvider
5+
import buildsrc.config.knitDocsAttributes
6+
import org.gradle.kotlin.dsl.getValue
7+
import org.gradle.kotlin.dsl.provideDelegate
8+
import org.gradle.kotlin.dsl.registering
9+
10+
plugins {
11+
id("buildsrc.convention.base")
12+
}
13+
14+
val knitDocsElements by configurations.registering {
15+
asProvider()
16+
attributes { knitDocsAttributes(objects) }
17+
}
18+
19+
val knitDocs by configurations.registering {
20+
asConsumer()
21+
attributes { knitDocsAttributes(objects) }
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package buildsrc.convention
2+
3+
import buildsrc.config.knitDocsAttributes
4+
import buildsrc.config.asConsumer
5+
import org.gradle.kotlin.dsl.withType
6+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
7+
8+
plugins {
9+
id("buildsrc.convention.base")
10+
id("buildsrc.convention.knit-files")
11+
id("org.jetbrains.kotlinx.knit")
12+
}
13+
14+
tasks.withType<KotlinCompile>().configureEach {
15+
mustRunAfter(tasks.knit)
16+
}

buildSrc/src/main/kotlin/buildsrc/convention/kotlin-jvm.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.gradle.kotlin.dsl.withType
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
88

99
plugins {
10-
id("buildsrc.convention.subproject")
10+
id("buildsrc.convention.base")
1111
kotlin("jvm")
1212
`java-library`
1313
}

buildSrc/src/main/kotlin/buildsrc/convention/kotlin-mpp.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
77

88

99
plugins {
10-
id("buildsrc.convention.subproject")
10+
id("buildsrc.convention.base")
1111
kotlin("multiplatform")
1212
}
1313

buildSrc/src/main/kotlin/buildsrc/convention/node.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package buildsrc.convention
22

33
plugins {
44
id("com.github.node-gradle.node")
5-
id("buildsrc.convention.subproject")
5+
id("buildsrc.convention.base")
66
}
77

88
val rootGradleDir: Directory by extra {

buildSrc/src/main/kotlin/buildsrc/convention/subproject.gradle.kts

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import com.github.gradle.node.npm.task.NpmTask
2+
import org.gradle.api.provider.ListProperty
3+
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
4+
5+
fun NpmTask.args(values: String) {
6+
args.set(parseSpaceSeparatedArgs(values))
7+
}

0 commit comments

Comments
 (0)