Skip to content

Commit 4e5ae66

Browse files
committed
build: bundle plugin's API sources
1 parent a9ddc0b commit 4e5ae66

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

build.gradle.kts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,21 @@ sourceSets {
5959
}
6060
}
6161

62-
/** Points to the Java executable (usually `java.exe`) of a DCEVM-enabled JVM. */
63-
val generateConventionalCommitLexer = task<GenerateLexerTask>("generateConventionalCommitLexer") {
64-
source.set("src/main/kotlin/com/github/lppedd/cc/language/lexer/conventionalCommit.flex")
65-
targetDir.set("src/main/gen/com/github/lppedd/cc/language/lexer")
66-
targetClass.set("ConventionalCommitFlexLexer")
67-
purgeOldFiles.set(true)
68-
}
69-
7062
tasks {
7163
wrapper {
7264
distributionType = Wrapper.DistributionType.ALL
7365
}
7466

67+
val generateLexer = task<GenerateLexerTask>("generateConventionalCommitLexer") {
68+
source.set("src/main/kotlin/com/github/lppedd/cc/language/lexer/conventionalCommit.flex")
69+
targetDir.set("src/main/gen/com/github/lppedd/cc/language/lexer")
70+
targetClass.set("ConventionalCommitFlexLexer")
71+
purgeOldFiles.set(true)
72+
}
73+
7574
val kotlinSettings: KotlinCompile.() -> Unit = {
75+
dependsOn(generateLexer)
76+
7677
kotlinOptions.jvmTarget = "11"
7778
kotlinOptions.freeCompilerArgs += listOf(
7879
"-Xno-call-assertions",
@@ -82,8 +83,6 @@ tasks {
8283
"-Xallow-kotlin-package",
8384
"-opt-in=kotlin.contracts.ExperimentalContracts",
8485
)
85-
86-
dependsOn(generateConventionalCommitLexer)
8786
}
8887

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

101+
val buildApiSourceJar = task<Jar>("buildConventionalCommitApiSourceJar") {
102+
dependsOn(generateLexer)
103+
104+
from(kotlin.sourceSets.main.get().kotlin) {
105+
include("com/github/lppedd/cc/api/*.kt")
106+
}
107+
108+
destinationDirectory.set(layout.buildDirectory.dir("libs"))
109+
archiveClassifier.set("src")
110+
}
111+
112+
buildPlugin {
113+
dependsOn(buildApiSourceJar)
114+
115+
from(buildApiSourceJar) {
116+
into("lib/src")
117+
}
118+
}
119+
102120
runPluginVerifier {
103121
ideVersions.set(listOf(
104122
"IC-2020.2.1",

0 commit comments

Comments
 (0)