forked from opensearch-project/alerting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
90 lines (74 loc) · 2.5 KB
/
build.gradle
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
buildscript {
apply from: 'build-tools/repositories.gradle'
ext {
opensearch_version = System.getProperty("opensearch.version", "1.3.0-SNAPSHOT")
// 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT
opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2')
common_utils_version = System.getProperty("common_utils.version", opensearch_build)
kotlin_version = '1.3.72'
}
repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
}
}
plugins {
id 'nebula.ospackage' version "8.3.0" apply false
id "com.dorongold.task-tree" version "1.5"
}
apply plugin: 'base'
apply plugin: 'jacoco'
apply from: 'build-tools/merged-coverage.gradle'
configurations {
ktlint
}
dependencies {
add("ktlint", "com.pinterest:ktlint:0.41.0") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
}
}
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "alerting/**/*.kt", "elastic-api/**/*.kt", "core/**/*.kt"
}
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "-F", "alerting/**/*.kt", "elastic-api/**/*.kt", "core/**/*.kt"
}
check.dependsOn ktlint
ext {
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}
allprojects {
group = "org.opensearch"
version = "${opensearch_version}" - "-SNAPSHOT" + ".0"
if (isSnapshot) {
version += "-SNAPSHOT"
}
apply from: "$rootDir/build-tools/repositories.gradle"
plugins.withId('java') {
sourceCompatibility = targetCompatibility = "1.8"
}
plugins.withId('org.jetbrains.kotlin.jvm') {
compileKotlin.kotlinOptions.jvmTarget = compileTestKotlin.kotlinOptions.jvmTarget = "1.8"
compileKotlin.dependsOn ktlint
}
}
evaluationDependsOnChildren()
check.dependsOn subprojects*.check