Skip to main content
summaryrefslogblamecommitdiffstats
blob: 9fcad8cbffde4f5ba8bd17ffcbb42e1598072d0b (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                       

                                                                                        


                                                                   

                                                    

                                               
                                                      






















                                                                         
                                    
















                                                             
                                                                















































































                                                                                                      
                                                           
                                                           
                                                                       
                                                               
                                                                    
                                                                    
                                                                  


                                         
                                                                                     

             




                                                                                                  

                                                                             
                                                  



                                                  
                                                         
                                                                                   
                                                      
                                                     
                                                    
                                                  


              
                                                              
                                                                                   

                                                           
                                                    
                                                  


              
                                                           
                                                                                         
                                                        
                                                       


                                                  
    
                                                              
                                                                                   
                                                           
                                                    

                                                    


              






                                                                                        

                                           
                                                       
                    













                                                           

                                                             

                                                                              


                                               


                                            
                                                                    











                                                                                      
                                                                                                  



                                                    

                                           


                      
                                                                                                  
        


                                                                  



                                               
                                  


                                              
                                       

             
                                                                                                              

                                 












                                                    




                                                                

                                          




                                                        
                                                                                                      












                                                    




                                                                




                                                        

             
                                                                 





















                                                                





















                                                                               
                               
                                        



                                  
                               
                                                                                                     
                                                               
               

                                       
                                                                              
        





























                                                                                     
                                                                  





                                                                      





                                                       

                                                  

               
                                                     






                                                                     
             





                                                          
          
<!-- 
  Copyright (c) 2014 BREDEX GmbH.
  All rights reserved. This program and the accompanying materials
  are made available under the terms of the Eclipse Public License v1.0
  which accompanies this distribution, and is available at
  http://www.eclipse.org/legal/epl-v10.html
-->

<project name="buildHelp" default="buildDocumentation">
    <property name="client.ua.help.path" value="../org.eclipse.jubula.client.ua.help/"/>
    <property name="html.path" value="content/html/${dir}"/>
    <property name="output" value="onlinehelp"/>
    <property name="build.path" value="${dir}/en/build/${output}"/>
    <property name="manual.name" value="${name}"/>
    <property name="buildRoot" value="${basedir}" />
    
    <macrodef name="xsltproc">
        <attribute name="chunk.section.depth"/>
        <attribute name="generate.section.toc.level"/>
        <sequential>
            <exec executable="xsltproc" failonerror="true">
                <arg value="--xinclude"/>
                <arg value="--stringparam"/>
                    <arg value="base.dir"/>
                    <arg value="${html.path}"/>
                <arg value="--stringparam"/>
                    <arg value="html.stylesheet"/>
                    <arg value="../css/style.css"/>
                <arg value="--stringparam"/>
                    <arg value="docbook.css.source"/>
                    <arg value=""/>
                <arg value="--stringparam"/>
                    <arg value="section.autolabel"/>
                    <arg value="1"/>
                <arg value="--stringparam"/>
                    <arg value="section.label.includes.component.label"/>
                    <arg value="1"/>
                <arg value="--stringparam"/>
                    <arg value="make.clean.html"/>
                    <arg value="1"/>
                <arg value="--stringparam"/>
                    <arg value="use.id.as.filename"/>
                    <arg value="0"/>
                <arg value="--stringparam"/>
                    <arg value="generate.toc"/>
                    <arg value="chapter toc
                                section toc
                                book    toc,title"/>
                <arg value="--stringparam"/>
                    <arg value="formal.title.placement"/>
                    <arg value="figure    after
                                example   after
                                equation  after
                                table     after
                                procedure after"/>
                <arg value="--stringparam"/>
                    <arg value="toc.section.depth"/>
                    <arg value="3"/>
                <arg value="--stringparam"/>
                    <arg value="generate.section.toc.level"/>
                    <arg value="@{generate.section.toc.level}"/>
                <arg value="--stringparam"/>
                    <arg value="collect.xref.targets"/>
                    <arg value="yes"/>
                <arg value="--stringparam"/>
                    <arg value="current.docid"/>
                    <arg value="${manual.name}"/>
                <arg value="--stringparam"/>
                    <arg value="target.database.document"/>
                    <arg value="../../olinkdb.xml"/>
                <arg value="--stringparam"/>
                    <arg value="chunker.output.indent"/>
                    <arg value="yes"/>
                <arg value="--stringparam"/>
                    <arg value="chunk.first.sections"/>
                    <arg value="1"/>
                <arg value="--stringparam"/>
                    <arg value="chunk.section.depth"/>
                    <arg value="@{chunk.section.depth}"/>
                <arg value="../org.eclipse.jubula.documentation.xsl/custom/jubulatemplates.xsl"/>
                <arg value="${dir}/en/docbook/book.xml"/>
                <redirector output="output.log"/>
            </exec>
        </sequential>
    </macrodef>
    
    <macrodef name="xsltprochtml">
        <attribute name="section.autolabel"/>
        <attribute name="section.label.includes.component.label"/>
        <attribute name="generate.toc.book"/>
        <attribute name="chapter.autolabel"/>
        <attribute name="toc.section.depth"/>
        <sequential>
            <exec executable="xsltproc" failonerror="true" output="output.log">
                <arg value="--xinclude"/>
                <arg value="--stringparam"/>
                    <arg value="base.dir"/>
                    <arg value="${html.path}"/>
                <arg value="--stringparam"/>
                    <arg value="html.stylesheet"/>
                    <arg value="../css/style.css"/>
                <arg value="--stringparam"/>
                    <arg value="docbook.css.source"/>
                    <arg value=""/>
                <arg value="--stringparam"/>
                    <arg value="section.autolabel"/>
                    <arg value="@{section.autolabel}"/>
                <arg value="--stringparam"/>
                    <arg value="section.label.includes.component.label"/>
                    <arg value="@{section.label.includes.component.label}"/>
                <arg value="--stringparam"/>
                    <arg value="make.clean.html"/>
                    <arg value="1"/>
                <arg value="--stringparam"/>
                    <arg value="generate.toc"/>
                    <arg value="chapter nop
                                book    @{generate.toc.book}"/>
                <arg value="--stringparam"/>
                    <arg value="chapter.autolabel"/>
                    <arg value="@{chapter.autolabel}"/>
                <arg value="--stringparam"/>
                    <arg value="formal.title.placement"/>
                    <arg value="figure    after
                                example   after
                                equation  after
                                table     after
                                procedure after"/>
                <arg value="--stringparam"/>
                    <arg value="toc.section.depth"/>
                    <arg value="@{toc.section.depth}"/>
                <arg value="--stringparam"/>
                    <arg value="current.docid"/>
                    <arg value="${manual.name}"/>
                <arg value="-o"/>
                    <arg value="${build.path}/index.html"/>
                <arg value="../org.eclipse.jubula.documentation.xsl/custom/jubulatemplates_html.xsl"/>
                <arg value="${dir}/en/docbook/book.xml"/>
            </exec>
        </sequential>
    </macrodef>
    
    <target name="buildDocumentation" depends="validateEnv,
                                               echoEnvInfo,
                                               buildInstallationManual,
                                               buildUserManual,
                                               buildReferenceManual,
                                               buildDeveloperManual,
                                               buildReleaseNotes">
    </target>

    <target name="validateDocumentation">
        <ant antfile="resources/validation/validation.xml" target="validateManuals"/>
    </target>
    
    <target name="echoEnvInfo" if="${notSuited}">
        <echo>WARNING: Can't build / generate documentation - therefore skipping this step!</echo>
    </target>
    
    <target name="buildInstallationManual" unless="${notSuited}">
        <ant antfile="buildScript.xml" target="buildHTML" inheritall="false">
            <property name="name" value="InstallationManual"/>
            <property name="dir" value="install"/>
            <property name="output" value="html"/>
        </ant>
    </target>
    
    <target name="buildUserManual" unless="${notSuited}">
        <ant antfile="buildScript.xml" target="buildOnlineHelp" inheritall="false">
            <property name="name" value="UserManual"/>
            <property name="dir" value="userManual"/>
            <property name="chunk.depth" value="2"/>
            <property name="toc.level" value="1"/>
        </ant>
    </target>
    
    <target name="buildDeveloperManual" unless="${notSuited}">
        <ant antfile="buildScript.xml" target="buildOnlineHelp" inheritall="false">
            <property name="name" value="DeveloperManual"/>
            <property name="dir" value="developerManual"/>
            <property name="chunk.depth" value="2"/>
            <property name="toc.level" value="1"/>
        </ant>
    </target>
    
    <target name="buildReleaseNotes" unless="${notSuited}">
        <ant antfile="buildScript.xml" target="buildReleaseNotesHTML" inheritall="false">
            <property name="name" value="ReleaseNotes"/>
            <property name="dir" value="releasenotes"/>
            <property name="output" value="html"/>
        </ant>
    </target>
    
    <target name="buildReferenceManual" unless="${notSuited}">
        <ant antfile="buildScript.xml" target="buildOnlineHelp" inheritall="false">
            <property name="name" value="ReferenceManual"/>
            <property name="dir" value="reference"/>
            <property name="chunk.depth" value="5"/>
            <property name="toc.level" value="3"/>
        </ant>
    </target>
    
    <target name="checkParam">
        <fail unless="name" message="Please provide a value for the parameter 'name'!"/>
        <fail unless="dir" message="Please provide a value for the parameter 'dir'!"/>
        
        <condition property="standalone">
            <equals arg1="${output}" arg2="html"/>
        </condition>
        
        <condition property="releaseNotes">
            <equals arg1="${dir}" arg2="releasenotes"/>
        </condition>
    </target>
    
    <target name="clean" depends="checkParam">
        <delete dir="${build.path}"/>
        <delete dir="${client.ua.help.path}/${html.path}"/>
        <delete dir="html"/>
    </target>
    
    <target name="makeDir" depends="clean, checkParam">
        <mkdir dir="${build.path}"/>
        <mkdir dir="${html.path}"/>
        <mkdir dir="${html.path}/images"/>
    </target>
    
    <target name="buildHtmlImageLister" depends="checkParam">
        <delete file="HtmlImageLister.jar"/>
        
        <exec executable="javac" dir="lib/HtmlImageLister" failonerror="true">
            <arg value="-cp"/>
            <arg value="lib/org.jsoup.jar"/>
            <arg value="HtmlImageLister.java"/>
        </exec>
        
        <jar destfile="HtmlImageLister.jar">
            <zipfileset src="lib/HtmlImageLister/lib/org.jsoup.jar">
                <exclude name="**/*.SF"/>
            </zipfileset>
            
            <fileset dir="lib/HtmlImageLister" excludes="**/*.java, **/.* **/lib/**"/>
            
            <manifest>
                <attribute name="Main-Class" value="HtmlImageLister"/>
                <attribute name="Class-Path" value="lib"/>
            </manifest>
        </jar>
    </target>
    
    <target name="buildOnlineHelp" unless="standalone" depends="checkParam, buildHtmlImageLister">
        <antcall target="makeDir"/>
        
        <copy todir="${html.path}/images">
            <fileset dir="${dir}/en/docbook/images">
                <include name="**/*.jpg" />
                <include name="**/*.png" />
            </fileset>
        </copy>
        
        <xsltproc chunk.section.depth="${chunk.depth}" generate.section.toc.level="${toc.level}"/>
        
        <loadfile property="output.log.msg" srcFile="output.log"/>
        <echo message="${output.log.msg}"/>
        
        <antcall target="checkForErrors"/>
        
        <delete file="${html.path}/index.xml"/>
        <delete file="plugin.xml"/>
        <delete file="target.db"/>
        <delete dir="${html.path}/en"/>
        
        <antcall target="moveGeneratedFiles"/>
        <antcall target="checkImages"/>
    </target>

    <target name="buildHTML" if="standalone" unless="releaseNotes" depends="checkParam, buildHtmlImageLister">
        <antcall target="clean"/>
        
        <copy todir="${build.path}/images">
            <fileset dir="${dir}/en/docbook/images">
                <include name="*.jpg" />
                <include name="*.png" />
            </fileset>
        </copy>
        
        <copy todir="${build.path}/css">
            <fileset dir="${dir}/en/docbook/css">
                <include name="*.css" />
            </fileset>
        </copy>
        
        <xsltprochtml chapter.autolabel="1"
                      generate.toc.book="toc,title"
                      section.autolabel="1"
                      section.label.includes.component.label="1"
                      toc.section.depth="3"/>
        
        <antcall target="checkForErrors"/>
        <antcall target="checkImages"/>
        
        <antcall target="moveGeneratedFilesStandalone"/>
    </target>
    
    <target name="buildReleaseNotesHTML" if="releaseNotes" depends="checkParam, buildHtmlImageLister">
        <copy todir="${build.path}/images">
            <fileset dir="${dir}/en/docbook/images">
                <include name="*.jpg" />
                <include name="*.png" />
            </fileset>
        </copy>
        
        <copy todir="${build.path}/css">
            <fileset dir="${dir}/en/docbook/css">
                <include name="*.css" />
            </fileset>
        </copy>
        
        <xsltprochtml chapter.autolabel="0"
                      generate.toc.book="nop"
                      section.autolabel="0"
                      section.label.includes.component.label="0"
                      toc.section.depth="0"/>
        
        <antcall target="checkForErrors"/>
        <antcall target="checkImages"/>
        
        <antcall target="moveGeneratedFilesStandalone"/>
    </target>
    
    <target name="buildReferenceManualHTML" depends="checkParam">
        <copy todir="${build.path}/images">
            <fileset dir="${dir}/en/docbook/images">
                <include name="*.jpg" />
                <include name="*.png" />
            </fileset>
        </copy>
        
        <copy todir="${build.path}/css">
            <fileset dir="${dir}/en/docbook/css">
                <include name="*.css" />
            </fileset>
        </copy>
        
        <xsltprochtml chapter.autolabel="1"
                      generate.toc.book="toc,title"
                      section.autolabel="1"
                      section.label.includes.component.label="1"
                      toc.section.depth="3"/>
        
        <antcall target="checkForErrors"/>
    </target>
    
    <target name="checkForErrors">
        <loadfile property="errorlines" srcfile="output.log">
            <filterchain>
                <linecontainsregexp>
                    <regexp pattern="(ERROR:|[Ee]rror:|WARNING:|[Ww]arning:)"/>
                </linecontainsregexp>
            </filterchain>
        </loadfile>
        
        <property name="errorlines" value=""/>
        
        <condition property="error">
            <length string="${errorlines}" when="greater" length="0"/>
        </condition>
        
        <fail if="${error}">
            ${errorlines}
        </fail>
        
        <delete file="output.log"/>
    </target>
    
    <target name="validateEnv">
        <condition property="notSuited">
           <os family="windows" />
        </condition>
    </target>
    
    <target name="checkImages">
        <java jar="HtmlImageLister.jar" outputProperty="imageListOld" failonerror="true" fork="true">
            <arg value="${basedir}/${dir}/en/build/${output}"/>
        </java>
        <loadfile property="imageList"
              srcFile="imageList.txt"/>
        <filelist id="files" dir="./${dir}/en/docbook" files="${imageList}" />
        
        <restrict id="missing.files">
            <filelist refid="files"/>
            <not>
                <exists/>
            </not>
        </restrict>
            
        <property name="missingFiles" refid="missing.files" />
            
        <condition property="filesExist" value="true">
            <length string="${missingFiles}" length="0" />
        </condition>
        
        <concat destFile="imagesMissing.log">${missingFiles}
            <filterchain>
                <linecontainsregexp>
                    <regexp pattern='.*'/>
                </linecontainsregexp>
                <tokenfilter>
                    <replaceregex pattern=":" replace="${line.separator}" flags="g"/>
                </tokenfilter>
            </filterchain>
        </concat>
            
        <loadfile property="missingFilesFormatted" srcfile="imagesMissing.log"/>
            
        <fail unless="${filesExist}">
            Missing Image Files:${line.separator}${missingFilesFormatted}
        </fail>
            
        <delete file="imageList.txt" failonerror="false"></delete>
        <delete file="imagesMissing.log"/>
    </target>
    
    <target name="moveGeneratedFiles">
        <move file="contexts.xml" tofile="context${manual.name}.xml"/>
        <move file="toc.xml" tofile="toc${manual.name}.xml"/>
        
        <move todir="${build.path}">
            <fileset file="toc${manual.name}.xml"/>
            <fileset file="context${manual.name}.xml"/>
        </move>
        
        <move todir="${build.path}/content/html" >
            <fileset dir="content/html"/>
        </move>
        
        <copy todir="${client.ua.help.path}/content">
            <fileset file="${build.path}/toc${manual.name}.xml"/>
            <fileset file="${build.path}/context${manual.name}.xml"/>
        </copy>
        
        <copy todir="${client.ua.help.path}/${html.path}">
            <fileset dir="${build.path}/${html.path}"/>
        </copy>
    </target>
    
    <target name="moveGeneratedFilesStandalone">
        <copy todir="${client.ua.help.path}/${html.path}">
            <fileset dir="${build.path}" excludes="css/"/>
        </copy>
    </target>
</project>

Back to the top