/ scripts / genRelease
genRelease
  1  #!/usr/bin/python3
  2  #
  3  # Copyright (c) 2016-2019 The Khronos Group Inc.
  4  #
  5  # Licensed under the Apache License, Version 2.0 (the "License");
  6  # you may not use this file except in compliance with the License.
  7  # You may obtain a copy of the License at
  8  #
  9  #     http://www.apache.org/licenses/LICENSE-2.0
 10  #
 11  # Unless required by applicable law or agreed to in writing, software
 12  # distributed under the License is distributed on an "AS IS" BASIS,
 13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  # See the License for the specific language governing permissions and
 15  # limitations under the License.
 16  
 17  # Ensure config/extDependency.py is up-to-date before we import it.
 18  # If it is up to date, 'make' will print a useless warning without '-s'.
 19  import argparse,subprocess,sys
 20  subprocess.check_call(['make', '-s', 'config/extDependency.py'])
 21  
 22  # Alter sys.path to import config/extDependency.py.
 23  sys.path = sys.path + [ 'config' ]
 24  
 25  from genspec import *
 26  from extDependency import allExts, khrExts
 27  
 28  # Eventually, these may be defined by extDependency.py
 29  allVersions = [ 'VK_VERSION_1_0', 'VK_VERSION_1_1' ]
 30  Version1_0 = [ 'VK_VERSION_1_0' ]
 31  
 32  if __name__ == '__main__':
 33      parser = argparse.ArgumentParser()
 34  
 35      parser.add_argument('-internal', action='store_true',
 36                          help='Generate internal build, not public')
 37      parser.add_argument('-norefpages', action='store_true',
 38                          help='Do not generate refpages')
 39      parser.add_argument('-singlerefpage', action='store_true',
 40                          help='Generate single-page refpage - NOT SUPPORTED')
 41      parser.add_argument('-chunked', action='store_true',
 42                          help='Always generate chunked HTML outputs')
 43      parser.add_argument('-pdf', action='store_true',
 44                          help='Always generate PDF outputs')
 45      parser.add_argument('-nov11', action='store_false', dest='v11',
 46                          help='Suppress Vulkan 1.1 targets')
 47      parser.add_argument('-v10', action='store_true',
 48                          help='Generate Vulkan 1.0 targets')
 49  
 50      args = parser.parse_args()
 51  
 52      if args.internal:
 53          # For internal build & pseudo-release
 54          repoDir = '/home/tree/git/vulkan'
 55          outDir = '/home/tree/git/vulkan/out'
 56      else:
 57          # For public release
 58          repoDir = '/home/tree/git/Vulkan-Docs'
 59          outDir = '/home/tree/git/registry/vulkan/specs'
 60  
 61          # Always build PDF for public releases
 62          args.pdf = True
 63  
 64      refPageTargets = ''
 65  
 66      if not args.norefpages:
 67          # Generate separate reference pages
 68          refPageTargets += ' manhtmlpages'
 69  
 70      if args.singlerefpage:
 71          # Generate single-page refpage.
 72          refPageTargets += ' manhtml'
 73          if args.pdf:
 74              refPageTargets += ' manpdf'
 75          print('echo Info: single-page refpage targets are NOT SUPPORTED')
 76  
 77      specTargets = ' html'
 78      if args.chunked:
 79          specTargets += ' chunked'
 80      if args.pdf:
 81          specTargets += ' pdf'
 82  
 83      print('echo Info: Building release from', repoDir, 'to', outDir)
 84      print('echo Info: Building spec targets', specTargets)
 85      print('')
 86  
 87      # Vulkan 1.1 specs
 88      if args.v11:
 89          # Build ref pages and validusage targets only for 1.1 + all
 90          # extensions.
 91          buildBranch('1.1-extensions',
 92                      versions = allVersions,
 93                      extensions = allExts,
 94                      ratified = False,
 95                      apititle = '(with all registered Vulkan extensions)',
 96                      xmlTargets = 'clobber install',
 97                      specTargets = specTargets + ' validusage' + refPageTargets,
 98                      repoDir = repoDir,
 99                      outDir = outDir)
100  
101          buildBranch('1.1-khr-extensions',
102                      versions = allVersions,
103                      extensions = khrExts,
104                      ratified = True,
105                      apititle = '(with KHR extensions)',
106                      xmlTargets = 'clobber install',
107                      specTargets = specTargets,
108                      repoDir = repoDir,
109                      outDir = outDir)
110  
111          # Build style guide and registry documentation targets only for 1.1
112          # + no extensions.
113          buildBranch('1.1',
114                      versions = allVersions,
115                      extensions = None,
116                      ratified = True,
117                      apititle = None,
118                      xmlTargets = 'clobber install',
119                      specTargets = specTargets + ' styleguide registry',
120                      repoDir = repoDir,
121                      outDir = outDir,
122                      needRefSources = True)
123  
124      # Vulkan 1.0 specs. Only build the core spec now that 1.1 is out.
125      if args.v10:
126          buildBranch('1.0-extensions',
127                  versions = Version1_0,
128                  extensions = allExts,
129                  ratified = False,
130                  apititle = '(with all registered Vulkan extensions)',
131                  xmlTargets = 'clobber install',
132                  specTargets = specTargets,
133                  repoDir = repoDir,
134                  outDir = outDir)
135  
136          buildBranch('1.0-wsi_extensions',
137                  versions = Version1_0,
138                  extensions = khrExts,
139                  ratified = True,
140                  apititle = '(with KHR extensions)',
141                  xmlTargets = 'clobber install',
142                  specTargets = specTargets,
143                  repoDir = repoDir,
144                  outDir = outDir)
145  
146          buildBranch('1.0',
147                  versions = Version1_0,
148                  extensions = None,
149                  ratified = True,
150                  apititle = None,
151                  xmlTargets = 'clobber install',
152                  specTargets = specTargets,
153                  repoDir = repoDir,
154                  outDir = outDir)
155      else:
156          print('echo Info: Not building 1.0 specs yet')
157  
158      print('echo Info: post-generation cleanup')
159      createTags(releaseNum(), buildOnFriday())