Skip to content

Commit d5c97e6

Browse files
authored
temporarily revert root build.gradle back to groovy (#1503)
1 parent 48fa886 commit d5c97e6

File tree

2 files changed

+117
-123
lines changed

2 files changed

+117
-123
lines changed

build.gradle

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
plugins {
2+
id 'org.jetbrains.kotlin.jvm' apply false
3+
alias(libs.plugins.checksum)
4+
alias(libs.plugins.shadow)
5+
alias(libs.plugins.githubRelease)
6+
// id 'nebula.lint' version '17.5.0'
7+
}
8+
9+
def isKotlinDev = project.hasProperty('isKotlinDev')
10+
11+
allprojects { p ->
12+
if (isKotlinDev) {
13+
String definedVersion = p.ext."VERSION_NAME".minus("-SNAPSHOT")
14+
p.ext."VERSION_NAME" = "$definedVersion-kotlin-dev-SNAPSHOT".toString()
15+
}
16+
17+
tasks.withType(Test).configureEach {
18+
it.useJUnitPlatform()
19+
}
20+
}
21+
22+
configurations {
23+
ktlint
24+
}
25+
26+
dependencies {
27+
ktlint projects.ktlint
28+
}
29+
30+
task ktlint(type: JavaExec, group: LifecycleBasePlugin.VERIFICATION_GROUP) {
31+
description = "Check Kotlin code style including experimental rules."
32+
classpath = configurations.ktlint
33+
mainClass.set("com.pinterest.ktlint.Main")
34+
// Experimental rules run by default run on the ktlint code base itself. Experimental rules should not be released if
35+
// we are not pleased ourselves with the results on the ktlint code base.
36+
// Sources in "ktlint/src/test/resources" are excluded as those source contain lint errors that have to be detected by
37+
// unit tests and should not be reported/fixed.
38+
args '**/src/**/*.kt', '!ktlint/src/test/resources/**', '--baseline=ktlint/src/test/resources/test-baseline.xml', '--experimental', '--verbose'
39+
}
40+
41+
// Deployment tasks
42+
String getGithubToken() {
43+
if (project.hasProperty("servers.github.privKey")) {
44+
return project.'servers.github.privKey'
45+
} else {
46+
logger.warn("No github token specified")
47+
return ""
48+
}
49+
}
50+
51+
// Explicitly adding dependency on "shadowJarExecutable" as Gradle does not it set via "releaseAssets" property
52+
tasks.named("githubRelease") {
53+
dependsOn { projects.ktlint.dependencyProject.tasks.named("shadowJarExecutable") }
54+
}
55+
56+
githubRelease {
57+
token getGithubToken()
58+
owner "pinterest"
59+
repo "ktlint"
60+
tagName project.properties['VERSION_NAME']
61+
releaseName project.properties['VERSION_NAME']
62+
releaseAssets project.files({
63+
// "shadowJarExecutableChecksum" task does not declare checksum files
64+
// as output, only the whole output directory. As it uses the same directory
65+
// as "shadowJarExecutable" - just pass all the files from that directory
66+
projects.ktlint.dependencyProject.tasks.named("shadowJarExecutable").get()
67+
.outputs
68+
.files
69+
.getFiles()
70+
.first()
71+
.parentFile
72+
.listFiles()
73+
})
74+
overwrite true
75+
dryRun false
76+
body {
77+
String changelog = project.file("CHANGELOG.md").text
78+
changelog = changelog.substring(changelog.indexOf("## "))
79+
// 1 in indexOf here to skip first "## [" occurence
80+
changelog.substring(0, changelog.indexOf("## [", 1))
81+
}
82+
}
83+
84+
// Put "servers.github.privKey" in "$HOME/.gradle/gradle.properties".
85+
def announceTask = tasks.register("announceRelease", Exec.class) { announceTask ->
86+
group = "Help"
87+
description = "Runs .announce script"
88+
subprojects
89+
.findAll { !it.name.contains("ktlint-ruleset-template") }
90+
.each { subproject ->
91+
announceTask.dependsOn subproject.tasks.named("publishMavenPublicationToMavenCentralRepository")
92+
}
93+
94+
commandLine './.announce', '-y'
95+
environment VERSION: "${project.'VERSION_NAME'}"
96+
environment GITHUB_TOKEN: "${getGithubToken()}"
97+
}
98+
99+
def homebrewTask = tasks.register("homebrewBumpFormula", Exec.class) { homebrewTask ->
100+
group "Help"
101+
description "Runs brew bump-forumula-pr"
102+
commandLine './.homebrew'
103+
environment VERSION: "${project.'VERSION_NAME'}"
104+
dependsOn(tasks.named("githubRelease"))
105+
}
106+
107+
tasks.register("publishNewRelease", DefaultTask.class) {
108+
group = "Help"
109+
description = "Triggers uploading new archives and publish announcements"
110+
dependsOn(announceTask, homebrewTask, tasks.named("githubRelease"))
111+
}
112+
113+
tasks.withType(Wrapper).configureEach {
114+
gradleVersion = libs.versions.gradle
115+
distributionSha256Sum = libs.versions.gradleSha256
116+
distributionType = Wrapper.DistributionType.BIN
117+
}

build.gradle.kts

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

0 commit comments

Comments
 (0)