Skip to content

Commit bbfa826

Browse files
daymxnDavid Motsonashvili
authored and
David Motsonashvili
committed
Replace Doclava with Dackka (#4324)
* Remove restriction on Dackka's Javadoc * Refactor release plugin to use dackka
1 parent 0930b41 commit bbfa826

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 -> {
@@ -120,116 +112,18 @@ public void apply(Project project) {
120112
"generateAllJavadocs",
121113
task -> {
122114
for (Project p : projectsToPublish) {
123-
task.dependsOn(p.getPath() + ":" + TasksKt.JAVADOC_TASK_NAME);
124-
125-
task.doLast(
126-
t -> {
127-
for (Project publishableProject : projectsToPublish) {
128-
publishableProject.copy(
129-
copy -> {
130-
copy.from(
131-
publishableProject.getBuildDir()
132-
+ "/docs/javadoc/reference");
133-
copy.include("**/*");
134-
copy.into(firebaseDevsiteJavadoc);
135-
});
136-
137-
publishableProject.copy(
138-
copy -> {
139-
copy.from(
140-
publishableProject.getBuildDir()
141-
+ "/docs/javadoc/reference/_toc.yaml");
142-
copy.include("**/*");
143-
copy.into(
144-
firebaseClientBuildDest
145-
+ "/"
146-
+ publishableProject.getName());
147-
});
148-
}
149-
});
115+
task.dependsOn(p.getPath() + ":kotlindoc");
150116
}
151117
});
152118

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