mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8190875: modules not listed in overview/index page
Reviewed-by: jjg, sundar
This commit is contained in:
parent
19c13c2026
commit
e62ea558be
@ -452,8 +452,12 @@ public class HtmlConfiguration extends BaseConfiguration {
|
||||
* packages is more than one. Sets {@link #createoverview} field to true.
|
||||
*/
|
||||
protected void setCreateOverview() {
|
||||
if ((overviewpath != null || packages.size() > 1) && !nooverview) {
|
||||
createoverview = true;
|
||||
if (!nooverview) {
|
||||
if (overviewpath != null
|
||||
|| modules.size() > 1
|
||||
|| (modules.isEmpty() && packages.size() > 1)) {
|
||||
createoverview = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8190875
|
||||
* @summary modules not listed in overview/index page
|
||||
* @library /tools/lib ../lib
|
||||
* @modules
|
||||
* jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* @build JavadocTester
|
||||
* @run main TestIndexWithModules
|
||||
*/
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import builder.ClassBuilder;
|
||||
import toolbox.ModuleBuilder;
|
||||
import toolbox.ToolBox;
|
||||
|
||||
|
||||
public class TestIndexWithModules extends JavadocTester {
|
||||
|
||||
final ToolBox tb;
|
||||
private final Path src;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestIndexWithModules tester = new TestIndexWithModules();
|
||||
tester.runTests(m -> new Object[]{Paths.get(m.getName())});
|
||||
}
|
||||
|
||||
TestIndexWithModules() throws Exception{
|
||||
tb = new ToolBox();
|
||||
src = Paths.get("src");
|
||||
initModules();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIndexWithOverviewPath(Path base) throws Exception {
|
||||
Path out = base.resolve("out");
|
||||
|
||||
tb.writeFile("overview.html",
|
||||
"<html><body>The overview summary page header</body></html>");
|
||||
|
||||
javadoc("-d", out.toString(),
|
||||
"-overview", "overview.html",
|
||||
"--module-source-path", src.toString(),
|
||||
"--module", "m1");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
checkOrder("index.html",
|
||||
"The overview summary page header",
|
||||
"Modules",
|
||||
"<a href=\"m1/module-summary.html\">m1</a>");
|
||||
|
||||
}
|
||||
|
||||
//multiple modules with frames
|
||||
@Test
|
||||
void testIndexWithMultipleModules1(Path base) throws Exception {
|
||||
Path out = base.resolve("out");
|
||||
javadoc("-d", out.toString(),
|
||||
"--module-source-path", src.toString(),
|
||||
"--module", "m1,m3,m4",
|
||||
"--frames");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("index.html", true,
|
||||
"window.location.replace('overview-summary.html')");
|
||||
checkOrder("overview-summary.html",
|
||||
"Modules",
|
||||
"<a href=\"m1/module-summary.html\">m1</a>",
|
||||
"<a href=\"m3/module-summary.html\">m3</a>",
|
||||
"<a href=\"m4/module-summary.html\">m4</a>");
|
||||
}
|
||||
|
||||
//multiple modules with out frames
|
||||
@Test
|
||||
void testIndexWithMultipleModules2(Path base) throws Exception {
|
||||
Path out = base.resolve("out");
|
||||
javadoc("-d", out.toString(),
|
||||
"--module-source-path", src.toString(),
|
||||
"--module", "m1,m3,m4",
|
||||
"--no-frames");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
checkOrder("index.html",
|
||||
"Modules",
|
||||
"<a href=\"m1/module-summary.html\">m1</a>",
|
||||
"<a href=\"m3/module-summary.html\">m3</a>",
|
||||
"<a href=\"m4/module-summary.html\">m4</a>");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIndexWithSingleModule(Path base) throws Exception {
|
||||
Path out = base.resolve("out");
|
||||
javadoc("-d", out.toString(),
|
||||
"--module-source-path", src.toString(),
|
||||
"--module", "m2");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
checkOutput("index.html", true,
|
||||
"window.location.replace('m2/module-summary.html')");
|
||||
}
|
||||
|
||||
//no modules and multiple packages
|
||||
@Test
|
||||
void testIndexWithNoModules1(Path base) throws Exception{
|
||||
Path out = base.resolve("out");
|
||||
new ClassBuilder(tb, "P1.A1")
|
||||
.setModifiers("public","class")
|
||||
.write(src);
|
||||
|
||||
new ClassBuilder(tb, "P2.A2")
|
||||
.setModifiers("public","class")
|
||||
.write(src);
|
||||
|
||||
javadoc("-d", out.toString(),
|
||||
"--no-frames",
|
||||
"-sourcepath", src.toString(),
|
||||
"P1","P2");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
checkOrder("index.html",
|
||||
"Packages",
|
||||
"<a href=\"P1/package-summary.html\">P1</a>",
|
||||
"<a href=\"P2/package-summary.html\">P2</a>");
|
||||
|
||||
}
|
||||
|
||||
//no modules and one package
|
||||
@Test
|
||||
void testIndexWithNoModules2(Path base) throws Exception{
|
||||
Path out = base.resolve("out");
|
||||
new ClassBuilder(tb, "P1.A1")
|
||||
.setModifiers("public","class")
|
||||
.write(src);
|
||||
|
||||
javadoc("-d", out.toString(),
|
||||
"--no-frames",
|
||||
"-sourcepath", src.toString(),
|
||||
"P1");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
checkOrder("index.html",
|
||||
"window.location.replace('P1/package-summary.html')");
|
||||
}
|
||||
|
||||
void initModules() throws Exception {
|
||||
new ModuleBuilder(tb, "m1")
|
||||
.exports("p1")
|
||||
.classes("package p1; public class c1{}")
|
||||
.write(src);
|
||||
|
||||
new ModuleBuilder(tb, "m2")
|
||||
.exports("p1")
|
||||
.exports("p2")
|
||||
.classes("package p1; public class c1{}")
|
||||
.classes("package p2; public class c2{}")
|
||||
.write(src);
|
||||
|
||||
new ModuleBuilder(tb, "m3").write(src);
|
||||
|
||||
new ModuleBuilder(tb, "m4").write(src);
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
|
||||
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
|
||||
* 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
|
||||
8164407 8192007 8182765 8196200 8196201 8196202
|
||||
8164407 8192007 8182765 8196200 8196201 8196202 8196202
|
||||
* @summary Test modules support in javadoc.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -1574,23 +1574,13 @@ public class TestModules extends JavadocTester {
|
||||
}
|
||||
|
||||
void checkGroupOptionSingleModule() {
|
||||
checkOutput("overview-summary.html", true,
|
||||
"<div class=\"contentContainer\">\n"
|
||||
+ "<table class=\"overviewSummary\">\n"
|
||||
+ "<caption><span>Module Group B</span><span class=\"tabEnd\"> </span></caption>");
|
||||
checkOutput("overview-summary.html", false,
|
||||
"<table class=\"overviewSummary\">\n"
|
||||
+ "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>");
|
||||
checkOutput("index.html", true,
|
||||
"window.location.replace('moduleB/module-summary.html')");
|
||||
}
|
||||
|
||||
void checkGroupOptionSingleModule_html4() {
|
||||
checkOutput("overview-summary.html", true,
|
||||
"<div class=\"contentContainer\">\n"
|
||||
+ "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Module Group B</span><span class=\"tabEnd\"> </span></caption>");
|
||||
checkOutput("overview-summary.html", false,
|
||||
"<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
|
||||
+ "<caption><span>Modules</span><span class=\"tabEnd\"> </span></caption>");
|
||||
checkOutput("index.html", true,
|
||||
"window.location.replace('moduleB/module-summary.html')");
|
||||
}
|
||||
|
||||
void checkModuleName(boolean found) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user