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

Commit 6c1aabb

Browse files
authored
Merge pull request #33 from DevAhamed/AS-3.0-update
Update to new gradle plugin
2 parents f03fd70 + c237b61 commit 6c1aabb

File tree

15 files changed

+229
-134
lines changed

15 files changed

+229
-134
lines changed

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
buildscript {
22
repositories {
33
jcenter()
4+
google()
45
}
56
dependencies {
6-
classpath 'com.android.tools.build:gradle:2.3.3'
7+
classpath 'com.android.tools.build:gradle:3.0.0'
8+
classpath 'com.novoda:bintray-release:0.7.0'
79
}
810
}
911

1012
allprojects {
1113
repositories {
1214
jcenter()
15+
google()
1316
}
1417
}
1518

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+
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ org.gradle.jvmargs=-Xmx1536m
1414
# When configured, Gradle will run in incubating parallel mode.
1515
# This option should only be used with decoupled projects. More details, visit
1616
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17-
# org.gradle.parallel=true
17+
18+
org.gradle.parallel=true

gradle/wrapper/gradle-wrapper.jar

-75 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#Thu Sep 21 00:26:32 IST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -155,7 +155,7 @@ if $cygwin ; then
155155
fi
156156

157157
# Escape application args
158-
save ( ) {
158+
save () {
159159
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160160
echo " "
161161
}

multi-view-adapter-databinding/build.gradle

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +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
31-
buildToolsVersion "25.0.3"
23+
compileSdkVersion Config.COMPILE_SDK
3224

3325
defaultConfig {
34-
minSdkVersion 9
35-
targetSdkVersion 25
36-
versionCode 1
37-
versionName "1.2.3"
26+
minSdkVersion Config.MIN_SDK
27+
targetSdkVersion Config.TARGET_SDK
28+
versionCode Config.VERSION_CODE
29+
versionName Config.VERSION_NAME
3830

3931
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
4032
}
@@ -47,56 +39,74 @@ android {
4739
}
4840

4941
dependencies {
50-
compile project(':multi-view-adapter')
51-
provided('com.android.databinding:library:1.3.1') {
42+
implementation project(':multi-view-adapter')
43+
implementation Config.RECYCLER_VIEW
44+
45+
compileOnly('com.android.databinding:library:1.3.1') {
5246
transitive = false
5347
}
54-
provided('com.android.databinding:baseLibrary:2.3.2') {
48+
compileOnly('com.android.databinding:baseLibrary:2.3.2') {
5549
transitive = false
5650
}
5751
}
5852

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

69-
if (project.hasProperty("android")) {
70-
// Android libraries
71-
task sourcesJar(type: Jar) {
72-
classifier = 'sources'
73-
from android.sourceSets.main.java.srcDirs
74-
}
63+
afterEvaluate { project ->
7564

76-
task javadoc(type: Javadoc) {
77-
source = android.sourceSets.main.java.srcDirs
78-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
79-
failOnError true
80-
}
81-
afterEvaluate {
82-
javadoc.classpath +=
83-
files(android.libraryVariants.collect { variant -> variant.javaCompile.classpath.files
84-
})
85-
}
86-
} else {
87-
// Java libraries
88-
task sourcesJar(type: Jar, dependsOn: classes) {
89-
classifier = 'sources'
90-
from sourceSets.main.allSource
65+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
66+
hasPlugin('com.android.library')) {
67+
68+
task androidJavadocs(type: Javadoc) {
69+
source = android.sourceSets.main.java.source
70+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
71+
}
72+
73+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
74+
classifier = 'javadoc'
75+
from androidJavadocs.destinationDir
76+
}
77+
78+
task androidSourcesJar(type: Jar) {
79+
classifier = 'sources'
80+
from android.sourceSets.main.java.source
81+
}
82+
} else {
83+
task sourcesJar(type: Jar, dependsOn: classes) {
84+
classifier = 'sources'
85+
from sourceSets.main.allSource
86+
}
87+
88+
task javadocJar(type: Jar, dependsOn: Javadoc) {
89+
classifier = 'javadoc'
90+
from Javadoc.destinationDir
91+
}
9192
}
92-
}
9393

94-
task javadocJar(type: Jar, dependsOn: javadoc) {
95-
classifier = 'javadoc'
96-
from javadoc.destinationDir
97-
}
94+
if (JavaVersion.current().isJava8Compatible()) {
95+
allprojects {
96+
tasks.withType(Javadoc) {
97+
options.addStringOption('Xdoclint:none', '-quiet')
98+
}
99+
}
100+
}
98101

99-
artifacts {
100-
archives javadocJar
101-
archives sourcesJar
102+
artifacts {
103+
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().
104+
hasPlugin('com.android.library')) {
105+
archives androidSourcesJar
106+
archives androidJavadocsJar
107+
} else {
108+
archives sourcesJar
109+
archives javadocJar
110+
}
111+
}
102112
}

0 commit comments

Comments
 (0)