Skip to content

Commit

Permalink
build: bundle plugin's API sources
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd committed Mar 22, 2023
1 parent a9ddc0b commit 4e5ae66
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,21 @@ sourceSets {
}
}

/** Points to the Java executable (usually `java.exe`) of a DCEVM-enabled JVM. */
val generateConventionalCommitLexer = task<GenerateLexerTask>("generateConventionalCommitLexer") {
source.set("src/main/kotlin/com/github/lppedd/cc/language/lexer/conventionalCommit.flex")
targetDir.set("src/main/gen/com/github/lppedd/cc/language/lexer")
targetClass.set("ConventionalCommitFlexLexer")
purgeOldFiles.set(true)
}

tasks {
wrapper {
distributionType = Wrapper.DistributionType.ALL
}

val generateLexer = task<GenerateLexerTask>("generateConventionalCommitLexer") {
source.set("src/main/kotlin/com/github/lppedd/cc/language/lexer/conventionalCommit.flex")
targetDir.set("src/main/gen/com/github/lppedd/cc/language/lexer")
targetClass.set("ConventionalCommitFlexLexer")
purgeOldFiles.set(true)
}

val kotlinSettings: KotlinCompile.() -> Unit = {
dependsOn(generateLexer)

kotlinOptions.jvmTarget = "11"
kotlinOptions.freeCompilerArgs += listOf(
"-Xno-call-assertions",
Expand All @@ -82,8 +83,6 @@ tasks {
"-Xallow-kotlin-package",
"-opt-in=kotlin.contracts.ExperimentalContracts",
)

dependsOn(generateConventionalCommitLexer)
}

compileKotlin(kotlinSettings)
Expand All @@ -99,6 +98,25 @@ tasks {
changeNotes.set((File("$projectPath/change-notes/${version.get().replace('.', '_')}.html").readText(Charsets.UTF_8)))
}

val buildApiSourceJar = task<Jar>("buildConventionalCommitApiSourceJar") {
dependsOn(generateLexer)

from(kotlin.sourceSets.main.get().kotlin) {
include("com/github/lppedd/cc/api/*.kt")
}

destinationDirectory.set(layout.buildDirectory.dir("libs"))
archiveClassifier.set("src")
}

buildPlugin {
dependsOn(buildApiSourceJar)

from(buildApiSourceJar) {
into("lib/src")
}
}

runPluginVerifier {
ideVersions.set(listOf(
"IC-2020.2.1",
Expand Down

0 comments on commit 4e5ae66

Please sign in to comment.