mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
Add environment variable to ignore types from ICG processing #535
Added a new environment variable TRICK_ICG_IGNORE_TYPES. Class/struct/enum types found in this semicolon delimited list will not have attributes written out.
This commit is contained in:
parent
9509924b64
commit
c694700148
@ -93,6 +93,7 @@ sub gte (@) {
|
|||||||
$def{"TRICK_ICG_COMPAT15"} = "" ;
|
$def{"TRICK_ICG_COMPAT15"} = "" ;
|
||||||
$def{"TRICK_ICG_NOCOMMENT"} = "" ;
|
$def{"TRICK_ICG_NOCOMMENT"} = "" ;
|
||||||
$def{"TRICK_ICG_EXCLUDE"} = "" ;
|
$def{"TRICK_ICG_EXCLUDE"} = "" ;
|
||||||
|
$def{"TRICK_ICG_IGNORE_TYPES"} = "" ;
|
||||||
$def{"TRICK_SWIG_EXCLUDE"} = "" ;
|
$def{"TRICK_SWIG_EXCLUDE"} = "" ;
|
||||||
$def{"TRICK_EXT_LIB_DIRS"} = "" ;
|
$def{"TRICK_EXT_LIB_DIRS"} = "" ;
|
||||||
$def{"TRICK_PYTHON_PATH"} = "" ;
|
$def{"TRICK_PYTHON_PATH"} = "" ;
|
||||||
|
@ -44,6 +44,7 @@ export TRICK_SFLAGS
|
|||||||
export TRICK_EXCLUDE
|
export TRICK_EXCLUDE
|
||||||
export TRICK_ICG_COMPAT15
|
export TRICK_ICG_COMPAT15
|
||||||
export TRICK_ICG_EXCLUDE
|
export TRICK_ICG_EXCLUDE
|
||||||
|
export TRICK_ICG_IGNORE_TYPES
|
||||||
export TRICK_ICG_NOCOMMENT
|
export TRICK_ICG_NOCOMMENT
|
||||||
export TRICK_SWIG_EXCLUDE
|
export TRICK_SWIG_EXCLUDE
|
||||||
export TRICK_EXT_LIB_DIRS
|
export TRICK_EXT_LIB_DIRS
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -32,6 +33,23 @@ PrintAttributes::PrintAttributes(int in_attr_version , HeaderSearchDirs & in_hsd
|
|||||||
printer = new PrintFileContents10() ;
|
printer = new PrintFileContents10() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintAttributes::addIgnoreTypes() {
|
||||||
|
|
||||||
|
char * env_var_contents = getenv("TRICK_ICG_IGNORE_TYPES") ;
|
||||||
|
|
||||||
|
if( env_var_contents != NULL ) {
|
||||||
|
std::string s = std::string(env_var_contents) ;
|
||||||
|
std::stringstream ss(s);
|
||||||
|
std::string item;
|
||||||
|
while(std::getline(ss, item, ';')) {
|
||||||
|
item = trim(item) ;
|
||||||
|
if ( ! item.empty() ) {
|
||||||
|
global_ignore_types.insert(item) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@details
|
@details
|
||||||
|
|
||||||
@ -482,7 +500,9 @@ bool PrintAttributes::isIgnored(ConstructValues& constructValues) {
|
|||||||
std::set<std::string>& constructs = ignored_types[fileName];
|
std::set<std::string>& constructs = ignored_types[fileName];
|
||||||
|
|
||||||
const bool ignored = constructs.find(constructValues.getName()) != constructs.end() or
|
const bool ignored = constructs.find(constructValues.getName()) != constructs.end() or
|
||||||
constructs.find(constructValues.getFullyQualifiedName()) != constructs.end();
|
constructs.find(constructValues.getFullyQualifiedName()) != constructs.end() or
|
||||||
|
global_ignore_types.find(constructValues.getName()) != global_ignore_types.end() or
|
||||||
|
global_ignore_types.find(constructValues.getFullyQualifiedName()) != global_ignore_types.end();
|
||||||
|
|
||||||
if (ignored and verboseBuild) {
|
if (ignored and verboseBuild) {
|
||||||
std::cout << skipping << "ICG Ignore Type: " << constructValues.getName() << " (from " << fileName << ")" << std::endl;
|
std::cout << skipping << "ICG Ignore Type: " << constructValues.getName() << " (from " << fileName << ")" << std::endl;
|
||||||
|
@ -39,6 +39,9 @@ class PrintAttributes {
|
|||||||
PrintAttributes( int attr_version , HeaderSearchDirs & hsd , CommentSaver & cs ,
|
PrintAttributes( int attr_version , HeaderSearchDirs & hsd , CommentSaver & cs ,
|
||||||
clang::CompilerInstance & in_ci, bool force , bool sim_services, std::string output_dir ) ;
|
clang::CompilerInstance & in_ci, bool force , bool sim_services, std::string output_dir ) ;
|
||||||
|
|
||||||
|
/** Adds construct names to ignore from TRICK_ICG_IGNORE_TYPES environment variable */
|
||||||
|
void addIgnoreTypes() ;
|
||||||
|
|
||||||
/** Prints all of the processed classes and enumerations */
|
/** Prints all of the processed classes and enumerations */
|
||||||
virtual void createMapFiles() ;
|
virtual void createMapFiles() ;
|
||||||
virtual void closeMapFiles() ;
|
virtual void closeMapFiles() ;
|
||||||
@ -128,6 +131,9 @@ class PrintAttributes {
|
|||||||
/** List of files that have ICG: No */
|
/** List of files that have ICG: No */
|
||||||
std::vector< std::string > icg_no_files ;
|
std::vector< std::string > icg_no_files ;
|
||||||
|
|
||||||
|
/** set of types from the TRICK_ICG_IGNORE_TYPES environment variable */
|
||||||
|
std::set< std::string > global_ignore_types ;
|
||||||
|
|
||||||
/** map of ignored types sorted by file */
|
/** map of ignored types sorted by file */
|
||||||
std::map< std::string , std::set< std::string > > ignored_types ;
|
std::map< std::string , std::set< std::string > > ignored_types ;
|
||||||
/** map of processed classes sorted by file */
|
/** map of processed classes sorted by file */
|
||||||
|
@ -164,6 +164,7 @@ int main(int argc, char * argv[]) {
|
|||||||
|
|
||||||
PrintAttributes printAttributes(attr_version, hsd, cs, ci, force, sim_services_flag, output_dir);
|
PrintAttributes printAttributes(attr_version, hsd, cs, ci, force, sim_services_flag, output_dir);
|
||||||
|
|
||||||
|
printAttributes.addIgnoreTypes() ;
|
||||||
// Create new class and enum map files
|
// Create new class and enum map files
|
||||||
if (create_map) {
|
if (create_map) {
|
||||||
printAttributes.createMapFiles();
|
printAttributes.createMapFiles();
|
||||||
|
Loading…
Reference in New Issue
Block a user