浏览代码

HPCC-10074 Generate Eclipse Help and generate zip file
Enable ECLReference xsltproc process but disabling PDF generation
Add --nonet option to speed up xsltproc process
Eclipse Help zip file is generated in EclipseHelp directory

Xiaoming Wang 10 年之前
父节点
当前提交
b98d7b6dd4

+ 41 - 5
cmake_modules/docMacros.cmake

@@ -33,10 +33,11 @@ MACRO(RUN_XSLTPROC _xsl _file _out _in_dir _out_dir )
 	ADD_CUSTOM_COMMAND(
 		COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${_out}.cmake
 		OUTPUT ${_out_dir}/${_out}
-		DEPENDS docbook-expand ${_xsl} ${_in_dir}/${_file} ${_xslt_target} ${FILES} ${DOC_IMAGE_LIST}
+		DEPENDS docbook-expand ${_xsl} ${_in_dir}/${_file} ${_xslt_target} ${FILES} ${DOC_IMAGE_LIST} ${XSLTPROC_DEPENDENCIES}
 		)
 	set_source_files_properties(${_out_dir}/${_out} PROPERTIES GENERATED TRUE)
 	ADD_CUSTOM_TARGET(${_out} DEPENDS ${_out_dir}/${_out} )
+        SET(XSLTPROC_DEPENDENCIES)
 ENDMACRO(RUN_XSLTPROC)
 
 MACRO(RUN_FOP _file _out)
@@ -73,6 +74,7 @@ MACRO(CLEAN_REL_SET _file _version_dir _doc_dir _in_dir _out_dir)
 ENDMACRO(CLEAN_REL_SET)
 
 MACRO(DOCBOOK_TO_PDF _xsl _file _name)
+
 	PARSE_ARGUMENTS(_DB "" "" ${ARGN})
 	LIST(LENGTH _DB_DEFAULT_ARGS length)
 	IF(MAKE_DOCS)
@@ -83,14 +85,48 @@ MACRO(DOCBOOK_TO_PDF _xsl _file _name)
 		CLEAN_REL_BOOK(${_file} ${VERSION_DIR} ${DOC_IMAGES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
 		set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file_base}.xsl  PROPERTIES GENERATED TRUE)
 		RUN_XSLTPROC(${_xsl} ${_file} ${_fo_file} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} "clean_${_file}" ${_DB_DEFAULT_ARGS})
-		RUN_FOP(${_fo_file} ${_pdf_file})
-		set_source_files_properties(${_pdf_file} PROPERTIES GENERATED TRUE)
-		MESSAGE("-- Adding document: ${_pdf_file} -  target: ${_docs_target}")
-		ADD_CUSTOM_TARGET(${_docs_target} ALL DEPENDS ${_pdf_file})
+                IF (DISABLE_PDF)
+                   SET(DISABLE_PDF)
+                   SET(_target_file ${_fo_file})
+                ELSE()
+		   RUN_FOP(${_fo_file} ${_pdf_file})
+		   set_source_files_properties(${_pdf_file} PROPERTIES GENERATED TRUE)
+                   SET(_target_file ${_pdf_file})
+                ENDIF()
+		MESSAGE("-- Adding document: ${_target_file} -  target: ${_docs_target}")
+		ADD_CUSTOM_TARGET(${_docs_target} ALL DEPENDS ${_target_file} )
 		set_property(GLOBAL APPEND PROPERTY DOC_TARGETS "${_docs_target}")
 	ENDIF(MAKE_DOCS)
 ENDMACRO(DOCBOOK_TO_PDF targetname_suffix srcfile outfile targetdir deps_list)
 
+MACRO(DOCBOOK_TO_HTML _xsl_file _xml_file _out_dir)
+    set(_html_zip "doc_generate_html_zip")
+    set(_html_files "_generate_html_files")
+
+    STRING(REGEX REPLACE "(.+)/([^/]+)$" "\\1" _out_dir1 "${_out_dir}")
+    STRING(REGEX REPLACE ".+/([^/]+)$" "\\1" _out_dir2 "${_out_dir}")
+    SET(_zip_file ${_out_dir2}-${version}-${stagever}.zip)
+    ADD_CUSTOM_COMMAND(
+        COMMAND mkdir -p ${_out_dir}
+        COMMAND cp ${HPCC_SOURCE_DIR}/docs/common/eclipsehelp.css ${_out_dir}/
+        OUTPUT ${_out_dir}/eclipsehelp.css
+        )
+    ADD_CUSTOM_TARGET(${_html_files}
+        COMMAND xsltproc --nonet --xinclude ${_xsl_file} ${_xml_file}
+        WORKING_DIRECTORY ${_out_dir}
+        DEPENDS docbook-expand ${_out_dir}/eclipsehelp.css ${HELP_DEPENDENCIES}
+        SOURCES ${_xsl_file}
+        )
+    SET(HELP_DEPENDENCIES)
+    ADD_CUSTOM_COMMAND(
+        COMMAND zip -r ${_zip_file} ${_out_dir2}
+        WORKING_DIRECTORY ${_out_dir1}
+        OUTPUT ${_zip_file}
+        )
+    ADD_CUSTOM_TARGET(${_html_zip} ALL DEPENDS ${_html_files} ${_zip_file})
+    set_property(GLOBAL APPEND PROPERTY DOC_TARGETS ${_html_zip})
+ENDMACRO(DOCBOOK_TO_HTML)
+
 MACRO(FILE_LIST_GENERATOR outxml filename linkname description)
 	set(xmlout "	<file>\n")
 	set(xmlout "${xmlout}		<name>${linkname}</name>\n")

+ 1 - 0
docs/BuildTools/CMakeLists.txt

@@ -2,3 +2,4 @@ project(xsl-config)
 
 configure_file(fo.xsl.in ${CMAKE_CURRENT_BINARY_DIR}/fo.xsl)
 configure_file(catalog.xml.in ${CMAKE_CURRENT_BINARY_DIR}/catalog.xml)
+configure_file(EclipseHelp.xsl.in ${CMAKE_CURRENT_BINARY_DIR}/EclipseHelp.xsl)

+ 3 - 0
docs/BuildTools/EclipseHelp.xsl

@@ -19,11 +19,14 @@
 <xsl:import href="../docbook-xsl/eclipse/profile-eclipse.xsl"/>
 <xsl:param name="img.src.path">../</xsl:param>
 <xsl:param name="html.stylesheet">eclipsehelp.css</xsl:param>
+<xsl:param name="use.id.as.filename" select="1" />
 <xsl:param name="chapter.autolabel" select="0" />
 <xsl:param name="eclipse.plugin.id" select="ECLR.Eclipse.plugin" />
 <xsl:param name="eclipse.plugin.name" select="ECLR.for.Eclipse" />
 <xsl:param name="eclipse.plugin.provider" select="HPCC Systems" />
 <xsl:param name="section.autolabel" select="0" />
+<xsl:param name="chunk.section.depth" select="1" />
+<xsl:param name="toc.section.depth">1</xsl:param>
 <xsl:param name="variablelist.as.table" select="1" />
 <xsl:param name="generate.toc">book toc</xsl:param>
 

+ 33 - 0
docs/BuildTools/EclipseHelp.xsl.in

@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+                xmlns:exsl="http://exslt.org/common"
+                xmlns:set="http://exslt.org/sets"
+		version="1.0"
+                exclude-result-prefixes="doc exsl set">
+
+<!-- ********************************************************************
+     $: EclipseHelp.xsl 1676 2013-09-23 16:20:PanaG :$
+     ********************************************************************
+
+     This file is used by EclipseHelp Intended to generate Eclispe Help.
+     It is based on the XSL DocBook Stylesheet distribution from Norman Walsh.
+     Modified and customized for HPCC Systems by GPanagiotatos - 2013
+
+     ******************************************************************** -->
+<!-- Import docbook XSL and other resources from Jenk-Build locale -->
+<xsl:import href="${DOCBOOK_XSL}/eclipse/profile-eclipse.xsl"/>
+<xsl:param name="img.src.path">${DOC_IMAGES}</xsl:param>
+<xsl:param name="html.stylesheet">eclipsehelp.css</xsl:param>
+<xsl:param name="use.id.as.filename" select="1" />
+<xsl:param name="chapter.autolabel" select="0" />
+<xsl:param name="eclipse.plugin.id" select="ECLR.Eclipse.plugin" />
+<xsl:param name="eclipse.plugin.name" select="ECLR.for.Eclipse" />
+<xsl:param name="eclipse.plugin.provider" select="HPCC_Systems" />
+<xsl:param name="section.autolabel" select="0" />
+<xsl:param name="variablelist.as.table" select="1" />
+<xsl:param name="chunk.section.depth" select="1" />
+<xsl:param name="toc.section.depth">1</xsl:param>
+<xsl:param name="generate.toc">book toc</xsl:param>
+
+</xsl:stylesheet>

+ 4 - 1
docs/CMakeLists.txt

@@ -29,6 +29,8 @@ set (XML_CATALOG ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/catalog.xml)
 set (DOC_VERSION "${HPCC_MAJOR}.${HPCC_MINOR}.${HPCC_POINT}")
 set (FO_XSL ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/fo.xsl)
 set (VERSION_DIR ${CMAKE_CURRENT_BINARY_DIR}/)
+set (ECLIPSE_HTML_XSL ${CMAKE_CURRENT_BINARY_DIR}/BuildTools/EclipseHelp.xsl)
+set (ECL_REFERENCE_XML ${CMAKE_CURRENT_BINARY_DIR}/ECLReference/ECLReference.xml)
 
 
 if ( "${HPCC_MATURITY}" STREQUAL "release" )
@@ -49,8 +51,9 @@ add_subdirectory(resources)
 # Doc dirs to include.
 add_subdirectory(ECLLanguageReference)
 add_subdirectory(ECLProgrammersGuide)
-#add_subdirectory(ECLReference)
 add_subdirectory(ECLStandardLibraryReference)
+add_subdirectory(ECLReference)
+add_subdirectory(EclipseHelp)
 add_subdirectory(HPCCClientTools)
 add_subdirectory(HPCCCertify)
 add_subdirectory(HPCCDataHandling)

+ 12 - 1
docs/ECLReference/CMakeLists.txt

@@ -14,5 +14,16 @@
 #    limitations under the License.
 ################################################################################
 
-DOCBOOK_TO_PDF( ${FO_XSL} ECLReference.xml "ECLReference")
+GET_PROPERTY(Current_Targets GLOBAL PROPERTY DOC_TARGETS)
 
+SET(XSLTPROC_DEPENDENCIES)
+FOREACH(T ${Current_Targets})
+   MESSAGE("+++ ${T}")
+   IF("${T}" MATCHES ".*ECLLanguageReference.*" OR
+      "${T}" MATCHES ".*ECLProgrammersGuide.*" OR
+      "${T}" MATCHES ".*ECLStandardLibraryReference.*")
+      LIST(APPEND XSLTPROC_DEPENDENCIES  ${T})
+   ENDIF()
+ENDFOREACH()
+SET(DISABLE_PDF ON)
+DOCBOOK_TO_PDF( ${FO_XSL} ECLReference.xml "ECLReference")

+ 26 - 0
docs/EclipseHelp/CMakeLists.txt

@@ -0,0 +1,26 @@
+################################################################################
+#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+################################################################################
+set (ECLIPSE_HTML_DIR ${CMAKE_CURRENT_BINARY_DIR}/eclipse_html)
+
+GET_PROPERTY(Current_Targets GLOBAL PROPERTY DOC_TARGETS)
+SET(HELP_DEPENDENCIES)
+FOREACH(T ${Current_Targets})
+   IF("${T}" MATCHES ".*ECLReference.*")
+      LIST(APPEND HELP_DEPENDENCIES  ${T})
+   ENDIF()
+ENDFOREACH()
+
+DOCBOOK_TO_HTML(${ECLIPSE_HTML_XSL} ${ECL_REFERENCE_XML} ${ECLIPSE_HTML_DIR})