-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
144 lines (107 loc) · 3.74 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def publishToJFrog() {
return 'true' == System.getenv('PUBLISH_TO_JFROG')
}
def publishToJCenter() {
return 'true' == System.getenv('PUBLISH_TO_JCENTER')
}
def bintrayUser() {
return project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
}
def bintrayApiKey() {
return project.hasProperty('BINTRAY_API_KEY') ? project.property('BINTRAY_API_KEY') : System.getenv('BINTRAY_API_KEY')
}
def buildVersionCode() {
String versionCode = System.getenv('VERSION_CODE')
return versionCode != null && !versionCode.isEmpty() ? Integer.valueOf(versionCode) : 1
}
def buildVersionName() {
String versionName = System.getenv('VERSION_NAME')
return versionName != null && !versionName.isEmpty() ? versionName : '0.0.1'
}
ext {
PUBLISH_TO_JFROG = publishToJFrog()
PUBLISH_TO_JCENTER = publishToJCenter()
BINTRAY_USER = bintrayUser()
BINTRAY_API_KEY = bintrayApiKey()
GROUP_ID = 'io.github.v7lin'
VERSION_CODE = buildVersionCode()
VERSION_NAME = buildVersionName()//'x.y.z'/'x.y.z-SNAPSHOT'
SITE_URL = 'https://github.com/v7lin/android-manufacturer'
GIT_URL = 'https://github.com/v7lin/android-manufacturer.git'
ISSUE_SYSTEM = 'GitHub'
ISSUE_TRACKER_URL = 'https://github.com/v7lin/android-manufacturer/issues'
LICENSE_APACHE_NAME = 'The Apache Software License, Version 2.0'
LICENSE_APACHE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
LICENSES_ALL = ['Apache-2.0']
DEVELOPER_ID = 'v7lin'
DEVELOPER_NAME = 'v7lin'
DEVELOPER_EMAIL = 'v7lin@qq.com'
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'// https://github.com/dcendents/android-maven-gradle-plugin#note-on-release
// publish to JFrog
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.9.0"
// publish to JCenter
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'// https://github.com/bintray/gradle-bintray-plugin#Getting_Started_Using_the_Plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
// publish to jcenter 最好加上全局编码设置
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://oss.jfrog.org/artifactory/oss-snapshot-local'
}
// JCenter 第一个版本审核通过之前需要
maven {
url "https://dl.bintray.com/v7lin/maven"
}
}
}
subprojects {
ext {
// ---
androidCompileSdkVersion = 28
androidBuildToolsVersion = "28.0.3"
// ---
androidMinSdkVersion = 14
androidTargetSdkVersion = 28
// ---
sourceCompatibilityVersion = JavaVersion.VERSION_1_8
targetCompatibilityVersion = JavaVersion.VERSION_1_8
// ---
jsr305Version = '2.0.1'
// ---
junitVersion = '4.12'
runnerVersion = '1.1.0-alpha4'
espressoVersion = '3.1.0-alpha4'
}
plugins.apply('checkstyle')
task('checkstyle', type: Checkstyle) {
configFile rootProject.file('checkstyle.xml')
source 'src/main/java'
ignoreFailures false
showViolations true
include '**/*.java'
classpath = files()
}
afterEvaluate {
tasks.findByName('check').dependsOn('checkstyle')
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}