Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 5472948

Browse files
committed
Upgrade gradle config
1 parent 5675bf1 commit 5472948

6 files changed

Lines changed: 119 additions & 73 deletions

File tree

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ buildscript {
55
}
66
dependencies {
77
classpath 'com.android.tools.build:gradle:3.0.0'
8+
classpath 'com.novoda:bintray-release:0.7.0'
89
}
910
}
1011

buildSrc/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
developer.properties
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2017 Riyaz Ahamed
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package gradle;
18+
19+
public class Config {
20+
21+
public static final int MIN_SDK = 9;
22+
public static final int COMPILE_SDK = 25;
23+
public static final int TARGET_SDK = COMPILE_SDK;
24+
25+
public static final String VERSION_NAME = "1.2.6";
26+
public static final int VERSION_CODE = 126;
27+
28+
private static final String SUPPORT_LIB_VERSION = "25.4.0";
29+
private static final String SUPPORT = "com.android.support:";
30+
31+
public static final String APP_COMPAT = SUPPORT + "appcompat-v7:" + SUPPORT_LIB_VERSION;
32+
public static final String DESIGN = SUPPORT + "design:" + SUPPORT_LIB_VERSION;
33+
public static final String RECYCLER_VIEW = SUPPORT + "recyclerview-v7:" + SUPPORT_LIB_VERSION;
34+
public static final String CARD_VIEW = SUPPORT + "cardview-v7:" + SUPPORT_LIB_VERSION;
35+
public static final String SUPPORT_ANNOTATION =
36+
SUPPORT + "support-annotations:" + SUPPORT_LIB_VERSION;
37+
38+
public static final String USER_ORG = "devahamed";
39+
public static final String GROUP_ID = "com.github.devahamed";
40+
public static final String REPO_NAME = "MultiViewAdapter";
41+
public static final String PUBLISH_VERSION = VERSION_NAME;
42+
public static final String DESC =
43+
"Recyclerview Adapter library to create composable view holders";
44+
public static final String WEBSITE = "https://github.com/DevAhamed/MultiViewAdapter";
45+
46+
public static final String ARTIFACT_ID_CORE = "multi-view-adapter";
47+
public static final String ARTIFACT_ID_DATA_BINDING = "multi-view-adapter-databinding";
48+
}

multi-view-adapter-databinding/build.gradle

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17+
import gradle.Config
18+
1719
apply plugin: 'com.android.library'
1820
apply plugin: 'com.novoda.bintray-release'
1921

20-
buildscript {
21-
repositories {
22-
jcenter()
23-
}
24-
dependencies {
25-
classpath 'com.novoda:bintray-release:0.5.0'
26-
}
27-
}
28-
2922
android {
30-
compileSdkVersion 25
23+
compileSdkVersion Config.COMPILE_SDK
3124

3225
defaultConfig {
33-
minSdkVersion 9
34-
targetSdkVersion 25
35-
versionCode 1
36-
versionName "1.2.6"
26+
minSdkVersion Config.MIN_SDK
27+
targetSdkVersion Config.TARGET_SDK
28+
versionCode Config.VERSION_CODE
29+
versionName Config.VERSION_NAME
3730

3831
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3932
}
@@ -46,29 +39,30 @@ android {
4639
}
4740

4841
dependencies {
49-
compile project(':multi-view-adapter')
50-
provided('com.android.databinding:library:1.3.1') {
42+
implementation project(':multi-view-adapter')
43+
44+
compileOnly('com.android.databinding:library:1.3.1') {
5145
transitive = false
5246
}
53-
provided('com.android.databinding:baseLibrary:2.3.2') {
47+
compileOnly('com.android.databinding:baseLibrary:2.3.2') {
5448
transitive = false
5549
}
5650
}
5751

5852
publish {
59-
userOrg = 'devahamed'
60-
groupId = 'com.github.devahamed'
61-
artifactId = 'multi-view-adapter-databinding'
62-
publishVersion = '1.2.6'
63-
repoName = 'MultiViewAdapter'
64-
desc = 'Additional DataBinding support for MultiViewAdapter'
65-
website = 'https://github.com/DevAhamed/MultiViewAdapter'
53+
userOrg = Config.USER_ORG
54+
groupId = Config.GROUP_ID
55+
artifactId = Config.ARTIFACT_ID_DATA_BINDING
56+
publishVersion = Config.PUBLISH_VERSION
57+
repoName = Config.REPO_NAME
58+
desc = Config.DESC
59+
website = Config.WEBSITE
6660
}
6761

6862
afterEvaluate { project ->
6963

70-
if (project.getPlugins().hasPlugin('com.android.application') ||
71-
project.getPlugins().hasPlugin('com.android.library')) {
64+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
65+
hasPlugin('com.android.library')) {
7266

7367
task androidJavadocs(type: Javadoc) {
7468
source = android.sourceSets.main.java.source
@@ -85,12 +79,12 @@ afterEvaluate { project ->
8579
from android.sourceSets.main.java.source
8680
}
8781
} else {
88-
task sourcesJar(type: Jar, dependsOn:classes) {
82+
task sourcesJar(type: Jar, dependsOn: classes) {
8983
classifier = 'sources'
9084
from sourceSets.main.allSource
9185
}
9286

93-
task javadocJar(type: Jar, dependsOn:Javadoc) {
87+
task javadocJar(type: Jar, dependsOn: Javadoc) {
9488
classifier = 'javadoc'
9589
from Javadoc.destinationDir
9690
}
@@ -105,8 +99,8 @@ afterEvaluate { project ->
10599
}
106100

107101
artifacts {
108-
if (project.getPlugins().hasPlugin('com.android.application') ||
109-
project.getPlugins().hasPlugin('com.android.library')) {
102+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
103+
hasPlugin('com.android.library')) {
110104
archives androidSourcesJar
111105
archives androidJavadocsJar
112106
} else {

multi-view-adapter/build.gradle

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

17+
import gradle.Config
18+
1719
apply plugin: 'com.android.library'
1820
apply plugin: 'com.novoda.bintray-release'
19-
20-
buildscript {
21-
repositories {
22-
jcenter()
23-
}
24-
dependencies {
25-
classpath 'com.novoda:bintray-release:0.5.0'
26-
}
27-
}
2821
apply plugin: 'jacoco'
2922

3023
jacoco {
3124
toolVersion = "0.7.4.201502262128"
3225
}
26+
3327
task jacocoTestReport(type: JacocoReport,
3428
dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
3529

@@ -50,13 +44,13 @@ task jacocoTestReport(type: JacocoReport,
5044
}
5145

5246
android {
53-
compileSdkVersion 25
47+
compileSdkVersion Config.COMPILE_SDK
5448

5549
defaultConfig {
56-
minSdkVersion 9
57-
targetSdkVersion 25
58-
versionCode 1
59-
versionName "1.2.6"
50+
minSdkVersion Config.MIN_SDK
51+
targetSdkVersion Config.TARGET_SDK
52+
versionCode Config.VERSION_CODE
53+
versionName Config.VERSION_NAME
6054

6155
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
6256
}
@@ -80,30 +74,30 @@ android {
8074
}
8175

8276
dependencies {
83-
compile 'com.android.support:recyclerview-v7:25.3.1'
77+
implementation Config.RECYCLER_VIEW
8478

85-
testCompile 'junit:junit:4.12'
86-
testCompile 'org.mockito:mockito-core:2.9.0'
79+
testImplementation 'junit:junit:4.12'
80+
testImplementation 'org.mockito:mockito-core:2.9.0'
8781

88-
androidTestCompile 'org.mockito:mockito-android:2.7.22'
89-
androidTestCompile "com.android.support.test:runner:1.0.1"
90-
androidTestCompile "com.android.support.test:rules:1.0.1"
82+
androidTestImplementation 'org.mockito:mockito-android:2.8.47'
83+
androidTestImplementation "com.android.support.test:runner:1.0.1"
84+
androidTestImplementation "com.android.support.test:rules:1.0.1"
9185
}
9286

9387
publish {
94-
userOrg = 'devahamed'
95-
groupId = 'com.github.devahamed'
96-
artifactId = 'multi-view-adapter'
97-
repoName = 'MultiViewAdapter'
98-
publishVersion = '1.2.6'
99-
desc = 'Recyclerview Adapter library to create composable view holders'
100-
website = 'https://github.com/DevAhamed/MultiViewAdapter'
88+
userOrg = Config.USER_ORG
89+
groupId = Config.GROUP_ID
90+
artifactId = Config.ARTIFACT_ID_CORE
91+
publishVersion = Config.PUBLISH_VERSION
92+
repoName = Config.REPO_NAME
93+
desc = Config.DESC
94+
website = Config.WEBSITE
10195
}
10296

10397
afterEvaluate { project ->
10498

105-
if (project.getPlugins().hasPlugin('com.android.application') ||
106-
project.getPlugins().hasPlugin('com.android.library')) {
99+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
100+
hasPlugin('com.android.library')) {
107101

108102
task androidJavadocs(type: Javadoc) {
109103
source = android.sourceSets.main.java.source
@@ -120,12 +114,12 @@ afterEvaluate { project ->
120114
from android.sourceSets.main.java.source
121115
}
122116
} else {
123-
task sourcesJar(type: Jar, dependsOn:classes) {
117+
task sourcesJar(type: Jar, dependsOn: classes) {
124118
classifier = 'sources'
125119
from sourceSets.main.allSource
126120
}
127121

128-
task javadocJar(type: Jar, dependsOn:javadoc) {
122+
task javadocJar(type: Jar, dependsOn: javadoc) {
129123
classifier = 'javadoc'
130124
from javadoc.destinationDir
131125
}
@@ -140,8 +134,8 @@ afterEvaluate { project ->
140134
}
141135

142136
artifacts {
143-
if (project.getPlugins().hasPlugin('com.android.application') ||
144-
project.getPlugins().hasPlugin('com.android.library')) {
137+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
138+
hasPlugin('com.android.library')) {
145139
archives androidSourcesJar
146140
archives androidJavadocsJar
147141
} else {

sample/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17+
import gradle.Config
18+
1719
apply plugin: 'com.android.application'
1820

1921
android {
20-
compileSdkVersion 25
22+
compileSdkVersion Config.TARGET_SDK
2123

2224
defaultConfig {
2325
applicationId "com.ahamed.sample"
2426
minSdkVersion 16
25-
targetSdkVersion 25
26-
versionCode 1
27-
versionName "1.2.6"
27+
targetSdkVersion Config.TARGET_SDK
28+
versionCode Config.VERSION_CODE
29+
versionName Config.VERSION_NAME
2830

2931
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3032
}
@@ -38,18 +40,16 @@ android {
3840
dataBinding {
3941
enabled = true
4042
}
41-
4243
}
4344

4445
dependencies {
4546
compile project(':multi-view-adapter')
4647
compile project(':multi-view-adapter-databinding')
4748

48-
compile 'com.android.support:appcompat-v7:25.3.1'
49-
compile 'com.android.support:recyclerview-v7:25.3.1'
50-
compile 'com.android.support:cardview-v7:25.3.1'
51-
compile 'com.android.support:design:25.3.1'
52-
compile 'com.android.support:support-v4:25.3.1'
49+
implementation Config.APP_COMPAT
50+
implementation Config.RECYCLER_VIEW
51+
implementation Config.CARD_VIEW
52+
implementation Config.DESIGN
5353
compile 'com.android.support.constraint:constraint-layout:1.0.2'
5454

5555
debugCompile "com.github.brianPlummer:tinydancer:0.1.0"

0 commit comments

Comments
 (0)