2010-03-18 12:06:43 +01:00
|
|
|
#!/bin/bash
|
2010-03-03 11:38:33 +01:00
|
|
|
|
2012-09-10 13:08:23 +02:00
|
|
|
# This is the script that generates the copy of the QmlJS parser from the sources
|
|
|
|
|
# in the qtdeclarative source tree.
|
|
|
|
|
#
|
|
|
|
|
# It applies a bunch of renames to make the source compatible with the Qt Creator
|
|
|
|
|
# sources as well as rewrites of the licenses.
|
|
|
|
|
#
|
|
|
|
|
# Example:
|
|
|
|
|
# cd src/libs/qmljs/parser
|
|
|
|
|
# QTDIR=~/path/to/qtdeclarative-checkout ./gen-parser.sh
|
|
|
|
|
|
2010-03-03 11:38:33 +01:00
|
|
|
me=$(dirname $0)
|
|
|
|
|
|
2013-11-06 14:17:23 +01:00
|
|
|
for i in $QTDIR/src/qml/parser/*.{g,h,cpp,pri}; do
|
2012-07-31 10:12:26 +02:00
|
|
|
sed -f $me/cmd.sed $i > $me/$(echo $(basename $i) | sed s/qqmljs/qmljs/)
|
2010-03-03 11:38:33 +01:00
|
|
|
done
|
|
|
|
|
|
2012-07-31 10:12:26 +02:00
|
|
|
for i in $QTDIR/src/qml/qml/qqml{error.{h,cpp},dirparser{_p.h,.cpp}}; do
|
|
|
|
|
sed -f $me/cmd.sed $i > $me/$(echo $(basename $i) | sed s/qqml/qml/)
|
2010-03-18 12:06:43 +01:00
|
|
|
done
|
2010-03-03 11:38:33 +01:00
|
|
|
|
2010-03-18 15:43:33 +01:00
|
|
|
# export QmlDirParser
|
2012-08-01 07:48:37 +02:00
|
|
|
perl -p -0777 -i -e 's/QT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QmlEngine;\nclass Q_AUTOTEST_EXPORT QmlDirParser/#include "qmljsglobal_p.h"\n\nQT_BEGIN_NAMESPACE\n\nclass QmlError;\nclass QmlEngine;\nclass QML_PARSER_EXPORT QmlDirParser/' qmldirparser_p.h
|
2011-10-12 19:29:34 +02:00
|
|
|
# export QmlJSGrammar
|
|
|
|
|
perl -p -0777 -i -e 's/#include <QtCore\/qglobal.h>\n\nQT_BEGIN_NAMESPACE\n\nclass QmlJSGrammar\n/#include "qmljsglobal_p.h"\n#include <QtCore\/qglobal.h>\n\nQT_BEGIN_NAMESPACE\n\nclass QML_PARSER_EXPORT QmlJSGrammar\n/' qmljsgrammar_p.h
|
2012-07-31 10:12:26 +02:00
|
|
|
# remove qmlglobal_p.h include
|
|
|
|
|
perl -p -0777 -i -e 's/#include \"qmlglobal_p.h\"//' qmldirparser.cpp
|
|
|
|
|
# remove qmlglobal_p.h include
|
2013-01-22 11:15:23 +01:00
|
|
|
perl -p -0777 -i -e 's/#include \"qmlglobal_p.h\"//' qmlerror.cpp
|
|
|
|
|
# remove qmlglobal_p.h include
|
2012-07-31 10:12:26 +02:00
|
|
|
perl -p -0777 -i -e 's/#include \<QtQml\/qmlfile.h\>//' qmldirparser.cpp
|
|
|
|
|
# remove QtQml/qtqmlglobal.h include
|
|
|
|
|
perl -p -0777 -i -e 's/#include \<QtQml\/qtqmlglobal.h\>//' qmlerror.h
|
|
|
|
|
# replace private/qhashedstring_p.h include and QHashedStringRef
|
|
|
|
|
perl -p -0777 -i -e 's/#include \<private\/qhashedstring_p.h\>//' qmldirparser_p.h
|
|
|
|
|
perl -p -0777 -i -e 's/QHashedStringRef/QString/g' qmldirparser_p.h qmldirparser.cpp
|
|
|
|
|
# don't use the new QVarLengthArray::length()
|
|
|
|
|
sed -i -e 's/chars.length()/chars.size()/' $me/qmljslexer.cpp
|
2014-01-15 00:18:53 +01:00
|
|
|
sed -i -e 's/DiagnosticMessage::Error/Severity::Error/g' $me/qmljsparser.cpp
|
|
|
|
|
sed -i -e 's/DiagnosticMessage::Warning/Severity::Warning/g' $me/qmljsparser.cpp
|
|
|
|
|
sed -i -e 's/DiagnosticMessage::Warning/Severity::Warning/g' $me/qmljsparser_p.h
|
|
|
|
|
sed -i -e 's|#include <private/qv4errorobject_p.h>||g' $me/qmlerror.cpp
|
|
|
|
|
sed -i -e 's|#include <QtCore/qstring.h>|#include <QString>|g' $me/qmljsengine_p.h
|
|
|
|
|
sed -i -e 's|#include <QtCore/qset.h>|#include <QSet>|g' $me/qmljsengine_p.h
|
|
|
|
|
perl -p -0777 -i -e 's/QT_QML_BEGIN_NAMESPACE/#include <qmljs\/qmljsconstants.h>\nQT_QML_BEGIN_NAMESPACE/' qmljsengine_p.h
|
2011-05-12 13:25:35 +02:00
|
|
|
|
|
|
|
|
./changeLicense.py $me/../qmljs_global.h qml*.{cpp,h}
|