forked from topjohnwu/libsu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
117 lines (96 loc) · 3.12 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'maven-publish'
apply plugin: 'java'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-alpha12'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task dlPackageList {
outputs.upToDateWhen { false }
/* Merge framework packages with AndroidX packages into the same list
* so links to Android classes can work properly in Javadoc */
rootProject.buildDir.mkdirs()
new File(rootProject.buildDir, 'package-list').withOutputStream { out ->
new URL('https://developer.android.com/reference/package-list')
.withInputStream { is -> out << is }
new URL('https://developer.android.com/reference/androidx/package-list')
.withInputStream { is -> out << is }
}
}
task javadoc(type: Javadoc, dependsOn: dlPackageList, overwrite: true) {
failOnError false
title = 'libsu API'
exclude '**/internal/**'
options.links('https://docs.oracle.com/javase/8/docs/api/')
options.linksOffline 'https://developer.android.com/reference/', rootProject.buildDir.getPath()
destinationDir = new File(rootProject.buildDir, 'javadoc')
options.noDeprecated = true
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task install (dependsOn: publishToMavenLocal) {
/* Force JitPack to build javadocJar and publish */
}
publishing {
publications {
maven(MavenPublication) {
artifact javadocJar
groupId 'com.github.topjohnwu'
artifactId 'docs'
}
}
}
subprojects {
buildscript {
repositories {
google()
jcenter()
}
}
repositories {
google()
jcenter()
}
configurations {
javadocDeps
}
afterEvaluate {
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
if (minSdkVersion == null)
minSdkVersion 9
targetSdkVersion 28
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
if (getPlugins().hasPlugin('com.android.library')) {
rootProject.javadoc {
source += android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.javadocDeps
}
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives sourcesJar
}
}
}
}