8357458: Missing Highlight.js license file
Reviewed-by: jlahoda
This commit is contained in:
parent
07f5b762a0
commit
a2743bab4f
@ -341,7 +341,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_UI_CSS),
|
||||
DocPaths.RESOURCE_FILES.resolve(DocPaths.JQUERY_UI_CSS), false); }
|
||||
|
||||
copyLegalFiles(options.createIndex());
|
||||
copyLegalFiles(options.createIndex(), options.syntaxHighlight());
|
||||
// Print a notice if the documentation contains diagnostic markers
|
||||
if (messages.containsDiagnosticMarkers()) {
|
||||
messages.notice("doclet.contains.diagnostic.markers");
|
||||
@ -357,7 +357,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
}
|
||||
}
|
||||
|
||||
private void copyLegalFiles(boolean includeJQuery) throws DocletException {
|
||||
private void copyLegalFiles(boolean includeJQuery, boolean includeHighlightJs) throws DocletException {
|
||||
Path legalNoticesDir;
|
||||
String legalNotices = configuration.getOptions().legalNotices();
|
||||
switch (legalNotices) {
|
||||
@ -401,6 +401,9 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
if (entry.getFileName().toString().startsWith("jquery") && !includeJQuery) {
|
||||
continue;
|
||||
}
|
||||
if (entry.getFileName().toString().equals("highlightjs.md") && !includeHighlightJs) {
|
||||
continue;
|
||||
}
|
||||
DocPath filePath = DocPaths.LEGAL.resolve(entry.getFileName().toString());
|
||||
DocFile df = DocFile.createFileForOutput(configuration, filePath);
|
||||
df.copyFile(DocFile.createFileForInput(configuration, entry));
|
||||
|
34
src/jdk.javadoc/share/legal/highlightjs.md
Normal file
34
src/jdk.javadoc/share/legal/highlightjs.md
Normal file
@ -0,0 +1,34 @@
|
||||
## Highlight.js v11.11.1
|
||||
|
||||
### Highlight.js License
|
||||
```
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2006, Ivan Sagalaev.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
```
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2025, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8293177 8324774
|
||||
* @bug 8293177 8324774 8357458
|
||||
* @summary Verify version numbers in legal files
|
||||
* @library /test/lib
|
||||
* @build jtreg.SkippedException
|
||||
@ -47,7 +47,7 @@ import jtreg.SkippedException;
|
||||
public class CheckLibraryVersions {
|
||||
static class SourceDirNotFound extends Error {}
|
||||
// Regex pattern for library name and version in legal Markdown file
|
||||
static final Pattern versionPattern = Pattern.compile("## ([\\w\\s]+) v(\\d+(\\.\\d+){1,2})");
|
||||
static final Pattern versionPattern = Pattern.compile("## ([\\w\\s.]+) v(\\d+(\\.\\d+){1,2})");
|
||||
|
||||
// Map of 3rd party libraries. The keys are the names of files in the legal directory,
|
||||
// the values are lists of templates for library files with the following placeholders:
|
||||
@ -56,7 +56,8 @@ public class CheckLibraryVersions {
|
||||
static final Map<String, List<String>> libraries = Map.of(
|
||||
"jquery.md", List.of("jquery/jquery-%V%M.js"),
|
||||
"jqueryUI.md", List.of("jquery/jquery-ui%M.js", "jquery/jquery-ui%M.css"),
|
||||
"dejavufonts.md", List.of("fonts/dejavu.css")
|
||||
"dejavufonts.md", List.of("fonts/dejavu.css"),
|
||||
"highlightjs.md", List.of("highlight.js")
|
||||
);
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2025, 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
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8259530
|
||||
* @bug 8259530 8357458
|
||||
* @summary Generated docs contain MIT/GPL-licenced works without reproducing the licence
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -61,6 +61,10 @@ public class TestLegalNotices extends JavadocTester {
|
||||
INDEX, NO_INDEX
|
||||
}
|
||||
|
||||
enum HighlightKind {
|
||||
HIGHLIGHT, NO_HIGHLIGHT
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCombo(Path base) throws IOException {
|
||||
@ -71,14 +75,17 @@ public class TestLegalNotices extends JavadocTester {
|
||||
|
||||
for (var optionKind : OptionKind.values()) {
|
||||
for (var indexKind : IndexKind.values()) {
|
||||
test(base, src, legal, optionKind, indexKind);
|
||||
for (var highlightKind : HighlightKind.values()) {
|
||||
test(base, src, legal, optionKind, indexKind, highlightKind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test(Path base, Path src, Path legal, OptionKind optionKind, IndexKind indexKind) throws IOException {
|
||||
System.out.println("testing " + optionKind + " " + indexKind);
|
||||
Path out = base.resolve(optionKind + "-" + indexKind).resolve("out");
|
||||
void test(Path base, Path src, Path legal, OptionKind optionKind, IndexKind indexKind,
|
||||
HighlightKind highlightKind) throws IOException {
|
||||
System.out.println("testing " + optionKind + " " + indexKind + " " + highlightKind);
|
||||
Path out = base.resolve(optionKind + "-" + indexKind + "-" + highlightKind).resolve("out");
|
||||
List<String> args = new ArrayList<>();
|
||||
args.addAll(List.of(
|
||||
"-d", out.toString()));
|
||||
@ -87,6 +94,10 @@ public class TestLegalNotices extends JavadocTester {
|
||||
args.add("-noindex");
|
||||
}
|
||||
|
||||
if (highlightKind == HighlightKind.HIGHLIGHT) {
|
||||
args.add("--syntax-highlight");
|
||||
}
|
||||
|
||||
args.addAll(List.of(
|
||||
"-Xdoclint:-missing",
|
||||
"--source-path", src.toString(),
|
||||
@ -103,7 +114,7 @@ public class TestLegalNotices extends JavadocTester {
|
||||
}
|
||||
javadoc(args.toArray(new String[0]));
|
||||
|
||||
Set<Path> expectFiles = getExpectFiles(optionKind, indexKind, legal);
|
||||
Set<Path> expectFiles = getExpectFiles(optionKind, indexKind, highlightKind, legal);
|
||||
Set<Path> foundFiles = listFiles(out.resolve("legal"));
|
||||
|
||||
checking("Checking legal notice files");
|
||||
@ -128,16 +139,18 @@ public class TestLegalNotices extends JavadocTester {
|
||||
|
||||
}
|
||||
|
||||
Set<Path> getExpectFiles(OptionKind optionKind, IndexKind indexKind, Path legal) throws IOException {
|
||||
Set<Path> getExpectFiles(OptionKind optionKind, IndexKind indexKind, HighlightKind highlightKind,
|
||||
Path legal) throws IOException {
|
||||
switch (optionKind) {
|
||||
case UNSET, DEFAULT -> {
|
||||
Path javaHome = Path.of(System.getProperty("java.home"));
|
||||
Path legal_javadoc = javaHome.resolve("legal").resolve("jdk.javadoc");
|
||||
return listFiles(legal_javadoc, p ->
|
||||
switch (indexKind) {
|
||||
case INDEX -> true;
|
||||
case NO_INDEX -> !p.getFileName().toString().contains("jquery");
|
||||
});
|
||||
!(indexKind == IndexKind.NO_INDEX
|
||||
&& p.getFileName().toString().contains("jquery"))
|
||||
&& !(highlightKind == HighlightKind.NO_HIGHLIGHT
|
||||
&& p.getFileName().toString().equals("highlightjs.md"))
|
||||
);
|
||||
}
|
||||
|
||||
case NONE -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user