Skip to content

Commit ce9a456

Browse files
committed
Include offline docs in distribution zip
1 parent 928e597 commit ce9a456

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testi
7676
## How to Obtain Runnable Tai-e?
7777

7878
The recommended way is to download the distribution ZIP from [GitHub Releases](https://github.com/pascal-lab/Tai-e/releases).
79-
The ZIP contains Tai-e, all runtime dependencies, and startup scripts for Windows, Linux, and macOS.
79+
The ZIP contains Tai-e, all runtime dependencies, offline documentation, and startup scripts for Windows, Linux, and macOS.
8080

8181
Alternatively, you might build the latest Tai-e yourself from the source code. This can be simply accomplished via Gradle (be sure that Java 17 (or higher version) is available on your system):
8282

build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,34 @@ application {
5959
applicationName = projectArtifactId
6060
}
6161

62+
val apiDocs = tasks.named("javadoc")
63+
val docsProject = project(":docs")
64+
6265
distributions {
6366
main {
6467
distributionBaseName.set(projectArtifactId)
6568
contents {
6669
from(files("COPYING", "COPYING.LESSER",
6770
"README.md", "CHANGELOG.md", "CITATION.bib"))
71+
from(apiDocs) {
72+
into("docs/api")
73+
}
74+
}
75+
}
76+
}
77+
78+
docsProject.plugins.withId("org.asciidoctor.jvm.convert") {
79+
val referenceDocs = docsProject.files(
80+
docsProject.layout.buildDirectory.dir("docs/asciidoc")
81+
).builtBy(docsProject.tasks.named("asciidoctor"))
82+
83+
distributions {
84+
main {
85+
contents {
86+
from(referenceDocs) {
87+
into("docs/reference")
88+
}
89+
}
6890
}
6991
}
7092
}

release-tests/src/test/java/pascal/taie/release/DistributionTests.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.zip.ZipEntry;
3131
import java.util.zip.ZipInputStream;
3232

33+
import static org.junit.jupiter.api.Assertions.assertFalse;
3334
import static org.junit.jupiter.api.Assertions.assertNotNull;
3435
import static org.junit.jupiter.api.Assertions.assertTrue;
3536

@@ -43,6 +44,9 @@ CliRunner createRunner(File workingDir) throws IOException {
4344
+ "distribution ZIP");
4445
Path distributionDir = workingDir.toPath().resolve("distribution");
4546
extractZip(Path.of(distributionZipPath), distributionDir);
47+
assertDistributionFile(distributionDir, "docs/reference/en/index.html");
48+
assertNoDistributionFile(distributionDir, "docs/reference/index.html");
49+
assertDistributionFile(distributionDir, "docs/api/index.html");
4650
Path executable = findExecutable(distributionDir);
4751
if (!isWindows()) {
4852
assertTrue(executable.toFile().setExecutable(true)
@@ -73,6 +77,28 @@ private static void extractZip(Path zipPath, Path outputDir) throws IOException
7377
}
7478
}
7579

80+
private static void assertDistributionFile(
81+
Path distributionDir, String relativePath) throws IOException {
82+
assertTrue(containsDistributionFile(distributionDir, relativePath),
83+
"Distribution ZIP should contain " + relativePath);
84+
}
85+
86+
private static void assertNoDistributionFile(
87+
Path distributionDir, String relativePath) throws IOException {
88+
assertFalse(containsDistributionFile(distributionDir, relativePath),
89+
"Distribution ZIP should not contain " + relativePath);
90+
}
91+
92+
private static boolean containsDistributionFile(
93+
Path distributionDir, String relativePath) throws IOException {
94+
Path expectedPath = Path.of(relativePath);
95+
try (var files = Files.walk(distributionDir)) {
96+
return files
97+
.filter(Files::isRegularFile)
98+
.anyMatch(path -> path.endsWith(expectedPath));
99+
}
100+
}
101+
76102
private static Path findExecutable(Path distributionDir) throws IOException {
77103
String executableName = isWindows() ? "tai-e.bat" : "tai-e";
78104
try (var files = Files.walk(distributionDir)) {

0 commit comments

Comments
 (0)