more code review using github compiler runs (hopefully the macos build will link with this)

This commit is contained in:
Heather Anderson 2021-09-04 00:14:59 -07:00 committed by ksuprynowicz
parent 227e899189
commit fb93e39f66
3 changed files with 2 additions and 76 deletions

View file

@ -1,11 +1,10 @@
set(TARGET_NAME entities-renderer)
setup_hifi_library(Network)
link_hifi_libraries(shared workload gpu shaders procedural graphics material-networking model-networking script-engine render render-utils image qml ui pointers)
link_hifi_libraries(shared workload gpu shaders procedural graphics material-networking model-networking script-engine render render-utils image qml ui pointers entities)
include_hifi_library_headers(animation)
include_hifi_library_headers(audio)
include_hifi_library_headers(avatars)
include_hifi_library_headers(controllers)
include_hifi_library_headers(entities)
include_hifi_library_headers(gl)
include_hifi_library_headers(graphics-scripting) # for Forward.h
include_hifi_library_headers(hfm)

View file

@ -48,7 +48,7 @@ private: // storage
ScriptEngineQtScript* _engine;
};
class ScriptFunctionContextQtWrapper : public ScriptFunctionContext {
class ScriptFunctionContextQtWrapper final : public ScriptFunctionContext {
public: // construction
inline ScriptFunctionContextQtWrapper(QScriptContext* context) : _value(context) {}

View file

@ -52,15 +52,10 @@
#include "ScriptProgramQtWrapper.h"
#include "ScriptValueQtWrapper.h"
static const int MAX_MODULE_ID_LENGTH { 4096 };
static const int MAX_DEBUG_VALUE_LENGTH { 80 };
static const QScriptEngine::QObjectWrapOptions DEFAULT_QOBJECT_WRAP_OPTIONS =
QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects;
static const QScriptValue::PropertyFlags READONLY_PROP_FLAGS { QScriptValue::ReadOnly | QScriptValue::Undeletable };
static const QScriptValue::PropertyFlags READONLY_HIDDEN_PROP_FLAGS { READONLY_PROP_FLAGS | QScriptValue::SkipInEnumeration };
static const bool HIFI_AUTOREFRESH_FILE_SCRIPTS { true };
Q_DECLARE_METATYPE(ScriptValue);
@ -315,74 +310,6 @@ void ScriptEngineQtScript::_debugDump(const QString& header, const QScriptValue&
}
#endif
static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) {
// assemble the message by concatenating our arguments
QString message = "";
for (int i = 0; i < context->argumentCount(); i++) {
if (i > 0) {
message += " ";
}
message += context->argument(i).toString();
}
// was this generated by a script engine? If we don't recognize it then send the message and exit
ScriptEngineQtScript* scriptEngine = qobject_cast<ScriptEngineQtScript*>(engine);
if (!scriptEngine) {
qCDebug(scriptengine_script, "%s", qUtf8Printable(message));
return QScriptValue();
}
QString filename;
auto scriptManager = scriptEngine->manager();
if (scriptManager) {
filename = scriptManager->getFilename();
}
// This message was sent by one of our script engines, let's try to see if we can find the source.
// Note that the first entry in the backtrace should be "print" and is somewhat useless to us
AbstractLoggerInterface* loggerInterface = AbstractLoggerInterface::get();
if (loggerInterface && loggerInterface->showSourceDebugging()) {
QScriptContext* userContext = context;
while (userContext && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) {
userContext = userContext->parentContext();
}
QString location;
if (userContext) {
QScriptContextInfo contextInfo(userContext);
QString fileName = contextInfo.fileName();
int lineNumber = contextInfo.lineNumber();
QString functionName = contextInfo.functionName();
location = functionName;
if (!fileName.isEmpty()) {
if (location.isEmpty()) {
location = fileName;
} else {
location = QString("%1 at %2").arg(location).arg(fileName);
}
}
if (lineNumber != -1) {
location = QString("%1:%2").arg(location).arg(lineNumber);
}
}
if (location.isEmpty()) {
location = filename;
}
// give the script engine a chance to notify the system about this message
scriptEngine->print(message);
// send the message to debug log
qCDebug(scriptengine_script, "[%s] %s", qUtf8Printable(location), qUtf8Printable(message));
} else {
scriptEngine->print(message);
// prefix the script engine name to help disambiguate messages in the main debug log
qCDebug(scriptengine_script, "[%s] %s", qUtf8Printable(filename), qUtf8Printable(message));
}
return QScriptValue();
}
static QScriptValue ScriptValueToQScriptValue(QScriptEngine* engine, const ScriptValue& src) {
return ScriptValueQtWrapper::fullUnwrap(static_cast<ScriptEngineQtScript*>(engine), src);
}