Skip to content

Commit 9623a53

Browse files
committed
Refactor: build
1 parent cbb7466 commit 9623a53

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

integration/build.gradle

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ compileTestKotlin {
2121
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
2222
}
2323

24-
configurations { buildSudachiDict }
24+
configurations {
25+
buildSudachiDict
26+
}
2527

2628
dependencies {
2729
buildSudachiDict (project(':spi'))
@@ -71,7 +73,6 @@ esTestEnv {
7173
bundlePath = packageDir
7274
systemDic = compileSystemDictionary.get().outputs.files.singleFile.toPath()
7375
configFile = rootProject.rootDir.toPath().resolve("src/test/resources/com/worksap/nlp/lucene/sudachi/ja/sudachi.json")
74-
additionalJars.add(project(":testlib").getTasksByName('jar', false).first().outputs.files.singleFile.toPath())
7576
addPlugin("analysis-icu", downloadIcuPlugin)
7677
addPlugin('sudachi-sub', project(':subplugin').getTasksByName('distZip', false).first())
7778
}
@@ -95,11 +96,17 @@ test {
9596
def distZip = tasks.register('distZip', Zip) {
9697
var esKind = sudachiEs.kind.get()
9798
archiveBaseName.set("${esKind.engine.kind}-${esKind.version}-$archivesBaseName")
98-
from(
99-
project(':subplugin').packageJars.outputs.files,
100-
project(':subplugin').embedVersion.outputs.files,
101-
project(':testlib').jar.outputs.files,
102-
)
99+
100+
// This task creates the test plugin ZIP used by the CI shell scripts.
101+
// We rebuild it from source components to ensure correctness and avoid build order issues.
102+
dependsOn(project(':subplugin').tasks.named('jar'), project(':testlib').tasks.named('jar'))
103+
104+
from(project(':subplugin').tasks.named('jar'))
105+
from(project(':testlib').tasks.named('jar'))
106+
from(project(':subplugin').file('src/main/extras/plugin-descriptor.properties')) {
107+
into('/') // Ensure descriptor is at the root of the zip
108+
expand(version: project(':subplugin').version, engineVersion: esKind.version, engineKind: esKind.engine.kind)
109+
}
103110
}
104111

105112
artifacts {

subplugin/build.gradle

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@ plugins {
88
group = 'com.worksap.nlp'
99
version = properties["pluginVersion"]
1010

11+
configurations {
12+
// A dedicated configuration to pull in just the testlib jar, not its transitive dependencies
13+
testlibJar {
14+
setTransitive(false)
15+
}
16+
}
17+
1118
dependencies {
12-
compileOnly(project(':spi'))
19+
compileOnly project(':spi')
20+
compileOnly project(':testlib')
21+
testlibJar project(':testlib')
1322
}
1423

1524
def embedVersion = tasks.register('embedVersion', Copy) {
@@ -26,11 +35,12 @@ def embedVersion = tasks.register('embedVersion', Copy) {
2635
}
2736

2837
def packageJars = tasks.register('packageJars', Copy) {
29-
from configurations.runtimeClasspath
30-
from tasks.jar.outputs
38+
// Package only this project's jar and the testlib jar.
39+
// Other dependencies are provided by the main plugin at runtime.
40+
from tasks.jar
41+
from configurations.testlibJar
3142
var esKind = sudachiEs.kind.get()
3243
into "build/package/${version}/${esKind.engine.kind}-${esKind.version}"
33-
dependsOn tasks.jar
3444
}
3545

3646
def distZip = tasks.register('distZip', Zip) {

0 commit comments

Comments
 (0)