forked from facebookarchive/shimmer-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·145 lines (124 loc) · 4.31 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.library'
import com.android.builder.core.BuilderConstants
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
}
sourceSets {
main {
manifest.srcFile 'shimmer-android/src/main/AndroidManifest.xml'
java.srcDirs = ['shimmer-android/src/main/java']
res.srcDirs = ['shimmer-android/src/main/res']
}
}
}
// Create jar for distribution.
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(BuilderConstants.RELEASE)) {
// Distribution Jar Task
def distJarTask = task shimmerDistJar(type: Jar, dependsOn: variant.javaCompile) {
from variant.javaCompile.destinationDir
}
artifacts.add('archives', distJarTask)
// Javadocs Task
def javadocsTask = task androidJavadocs(type: Javadoc, dependsOn: variant.javaCompile) {
source = variant.javaCompile.source
def androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files, androidJar)
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
}
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
def javadocsJarTask = task androidJavadocsJar(type: Jar, dependsOn: javadocsTask) {
classifier = 'javadoc'
from javadocsTask.destinationDir
}
artifacts.add('archives', javadocsJarTask)
// Sources Jar Task
def sourcesJarTask = task androidSourcesJar(type: Jar) {
classifier = 'sources'
from variant.javaCompile.source
}
artifacts.add('archives', sourcesJarTask)
}
}
task installExample(dependsOn: 'shimmer-android-example:installDebug')
task smokeTest(dependsOn: [
'shimmer-android:assemble',
'shimmer-android:check',
'shimmer-android-example:assembleDebug',
'shimmerDistJar'
])
// Configure gradle.properties to do maven builds
if (!project.hasProperty('sonatypeRepo') ||
!project.hasProperty('sonatypeUsername') ||
!project.hasProperty('sonatypePassword')) {
return;
}
// Maven Push
apply plugin: 'maven'
apply plugin: 'signing'
version = "0.1.0"
group = "com.facebook.shimmer"
signing {
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: sonatypeRepo) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'Shimmer'
packaging 'jar'
description 'Shimmer effect for Android applications'
url 'http://facebook.github.io/shimmer-android'
scm {
url 'scm:[email protected]:facebook/shimmer-android.git'
connection 'scm:[email protected]:facebook/shimmer-android.git'
developerConnection 'scm:[email protected]:facebook/shimmer-android.git'
}
licenses {
license {
name 'BSD 2-Clause License'
url 'https://github.com/facebook/shimmer-android/blob/master/LICENSE'
distribution 'repo'
}
}
developers {
developer {
id 'jasleen'
name 'Jasleen Singh'
email '[email protected]'
}
}
}
}
}
task installArchives(type: Upload) {
configuration = configurations.archives
repositories {
mavenDeployer {
repository url: "file://${System.properties['user.home']}/.m2/repository"
}
}
}