This repository has been archived by the owner on Apr 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
146 lines (125 loc) · 4.6 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright 2018 Sumo Logic
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
import java.util.regex.Matcher
buildscript {
dependencies {
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.11.+"
}
}
plugins {
id 'nebula.maven-publish' version '5.1.0'
}
apply plugin: "build-time-tracker"
def pom = new XmlParser().parse(file("$rootDir/pom.xml"))
// load properties from pom.xml, e.g. 'scala.compat.version' -> '2.11'
def pomProps = [:]
pom.properties.'*'.each { prop -> pomProps.put(prop.name().localPart, prop.text()) }
// resolve properties, e.g. '${scala.compat.version}.11 -> '2.11.11'
def resolveProps (s, props) {
if (s =~ ~/.*\$\{(.+)}.*/) {
def match = Matcher.lastMatcher[0][1]
return resolveProps(s.replace("\${$match}", props[match]), props)
}
return s
}
def javaSourceVersion = resolveProps(pomProps['maven.compiler.source'], pomProps)
def javaTargetVersion = resolveProps(pomProps['maven.compiler.target'], pomProps)
allprojects {
apply plugin: 'idea'
apply plugin: 'nebula.maven-publish'
apply plugin: 'nebula.maven-resolved-dependencies'
group = epigraphGroup
version = epigraphVersion
pom.dependencyManagement.dependencies.dependency.each { dep ->
def version = resolveProps("${dep.groupId.text()}:${dep.artifactId.text()}:${dep.version.text()}", pomProps)
// println "${dep.groupId.text()}:${dep.artifactId.text()}:${dep.version.text()} -> $version"
configurations.all {
// https://github.com/typesafehub/zinc/issues/87#issuecomment-139236549
if (it.name != 'zinc') {
resolutionStrategy {
force version
}
}
}
}
}
subprojects {
repositories {
mavenCentral()
jcenter()
}
tasks.withType(JavaCompile) {
sourceCompatibility = javaSourceVersion
targetCompatibility = javaTargetVersion
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xdiags:verbose"
}
tasks.withType(ScalaCompile) {
sourceCompatibility = javaSourceVersion
targetCompatibility = javaTargetVersion
ScalaCompileOptions.metaClass.daemonServer = true
ScalaCompileOptions.metaClass.fork = true
ScalaCompileOptions.metaClass.useAnt = false
ScalaCompileOptions.metaClass.useCompileDaemon = false
options.encoding = 'UTF-8'
scalaCompileOptions.deprecation = true
scalaCompileOptions.unchecked = true
scalaCompileOptions.additionalParameters = ["-explaintypes"]
}
}
// importing gradle project from IDEA is preferred to using 'gradle idea'
idea {
project {
jdkName = javaSourceVersion
languageLevel = javaSourceVersion
vcs = 'Git'
}
}
// bootstrap: ./gradlew -c settings-bootstrap.gradle publishGradlePlugins
task publishGradlePlugins(dependsOn: [
':epigraph-compiler:publishToMavenLocal',
':epigraph-gradle-plugin:publishToMavenLocal',
':epigraph-gradle-plugin-common:publishToMavenLocal',
':epigraph-java-core:publishToMavenLocal',
':epigraph-java-codegen:publishToMavenLocal',
':epigraph-java-data-processing:publishToMavenLocal',
':epigraph-java-gradle-plugin:publishToMavenLocal',
':epigraph-java-lang-common:publishToMavenLocal',
':epigraph-java-projections:publishToMavenLocal',
':epigraph-java-projections-psi-parser-util:publishToMavenLocal',
':epigraph-java-projections-schema-psi-parser:publishToMavenLocal',
':epigraph-java-standalone-psi-util:publishToMavenLocal',
':epigraph-java-schema:publishToMavenLocal',
':epigraph-java-schema-parser:publishToMavenLocal',
':epigraph-java-schema-psi-parser:publishToMavenLocal',
':epigraph-java-schema-psi-parser-common:publishToMavenLocal',
':epigraph-java-test-util:publishToMavenLocal',
':epigraph-java-util:publishToMavenLocal',
':epigraph-light-psi:publishToMavenLocal',
':epigraph-scala-core:publishToMavenLocal'
]) {
description 'Bootstraps gradle build by installing necessary plugins. Usage: \n ./gradlew -c settings-bootstrap.gradle publishGradlePlugins'
}
buildtimetracker {
reporters {
summary {
ordered false
threshold 500
shortenTaskNames false
barstyle "unicode"
}
}
}