|
1 | | -import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension |
2 | | - |
3 | | -plugins { |
4 | | - signing |
5 | | - kotlin("jvm") apply false |
6 | | - alias(libs.plugins.com.vanniktech.maven.publish) apply false |
7 | | -} |
8 | | - |
9 | | -subprojects { |
10 | | - |
11 | | - plugins.withId("org.jetbrains.kotlin.jvm") { |
12 | | - |
13 | | - configure<KotlinJvmProjectExtension> { |
14 | | - jvmToolchain(11) |
15 | | - } |
16 | | - |
17 | | - dependencies { |
18 | | - "compileOnly"(kotlin("stdlib")) |
19 | | - "compileOnly"(kotlin("stdlib-jdk8")) |
20 | | - } |
21 | | - } |
22 | | - |
23 | | - plugins.withType<JavaPlugin> { |
24 | | - |
25 | | - configure<JavaPluginExtension> { |
26 | | - withSourcesJar() |
27 | | - // We don't publish Javadoc, because it is useless in out case. We publish sources, plus it is easy to find |
28 | | - // GitHub project and read the source code. We don't have any comprehensive documentation, so let's just publish nothing. |
29 | | - // Additionally, JavaDoc task conflicts with publishing plugin, so let's simply delete one of them. |
30 | | - // withJavadocJar() |
31 | | - } |
32 | | - |
33 | | - tasks.withType<Test> { |
34 | | - useJUnitPlatform() |
35 | | - // store all temporary results inside the Gradle folder |
36 | | - val localTempFolder = layout.buildDirectory.dir("tmp").get().asFile |
37 | | - systemProperty("java.io.tmpdir", localTempFolder.absolutePath) |
38 | | - |
39 | | - doFirst { |
40 | | - // create the folder if needed |
41 | | - localTempFolder.mkdirs() |
42 | | - } |
43 | | - } |
44 | | - |
45 | | - plugins.withType<MavenPublishPlugin> { |
46 | | - plugins.apply(com.vanniktech.maven.publish.MavenPublishPlugin::class) |
47 | | - } |
48 | | - } |
49 | | - |
50 | | - |
51 | | - plugins.withType<MavenPublishPlugin> { |
52 | | - val publishing = the<PublishingExtension>() |
53 | | - |
54 | | - publishing.publications.withType<MavenPublication> { |
55 | | - pom { |
56 | | - val githubRepo = providers.gradleProperty("githubRepo") |
57 | | - val githubUrl = githubRepo.map { "https://github.com/$it" } |
58 | | - |
59 | | - name.set(providers.gradleProperty("projectName")) |
60 | | - description.set(providers.gradleProperty("projectDescription")) |
61 | | - url.set(providers.gradleProperty("projectUrl")) |
62 | | - licenses { |
63 | | - license { |
64 | | - name.set(providers.gradleProperty("projectLicenseName")) |
65 | | - url.set(providers.gradleProperty("projectLicenseUrl")) |
66 | | - } |
67 | | - } |
68 | | - developers { |
69 | | - developer { |
70 | | - name.set(providers.gradleProperty("developerName")) |
71 | | - email.set(providers.gradleProperty("developerEmail")) |
72 | | - url.set(providers.gradleProperty("developerUrl")) |
73 | | - } |
74 | | - } |
75 | | - scm { |
76 | | - url.set(githubUrl.map { "$it/tree/master" }) |
77 | | - connection.set(githubRepo.map { "scm:git:git://github.com/$it.git" }) |
78 | | - developerConnection.set(githubRepo.map { "scm:git:ssh://github.com:$it.git" }) |
79 | | - } |
80 | | - issueManagement { |
81 | | - url.set(githubUrl.map { "$it/issues" }) |
82 | | - system.set("GitHub") |
83 | | - } |
84 | | - } |
85 | | - } |
86 | | - |
87 | | - publishing.repositories { |
88 | | - maven { |
89 | | - name = "local" |
90 | | - url = file(layout.buildDirectory.dir("repos/releases")).toURI() |
91 | | - } |
92 | | - } |
93 | | - } |
94 | | -} |
95 | | - |
0 commit comments