Skip to content

Commit d238909

Browse files
authored
Merge pull request #315 from Kotlin/refactor-build
Refactor build, fix #306 - Use version catalogs - Use typesafe project accessors - Move common logic to the build plugin - Expose configurable options as extensions - Reduce the number of project options - Use only lazy task configuration (register instead of create) - Get rid of libraries submodule, load libraries on demand
2 parents 9dd9c11 + c750442 commit d238909

File tree

81 files changed

+2466
-1968
lines changed

Some content is hidden

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

81 files changed

+2466
-1968
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
# Folders with build files
1515
out/
1616
/build/
17-
/*jupyter*/build/
17+
/build-plugin/**/.idea/
18+
/build-plugin/**/build/
19+
!/build-plugin/**/src/build/
1820
/*jupyter*/*/build/
1921
/api-examples/*/build/
2022
/teamcity-artifacts/
2123

24+
# Folder with library descriptors
25+
libraries/
26+
2227
# Gradle caches and internal files
2328
.gradle/
2429

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

api-examples/getting-started/build.gradle.kts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,15 @@ kotlinJupyter {
99
addScannerDependency()
1010
}
1111

12-
project.version = rootProject.version
13-
1412
dependencies {
15-
implementation(kotlin("stdlib"))
16-
implementation(kotlin("reflect"))
13+
implementation(libs.kotlin.stable.stdlib)
14+
implementation(libs.kotlin.stable.reflect)
1715
}
1816

1917
kotlinPublications {
2018
publication {
21-
publicationName = "example-getting-started"
22-
artifactId = "kotlin-jupyter-example-getting-started"
23-
description = "Basic API usage example"
24-
packageName = artifactId
25-
publishToSonatype = false
19+
publicationName.set("example-getting-started")
20+
description.set("Basic API usage example")
21+
publishToSonatype.set(false)
2622
}
2723
}

build-plugin/build.gradle.kts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
id("build.plugins.versions")
5+
`kotlin-dsl`
6+
}
7+
8+
repositories {
9+
mavenCentral()
10+
gradlePluginPortal()
11+
}
12+
13+
dependencies {
14+
implementation(projects.commonDependencies)
15+
api(libs.bundles.allGradlePlugins)
16+
}
17+
18+
sourceSets {
19+
main {
20+
java.setSrcDirs(listOf("src"))
21+
}
22+
test {
23+
allJava.setSrcDirs(emptyList<String>())
24+
resources.setSrcDirs(emptyList<String>())
25+
}
26+
}
27+
28+
tasks.withType<KotlinCompile> {
29+
kotlinOptions {
30+
freeCompilerArgs = freeCompilerArgs + listOf("-Xopt-in=kotlin.RequiresOptIn")
31+
}
32+
}
33+
34+
gradlePlugin {
35+
plugins {
36+
create("dependencies") {
37+
id = "build.plugins.main"
38+
implementationClass = "build.KernelBuildPlugin"
39+
}
40+
}
41+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
id("ru.ileasile.kotlin.publisher")
3+
kotlin("jvm")
4+
}
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
implementation(libs.kotlin.gradle.stdlib)
12+
13+
// HTTP4K for resolving remote library dependencies
14+
api(libs.bundles.http4k)
15+
16+
// Serialization implementation for kernel code
17+
api(libs.serialization.json)
18+
}
19+
20+
sourceSets {
21+
main {
22+
java.setSrcDirs(listOf("src"))
23+
}
24+
test {
25+
allJava.setSrcDirs(emptyList<String>())
26+
resources.setSrcDirs(emptyList<String>())
27+
}
28+
}
29+
30+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
31+
kotlinOptions {
32+
apiVersion = "1.4"
33+
languageVersion = "1.4"
34+
35+
@Suppress("SuspiciousCollectionReassignment")
36+
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn")
37+
}
38+
}
39+
40+
kotlinPublications {
41+
publication {
42+
publicationName.set("common-dependencies")
43+
description.set("Notebook API entities used for building kernel documentation")
44+
}
45+
}

0 commit comments

Comments
 (0)