jdk

Форк
0
/
Docs.gmk 
814 строк · 31.8 Кб
1
# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
#
4
# This code is free software; you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 2 only, as
6
# published by the Free Software Foundation.  Oracle designates this
7
# particular file as subject to the "Classpath" exception as provided
8
# by Oracle in the LICENSE file that accompanied this code.
9
#
10
# This code is distributed in the hope that it will be useful, but WITHOUT
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
# version 2 for more details (a copy is included in the LICENSE file that
14
# accompanied this code).
15
#
16
# You should have received a copy of the GNU General Public License version
17
# 2 along with this work; if not, write to the Free Software Foundation,
18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
# or visit www.oracle.com if you need additional information or have any
22
# questions.
23
#
24

25
default: all
26

27
include $(SPEC)
28
include MakeBase.gmk
29

30
include CopyFiles.gmk
31
include Execute.gmk
32
include Modules.gmk
33
include ModuleTools.gmk
34
include ProcessMarkdown.gmk
35
include ToolsJdk.gmk
36
include ZipArchive.gmk
37
include TextFileProcessing.gmk
38

39
# This is needed to properly setup DOCS_MODULES.
40
$(eval $(call ReadImportMetaData))
41

42
################################################################################
43
# Hook to include the corresponding custom file, if present.
44
$(eval $(call IncludeCustomExtension, Docs.gmk))
45

46
################################################################################
47
# This file generates all documentation for OpenJDK.
48
#
49
# We will generate API documentation for two different selections of the source
50
# code: "Java SE", which contains just the modules covered by the top-level
51
# module java.se and "JDK", which covers all of Java SE and also all
52
# other available modules that should be documented, including imported modules,
53
# if any.
54
#
55
# We will also generate separate, free-standing specifications from either
56
# markdown or existing html files.
57
#
58

59
################################################################################
60
# Javadoc settings
61

62
# Include configuration for URLs in generated javadoc
63
include $(TOPDIR)/make/conf/javadoc.conf
64

65
MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) )
66

67

68
# In order to get a specific ordering it's necessary to specify the total
69
# ordering of tags as the tags are otherwise ordered in order of definition.
70
JAVADOC_TAGS := \
71
    -tag 'apiNote:a:API Note:' \
72
    -tag 'implSpec:a:Implementation Requirements:' \
73
    -tag 'implNote:a:Implementation Note:' \
74
    -tag param \
75
    -tag return \
76
    -tag throws \
77
    -taglet build.tools.taglet.JSpec\$$JLS \
78
    -taglet build.tools.taglet.JSpec\$$JVMS \
79
    -taglet build.tools.taglet.ModuleGraph \
80
    -taglet build.tools.taglet.SealedGraph \
81
    -taglet build.tools.taglet.ToolGuide \
82
    -tag since \
83
    -tag serialData \
84
    -tag factory \
85
    -tag spec \
86
    -tag see \
87
    -taglet build.tools.taglet.ExtLink \
88
    -taglet build.tools.taglet.Incubating \
89
    -tagletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
90
    $(CUSTOM_JAVADOC_TAGS) \
91
    #
92

93
# The reference tags must stay stable to allow for comparisons across the
94
# development cycle. If JAVADOC_TAGS needs to change, make sure that
95
# REFERENCE_TAGS remains unchanged, by copying and hardcoding, if necessary.
96
REFERENCE_TAGS := $(JAVADOC_TAGS)
97

98
# Which doclint checks to ignore
99
JAVADOC_DISABLED_DOCLINT_WARNINGS := missing
100
JAVADOC_DISABLED_DOCLINT_PACKAGES := org.w3c.* javax.smartcardio
101

102
# Allow overriding on the command line
103
# (intentionally sharing name with the javac option)
104
JAVA_WARNINGS_ARE_ERRORS ?= -Werror
105

106
# The initial set of options for javadoc
107
JAVADOC_OPTIONS := -use -keywords -notimestamp \
108
    -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
109
    -splitIndex --system none -javafx --expand-requires transitive \
110
    --override-methods=summary \
111
    --no-external-specs-page
112

113
# The reference options must stay stable to allow for comparisons across the
114
# development cycle.
115
REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \
116
    -encoding ISO-8859-1 -breakiterator -splitIndex --system none \
117
    -html5 -javafx --expand-requires transitive \
118
    --no-external-specs-page
119

120
# Should we add DRAFT stamps to the generated javadoc?
121
ifeq ($(VERSION_IS_GA), true)
122
  IS_DRAFT := false
123
else
124
  IS_DRAFT := true
125
endif
126

127
################################################################################
128
# General text snippets
129

130
FULL_COMPANY_NAME := Oracle and/or its affiliates
131
COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
132

133
JAVA_PLATFORM := Java Platform
134

135
ifeq ($(IS_DRAFT), true)
136
  DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
137
  ifeq ($(VERSION_BUILD), )
138
    DRAFT_MARKER_TITLE := $(SPACE)[ad-hoc build]
139
  else
140
    DRAFT_MARKER_TITLE := $(SPACE)[build $(VERSION_BUILD)]
141
  endif
142
  DRAFT_TEXT := This specification is not final and is subject to change. \
143
      Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
144
endif
145

146
# $1 - Relative prefix to COPYRIGHT_URL
147
COPYRIGHT_BOTTOM = \
148
    <a href="$(strip $1)$(COPYRIGHT_URL)">Copyright</a> \
149
    &copy; 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
150
    $(COMPANY_ADDRESS).<br>All rights reserved. \
151
    Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
152
    <a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
153
    $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
154

155
# $1 - Optional "Other Versions" link
156
JAVADOC_BOTTOM = \
157
    <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
158
    For further API reference and developer documentation see the \
159
    <a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
160
    Documentation</a>, which contains more detailed, \
161
    developer-targeted descriptions with conceptual overviews, definitions \
162
    of terms, workarounds, and working code examples. $1<br> \
163
    Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
164
    the US and other countries.<br> \
165
    $(call COPYRIGHT_BOTTOM, {@docroot}/../)
166

167
JAVADOC_TOP := \
168
    <div style="padding: 6px; text-align: center; font-size: 80%; \
169
    font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
170
    font-weight: normal;">$(DRAFT_TEXT)</div>
171

172
################################################################################
173
# JDK javadoc titles/text snippets
174

175
JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) &amp; JDK $(VERSION_SPECIFICATION)
176
JDK_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition \
177
    &amp;&nbsp;Java&nbsp;Development&nbsp;Kit
178

179
################################################################################
180
# Java SE javadoc titles/text snippets
181

182
JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
183
JAVASE_LONG_NAME := Java<sup>&reg;</sup> Platform, Standard Edition
184

185
################################################################################
186
# Functions
187

188
# Helper function for creating a svg file from a dot file generated by the
189
# GenGraphs tool for a module.
190
# param 1: SetupJavadocGeneration namespace ($1)
191
# param 2: module name
192
#
193
define setup_module_graph_dot_to_svg
194
  $1_$2_DOT_SRC :=  $$($1_MODULE_GRAPHS_DIR)/$2.dot
195
  $1_$2_SVG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.svg
196

197
    # For each module needing a graph, create a svg file from the dot file
198
    # generated by the GenGraphs tool and store it in the target dir.
199
    $$(eval $$(call SetupExecute, module_graphs_svg_$1_$2, \
200
        INFO := Running dot for module graphs for $2, \
201
        DEPS := $$(module_graphs_dot_$1_TARGET), \
202
        OUTPUT_FILE := $$($1_$2_SVG_TARGET), \
203
        SUPPORT_DIR := $$($1_MODULE_GRAPHS_DIR), \
204
        COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \
205
    ))
206

207
  $1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET)
208
endef
209

210
# Helper function for creating a svg file for a class for which the SealedGraph
211
# taglet has generated a dot file. The dot file has a special name which
212
# encodes the module and class the graph belongs to.
213
#
214
# param 1: SetupJavadocGeneration namespace ($1)
215
# param 2: dot file name
216
#
217
define setup_sealed_graph_dot_to_svg
218
  $1_$2_DOT_SRC :=  $$($1_SEALED_GRAPHS_DIR)/$2.dot
219
  $1_$2_TARGET_CLASS := $$(word 2, $$(subst _, , $2))
220
  $1_$2_SLASHED_NAME := $$(subst .,/, $$($1_$2_TARGET_CLASS))
221
  $1_$2_TARGET_MODULE := $$(word 1, $$(subst _, , $2))
222
  $1_$2_TARGET_PATH := $$($1_TARGET_DIR)/$$($1_$2_TARGET_MODULE)/$$(dir $$($1_$2_SLASHED_NAME))
223
  $1_$2_TARGET_NAME := $$(notdir $$($1_$2_SLASHED_NAME))
224
  $1_$2_SVG_TARGET := $$($1_$2_TARGET_PATH)/$$($1_$2_TARGET_NAME)-sealed-graph.svg
225
  $$(call MakeDir, $$($1_$2_TARGET_PATH))
226

227
    # For each class needing a graph, create a svg file from the dot file
228
    # generated by the SealedGraph taglet and store it in the target dir.
229
    $$(eval $$(call SetupExecute, sealed_graphs_svg_$1_$2, \
230
        INFO := Running dot for sealed graphs for $$($1_$2_TARGET_MODULE)/$$($1_$2_TARGET_CLASS), \
231
        DEPS := $$($1_$2_DOT_SRC), \
232
        OUTPUT_FILE := $$($1_$2_SVG_TARGET), \
233
        SUPPORT_DIR := $$($1_SEALED_GRAPHS_DIR), \
234
        COMMAND := $$(DOT) -Tsvg -o $$($1_$2_SVG_TARGET) $$($1_$2_DOT_SRC), \
235
    ))
236

237
  $1_GRAPHS_TARGETS += $$($1_$2_SVG_TARGET)
238
endef
239

240
# Helper function to create the overview.html file to use with the -overview
241
# javadoc option.
242
# Returns the filename as $1_OVERVIEW.
243
#
244
# param 1: SetupJavadocGeneration namespace ($1)
245
define create_overview_file
246
  $1_OVERVIEW_TEXT := \
247
      <!DOCTYPE html> \
248
      <html><head></head><body> \
249
      #
250
  ifneq ($$($1_GROUPS),)
251
    $1_OVERVIEW_TEXT += \
252
      <p>This document is divided into \
253
      $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
254
      <blockquote><dl> \
255
      #
256
    $1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
257
        <dt style="margin-top: 8px;">$$($$g_GROUP_NAME)</dt> \
258
        <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dd> \
259
    )
260
    $1_OVERVIEW_TEXT += \
261
        </dl></blockquote> \
262
        #
263
  endif
264
  $1_OVERVIEW_TEXT += \
265
      </body></html> \
266
      #
267

268
  $1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
269

270
  $1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
271
      $$($1_OVERVIEW).vardeps)
272

273
  $$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
274
	$$(call LogInfo, Creating overview.html for $1)
275
	$$(call MakeDir, $$(@D))
276
	$$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)'
277
endef
278

279
################################################################################
280
# Setup make rules to create an API documentation collection, using javadoc and
281
# other tools if needed.
282
#
283
# Parameter 1 is the name of the rule. This name is used as variable prefix.
284
# Targets generated are returned as $1_JAVADOC_TARGETS and
285
# $1_GRAPHS_TARGETS. Note that the index.html file will work as a "touch
286
# file" for all the magnitude of files that are generated by javadoc.
287
#
288
# Remaining parameters are named arguments. These include:
289
#   MODULES - Modules to generate javadoc for
290
#   GROUPS - Name of the groups to divide the modules into, if any
291
#   SHORT_NAME - The short name of this documentation collection
292
#   LONG_NAME - The long name of this documentation collection
293
#   TARGET_DIR - Where to store the output
294
#   OTHER_VERSIONS - URL for other page listing versions
295
#
296
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
297
define SetupApiDocsGenerationBody
298

299
  # Figure out all modules, both specified and transitive indirect exports, that
300
  # will be processed by javadoc.
301
  $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
302
  $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
303

304
  $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \
305
	-Djspec.version=$$(VERSION_SPECIFICATION)
306

307
  ifeq ($$(ENABLE_FULL_DOCS), true)
308
    $1_SEALED_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-sealed-graphs
309

310
    # Tell the ModuleGraph and SealedGraph taglets to generate html links to
311
    # soon-to-be-created svg files with module/sealed graphs.
312
    $1_JAVA_ARGS += -DenableModuleGraph=true -DsealedDotOutputDir=$$($1_SEALED_GRAPHS_DIR)
313
    $$(call MakeDir, $$($1_SEALED_GRAPHS_DIR))
314
  endif
315

316
  # Start with basic options and tags
317
  ifeq ($$($1_OPTIONS), )
318
    $1_OPTIONS := $$(JAVADOC_OPTIONS)
319
  endif
320
  ifeq ($$($1_TAGS), )
321
    $1_TAGS := $$(JAVADOC_TAGS)
322
  endif
323
  $1_OPTIONS += $$($1_TAGS)
324

325
  $1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
326
  $1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
327

328
  # Create a string like "-Xdoclint:all,-syntax,-html,..."
329
  $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
330
      $$(JAVADOC_DISABLED_DOCLINT_WARNINGS)))
331
  # Ignore the doclint warnings in certain packages
332
  $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$(addprefix -, \
333
      $$(JAVADOC_DISABLED_DOCLINT_PACKAGES)))
334
  $1_OPTIONS += $$(JAVA_WARNINGS_ARE_ERRORS)
335

336
  $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API \
337
      Specification
338
  $1_WINDOW_TITLE := $$(subst &amp;,&,$$($1_SHORT_NAME))$$(DRAFT_MARKER_TITLE)
339
  $1_HEADER_TITLE := <div><strong>$$($1_SHORT_NAME)</strong> \
340
      $$(DRAFT_MARKER_STR)</div>
341
  ifneq ($$($1_OTHER_VERSIONS), )
342
      $1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, <a href="$$($1_OTHER_VERSIONS)">Other versions.</a>)
343
  else
344
      $1_JAVADOC_BOTTOM := $$(call JAVADOC_BOTTOM, )
345
  endif
346

347
  $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
348
  $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
349
  $1_OPTIONS += -header '$$($1_HEADER_TITLE)'
350
  $1_OPTIONS += -bottom '$$($1_JAVADOC_BOTTOM)'
351
  ifeq ($$(IS_DRAFT), true)
352
    $1_OPTIONS += -top '$$(JAVADOC_TOP)'
353
  endif
354

355
  # Do not store debug level options in VARDEPS.
356
  ifneq ($$(LOG_LEVEL), trace)
357
    $1_LOG_OPTION += -quiet
358
  else
359
    $1_LOG_OPTION += -verbose
360
  endif
361

362
  # Generate the overview.html file. This will return the filename in
363
  # $1_OVERVIEW.
364
  $$(eval $$(call create_overview_file,$1))
365
  $1_OPTIONS += -overview $$($1_OVERVIEW)
366

367
  # Add summary pages for new/deprecated APIs in recent releases
368
  $1_OPTIONS += --since $(call CommaList, \
369
      $(filter-out $(VERSION_DOCS_API_SINCE), \
370
          $(call sequence, $(VERSION_DOCS_API_SINCE), $(VERSION_FEATURE))))
371
  $1_OPTIONS += --since-label "New API since JDK $(VERSION_DOCS_API_SINCE)"
372

373
  $$(foreach g, $$($1_GROUPS), \
374
    $$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
375
  )
376

377
  ifeq ($$($1_JAVADOC_CMD), )
378
    $1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
379
        $$(NEW_JAVADOC)
380
  else
381
    $1_OPTIONS += $$(addprefix -J, $$($1_JAVA_ARGS))
382
  endif
383

384
  $1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
385
      $$($1_ALL_MODULES) $$($1_JAVADOC_CMD)
386
  $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
387
      $$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
388

389
  # Get a list of all files in all the source dirs for all included modules
390
  $1_SOURCE_DEPS := $$(call FindFiles, $$(wildcard $$(foreach module, \
391
      $$($1_ALL_MODULES), $$(call FindModuleSrcDirs, $$(module)))))
392

393
  $$(eval $$(call SetupExecute, javadoc_$1, \
394
      WARN := Generating $1 javadoc for $$(words $$($1_ALL_MODULES)) modules, \
395
      INFO := Javadoc modules: $$($1_ALL_MODULES), \
396
      DEPS := $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) $$($1_SOURCE_DEPS) \
397
          $$($1_OVERVIEW), \
398
      OUTPUT_DIR := $$($1_TARGET_DIR), \
399
      SUPPORT_DIR := $$(SUPPORT_OUTPUTDIR)/docs, \
400
      COMMAND := $$($1_JAVADOC_CMD) -d $$($1_TARGET_DIR) $$($1_OPTIONS) \
401
          $$($1_LOG_OPTION), \
402
  ))
403

404
  $1_JAVADOC_TARGETS := $$(javadoc_$1_TARGET)
405

406
  ifeq ($$(ENABLE_FULL_DOCS), true)
407
    # We have asked ModuleGraph to generate links to svg files. Now we must
408
    # produce the svg files.
409

410
    # Locate which modules has the @moduleGraph tag in their module-info.java
411
    $1_MODULES_NEEDING_GRAPH := $$(strip $$(foreach m, $$($1_ALL_MODULES), \
412
      $$(if $$(shell $$(GREP) -e @moduleGraph \
413
          $$(wildcard $$(addsuffix /module-info.java, \
414
          $$(call FindModuleSrcDirs, $$m)))), \
415
        $$m) \
416
    ))
417

418
    # First we run the GenGraph tool. It will query the module structure of the
419
    # running JVM and output .dot files for all existing modules.
420
    MODULE_GRAPHS_PROPS := \
421
        $$(TOPDIR)/make/jdk/src/classes/build/tools/jigsaw/javadoc-graphs.properties
422

423
    $1_MODULE_GRAPHS_DIR := $$(SUPPORT_OUTPUTDIR)/docs/$1-module-graphs
424

425
    $$(eval $$(call SetupExecute, module_graphs_dot_$1, \
426
        INFO := Generating module graphs for $1 documentation, \
427
        DEPS := $$(BUILD_JIGSAW_TOOLS) $$(MODULE_GRAPHS_PROPS), \
428
        OUTPUT_DIR := $$($1_MODULE_GRAPHS_DIR), \
429
        COMMAND := $$(TOOL_GENGRAPHS) --spec --output $$($1_MODULE_GRAPHS_DIR) \
430
            --dot-attributes $$(MODULE_GRAPHS_PROPS), \
431
    ))
432

433
    # For each module needing a graph, create a svg file from the dot file
434
    # generated by the GenGraphs tool and store it in the target dir.
435
    # They will depend on module_graphs_dot_$1_TARGET, and will be added to
436
    # $1_GRAPHS_TARGETS.
437
    $$(foreach m, $$($1_MODULES_NEEDING_GRAPH), \
438
      $$(eval $$(call setup_module_graph_dot_to_svg,$1,$$m)) \
439
    )
440

441
    # We have asked SealedGraph to generate dot files and links to svg files.
442
    # Now we must produce the svg files from the dot files.
443

444
    # Get a list of classes for which SealedGraph has generated dot files
445
    $1_SEALED_CLASSES := $$(patsubst %.dot,%,$$(patsubst \
446
        $$($1_SEALED_GRAPHS_DIR)/%,%, \
447
        $$(wildcard $$($1_SEALED_GRAPHS_DIR)/*.dot)))
448

449
    # For each class needing a graph, create a svg file from the dot file
450
    # generated by the SealedGraph taglet and store it in the target dir.
451
    # They will will be added to $1_GRAPHS_TARGETS.
452
    $$(foreach c, $$($1_SEALED_CLASSES), \
453
      $$(eval $$(call setup_sealed_graph_dot_to_svg,$1,$$c)) \
454
    )
455
  endif
456
endef
457

458
################################################################################
459
# Setup generation of the JDK API documentation (javadoc + graphs)
460

461
# Define the groups of the JDK API documentation
462
JavaSE_GROUP_NAME := Java SE
463
JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se \
464
    $(call FindTransitiveIndirectDepsForModules, java.se)))
465
JavaSE_GROUP_DESCRIPTION := \
466
    The Java Platform, Standard Edition (Java SE) APIs define the core Java \
467
    platform for general-purpose computing. These APIs are in modules whose \
468
    names start with {@code java}. \
469
    #
470
JDK_GROUPS += JavaSE
471

472
JDK_GROUP_NAME := JDK
473
JDK_GROUP_MODULES := jdk.*
474
JDK_GROUP_DESCRIPTION := \
475
    The Java Development Kit (JDK) APIs are specific to the JDK and will not \
476
    necessarily be available in all implementations of the Java SE Platform. \
477
    These APIs are in modules whose names start with {@code jdk}. \
478
    #
479
JDK_GROUPS += JDK
480

481
# If we are importing JavaFX, we need a JavaFX group. In an ideal world, this
482
# would have been abstracted away to a more proper generic handling of imported
483
# modules.
484
ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
485
  JavaFX_GROUP_NAME := JavaFX
486
  JavaFX_GROUP_MODULES := javafx.*
487
  JavaFX_GROUP_DESCRIPTION := \
488
      The JavaFX APIs define a set of user-interface controls, graphics, \
489
      media, and web packages for developing rich client applications. These \
490
      APIs are in modules whose names start with {@code javafx}. \
491
      #
492
  JDK_GROUPS += JavaFX
493
endif
494

495
# All modules to have docs generated by docs-jdk-api target
496
JDK_MODULES := $(sort $(filter-out $(MODULES_FILTER), $(DOCS_MODULES)))
497

498
$(eval $(call SetupApiDocsGeneration, JDK_API, \
499
    MODULES := $(JDK_MODULES), \
500
    GROUPS := $(JDK_GROUPS), \
501
    SHORT_NAME := $(JDK_SHORT_NAME), \
502
    LONG_NAME := $(JDK_LONG_NAME), \
503
    TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
504
    OTHER_VERSIONS := $(OTHER_JDK_VERSIONS_URL), \
505
))
506

507
# Targets generated are returned in JDK_API_JAVADOC_TARGETS and
508
# JDK_API_GRAPHS_TARGETS.
509

510
################################################################################
511
# Setup generation of the Java SE API documentation (javadoc + graphs)
512

513
# The Java SE module scope is just java.se and its transitive indirect
514
# exports.
515
JAVASE_MODULES := java.se
516

517
$(eval $(call SetupApiDocsGeneration, JAVASE_API, \
518
    MODULES := $(JAVASE_MODULES), \
519
    SHORT_NAME := $(JAVASE_SHORT_NAME), \
520
    LONG_NAME := $(JAVASE_LONG_NAME), \
521
    TARGET_DIR := $(DOCS_JAVASE_IMAGE_DIR)/api, \
522
))
523

524
# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
525
# JAVASE_API_GRAPHS_TARGETS.
526

527
################################################################################
528
# Setup generation of the reference Java SE API documentation (javadoc + graphs)
529

530
# The reference javadoc is just the same as javase, but using the BootJDK javadoc
531
# and a stable set of javadoc options.  Typically it is used for generating
532
# diffs between the reference javadoc and a javadoc bundle of a specific build
533
# generated in the same way.
534

535
$(eval $(call SetupApiDocsGeneration, REFERENCE_API, \
536
    MODULES := $(JAVASE_MODULES), \
537
    SHORT_NAME := $(JAVASE_SHORT_NAME), \
538
    LONG_NAME := $(JAVASE_LONG_NAME), \
539
    TARGET_DIR := $(DOCS_REFERENCE_IMAGE_DIR)/api, \
540
    JAVADOC_CMD := $(DOCS_REFERENCE_JAVADOC), \
541
    OPTIONS := $(REFERENCE_OPTIONS), \
542
    TAGS := $(REFERENCE_TAGS), \
543
))
544

545
# Targets generated are returned in REFERENCE_API_JAVADOC_TARGETS and
546
# REFERENCE_API_GRAPHS_TARGETS.
547

548
################################################################################
549

550
# Use this variable to control which spec files are included in the output.
551
# Format: space-delimited list of names, including at most one '%' as a
552
# wildcard. Spec source files match if their filename or any enclosing folder
553
# name matches one of the items in SPEC_FILTER.
554
SPEC_FILTER := %
555

556
ApplySpecFilter = \
557
    $(strip $(foreach file, $(1), \
558
        $(eval searchkeys := $(subst /, ,$(subst $(WORKSPACE_ROOT),,$(file)))) \
559
        $(if $(filter $(SPEC_FILTER), $(searchkeys)), \
560
            $(file) \
561
        ) \
562
    ))
563

564
# Copy the global resources, including the top-level redirect index.html
565
GLOBAL_SPECS_RESOURCES_DIR := $(TOPDIR)/make/data/docs-resources
566
$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
567
    SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
568
    FILES := $(call ApplySpecFilter, $(call FindFiles, $(GLOBAL_SPECS_RESOURCES_DIR))), \
569
    DEST := $(DOCS_OUTPUTDIR), \
570
))
571
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
572

573
# Copy the legal notices distributed with the docs bundle
574
$(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
575
    SRC := $(TOPDIR)/src/jdk.javadoc/share/legal, \
576
    FILES := $(call ApplySpecFilter, $(wildcard $(TOPDIR)/src/jdk.javadoc/share/legal/*)), \
577
    DEST := $(DOCS_OUTPUTDIR)/legal, \
578
))
579
JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
580

581
################################################################################
582
# Copy JDK specs files
583

584
# For all non html/md files in $module/share/specs directories, copy them
585
# unmodified
586

587
ALL_MODULES := $(call FindAllModules)
588
COPY_SPEC_FILTER := %.gif %.jpg %.mib %.css
589

590
$(foreach m, $(ALL_MODULES), \
591
  $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
592
  $(foreach d, $(SPECS_$m), \
593
    $(if $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
594
      $(eval $(call SetupCopyFiles, COPY_$m, \
595
          SRC := $d, \
596
          FILES := $(call ApplySpecFilter, $(filter $(COPY_SPEC_FILTER), $(call FindFiles, $d))), \
597
          DEST := $(DOCS_OUTPUTDIR)/specs/, \
598
      )) \
599
      $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \
600
    ) \
601
  ) \
602
)
603

604
# Create copyright footer variables. We need different variables for different
605
# relative paths to the copyright.html file. The number 0-2 below represent how
606
# many extra directory levels down below the specs dir the specs html file is
607
# located.
608
SPECS_BOTTOM = <footer class="legal-footer"><hr/>$(COPYRIGHT_BOTTOM)</footer>
609
# The legal dir is one ../ below the specs dir, so start with one ../.
610
specs_bottom_rel_path := ../
611
$(foreach n, 0 1 2, \
612
  $(eval SPECS_BOTTOM_$n := $(call SPECS_BOTTOM,$(specs_bottom_rel_path))) \
613
  $(eval specs_bottom_rel_path := $(specs_bottom_rel_path)../) \
614
)
615

616
SPECS_TOP := $(if $(filter true, $(IS_DRAFT)), <header class="draft-header" role="banner">$(DRAFT_TEXT)</header>)
617

618
# For all html files in $module/share/specs directories, copy and add the
619
# copyright footer.
620

621
$(foreach m, $(ALL_MODULES), \
622
  $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
623
  $(foreach d, $(SPECS_$m), \
624
    $(foreach f, $(call ApplySpecFilter, $(filter %.html, $(call FindFiles, $d))), \
625
      $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
626
      $(eval $m_$f_NAME := PROCESS_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
627
      $(eval $(call SetupTextFileProcessing, $($m_$f_NAME), \
628
          SOURCE_FILES := $f, \
629
          SOURCE_BASE_DIR := $d, \
630
          OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
631
          REPLACEMENTS := \
632
              <body> => <body>$(SPECS_TOP) ; \
633
              </body> => $(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))</body>, \
634
      )) \
635
      $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
636
    ) \
637
  ) \
638
)
639

640
ifeq ($(ENABLE_PANDOC), true)
641
  # For all markdown files in $module/share/specs directories, convert them to
642
  # html, if we have pandoc (otherwise we'll just skip this).
643

644
  GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
645
  # Unset the following to suppress the link to the tool guides
646
  NAV_LINK_GUIDES := --nav-link-guides
647
  HEADER_RIGHT_SIDE_INFO := <strong>$(subst &amp;,&,$(JDK_SHORT_NAME))</strong>$(DRAFT_MARKER_STR)
648

649
  $(foreach m, $(ALL_MODULES), \
650
    $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
651
    $(foreach d, $(SPECS_$m), \
652
      $(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
653
        $(eval $m_$f_NOF_SUBDIRS := $(words $(subst /, $(SPACE), $(subst $d, , $(dir $f))))) \
654
        $(eval $m_$f_NAME := SPECS_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
655
        $(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
656
            SRC := $d, \
657
            FILES := $f, \
658
            DEST := $(DOCS_OUTPUTDIR)/specs/, \
659
            CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
660
            OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_$($m_$f_NOF_SUBDIRS))', \
661
            REPLACEMENTS := \
662
		@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
663
		@@VERSION_STRING@@ => $(VERSION_STRING), \
664
            POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
665
                --nav-subdirs $($m_$f_NOF_SUBDIRS) $(NAV_LINK_GUIDES), \
666
        )) \
667
        $(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
668
      ) \
669
    ) \
670
  )
671

672
  # For all markdown files in $module/share/man directories, convert them to
673
  # html.
674

675
  # Create dynamic man pages from markdown using pandoc. We need
676
  # PANDOC_HTML_MANPAGE_FILTER, a wrapper around
677
  # PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT. This is created by buildtools-jdk.
678

679
  # We should also depend on the source code for the filter
680
  PANDOC_HTML_MANPAGE_FILTER_SOURCE := $(call FindFiles, \
681
      $(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter)
682

683
  $(foreach m, $(ALL_MODULES), \
684
    $(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \
685
          $(call FindModuleManDirs, $m))))) \
686
    $(if $(MAN_$m), \
687
      $(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \
688
        FILES := $(MAN_$m), \
689
        DEST := $(DOCS_OUTPUTDIR)/specs/man, \
690
        FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
691
        CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
692
        REPLACEMENTS := \
693
            @@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
694
            @@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
695
            @@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
696
        OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
697
        POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
698
            --nav-subdirs 1 --nav-link-guides, \
699
        EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
700
            $(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \
701
      )) \
702
      $(eval JDK_SPECS_TARGETS += $(MAN_TO_HTML_$m)) \
703
    ) \
704
  )
705

706
  # The html generated from markdown also needs the css file
707
  JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
708
endif
709

710
# Special treatment for generated documentation
711

712
SPEC_HEADER_BLOCK := \
713
<header id="title-block-header"> \
714
    <div class="navbar"> \
715
        <div>$(HEADER_RIGHT_SIDE_INFO)</div> \
716
        <nav><ul><li><a href="PATH_TO_SPECS/../api/index.html">API</a> \
717
        <li><a href="PATH_TO_SPECS/index.html">OTHER SPECIFICATIONS</a> \
718
        <li><a href="PATH_TO_SPECS/man/index.html">TOOL GUIDES</a></ul></nav> \
719
    </div> \
720
</header>
721

722
JDWP_PROTOCOL := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
723
ifneq ($(call ApplySpecFilter, $(JDWP_PROTOCOL)), )
724
  JDWP_HEADER_BLOCK := $(subst PATH_TO_SPECS,..,$(SPEC_HEADER_BLOCK))
725
  $(eval $(call SetupTextFileProcessing, PROCESS_JDWP_PROTOCOL, \
726
      SOURCE_FILES := $(JDWP_PROTOCOL), \
727
      OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/jdwp, \
728
      REPLACEMENTS := \
729
          <style> => <link rel="stylesheet" href="../../resources/jdk-default.css"/><style> ; \
730
          <body> => <body>$(SPECS_TOP)$(JDWP_HEADER_BLOCK) ; \
731
          </body> => $(SPECS_BOTTOM_1)</body>, \
732
  ))
733
  JDK_SPECS_TARGETS += $(PROCESS_JDWP_PROTOCOL)
734
endif
735

736
# Get jvmti.html from the main jvm variant (all variants' jvmti.html are identical).
737
JVMTI_HTML ?= $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT_MAIN)/gensrc/jvmtifiles/jvmti.html
738
ifneq ($(call ApplySpecFilter, $(JVMTI_HTML)), )
739
  JVMTI_HEADER_BLOCK := $(subst PATH_TO_SPECS,.,$(SPEC_HEADER_BLOCK))
740
  $(eval $(call SetupTextFileProcessing, PROCESS_JVMTI_HTML, \
741
      SOURCE_FILES := $(JVMTI_HTML), \
742
      OUTPUT_DIR := $(DOCS_OUTPUTDIR)/specs/, \
743
      REPLACEMENTS := \
744
          <style> => <link rel="stylesheet" href="../resources/jdk-default.css"/><style> ; \
745
          <body> => <body>$(SPECS_TOP)$(JVMTI_HEADER_BLOCK) ; \
746
          </body> => $(SPECS_BOTTOM_0)</body>, \
747
  ))
748
  JDK_SPECS_TARGETS += $(PROCESS_JVMTI_HTML)
749
endif
750

751
################################################################################
752
# Optional target which bundles all generated javadocs into a zip archive.
753

754
JAVADOC_ZIP_NAME := jdk-$(VERSION_STRING)-docs.zip
755
JAVADOC_ZIP_FILE := $(OUTPUTDIR)/bundles/$(JAVADOC_ZIP_NAME)
756

757
$(eval $(call SetupZipArchive, BUILD_JAVADOC_ZIP, \
758
    SRC := $(DOCS_OUTPUTDIR), \
759
    ZIP := $(JAVADOC_ZIP_FILE), \
760
    EXTRA_DEPS := $(JDK_API_JAVADOC_TARGETS) $(JDK_API_GRAPHS_TARGETS) \
761
        $(JDK_SPECS_TARGETS), \
762
))
763

764
ZIP_TARGETS += $(BUILD_JAVADOC_ZIP)
765

766
################################################################################
767
# Hook to include the corresponding custom file, if present.
768
$(eval $(call IncludeCustomExtension, Docs-post.gmk))
769

770
################################################################################
771
# Bundles all generated specs into a zip archive, skipping javadocs.
772

773
SPECS_ZIP_NAME := jdk-$(VERSION_STRING)-specs.zip
774
SPECS_ZIP_FILE := $(OUTPUTDIR)/bundles/$(SPECS_ZIP_NAME)
775

776
$(eval $(call SetupZipArchive, BUILD_SPECS_ZIP, \
777
    SRC := $(DOCS_OUTPUTDIR), \
778
    ZIP := $(SPECS_ZIP_FILE), \
779
    EXTRA_DEPS := $(JDK_SPECS_TARGETS), \
780
))
781

782
SPECS_ZIP_TARGETS += $(BUILD_SPECS_ZIP)
783

784
################################################################################
785

786
docs-jdk-api-javadoc: $(JDK_API_JAVADOC_TARGETS) $(JDK_API_CUSTOM_TARGETS)
787

788
docs-jdk-api-graphs: $(JDK_API_GRAPHS_TARGETS)
789

790
docs-javase-api-javadoc: $(JAVASE_API_JAVADOC_TARGETS) $(JAVASE_API_CUSTOM_TARGETS)
791

792
docs-javase-api-graphs: $(JAVASE_API_GRAPHS_TARGETS)
793

794
docs-reference-api-javadoc: $(REFERENCE_API_JAVADOC_TARGETS) $(REFERENCE_API_CUSTOM_TARGETS)
795

796
docs-reference-api-graphs: $(REFERENCE_API_GRAPHS_TARGETS)
797

798
docs-jdk-specs: $(JDK_SPECS_TARGETS)
799

800
docs-jdk-index: $(JDK_INDEX_TARGETS)
801

802
docs-zip: $(ZIP_TARGETS)
803

804
docs-specs-zip: $(SPECS_ZIP_TARGETS)
805

806
all: docs-jdk-api-javadoc docs-jdk-api-graphs docs-javase-api-javadoc \
807
    docs-javase-api-graphs docs-reference-api-javadoc \
808
    docs-reference-api-graphs docs-jdk-specs docs-jdk-index docs-zip \
809
    docs-specs-zip
810

811
.PHONY: default all docs-jdk-api-javadoc docs-jdk-api-graphs \
812
    docs-javase-api-javadoc docs-javase-api-graphs \
813
    docs-reference-api-javadoc docs-reference-api-graphs docs-jdk-specs \
814
    docs-jdk-index docs-zip docs-specs-zip
815

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.