Skip to content

Commit

Permalink
feat: KSP/Kotlin compiler plugin support
Browse files Browse the repository at this point in the history
This changeset restructures the build to provide more control over
Kotlin targets. Support is introduced for KSP processors and Kotlin
compiler plugins.

The plugins don't do much yet, but will host rich functionality
later down the road once the build flow is perfected. A number of
other important changes are also enclosed which prepare the lib for
an initial beta release.

Changes enclosed:
- Cleanup all workflow configs
- Add sharing of codebase-wide properties
- Add ABI check validation (fixes and closes #70), + build step
- Refactor convention plugins (relates to #71)
- Prep version catalog and platform releases (relates to #73)
- Prep for SSG compiler (relates to #65 and #76)
- Fix state sharing issue (fixes and closes #35)
  • Loading branch information
sgammon committed Nov 19, 2022
1 parent d0eadf0 commit 4455f63
Show file tree
Hide file tree
Showing 133 changed files with 3,723 additions and 1,148 deletions.
126 changes: 29 additions & 97 deletions .github/workflows/build.ci.yml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions .github/workflows/codeql.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml

## Code QL: Perform analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
9 changes: 4 additions & 5 deletions .github/workflows/copybara.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
(github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'migrate:protocol') ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'migrate:protocol'))
steps:
# Pull code.
- uses: actions/checkout@v2

- name: "Setup: Checkout"
uses: actions/checkout@v2
- name: "Migrate: Protocol"
uses: sgammon/copybara-action@5669453d54072738035b0985cfe322d0ee5de0db
with:
Expand All @@ -48,8 +47,8 @@ jobs:
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'migrate:buildtools'))
steps:
# Pull code.
- uses: actions/checkout@v2

- name: "Setup: Checkout"
uses: actions/checkout@v2
- name: "Migrate: Cluster"
uses: sgammon/copybara-action@5669453d54072738035b0985cfe322d0ee5de0db
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/deploy.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,10 @@ jobs:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
## Setup: Checkout Code
- name: "Setup: Checkout"
uses: actions/checkout@v3

## Setup: Fly
- name: "Setup: Fly"
uses: superfly/flyctl-actions/setup-flyctl@master

## Deploy: App
- name: "Deploy: Fly (${{ inputs.environment }})"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/labeler.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- name: "Bot: Labeler Triage"
uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
43 changes: 19 additions & 24 deletions .github/workflows/model.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ jobs:
permissions:
contents: "read"
steps:
## Setup: Checkout Code
- uses: actions/checkout@v3

# Setup: Buf
- uses: bufbuild/buf-setup-action@v1
- name: "Setup: Checkout"
uses: actions/checkout@v3
- name: "Setup: Buf"
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}

# Job: Lint
- uses: bufbuild/buf-lint-action@v1
- name: "Check: Buf Lint"
uses: bufbuild/buf-lint-action@v1

##
## Job: Buf Breaking
Expand All @@ -44,16 +42,14 @@ jobs:
contents: "read"
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'ci:buf-breaking-ignore') }}
steps:
## Setup: Checkout Code
- uses: actions/checkout@v3

# Setup: Buf
- uses: bufbuild/buf-setup-action@v1
- name: "Setup: Checkout"
uses: actions/checkout@v3
- name: "Setup: Buf"
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}

# Job: Breaking
- uses: bufbuild/buf-breaking-action@v1
- name: "Check: Buf Breaking"
uses: bufbuild/buf-breaking-action@v1
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'ci:buf-breaking-ignore') }}
with:
against: https://github.com/elide-dev/v3.git#branch=v3
Expand All @@ -70,20 +66,19 @@ jobs:
if: |
(
github.ref == 'refs/heads/stable' ||
github.ref == 'refs/heads/v3' ||
startsWith(github.ref, 'refs/tags/v')
)
permissions:
contents: "read"
steps:
## Setup: Checkout Code
- uses: actions/checkout@v3

# Setup: Buf
- uses: bufbuild/buf-setup-action@v1
- name: "Setup: Checkout"
uses: actions/checkout@v3
- name: "Setup: Buf"
uses: bufbuild/buf-setup-action@v1
with:
github_token: ${{ github.token }}

# Job: Breaking
- uses: bufbuild/buf-push-action@v1
- name: "Push: BSR"
uses: bufbuild/buf-push-action@v1
with:
buf_token: ${{ secrets.BUF_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/qodana.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: "Setup: Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Qodana Scan"
- name: "Check: Qodana Scan"
uses: JetBrains/qodana-action@v2022.2.3
- uses: github/codeql-action/upload-sarif@v2
- name: "Report: SARIF Upload"
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json
42 changes: 41 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
"DSL_SCOPE_VIOLATION",
)

import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import java.util.Properties

plugins {
id("dev.elide.build")
id("project-report")
id("org.sonarqube")
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.kover")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
id("io.gitlab.arturbosch.detekt")

alias(libs.plugins.qodana)
alias(libs.plugins.ktlint)
alias(libs.plugins.doctor)
Expand Down Expand Up @@ -52,6 +58,7 @@ buildscript {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://elide-snapshots.storage-download.googleapis.com/repository/v3/")
}
dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}")
Expand All @@ -67,6 +74,36 @@ buildscript {
}
}

plugins.withType<NodeJsRootPlugin>().configureEach {
// 16+ required for Apple Silicon support
// https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5259190.0-0
the<NodeJsRootExtension>().nodeVersion = "18.0.0"
}

apiValidation {
// Nothing yet.
ignoredProjects += listOf(
"bundler",
"bom",
"proto",
"ssg",
"processor",
"reports",
).plus(
if (project.properties["buildSamples"] == "true") {
listOf("samples")
} else {
emptyList()
}
).plus(
if (project.properties["buildBenchmarks"] == "true") {
listOf("benchmarks")
} else {
emptyList()
}
)
}

tasks.register("relock") {
dependsOn(
*(subprojects.map {
Expand Down Expand Up @@ -160,6 +197,7 @@ subprojects {
ignoreFailures.set(true)
enableExperimentalRules.set(true)
filter {
exclude("**/proto/**")
exclude("**/generated/**")
exclude("**/tools/plugin/gradle-plugin/**")
include("**/kotlin/**")
Expand Down Expand Up @@ -338,8 +376,10 @@ if (buildDocs == "true") {
includes.from("README.md")
outputDirectory.set(buildDir.resolve("docs/kotlin/html"))
}
}

tasks.create("docs") {
tasks.create("docs") {
if (buildDocs == "true") {
dependsOn(listOf(
"dokkaHtmlMultiModule",
"dokkaGfmMultiModule",
Expand Down
10 changes: 7 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
val kotlinVersion = "1.7.21"

plugins {
id("dev.elide.build")

`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}
Expand All @@ -20,8 +22,10 @@ repositories {

dependencies {
api(kotlin("gradle-plugin"))
implementation(libs.plugin.buildConfig)
implementation(libs.plugin.graalvm)
implementation(libs.plugin.docker)
implementation(libs.plugin.dokka)
implementation(libs.plugin.detekt)
implementation(libs.plugin.kover)
implementation(libs.plugin.micronaut)
Expand All @@ -33,9 +37,9 @@ dependencies {
implementation(libs.plugin.kotlin.noarg)
implementation(libs.plugin.kotlinx.atomicfu)
implementation(libs.plugin.kotlinx.serialization)
implementation(libs.plugin.kotlinx.abiValidator)
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
if (buildDocs == "true") {
implementation(libs.plugin.dokka)
}
}

apply(from = "../gradle/loadProps.gradle")
30 changes: 0 additions & 30 deletions buildSrc/gradle.properties

This file was deleted.

1 change: 0 additions & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
Expand Down
81 changes: 0 additions & 81 deletions buildSrc/src/main/kotlin/dev.elide.build.native.lib.gradle.kts

This file was deleted.

3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Settings: Build
buildSamples = true
buildSamples = false
buildPlugins = false
buildDocs = false
buildBenchmarks = true
enableSigning = false
elide.buildMode = dev
elide.strict = true
Expand Down
Loading

0 comments on commit 4455f63

Please sign in to comment.