forked from halfhp/androidplot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
190 lines (162 loc) · 5.15 KB
/
build.gradle
File metadata and controls
190 lines (162 loc) · 5.15 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* Copyright 2015 AndroidPlot.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'com.android.library'
id 'com.dicedmelon.gradle.jacoco-android'
id 'maven-publish'
id 'signing'
}
class AttrMarkdown extends DefaultTask {
def inFile
def outFile
@TaskAction
def generate() {
def input = project.file(inFile)
def output = project.file(outFile)
if(output.exists()) {
output.delete()
}
output.parentFile.mkdirs()
input.text.findAll(/<!--\n?([\s\S]*?)\n?-->/) { match, g1 -> g1
if(!g1.startsWith("NODOC")) {
output.append(g1)
output.append "\n\n"
}
}
}
}
/**
* Generates xml attrs markdown docs. To run:
* at the command line from the project root dir type:
* ./gradlew generateAttrsMarkdown
*
* The generated doc will appear in / replace androidplot/docs/attrs.md
*/
task generateAttrsMarkdown(type: AttrMarkdown) {
inFile = { "src/main/res/values/attrs.xml"}
outFile = { "../docs/attrs.md" }
}
android {
compileSdkVersion theCompileSdkVersion
defaultConfig {
minSdkVersion theMinSdkVersion
targetSdkVersion theTargetSdkVersion
testApplicationId "com.androidplot.test"
}
testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
}
}
lint {
abortOnError false
}
}
group = 'com.androidplot'
version = theVersionName
def siteUrl = 'http://androidplot.com'
def gitUrl = 'https://github.com/halfhp/androidplot.git'
dependencies {
implementation 'com.halfhp.fig:figlib:1.0.11'
implementation 'com.android.support:support-annotations:28.0.0'
testImplementation "org.mockito:mockito-core:4.0.0"
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation "org.robolectric:robolectric:4.7.3"
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError false
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'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
javadoc {
options.overview = "src/main/java/overview.html"
}
afterEvaluate {
publishing {
repositories {
maven {
name = "Maven Central"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("OSSRH_ACTOR")
password = System.getenv("OSSRH_TOKEN")
}
}
}
publications {
release(MavenPublication) {
from components.release
// You can then customize attributes of the publication as shown below.
groupId = 'com.androidplot'
artifactId = 'androidplot-core'
version = theVersionName
pom {
packaging 'aar'
name = 'Androidplot'
description = "Configure any object from XML."
url = gitUrl
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'halfhp'
name = 'Nick Fellows'
email = '[email protected]'
}
}
scm {
connection = gitUrl
developerConnection = gitUrl
url = gitUrl
}
}
}
}
}
}
afterEvaluate {
signing {
def signingKey = System.getenv("SIGNING_KEY")
def signingPassword = System.getenv("SIGNING_PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.release
}
}
artifacts {
archives javadocJar
archives sourcesJar
}