Reduce dependency of onscreengui module in libOpenspace

Add check to `check_style_guide` that reports wrong dependencies
This commit is contained in:
Alexander Bock
2017-02-16 16:54:03 -05:00
parent 11fbff5fbc
commit 2ebc803cb7
3 changed files with 21 additions and 11 deletions

View File

@@ -46,10 +46,6 @@
#include <openspace/util/time.h>
#include <openspace/util/timerange.h>
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
#include <modules/onscreengui/include/gui.h>
#endif
namespace openspace {
void registerCoreClasses(documentation::DocumentationEngine& engine) {

View File

@@ -54,10 +54,6 @@
#include <fstream>
#include <string>
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
#include <modules/onscreengui/include/gui.h>
#endif
#include "scene_doc.inl"
#include "scene_lua.inl"

View File

@@ -229,6 +229,17 @@ def check_glm_header(lines, file):
else:
return ''
def check_core_dependency(lines, component):
if component != "openspace_core":
return ''
index = [i for i,s in enumerate(lines) if 'OPENSPACE_MODULE_' in s]
if len(index) > 0:
return lines[index[0]][:-1]
else:
return ''
previousSymbols = {}
def check_header_file(file, component):
@@ -255,7 +266,6 @@ def check_header_file(file, component):
print(file, '\t', 'Filename styling check failed', '\t', styling_filename)
return
comment = check_comment(lines)
if comment:
print(file, '\t', 'Comment check failed', '\t', comment)
@@ -278,16 +288,20 @@ def check_header_file(file, component):
duplicates, symbol = check_duplicates(lines, previousSymbols)
if not duplicates:
print(file, '\t', 'Duplicate include guard', symbol, 'first in', previousSymbols[symbol])
print(file, '\t', 'Duplicate include guard', symbol, 'first in', previousSymbols[symbol])
return
else:
previousSymbols[symbol] = file
header = check_glm_header(lines, file)
if header:
print(file, '\t', 'Illegal glm header include', header)
print(file, '\t', 'Illegal glm header include', header)
return
core_dependency = check_core_dependency(lines, component)
if core_dependency:
print(file, '\t' 'Wrong core dependency', core_dependency)
def check_source_file(file, component):
with open(file, 'r+') as f:
@@ -298,6 +312,10 @@ def check_source_file(file, component):
print(file, '\t', 'Illegal glm header include', header)
return
core_dependency = check_core_dependency(lines, component)
if core_dependency:
print(file, '\t' 'Wrong core dependency', core_dependency)
def check_files(positiveList, negativeList, component, check_function):