Skip to content

Commit 17f22be

Browse files
committed
japi-cxx_0.5
0 parents  commit 17f22be

51 files changed

Lines changed: 5613 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config.xpybuild.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# xpyBuild build file. For inclusion by the root build file.
2+
#
3+
# $Copyright (c) 2018 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.$
4+
# Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG
5+
#
6+
# $Id: config.xpybuild.py 392694 2021-06-29 13:29:16Z sgol $
7+
#
8+
9+
from xpybuild.propertysupport import *
10+
from xpybuild.buildcommon import *
11+
from xpybuild.pathsets import *
12+
13+
# configure build process and modes
14+
defineEnumerationProperty('BUILD_MODE', default='release', enumValues=['release', 'debug'])
15+
BUILD_MODE = getBuildInitializationContext().getPropertyValue('BUILD_MODE')
16+
17+
if BUILD_MODE == 'debug':
18+
defineStringProperty('DEBUGSUFFIX', "d")
19+
else:
20+
defineStringProperty('DEBUGSUFFIX', "")
21+
22+
defineStringProperty('PLATFORM', None)
23+
defineStringProperty('LIBRARY_EXTENSION', '' if isWindows() else '.0')
24+
definePathProperty('LIB_BOOST_INCLUDE', None)
25+
definePathProperty('JAVA_HOME', None)
26+
definePathProperty('LIB_JNI_INCLUDE', '${JAVA_HOME}/include')
27+
definePathProperty('DOXYGEN', '/usr/bin/doxygen')
28+
29+
definePathProperty('LIB_DIR', 'lib/')
30+
definePathProperty('DOC_DIR', 'docs/')
31+
setGlobalOption('doxygen.exepath', '${DOXYGEN}')
32+
definePropertiesFromFile('release.properties')
33+
34+
include('platform.${PLATFORM}.xpybuild.py')
35+

doxygen.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# $Copyright(c) 2013 Progress Software Corporation (PSC). All rights reserved.$
2+
# $Copyright (c) 2013-2017 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.$
3+
# Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG
4+
#
5+
# $Id: doxygen.py 392236 2021-06-17 15:25:31Z sgol $
6+
7+
import subprocess, re
8+
9+
from xpybuild.basetarget import BaseTarget
10+
11+
from xpybuild.buildcommon import *
12+
from xpybuild.utils.buildexceptions import *
13+
from xpybuild.utils.fileutils import openForWrite, mkdir
14+
from xpybuild.pathsets import PathSet
15+
from xpybuild.propertysupport import defineOption
16+
17+
defineOption('doxygen.exepath', None)
18+
defineOption('doxygen.warnignores', [])
19+
20+
class Doxygen(BaseTarget):
21+
def __init__(self, target, source, config, internal=False, dependencies=None, failOnWarnings=False):
22+
"""
23+
Uses the doxygen tool to generate a directory of API documentation for languages such as C/C++.
24+
25+
@param target: The destination directory.
26+
27+
@param source: pathset listing the top-level source files to be documented.
28+
To avoid classes appearing twice under different namespaces, use "dependencies" not "source"
29+
for files that are #included by source/documented files where the namespace is provided
30+
around the #include statement but not in the file itself.
31+
32+
@param config: the doxygen configuration file.
33+
34+
@param internal: True if items marked as internal/private should be included.
35+
36+
@param dependencies: optional pathset for files that are implicitly depended upon
37+
by the source files to be documented (e.g. due to #include statements) but should not be
38+
handled as source files in their own right (e.g. if the namespace is provided by the
39+
file that #includes them).
40+
41+
@param failOnWarnings: makes this target fail if any warnings are logged to stderr
42+
(the option doxygen.warnignores can be used to ignore expected warnings)
43+
"""
44+
45+
BaseTarget.__init__(self, target, dependencies=[source, config, dependencies])
46+
self.source = PathSet(source)
47+
self.config = PathSet(config)
48+
self.internal = internal
49+
self.failOnWarnings = failOnWarnings
50+
51+
# todo: ought to be setting hashable implicit inputs
52+
53+
def run(self, context):
54+
configtmpl = self.config.resolve(context)
55+
assert len(configtmpl)==1, configtmpl
56+
configtmpl = configtmpl[0]
57+
58+
sources = " ".join(self.source.resolve(context))
59+
config = os.path.join(self.workDir, 'doxygen.conf')
60+
61+
replace = {
62+
'INPUT' : sources,
63+
'OUTPUT_DIR' : self.path,
64+
'INTERNAL':'YES' if self.internal else 'NO',
65+
'HIDE_INTERNAL':'NO' if self.internal else 'YES',
66+
}
67+
68+
mkdir(self.workDir)
69+
with openForWrite(config, 'wb') as outf:
70+
with open(configtmpl, 'rb') as inf:
71+
for l in inf:
72+
for k in replace:
73+
l = l.replace('@%s@' % k, replace[k])
74+
outf.write(l)
75+
76+
exe = context.mergeOptions(self)['doxygen.exepath']
77+
if not exe: raise BuildException('doxygen.exepath option must be set')
78+
args = [ exe, config ]
79+
80+
args = [ context.expandPropertyValues(x) for x in args ]
81+
#self.log.info('%s doxygen output file is: %s', self, os.path.join(self.workDir, 'doxygen.err'))
82+
with open(os.path.join(self.workDir, 'doxygen.out'), 'wb') as stdout:
83+
with open(os.path.join(self.workDir, 'doxygen.err'), 'wb') as stderr:
84+
subprocess.check_call(args, stdout=stdout, stderr=stderr)
85+
86+
contents = []
87+
with open(os.path.join(self.workDir, 'doxygen.out'), 'r') as stdout:
88+
for l in stdout:
89+
# Generating docs for compound com::softwareag::connectivity::StatusReporter...
90+
if l.startswith('Generating docs for '):
91+
# normalize " nested compound " to " compound " since the sorted list is easier to read that way
92+
l = l.replace(' nested ', ' ').replace('Generating docs for ','').strip().strip('.')
93+
contents.append(l)
94+
if contents:
95+
with open(os.path.join(self.path, 'html/contents.txt'), 'w') as f:
96+
for l in sorted(contents):
97+
print >>f, l
98+
with open(os.path.join(self.workDir, 'doxygen.err'), 'r') as stderr:
99+
errs = []
100+
for l in stderr:
101+
if not l.strip(): continue
102+
if l.startswith(' ') and errs:
103+
errs[-1] += ' - '+l.strip()
104+
else:
105+
errs.append(l.strip())
106+
ignores = context.mergeOptions(self)['doxygen.warnignores']
107+
errs = [e for e in errs if not any([re.match(i, e) for i in ignores])]
108+
if errs:
109+
if self.failOnWarnings:
110+
self.log.error('Doxygen reported %d lines of stderr warnings for %s; see %s: \n%s', len(errs), self, os.path.join(self.workDir, 'doxygen.err'), '\n '.join(errs))
111+
raise BuildException('Doxygen reported %d lines of stderr warnings (see %s), first is: %s'%(len(errs), os.path.join(self.workDir, 'doxygen.err'), errs[0].strip()))
112+
else:
113+
self.log.info('Doxygen reported %d lines of stderr warnings for %s; see %s', len(errs), self, os.path.join(self.workDir, 'doxygen.err'))
114+
115+

0 commit comments

Comments
 (0)