-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
265 lines (228 loc) · 8.83 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
buildscript {
ext.kotlin_version = '1.9.23'
repositories {
mavenLocal()
mavenCentral()
google()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://artifacts.bitmovin.com/artifactory/public-releases' }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.0'
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.23.3"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.33.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'java'
id 'jacoco'
id "org.sonarqube" version "3.5.0.2730"
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version '0.16.3'
}
apply from: './bitmovinpropertiesloader.gradle'
allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
maven { url 'https://artifacts.bitmovin.com/artifactory/public-releases' }
maven {
credentials {
username bitmovinProperties.getProperty('artifactoryUser')
password bitmovinProperties.getProperty('artifactoryPassword')
}
url 'https://bitmovin.jfrog.io/bitmovin/libs-snapshot-local/'
}
}
apply plugin: "com.diffplug.spotless"
spotless {
// only run on modified files
ratchetFrom 'origin/main'
format 'misc', {
// define the files to apply `misc` to
target '**/*.gradle', '**/*.md', '**/*.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
kotlin {
target '**/*.kt'
ktlint()
}
java {
// apply a specific flavor of google-java-format
googleJavaFormat('1.10.0').aosp().reflowLongStrings()
// fix formatting of type annotations
formatAnnotations()
}
}
}
ext {
developLocal = System.getProperty("developLocal", "true").toBoolean()
packageGroupId = 'com.bitmovin.analytics'
/**
* Not relevant for us as versionCode is used only by PlayStore to indicate updates of apps,
* but we publish artifacts to maven repositories
*/
versionCode = 122003
version = System.getProperty("version", "0.0.0") + (developLocal ? '-local' : '')
// minSdkVersion we officially support is 21
// Emulators need to have at least API level 25, since lower don't emulate
// the media stack correctly
// (ref: https://developer.android.com/guide/topics/media/exoplayer/supported-devices)
minSdkVersion = 21
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_1_8.toString()
exampleAppJvmTarget = jvmTarget
compileSdk = 35
amazonIvsMinSdkVersion = 21
targetSdkVersion = 35
// player versions
bitmovinPlayerVersion = '3.94.0'
exoplayerVersion = '2.19.1'
amazonIvsPlayerVersion = '1.34.0'
media3PlayerVersion = '1.5.0'
// collector dependencies
gsonVersion = '2.11.0'
okhttp3Version = '4.12.0'
appCompatVersion = '1.6.1' // required for bitmovin player and @Keep annotation in core collector to avoid proguard issues
coroutinesVersion = "1.8.1"
// example apps dependencies
playServicesAdsVersion = '19.8.0'
imaSdkVersion = '3.31.0'
constraintlayoutVersion = '2.1.4'
multidexVersion = '2.0.1'
workRuntimeKtxVersion = '2.9.0'
// test dependencies
testRunnerVersion = '1.6.2'
mockitoCoreVersion = '5.14.2'
junitVersion = '4.13.2'
junitXVersion = '1.1.5'
mockkVersion = '1.13.13'
assertjCoreVersion = '3.26.3'
robolectricVersion = '4.14.1'
testCoreXVersion = '1.6.1'
}
tasks.register('createPrePushHook') {
def gitDirStream = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--git-dir"
workingDir = project.rootDir
standardOutput = gitDirStream
}
def gitDir = project.file(gitDirStream.toString().trim())
def gitHooksDirectory = new File(gitDir, "/hooks/")
if (!gitHooksDirectory.exists()) gitHooksDirectory.mkdirs()
def prePushHookFile = new File(gitDir, "/hooks/pre-push")
if (prePushHookFile.exists()) prePushHookFile.delete()
prePushHookFile.text = """
#!/bin/sh
echo '[git hook] executing gradle spotlessCheck before push'
oldsha=\$(git rev-parse -q --verify refs/stash)
# stash any unstaged changes
git stash save --keep-index --include-untracked
newsha=\$(git rev-parse -q --verify refs/stash)
# run the spotlessCheck with the gradle wrapper
./gradlew spotlessCheck --daemon
# store the last exit code in a variable
RESULT=\$?
# unstash the unstaged changes
if [ "\$oldsha" != "\$newsha" ];
then
echo 'Popping stash as there have been changes before.'
git stash pop;
fi
# return the './gradlew spotlessCheck' exit code
exit \$RESULT
"""
"chmod +x .git/hooks/pre-push".execute()
}
test {
useJUnitPlatform()
}
// SonarQube configuration
sonar {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "bitmovin-engineering"
property "sonar.projectName", "Analytics Collector Android"
property "sonar.projectKey", "bitmovin-engineering_bitmovin-analytics-collector-android-internal"
property "sonar.tests", ["src/test"]
property "sonar.sourceEncoding", "UTF-8"
property "sonar.sources", "src/main"
property "sonar.exclusions", "**/R.class,**/*Generated.java,**/*Test*/**"
property "sonar.junit.reportPaths", "build/test-results/testDebugUnitTest"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/jacocoTestReportBitmovinTesting/jacocoTestReportBitmovinTesting.xml"
property "sonar.verbose", "true"
property "sonar.java.coveragePlugin", "jacoco" // Please refer to the jacoco.gradle file to understand how the jacoco report is generated.
}
}
def nonSonarProjects = ["collector-bitmovin-player-example",
"collector-bitmovin-player-tv-example",
"collector-exoplayer-example",
"collector-amazon-ivs-example",
"collector-media3-exoplayer-example",
"example-shared",
"systemtest-utils"
]
nonSonarProjects.forEach {
project(":$it") {
sonar {
skipProject = true
}
}
}
/**
* Config for org.jetbrains.kotlinx.binary-compatibility-validator.
* Documentation : https://kotlin.github.io/binary-compatibility-validator/index.html
*
* This plugin is used to ensure binary compatibility on our public APIs between versions.
* It needs to be run manually for now since collector has too many public methods
* ./gradlew apiCheck #runs the check against the current dump (stored in /api/ for each module)
* ./gradlew apiDump #creates a new dump which we can run against in the future
*/
apiValidation {
/*
Sub-projects that are excluded from API validation
*/
ignoredProjects += ["collector-bitmovin-player-example",
"collector-bitmovin-player-tv-example",
"collector-exoplayer-example",
"collector-amazon-ivs-example",
"collector-media3-exoplayer-example",
"example-shared",
"systemtest-utils"]
/*
We can't use the publicPackages property because it doesn't work for some reason.
We also can't make most of the package private/internal because for technical reasons.
To check for backwards compatibility, we exclude everything that should not be used by customers.
*/
ignoredPackages += [
"com.bitmovin.analytics.adapters",
"com.bitmovin.analytics.ads",
"com.bitmovin.analytics.data",
"com.bitmovin.analytics.enums",
"com.bitmovin.analytics.error",
"com.bitmovin.analytics.features",
"com.bitmovin.analytics.internal",
"com.bitmovin.analytics.license",
"com.bitmovin.analytics.persistence",
"com.bitmovin.analytics.retryBackend",
"com.bitmovin.analytics.ssai",
"com.bitmovin.analytics.stateMachines",
"com.bitmovin.analytics.utils",
]
nonPublicMarkers += [
"com.bitmovin.analytics.internal.InternalBitmovinApi"
]
}
java {
sourceCompatibility = rootProject.ext.sourceCompatibility
targetCompatibility = rootProject.ext.targetCompatibility
}