Skip to content

Commit e75d370

Browse files
authored
Replace Doclava with Dackka (#4324)
* Remove restriction on Dackka's Javadoc * Refactor release plugin to use dackka
1 parent e0cfdd6 commit e75d370

File tree

2 files changed

+8
-121
lines changed

2 files changed

+8
-121
lines changed

buildSrc/src/main/java/com/google/firebase/gradle/MultiProjectReleasePlugin.java

Lines changed: 3 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,19 @@
1515

1616
import static com.google.firebase.gradle.plugins.ProjectUtilsKt.toBoolean;
1717

18-
import com.google.common.collect.ImmutableList;
1918
import com.google.common.collect.ImmutableMap;
2019
import com.google.firebase.gradle.bomgenerator.BomGeneratorTask;
2120
import com.google.firebase.gradle.plugins.FireEscapeArtifactPlugin;
2221
import com.google.firebase.gradle.plugins.FirebaseLibraryExtension;
2322
import com.google.firebase.gradle.plugins.JavadocPlugin;
24-
import com.google.firebase.gradle.plugins.TasksKt;
2523
import com.google.firebase.gradle.plugins.publish.PublishingPlugin;
2624
import java.io.File;
27-
import java.io.IOException;
28-
import java.nio.file.Files;
2925
import java.util.Set;
3026
import java.util.stream.Collectors;
3127
import org.gradle.api.GradleException;
3228
import org.gradle.api.Plugin;
3329
import org.gradle.api.Project;
3430
import org.gradle.api.Task;
35-
import org.gradle.api.tasks.Delete;
3631
import org.gradle.api.tasks.bundling.Zip;
3732

3833
/**
@@ -62,10 +57,7 @@ public void apply(Project project) {
6257
project.apply(ImmutableMap.of("plugin", PublishingPlugin.class));
6358

6459
boolean releaseJavadocs = toBoolean(System.getProperty("releaseJavadocs", "true"));
65-
66-
File firebaseDevsiteJavadoc = new File(project.getBuildDir(), "firebase-javadocs/");
67-
File firebaseClientBuildDest = new File(firebaseDevsiteJavadoc, "client/");
68-
firebaseClientBuildDest.mkdirs();
60+
File firebaseDevsiteJavadoc = new File(project.getBuildDir(), "firebase-kotlindoc/android");
6961

7062
project.subprojects(
7163
sub -> {
@@ -118,116 +110,18 @@ public void apply(Project project) {
118110
"generateAllJavadocs",
119111
task -> {
120112
for (Project p : projectsToPublish) {
121-
task.dependsOn(p.getPath() + ":" + TasksKt.JAVADOC_TASK_NAME);
122-
123-
task.doLast(
124-
t -> {
125-
for (Project publishableProject : projectsToPublish) {
126-
publishableProject.copy(
127-
copy -> {
128-
copy.from(
129-
publishableProject.getBuildDir()
130-
+ "/docs/javadoc/reference");
131-
copy.include("**/*");
132-
copy.into(firebaseDevsiteJavadoc);
133-
});
134-
135-
publishableProject.copy(
136-
copy -> {
137-
copy.from(
138-
publishableProject.getBuildDir()
139-
+ "/docs/javadoc/reference/_toc.yaml");
140-
copy.include("**/*");
141-
copy.into(
142-
firebaseClientBuildDest
143-
+ "/"
144-
+ publishableProject.getName());
145-
});
146-
}
147-
});
113+
task.dependsOn(p.getPath() + ":kotlindoc");
148114
}
149115
});
150116

151-
Delete prepareJavadocs =
152-
project
153-
.getTasks()
154-
.create(
155-
"prepareJavadocs",
156-
Delete.class,
157-
del -> {
158-
del.dependsOn(generateAllJavadocs);
159-
del.doLast(
160-
d -> {
161-
// cleanup docs
162-
project.delete(
163-
delSpec -> {
164-
ImmutableList<String> relativeDeletablePaths =
165-
ImmutableList.of(
166-
"timestamp.js",
167-
"navtree_data.js",
168-
"assets/",
169-
"classes.html",
170-
"hierarchy.html",
171-
"lists.js",
172-
"package-list",
173-
"packages.html",
174-
"index.html",
175-
"current.xml",
176-
"_toc.yaml");
177-
delSpec.delete(
178-
relativeDeletablePaths.stream()
179-
.map(
180-
path ->
181-
firebaseDevsiteJavadoc.getPath()
182-
+ "/"
183-
+ path)
184-
.collect(Collectors.toList()));
185-
});
186-
// Transform
187-
project.exec(
188-
execSpec -> {
189-
execSpec.setIgnoreExitValue(true);
190-
execSpec.setWorkingDir(firebaseDevsiteJavadoc);
191-
execSpec.setCommandLine(
192-
project.getRootProject().file("buildSrc").getPath()
193-
+ "/firesite_transform.sh");
194-
});
195-
196-
// Tidy
197-
String tidyBinary = System.getProperty("tidyBinaryPath", null);
198-
String tidyConfig = System.getProperty("tidyConfigPath", null);
199-
if (tidyBinary != null && tidyConfig != null) {
200-
try {
201-
Files.walk(firebaseDevsiteJavadoc.toPath())
202-
.filter(
203-
p ->
204-
p.toFile().isFile()
205-
&& p.toString().endsWith(".html"))
206-
.forEach(
207-
p -> {
208-
project.exec(
209-
execSpec -> {
210-
System.out.println("Tidying " + p);
211-
execSpec.setIgnoreExitValue(true);
212-
execSpec.commandLine(
213-
tidyBinary, "-config", tidyConfig, p);
214-
});
215-
});
216-
} catch (IOException e) {
217-
throw new GradleException("Directory walk failed.", e);
218-
}
219-
}
220-
});
221-
});
222-
223117
Zip assembleFirebaseJavadocZip =
224118
project
225119
.getTasks()
226120
.create(
227121
"assembleFirebaseJavadocZip",
228122
Zip.class,
229123
zip -> {
230-
zip.dependsOn(prepareJavadocs);
124+
zip.dependsOn(generateAllJavadocs);
231125
zip.getDestinationDirectory().set(project.getBuildDir());
232126
zip.getArchiveFileName().set("firebase-javadoc.zip");
233127
zip.from(firebaseDevsiteJavadoc);

buildSrc/src/main/java/com/google/firebase/gradle/plugins/DackkaPlugin.kt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -338,21 +338,14 @@ abstract class DackkaPlugin : Plugin<Project> {
338338
outputDirectory: Provider<File>
339339
) =
340340
project.tasks.register<Copy>("copyJavaDocToCommonDirectory") {
341-
/**
342-
* This is not currently cache compliant. The need for this property is temporary while we
343-
* test it alongside the current javaDoc task. Since it's such a temporary behavior, losing
344-
* cache compliance is fine for now.
345-
*/
346-
if (project.rootProject.findProperty("dackkaJavadoc") == "true") {
347-
mustRunAfter("firesiteTransform")
341+
mustRunAfter("firesiteTransform")
348342

349-
val outputFolder = project.rootProject.fileFromBuildDir("firebase-kotlindoc/android")
350-
val javaFolder = project.childFile(outputDirectory, "android")
343+
val outputFolder = project.rootProject.fileFromBuildDir("firebase-kotlindoc")
344+
val javaFolder = project.childFile(outputDirectory, "android")
351345

352-
fromDirectory(javaFolder)
346+
fromDirectory(javaFolder)
353347

354-
into(outputFolder)
355-
}
348+
into(outputFolder)
356349
}
357350

358351
// TODO(b/246593212): Migrate doc files to single directory

0 commit comments

Comments
 (0)