Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8236823: Ensure that API documentation uses minified libraries
Reviewed-by: jjg
  • Loading branch information
pavelrappo committed Jun 2, 2020
1 parent a111494 commit f6ad22fce5b2a8d5d349e8b389103e2d565dc709
@@ -211,18 +211,18 @@ protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG));
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false);
copyJqueryFiles();

f = DocFile.createFileForOutput(configuration, DocPaths.JQUERY_OVERRIDES_CSS);
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.JQUERY_OVERRIDES_CSS), true, true);
}
}

private void copyJqueryFiles() throws DocletException {
List<String> files = Arrays.asList(
"jquery-3.4.1.js",
"jquery-ui.js",
"jquery-ui.css",
"jquery-3.4.1.min.js",
"jquery-ui.min.js",
"jquery-ui.min.css",
"jquery-ui.structure.min.css",
"jquery-ui.structure.css",
"images/ui-bg_glass_65_dadada_1x400.png",
"images/ui-icons_454545_256x240.png",
"images/ui-bg_glass_95_fef1ec_1x400.png",
@@ -311,7 +311,9 @@ private void addStylesheets(HtmlTree tree) {
}

if (index) {
addStylesheet(tree, DocPaths.JQUERY_FILES.resolve(DocPaths.JQUERY_STYLESHEET_FILE));
// The order of the addStylesheet(...) calls is important
addStylesheet(tree, DocPaths.JQUERY_FILES.resolve(DocPaths.JQUERY_UI_CSS));
addStylesheet(tree, DocPaths.JQUERY_OVERRIDES_CSS);
}
}

@@ -332,8 +334,8 @@ private void addScripts(HtmlTree tree) {
.append(";\n")
.append("loadScripts(document, 'script');");
}
addJQueryFile(tree, DocPaths.JQUERY_JS_3_4);
addJQueryFile(tree, DocPaths.JQUERY_JS);
addJQueryFile(tree, DocPaths.JQUERY_UI_JS);
}
for (Script script : scripts) {
tree.add(script.asContent());
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2020, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active,
a.ui-button:active,
.ui-button:active,
.ui-button.ui-state-active:hover {
/* Overrides the color of selection used in jQuery UI */
background: #F8981D;
}

Large diffs are not rendered by default.

@@ -251,7 +251,7 @@ a.ui-button:active,
.ui-button:active,
.ui-button.ui-state-active:hover {
border: 1px solid #aaaaaa;
background: #F8981D;
background: #dadada url("images/ui-bg_glass_65_dadada_1x400.png") 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
@@ -97,17 +97,20 @@ public static DocPath indexN(int n) {
/** The name of the default javascript file. */
public static final DocPath JAVASCRIPT = DocPath.create("script.js");

/** The name of the stylesheet file overriding jQuery UI stylesheet. */
public static final DocPath JQUERY_OVERRIDES_CSS = DocPath.create("jquery-ui.overrides.css");

/** The name of the directory for the jQuery. */
public static final DocPath JQUERY_FILES = DocPath.create("script-dir");

/** The name of the default jQuery stylesheet file. */
public static final DocPath JQUERY_STYLESHEET_FILE = DocPath.create("jquery-ui.css");

/** The name of the default jQuery javascript file. */
public static final DocPath JQUERY_JS_3_4 = DocPath.create("jquery-3.4.1.js");
public static final DocPath JQUERY_JS = DocPath.create("jquery-3.4.1.min.js");

/** The name of the default jQuery javascript file. */
public static final DocPath JQUERY_JS = DocPath.create("jquery-ui.js");
/** The name of the default jQuery UI stylesheet file. */
public static final DocPath JQUERY_UI_CSS = DocPath.create("jquery-ui.min.css");

/** The name of the default jQuery UI javascript file. */
public static final DocPath JQUERY_UI_JS = DocPath.create("jquery-ui.min.js");

/** The name of the member search index js file. */
public static final DocPath MEMBER_SEARCH_INDEX_JS = DocPath.create("member-search-index.js");
@@ -406,13 +406,13 @@ void checkSearchOutput(String fileName, boolean expectedOutput, boolean moduleDi
// Test for search related markup
checkOutput(fileName, expectedOutput,
"""
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.css" title="Style">
<link rel="stylesheet" type="text/css" href="script-dir/jquery-ui.min.css" title="Style">
""",
"""
<script type="text/javascript" src="script-dir/jquery-3.4.1.js"></script>
<script type="text/javascript" src="script-dir/jquery-3.4.1.min.js"></script>
""",
"""
<script type="text/javascript" src="script-dir/jquery-ui.js"></script>""",
<script type="text/javascript" src="script-dir/jquery-ui.min.js"></script>""",
"""
var pathtoroot = "./";
loadScripts(document, 'script');""",
@@ -689,13 +689,11 @@ void checkInvalidUsageIndexTag() {
void checkJqueryAndImageFiles(boolean expectedOutput) {
checkFiles(expectedOutput,
"search.js",
"script-dir/jquery-3.4.1.js",
"script-dir/jquery-ui.js",
"script-dir/jquery-ui.css",
"jquery-ui.overrides.css",
"script-dir/jquery-3.4.1.min.js",
"script-dir/jquery-ui.min.js",
"script-dir/jquery-ui.min.css",
"script-dir/jquery-ui.structure.min.css",
"script-dir/jquery-ui.structure.css",
"script-dir/images/ui-bg_glass_65_dadada_1x400.png",
"script-dir/images/ui-icons_454545_256x240.png",
"script-dir/images/ui-bg_glass_95_fef1ec_1x400.png",
@@ -197,13 +197,10 @@ protected void error(String msg) {
"help-doc.html",
"index-all.html",
"index.html",
"script-dir/jquery-3.4.1.js",
"script-dir/jquery-ui.js",
"script-dir/jquery-ui.css",
"script-dir/jquery-3.4.1.min.js",
"script-dir/jquery-ui.min.js",
"script-dir/jquery-ui.min.css",
"script-dir/jquery-ui.structure.min.css",
"script-dir/jquery-ui.structure.css",
"script-dir/images/ui-bg_glass_65_dadada_1x400.png",
"script-dir/images/ui-icons_454545_256x240.png",
"script-dir/images/ui-bg_glass_95_fef1ec_1x400.png",
@@ -226,15 +223,21 @@ protected void error(String msg) {
"resources/x.png",
"script.js",
"search.js",
"jquery-ui.overrides.css",
"stylesheet.css",
"type-search-index.js"
));

protected static Set<String> noIndexFiles = standardExpectFiles.stream()
.filter(s -> !s.startsWith("script-dir") && !s.startsWith("resources")
&& !s.equals("index-all.html") && !s.equals("search.js") && !s.endsWith("-search-index.js")
&& !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html")
&& !s.equals("system-properties.html"))
.filter(s -> !s.startsWith("script-dir")
&& !s.startsWith("resources")
&& !s.endsWith("-search-index.js")
&& !s.equals("index-all.html")
&& !s.equals("search.js")
&& !s.equals("jquery-ui.overrides.css")
&& !s.equals("allclasses-index.html")
&& !s.equals("allpackages-index.html")
&& !s.equals("system-properties.html"))
.collect(Collectors.toSet());
}

0 comments on commit f6ad22f

Please sign in to comment.