Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
ADD_CUSTOM_TARGET(qacpp
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/create_qav_project.py
|
||||
"LTS"
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/qav_LTS"
|
||||
)
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
import fileinput
|
||||
import glob
|
||||
import inspect
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import ntpath
|
||||
|
||||
|
||||
# acf, vcf, qcf gibt es nicht mehr
|
||||
def createPrqaProjectXML (qafProjectXML, cctfileCpp, cctfileC, includeOptionSyntax, defineOptionSyntax, excludedSourceDirs, buildRoot, qafConfigFolder):
|
||||
print( "######################################################")
|
||||
print( "## CREATE PROJECT XML FILE AT " + qafProjectXML)
|
||||
print( "######################################################")
|
||||
if os.path.isfile(qafProjectXML):
|
||||
os.remove(qafProjectXML)
|
||||
qafProjectXML = open( qafProjectXML, "w")
|
||||
qafProjectXML.write( "<?xml version='1.0' encoding='UTF-8'?>\n")
|
||||
qafProjectXML.write( "<prqaproject xmlversion=\"2.1.0\" qafversion=\"2.1.1\">\n")
|
||||
qafProjectXML.write( " <!-- Config file information... -->\n")
|
||||
qafProjectXML.write( " <configuration>\n")
|
||||
qafProjectXML.write( " <root_paths>\n")
|
||||
qafProjectXML.write( ' <root_path path="${PROJECT_ROOT}" name="SOURCE_ROOT"/>\n')
|
||||
qafProjectXML.write( " </root_paths> \n")
|
||||
qafProjectXML.write( " <languageFamily name=\"C_CPP\"/>\n")
|
||||
qafProjectXML.write( " <baselinedSourceRoot baseline=\"OFF\"/>\n")
|
||||
qafProjectXML.write( " <baselineSnapshot id=\"\" name=\"\" date=\"\"/>\n")
|
||||
qafProjectXML.write( " <processMonitor>\n")
|
||||
qafProjectXML.write( " <includeOptionSyntax>\n")
|
||||
for includeOptionItem in includeOptionSyntax: ### VARIABLE FOREACH
|
||||
qafProjectXML.write( " <option string=\""+includeOptionItem+"\"/>\n")
|
||||
qafProjectXML.write( " </includeOptionSyntax>\n")
|
||||
qafProjectXML.write( " <defineOptionSyntax>\n")
|
||||
for defineOptionItem in defineOptionSyntax: ### VARIABLE FOREACH
|
||||
qafProjectXML.write( " <option string=\""+defineOptionItem+"\"/>\n")
|
||||
qafProjectXML.write( " </defineOptionSyntax>\n")
|
||||
qafProjectXML.write( " <settingsOptionSyntax>\n")
|
||||
qafProjectXML.write( " <option compiler=\"Visual Studio\" string=\"@\" quotes_escaped=\"yes\" extension=\"rsp\"/>\n")
|
||||
qafProjectXML.write( " <option compiler=\"Windriver\" string=\" -@\" quotes_escaped=\"yes\" extension=\"\"/>\n")
|
||||
qafProjectXML.write( " <option compiler=\"Greenhills\" string=\"--Via\" quotes_escaped=\"yes\" extension=\"__i\"/>\n")
|
||||
qafProjectXML.write( " </settingsOptionSyntax>\n")
|
||||
qafProjectXML.write( " <excludeStrings/>\n")
|
||||
if len(excludedSourceDirs):
|
||||
qafProjectXML.write( " <fileFilterStrings>\n")
|
||||
for excludedSourceItem in excludedSourceDirs: ### VARIABLE FOREACH
|
||||
qafProjectXML.write( " <option string=\""+excludedSourceItem+"\"/>\n")
|
||||
qafProjectXML.write( " </fileFilterStrings>\n")
|
||||
else:
|
||||
qafProjectXML.write( " <fileFilterStrings/>\n")
|
||||
qafProjectXML.write( " </processMonitor>\n")
|
||||
qafProjectXML.write( " <suppressIncludes active=\"yes\"/>\n")
|
||||
qafProjectXML.write( ' <acf name="project.acf"/>\n')
|
||||
qafProjectXML.write( ' <rcf name="project.rcf"/>\n')
|
||||
qafProjectXML.write( " <ccts>\n")
|
||||
qafProjectXML.write( " <cct target=\"C\" active=\"yes\" name=\""+ntpath.basename(cctfileC)+"\"/>\n") ### VARIABLE
|
||||
qafProjectXML.write( " <cct target=\"C++\" active=\"yes\" name=\""+ntpath.basename(cctfileCpp)+"\"/>\n") ### VARIABLE
|
||||
qafProjectXML.write( " </ccts>\n")
|
||||
qafProjectXML.write( ' <messages name="%s"/>\n' % os.path.join(qafConfigFolder, 'user_library/user_messages/messages.xml' ))
|
||||
qafProjectXML.write( " </configuration>\n")
|
||||
qafProjectXML.write( " <!-- Mapping of extension to target_language... -->\n")
|
||||
qafProjectXML.write( " <file_extensions>\n")
|
||||
qafProjectXML.write( " <language target=\"C\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".c\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".C\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".cpp\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".cxx\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".cc\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".CPP\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".CXX\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " <language target=\"C++\">\n")
|
||||
qafProjectXML.write( " <extension ext=\".CC\"/>\n")
|
||||
qafProjectXML.write( " </language>\n")
|
||||
qafProjectXML.write( " </file_extensions>\n")
|
||||
qafProjectXML.write( " <!-- Files in project... -->\n")
|
||||
qafProjectXML.write( " <files>\n")
|
||||
qafProjectXML.write( " <!-- Explicit files... -->\n")
|
||||
qafProjectXML.write( " </files>\n")
|
||||
qafProjectXML.write( "</prqaproject>\n")
|
||||
|
||||
|
||||
|
||||
def createACF(acfFile, additionalIncludeDirs, excludedIncludeDirs, analysisDefinitions):
|
||||
print( "######################################################")
|
||||
print( "## CREATE ACF FILE AT " + acfFile)
|
||||
print( "######################################################")
|
||||
if os.path.isfile(acfFile):
|
||||
os.remove(acfFile)
|
||||
|
||||
acfFileWrite = open( acfFile, "w")
|
||||
acfFileWrite.write( '<?xml version="1.0" encoding="UTF-8"?>\n')
|
||||
acfFileWrite.write( '<acf xmlversion="2.0.0">\n')
|
||||
acfFileWrite.write( ' <components>\n')
|
||||
acfFileWrite.write( ' <component version="9.1.1" target="C" name="qac"/>\n')
|
||||
acfFileWrite.write( ' <component version="4.1.0" target="C++" name="qacpp"/>\n')
|
||||
acfFileWrite.write( ' </components>\n')
|
||||
acfFileWrite.write( ' <component_settings>\n')
|
||||
acfFileWrite.write( ' <input_to version="4.1.0" target="C++" component="qacpp">\n')
|
||||
for additionalIncludeItem in additionalIncludeDirs:
|
||||
acfFileWrite.write( ' <option argument="' + additionalIncludeItem + '" name="-i"/>\n')
|
||||
for excludedIncludeItem in excludedIncludeDirs:
|
||||
acfFileWrite.write( ' <option argument="' + excludedIncludeItem + '" name="-quiet"/>\n')
|
||||
for analysisDefinitionItem in analysisDefinitions:
|
||||
acfFileWrite.write( ' <option argument="' + analysisDefinitionItem + '" name="-d"/>\n')
|
||||
acfFileWrite.write( ' </input_to>\n')
|
||||
acfFileWrite.write( ' </component_settings>\n')
|
||||
acfFileWrite.write( '</acf>\n')
|
||||
acfFileWrite.close()
|
||||
|
||||
Executable
+129
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/python
|
||||
# coding: utf-8
|
||||
#
|
||||
|
||||
import argparse
|
||||
import fileinput
|
||||
import glob
|
||||
import inspect
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser( description='Perform cqm analysis of a component.')
|
||||
parser.add_argument( 'projectName', help='Name of the project as shown in the server or in the gui.')
|
||||
parser.add_argument( 'buildRoot', help='Absolute path to a preconfigured (cmake) build folder of the component to be analyzed..')
|
||||
parser.add_argument( 'scriptFolder', help='Absolute path with qav helper scripts')
|
||||
parser.add_argument( 'qafProjectRoot', help='Absolute path to generate the qav project files')
|
||||
args = parser.parse_args()
|
||||
|
||||
scriptFolder = args.scriptFolder
|
||||
if not os.path.isdir(args.scriptFolder):
|
||||
print >> sys.stderr, "Given script folder does not exist: %s" % scriptFolder
|
||||
sys.path.append(scriptFolder) # to make sure import createPrqaXmls200 works
|
||||
|
||||
# after sys.path.append
|
||||
import createPrqaXmls200
|
||||
import modifyJSON
|
||||
|
||||
scriptFolder = args.scriptFolder
|
||||
qafProjectRoot = args.qafProjectRoot
|
||||
qafConfigFolder = os.path.join(os.getenv('HOME'), '.config/PRQA/prqa-framework-2.1.1')
|
||||
qafInstallFolder = os.path.join(os.getenv('HOME'), 'qav/prqa-framework-2.1.1')
|
||||
qaCliExe = qafInstallFolder + "/common/bin/qacli"
|
||||
qaGuiExe = qafInstallFolder + "/common/bin/qagui"
|
||||
qaVerifyHost = "compile.defence-elec.de"
|
||||
qaVerifyPort = "22230"
|
||||
licenseServerAndPort = "5055@ubuntu-polarion.defence-elec.de"
|
||||
|
||||
###### PROJECT SPECIFIC CONFIGURATION
|
||||
qafProjectXML = qafProjectRoot+"/prqaproject.xml"
|
||||
acfFile = os.path.join( qafProjectRoot, args.projectName + ".acf" )
|
||||
rcfFile = qafInstallFolder + "/config/rcf/RDE-CodingStandard.rcf"
|
||||
cctfileCpp = qafInstallFolder + "/config/cct/GNU_GCC-g++_4.8-x86_64-generic-linux-C++-c++11.cct"
|
||||
cctfileC = qafInstallFolder + "/config/cct/GNU_GCC-gcc_4.8-x86_64-generic-linux-C-c11.cct"
|
||||
|
||||
excludedSourceDirs = []
|
||||
additionalIncludeDirs= []
|
||||
|
||||
excludedIncludeDirs = ['/opt'
|
||||
]
|
||||
|
||||
analysisDefinitions = ['__PIC__',
|
||||
'__x86_64__',
|
||||
'__LP64__',
|
||||
'__GNUC__=4',
|
||||
'__GNUC_MINOR__=8',
|
||||
'__cplusplus=201103',
|
||||
]
|
||||
|
||||
# this stuff here is not used by qacli admin -F (or -j) ... so why do we need this?
|
||||
defineOptionSyntax = [ '-D',
|
||||
'/D'
|
||||
]
|
||||
|
||||
includeOptionSyntax = [ '-I',
|
||||
'/I',
|
||||
'-i',
|
||||
'-isystem'
|
||||
]
|
||||
|
||||
###### PROJECT SPECIFIC CONFIGURATION
|
||||
|
||||
|
||||
prqaProjectFileList = glob.glob( qafProjectRoot + "/prqaproject.xml*")
|
||||
for prqaprojectFile in prqaProjectFileList:
|
||||
os.remove( prqaprojectFile)
|
||||
|
||||
prqaConfigFolder = os.path.join(qafProjectRoot, 'prqa', 'config')
|
||||
if not os.path.exists(prqaConfigFolder):
|
||||
os.makedirs(prqaConfigFolder)
|
||||
|
||||
print( "######################################################")
|
||||
print( "## QAF Projekt ANLEGEN " + qafProjectRoot)
|
||||
print( "######################################################")
|
||||
|
||||
createPrqaXmls200.createACF(acfFile, additionalIncludeDirs, excludedIncludeDirs, analysisDefinitions)
|
||||
|
||||
os.system( qaCliExe+' admin --qaf-project-config --qaf-project '+ qafProjectRoot+' --cct '+cctfileCpp+' --cct '+cctfileC+' --rcf '+rcfFile+' --acf '+acfFile)
|
||||
|
||||
print( "######################################################")
|
||||
print( "## XML FILES SCHREIBEN " + qafProjectRoot)
|
||||
print( "######################################################")
|
||||
createPrqaXmls200.createPrqaProjectXML(qafProjectXML, cctfileCpp, cctfileC, includeOptionSyntax, defineOptionSyntax, excludedSourceDirs, args.buildRoot, qafConfigFolder)
|
||||
|
||||
#print( "######################################################")
|
||||
#print( "## SET LICENCE SERVER")
|
||||
#print( "######################################################")
|
||||
os.system( qaCliExe+' admin --set-license-server ' + licenseServerAndPort)
|
||||
|
||||
#print( "######################################################")
|
||||
#print( "## ENABLE DEBUG INFO")
|
||||
#print( "######################################################")
|
||||
os.system( qaCliExe + " admin --debug-level DEBUG")
|
||||
|
||||
#print( "######################################################")
|
||||
#print( "## REMOVE ALL LOCKS THAT MAY BE ACTIVE DUE TO DISTURBED ANALYZES")
|
||||
#print( "######################################################")
|
||||
os.system( qaCliExe + " admin --qaf-project \"" + qafProjectRoot + "\" --remove-locks")
|
||||
print (qaCliExe + " admin --qaf-project \"" + qafProjectRoot + "\" --remove-locks")
|
||||
|
||||
#print( "######################################################")
|
||||
#print( "## LIST FILES --- TEST")
|
||||
#print( "######################################################")
|
||||
os.system( qaCliExe + " admin -P \"" + qafProjectRoot + "\" --list-config-files")
|
||||
|
||||
#print( "######################################################")
|
||||
#print( "## CMAKE CONFIGURE WITH JSON")
|
||||
#print( "######################################################")
|
||||
#print('####')
|
||||
|
||||
cc_json = os.path.join(args.buildRoot, 'compile_commands.json')
|
||||
cc_txt = os.path.join(args.qafProjectRoot, 'compile_commands.txt')
|
||||
if not modifyJSON.generate_compile_commands_from_json(cc_json, cc_txt, args.buildRoot):
|
||||
sys.exit(1)
|
||||
|
||||
print(qaCliExe + ' admin -P ' + qafProjectRoot + ' -F ' + cc_txt)
|
||||
os.system( qaCliExe + ' admin -P ' + qafProjectRoot + ' -F ' + cc_txt)
|
||||
print('####')
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/python
|
||||
# coding: utf-8
|
||||
#
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
def generate_compile_commands_from_json(infilename, outfilename, builddir = None):
|
||||
try:
|
||||
if os.path.isfile(outfilename):
|
||||
os.remove(outfilename)
|
||||
|
||||
jsonFile = open(infilename,'r')
|
||||
outFile = open(outfilename, 'w')
|
||||
|
||||
for command in json.load(jsonFile):
|
||||
# blacklist build dir
|
||||
if builddir:
|
||||
fn = command['file']
|
||||
if command['file'].startswith(builddir):
|
||||
continue
|
||||
# whilelist some generated files (generated by us) - is not useful since qacpp can't handle dds data types
|
||||
#if not '_impl' in fn and not '_plugin.cpp' in fn:
|
||||
# if 'moc_' in fn:
|
||||
# continue
|
||||
# not sure why \" must be replaced with \"" - but that's the output of the old script
|
||||
# .acf file is not used, add some defines...
|
||||
cmd = ' "' + command['command'].replace('-isystem ', '-I').replace('-isystem', '-I').replace('-I ', '-I').replace('\\\\\\','\\"').replace('\"', '\""') + ' "\n'
|
||||
outFile.write(cmd)
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print >> sys.stderr, "Error generating compile commands file '%s': %s" % (outfilename, e)
|
||||
return False
|
||||
|
||||
########### START --- CHECK FOR VALID OPTION AND PATH ###########
|
||||
def main():
|
||||
print sys.argv[1]
|
||||
print sys.argv[2]
|
||||
try:
|
||||
usageOption = sys.argv[1]
|
||||
except:
|
||||
print ('''You forgot to add a OPTION
|
||||
-path <path>
|
||||
''')
|
||||
sys.exit()
|
||||
try:
|
||||
path = sys.argv[2]
|
||||
except:
|
||||
print ('''You forgot to add a PATH
|
||||
-path <path>
|
||||
''')
|
||||
sys.exit()
|
||||
|
||||
if ( usageOption == '-path'):
|
||||
jsonOrigFile = os.path.abspath(path+'/compile_commands.json')
|
||||
outfilename = os.path.abspath(path+'/compile_commands.txt')
|
||||
if not os.path.isfile(jsonOrigFile):
|
||||
print >> sys.stderr, "Could not find compile commands file %s... aborting" % jsonOrigFile
|
||||
sys.exit(1)
|
||||
generate_compile_commands_from_json(jsonOrigFile, outfilename)
|
||||
|
||||
########### END --- CHECK FOR VALID OPTION AND PATH ###########
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user