forked from opensearch-project/alerting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
112 lines (94 loc) · 3.25 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
buildscript {
apply from: 'build-tools/repositories.gradle'
ext {
opensearch_version = System.getProperty("opensearch.version", "1.1.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()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
}
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