forked from codyer/ElegantBus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-variant-doc.gradle
115 lines (103 loc) · 4.12 KB
/
config-variant-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
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
/*
* ************************************************************
* 文件:config-variant-doc.gradle 模块:ElegantBus 项目:ElegantBus
* 当前修改时间:2020年06月17日 21:57:19
* 上次修改时间:2020年06月17日 17:02:09
* 作者:Cody.yi https://github.com/codyer
*
* 描述:ElegantBus
* Copyright (c) 2020
* ************************************************************
*/
//编译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
archiveClassifier.convention('sources')
archiveClassifier.set('sources')
}*/
//project.android.libraryVariants.toList().first().javaCompileProvider.get()
// 打包源码jar
/*if (android.productFlavors.size() > 0) {
android.libraryVariants.all { variant ->
if (variant.name.toLowerCase().contains("debug")) {
return
}
def taskSourcesJar = project.tasks.create "sourcesJar${project.name + name.capitalize()}", Jar
def taskJavadoc = project.tasks.create "javadoc${project.name + name.capitalize()}", Javadoc
for (int i = 0; i < variant.sourceSets.size; i++) {
if (variant.flavorName == variant.sourceSets.get(i).name) {
taskSourcesJar.from android.sourceSets.main.java.sourceFiles
taskSourcesJar.from variant.sourceSets.get(i).java.sourceFiles
artifacts {
archives(taskSourcesJar.archivePath) {
classifier "sources"
builtBy taskSourcesJar
name = project.name
}
}
*//*taskJavadoc.source += "$buildDir/generated/aidl_source_output_dir/"
taskJavadoc.source += android.sourceSets.main.java.sourceFiles
taskJavadoc.source += variant.sourceSets.get(i).java.sourceFiles
taskJavadoc.classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
taskJavadoc.classpath += variant.javaCompileProvider.get().classpath
taskJavadoc.options.addStringOption('Xdoclint:none', '-quiet')
taskJavadoc.failOnError false
def taskJavadocJar = project.tasks.create "javadocJar${project.name + name.capitalize()}", Jar
taskJavadocJar.dependsOn(taskJavadoc)
taskJavadocJar.from taskJavadoc.destinationDir
artifacts {
archives(taskJavadocJar.archivePath) {
classifier "javadoc"
builtBy taskJavadocJar
name = project.name
}
}*//*
break
}
}
}
}*/
/*task javadoc(type: Javadoc) {
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')
}
failOnError false
}*/
// 打包文档jar
/*task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.convention('javadoc')
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}*/
//artifacts {
// archives sourcesJar
// archives javadocJar
//}
/*在javadoc task执行之前先添加第三方的依赖进来,否则会找不到相关的jar包*/
/*afterEvaluate {
javadoc.source += "$buildDir/generated/aidl_source_output_dir/"
// javadoc.source += variant.javaCompileProvider.get().source
// javadoc.source += compileReleaseAidl.sourceOutputDir.get().asFileTree
javadoc.classpath += project.android.libraryVariants.toList().first().javaCompileProvider.get().classpath
}*/
/*
javadoc {
options {
// 语言
locale 'en_US'
encoding 'UTF-8'
charSet 'UTF-8'
links "http://docs.oracle.com/javase/8/docs/api"
}
}*/