Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
76014cf0
authored
Sep 13, 2021
by
andrewlewis
Committed by
Christos Tsilopoulos
Sep 14, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add support for generating javadoc with Dackka
PiperOrigin-RevId: 396297834
parent
a951769e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
4 deletions
javadoc_combined.gradle
javadoc_combined.gradle
View file @
76014cf0
...
@@ -16,22 +16,27 @@ apply from: "${buildscript.sourceFile.parentFile}/javadoc_util.gradle"
...
@@ -16,22 +16,27 @@ apply from: "${buildscript.sourceFile.parentFile}/javadoc_util.gradle"
class
CombinedJavadocPlugin
implements
Plugin
<
Project
>
{
class
CombinedJavadocPlugin
implements
Plugin
<
Project
>
{
static
final
String
TASK_NAME
=
"generateCombinedJavadoc"
static
final
String
JAVADOC_TASK_NAME
=
"generateCombinedJavadoc"
static
final
String
DACKKA_TASK_NAME
=
"generateCombinedDackka"
static
final
String
DACKKA_JAR_URL
=
"https://androidx.dev/dackka/builds/7709825/artifacts/dackka-0.0.9.jar"
@Override
@Override
void
apply
(
Project
project
)
{
void
apply
(
Project
project
)
{
project
.
gradle
.
projectsEvaluated
{
project
.
gradle
.
projectsEvaluated
{
Set
<
Project
>
libraryModules
=
getLibraryModules
(
project
)
Set
<
Project
>
libraryModules
=
getLibraryModules
(
project
)
if
(!
libraryModules
.
isEmpty
())
{
if
(!
libraryModules
.
isEmpty
())
{
project
.
task
(
TASK_NAME
,
type:
Javadoc
)
{
def
guavaReferenceUrl
=
"https://guava.dev/releases/$project.ext.guavaVersion/api/docs"
project
.
task
(
JAVADOC_TASK_NAME
,
type:
Javadoc
)
{
description
=
"Generates combined Javadoc."
description
=
"Generates combined Javadoc."
title
=
"ExoPlayer library"
title
=
"ExoPlayer library"
source
=
libraryModules
.
generateJavadoc
.
source
source
=
libraryModules
.
generateJavadoc
.
source
classpath
=
project
.
files
([])
classpath
=
project
.
files
([])
destinationDir
=
project
.
file
(
"$project.buildDir/docs/javadoc"
)
destinationDir
=
project
.
file
(
"$project.buildDir/docs/javadoc"
)
options
{
options
{
links
"https://developer.android.com/reference"
,
links
"https://developer.android.com/reference"
,
guavaReferenceUrl
"https://guava.dev/releases/$project.ext.guavaVersion/api/docs"
encoding
=
"UTF-8"
encoding
=
"UTF-8"
}
}
options
.
addBooleanOption
"-no-module-directories"
,
true
options
.
addBooleanOption
"-no-module-directories"
,
true
...
@@ -60,6 +65,54 @@ class CombinedJavadocPlugin implements Plugin<Project> {
...
@@ -60,6 +65,54 @@ class CombinedJavadocPlugin implements Plugin<Project> {
project
.
fixJavadoc
()
project
.
fixJavadoc
()
}
}
}
}
project
.
task
(
DACKKA_TASK_NAME
,
type:
JavaExec
)
{
doFirst
{
// Recreate the output directory to remove any leftover files from a previous run.
def
outputDir
=
project
.
file
(
"$project.buildDir/docs/dackka"
)
project
.
delete
outputDir
project
.
mkdir
outputDir
// Download the Dackka JAR.
new
URL
(
DACKKA_JAR_URL
).
withInputStream
{
i
->
classpath
.
getSingleFile
().
withOutputStream
{
it
<<
i
}
}
// Build lists of source files and dependencies.
def
sources
=
[]
def
dependencies
=
[]
libraryModules
.
each
{
libraryModule
->
libraryModule
.
android
.
libraryVariants
.
all
{
variant
->
def
name
=
variant
.
buildType
.
name
if
(
name
==
"release"
)
{
def
classpathFiles
=
project
.
files
(
variant
.
javaCompileProvider
.
get
().
classpath
.
files
)
variant
.
sourceSets
.
inject
(
sources
)
{
acc
,
val
->
acc
<<
val
.
javaDirectories
}
dependencies
<<
classpathFiles
.
filter
{
f
->
!(
f
.
path
.
contains
(
"/buildout/"
))
}
dependencies
<<
libraryModule
.
project
.
android
.
getBootClasspath
()
}
}
}
// Set command line arguments to Dackka.
def
guavaPackageListFile
=
getGuavaPackageListFile
(
getTemporaryDir
())
def
globalLinksString
=
"$guavaReferenceUrl^$guavaPackageListFile^^"
def
sourcesString
=
project
.
files
(
sources
.
flatten
())
.
filter
({
f
->
project
.
file
(
f
).
exists
()
}).
join
(
";"
)
def
dependenciesString
=
project
.
files
(
dependencies
).
asPath
.
replace
(
':'
,
';'
)
args
(
"-moduleName"
,
""
,
"-outputDir"
,
"$outputDir"
,
"-globalLinks"
,
"$globalLinksString"
,
"-loggingLevel"
,
"WARN"
,
"-sourceSet"
,
"-src $sourcesString -classpath $dependenciesString"
,
"-offlineMode"
)
environment
(
"DEVSITE_TENANT"
,
"androidx"
)
}
description
=
"Generates combined javadoc for developer.android.com."
classpath
=
project
.
files
(
new
File
(
getTemporaryDir
(),
"dackka.jar"
))
}
}
}
}
}
}
}
...
@@ -72,6 +125,17 @@ class CombinedJavadocPlugin implements Plugin<Project> {
...
@@ -72,6 +125,17 @@ class CombinedJavadocPlugin implements Plugin<Project> {
}
}
}
}
// Returns a file containing the list of packages that should be linked to Guava documentation.
private
static
File
getGuavaPackageListFile
(
File
directory
)
{
def
packageListFile
=
new
File
(
directory
,
"guava"
)
packageListFile
.
text
=
[
"com.google.common.base"
,
"com.google.common.collect"
,
"com.google.common.io"
,
"com.google.common.math"
,
"com.google.common.net"
,
"com.google.common.primitives"
,
"com.google.common.truth"
,
"com.google.common.util.concurrent"
]
.
join
(
'\n'
)
return
packageListFile
}
}
}
apply
plugin:
CombinedJavadocPlugin
apply
plugin:
CombinedJavadocPlugin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment