-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
184 lines (162 loc) · 6.15 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**
* Copyright (C) 2013 Johannes Schnatterer
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This file is part of nusic.
*
* nusic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nusic 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with nusic. If not, see <http://www.gnu.org/licenses/>.
*/
import nl.javadude.gradle.plugins.license.License
//External dependencies for the build script
buildscript {
repositories {
jcenter()
google()
}
// Gradle plugins
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'de.undercouch:gradle-download-task:3.0.0'
// Mark down generation
classpath 'org.pegdown:pegdown:1.6.0'
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.13.1"
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
}
}
plugins {
id "maven"
id "jacoco"
id "org.sonarqube" version "2.6"
}
//rootProject and the subprojects
allprojects {
group = "info.schnatterer.nusic"
//version = gradle.properties
apply plugin: "com.github.hierynomus.license"
apply plugin: "jacoco"
license {
header rootProject.file('resources/GPL-3.txt')
strictCheck true
excludes(["**/build/**",
// This file is downloaded from the github site. Don't fiddle with it.
"**/privacyPolicy.html",
// This file has a different license, as it was modified from a different project
"**/RoboAppCompatPreferenceActivity.java"
])
encoding "UTF-8"
// Properties for substitution
ext.setProperty("project.inceptionYear", "2013")
ext.setProperty("project.name", "nusic")
ext.owner = "Johannes Schnatterer"
}
// We also want to check license headers in gradle files
task licenseGradleFiles(type: License) {
source = fileTree(dir: ".").include("build.gradle")
mapping {
gradle = 'JAVADOC_STYLE'
}
check = true
}
tasks['license'].dependsOn licenseGradleFiles
// When adding licenses to files, also add to gradle files
task formatLicenseGradleFiles(type: License) {
source = fileTree(dir: ".").include("build.gradle")
mapping {
gradle = 'JAVADOC_STYLE'
}
}
licenseFormat.dependsOn formatLicenseGradleFiles
// Make sure license check is performed on each build
check.dependsOn tasks['license']
}
// Only subprojects, not root project
subprojects {
repositories {
mavenLocal()
google()
jcenter()
// For musicbrainzws from github
maven { url "https://jitpack.io" }
}
}
task setVersion << {
// Load file
def Properties gradleProperties = new Properties()
def gradlePropertiesFile = file('gradle.properties')
gradleProperties.load(new FileInputStream(gradlePropertiesFile))
// Increase android version
if (newVersion.contains("SNAPSHOT")) {
gradleProperties['versionCode'] = (nusicVersionCode + 1).toString()
}
gradleProperties['version'] = newVersion
// Write file
gradleProperties.store(gradlePropertiesFile.newWriter(), null)
}
project.ext {
website = "https://github.com/schnatterer/nusic"
}
ext {
// Properties for android submodules
nusicVersionCode = Integer.parseInt(versionCode)
nusicMinSdkVersion = 9
// When changing the following, change also in .travis.yml
nusictTargetSdkVersion = 24
nusicCompileSdkVersion = 24
nusicBuildToolsVersion = '27.0.3'
// Properties for java & android submodules
nusicSourceCompatibility = JavaVersion.VERSION_1_8
nusicTargetCompatibility = JavaVersion.VERSION_1_8
nusicSourceEncoding = "UTF-8"
slf4jVersion = "1.7.21"
mockitoVersion = "2.8.47"
androidCompatibilityVersion = "24.2.1"
roboguiceVersion = "3.0.1"
libraries = [
android : "com.google.android:android:4.1.1.4",
// Android Support libs
androidSupportV4 : "com.android.support:support-v4:${androidCompatibilityVersion}",
// Appcompat for API lvl 4 and 7, as well as backport of material design
androidDesign : "com.android.support:design:${androidCompatibilityVersion}",
// Roboguice
roboguice : "org.roboguice:roboguice:${roboguiceVersion}",
roboblender : "org.roboguice:roboblender:${roboguiceVersion}",
//logback-android - process log statements produced by dependencies via slf4j with logback
logback : dependencies.create("com.github.tony19:logback-android-classic:1.1.1-6") {
exclude group: "com.google.android", module: "android"
force = true
},
logbackAndroidUtils: "com.github.schnatterer:logback-android-utils:1.0.0",
julToSlf4j : "org.slf4j:jul-to-slf4j:${slf4jVersion}",
slf4j : "org.slf4j:slf4j-api:${slf4jVersion}",
guava : "com.google.guava:guava:19.0",
commonsIo : "commons-io:commons-io:2.4",
/*
* Test dependencies
*/
// Robolectric
robolectric : "org.robolectric:robolectric:3.4",
robolectricAndroid: "org.robolectric:android-all:7.1.0_r7-robolectric-0",
// Might be fixed with robolectric 3.3.2
opengl: 'org.khronos:opengl-api:gl1.1-android-2.1_r1',
junit : "junit:junit:4.12",
hamcrest : "org.hamcrest:hamcrest-all:1.3",
mockito : "org.mockito:mockito-core:${mockitoVersion}",
mockitoAndroid : "org.mockito:mockito-android:${mockitoVersion}"
]
}
jacoco {
toolVersion = "0.7.7.201606060606"
}