-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathconfig-doc.gradle
73 lines (63 loc) · 1.87 KB
/
config-doc.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
import org.gradle.internal.jvm.Jvm
/*
* ************************************************************
* 文件:config-doc.gradle 模块:StudioProjects-component 项目:component
* 当前修改时间:2019年04月24日 22:56:35
* 上次修改时间:2019年04月24日 22:56:34
* 作者:Cody.yi https://github.com/codyer
*
* 描述:StudioProjects-component
* Copyright (c) 2019
* ************************************************************
*/
//编译groovy代码时采用 UTF-8
tasks.withType(GroovyCompile) {
groovyOptions.encoding = "MacRoman"
}
//编译JAVA文件时采用UTF-8
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
// 打包源码jar
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
if (Jvm.current().getJavaVersion() == JavaVersion.VERSION_1_8) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
// 打包文档jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
/*在javadoc task执行之前先添加第三方的依赖进来,否则会找不到相关的jar包*/
/*
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant2 ->
variant2.getJavaCompiler().classpath.files
})
}
*/
afterEvaluate {
javadoc.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}
javadoc {
options {
// 语言
locale 'en_US'
encoding 'UTF-8'
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
}
}