This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild.gradle
141 lines (123 loc) · 3.98 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
/*
* Copyright 2019 Fitbit, Inc. All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2"
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
if(group == null) {
group = 'com.github.Fitbit'
}
def releaseTag = System.getenv("RELEASE_TAG")
if (releaseTag != null && !releaseTag.isEmpty()) {
if (releaseTag.startsWith("v")) {
releaseTag = releaseTag.substring(1)
}
version = releaseTag
project.properties.put("release.version", releaseTag)
println("Releasing with version " + version)
}
def artifactPath = "$buildDir/outputs/aar"
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
multiDexEnabled true
versionName version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
consumerProguardFiles 'proguard-rules.pro'
buildConfigField("String","VERSION_NAME","\"${defaultConfig.versionName}\"")
}
debug {
testCoverageEnabled true
buildConfigField("String","VERSION_NAME","\"${defaultConfig.versionName}\"")
}
}
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
}
ext {
MULTIDEX_VERSION = '2.0.1'
APP_COMPAT_VERSION = '1.1.0'
TIMBER_VERSION = '4.7.1'
JUNIT_VERSION = '4.12'
TEST_RUNNER_VERSION = '1.1.0'
MOCKITO_VERSION = '3.6.0'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "androidx.multidex:multidex:$MULTIDEX_VERSION"
implementation "androidx.appcompat:appcompat:$APP_COMPAT_VERSION"
implementation "com.jakewharton.timber:timber:$TIMBER_VERSION"
testImplementation "junit:junit:$JUNIT_VERSION"
testImplementation "androidx.test:runner:$TEST_RUNNER_VERSION"
testImplementation "androidx.test:rules:$TEST_RUNNER_VERSION"
testImplementation "org.mockito:mockito-inline:$MOCKITO_VERSION"
testImplementation "org.mockito:mockito-core:$MOCKITO_VERSION"
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'androidx.test:core:1.3.0'
androidTestImplementation "junit:junit:$JUNIT_VERSION"
androidTestImplementation "androidx.test:runner:$TEST_RUNNER_VERSION"
androidTestImplementation "androidx.test:rules:$TEST_RUNNER_VERSION"
androidTestImplementation("org.mockito:mockito-android:$MOCKITO_VERSION")
androidTestImplementation 'com.github.tmurakami:dexopener:2.0.0'
}
task sourceJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier "sources"
}
android.libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}.aar"
}
}
publishing {
publications {
release (MavenPublication) {
from components.findByName("androidRelease")
groupId group
artifactId 'bitgatt'
version "$version-release"
artifact("$artifactPath/release.aar") {
builtBy tasks.getByName("build")
}
}
}
}