-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathorg.sonarsource.cloud-native.rule-api.gradle.kts
More file actions
58 lines (53 loc) · 2.5 KB
/
org.sonarsource.cloud-native.rule-api.gradle.kts
File metadata and controls
58 lines (53 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* SonarSource Cloud Native Gradle Modules
* Copyright (C) SonarSource Sàrl
* mailto:info AT sonarsource DOT com
*
* You can redistribute and/or modify this program under the terms of
* the Sonar Source-Available License Version 1, as published by SonarSource Sàrl.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Sonar Source-Available License for more details.
*
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
import org.sonarsource.cloudnative.gradle.RuleApiExtension
import org.sonarsource.cloudnative.gradle.ifAuthenticatedOrElse
import org.sonarsource.cloudnative.gradle.registerRuleApiGenerateTask
import org.sonarsource.cloudnative.gradle.registerRuleApiUpdateTask
import org.sonarsource.cloudnative.gradle.repox
val ruleApi: Configuration = configurations.create("ruleApi")
val ruleApiExtension = extensions.create<RuleApiExtension>("ruleApi")
repositories {
ifAuthenticatedOrElse(providers, { artifactoryUsername, artifactoryPassword ->
repox("sonarsource-private-releases", artifactoryUsername, artifactoryPassword, ruleApiExtension.fileOperations)
repox("sonarsource", artifactoryUsername, artifactoryPassword, ruleApiExtension.fileOperations)
}) {
error("Downloading dependencies from sonarsource-private-releases requires authentication.")
}
}
dependencies {
ruleApi("com.sonarsource.rule-api:rule-api:2.19.0.5763")
ruleApi("org.slf4j:slf4j-nop:2.0.17") {
because(
"To get rid of a warning. A logging backend is not needed, because the rule API logs everything important to stdout. " +
"Slf4j logs contain only debug information"
)
}
}
project.afterEvaluate {
val languageToSonarpediaDirectory = ruleApiExtension.languageToSonarpediaDirectory.get()
val ruleApiUpdateTasks = mutableSetOf<TaskProvider<JavaExec>>()
languageToSonarpediaDirectory.forEach { (language, sonarpediaDirectory) ->
registerRuleApiUpdateTask(language, file(sonarpediaDirectory)).also { ruleApiUpdateTasks.add(it) }
registerRuleApiGenerateTask(language, file(sonarpediaDirectory))
}
tasks.register("ruleApiUpdate") {
description = "Update ALL rules description"
group = "Rule API"
ruleApiUpdateTasks.forEach { this.dependsOn(it) }
}
}