Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/json_bug_repro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: json_bug_repro

on: [push]

jobs:
build:

runs-on: windows-2019

steps:
- uses: actions/checkout@v1

- name: nmake_build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
"C:\Program Files\Git\bin\bash.exe" ./json_bug_repro/ci/win_ci.sh
28 changes: 28 additions & 0 deletions json_bug_repro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.16)

project(Reproducejsonbug VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Quick Bluetooth)

qt_standard_project_setup(REQUIRES 6.5)


qt_add_executable(appReproducejsonbug
main.cpp
)

qt_add_qml_module(appReproducejsonbug
URI Reproducejsonbug
VERSION 1.0
QML_FILES qml/Main.qml
)

set_target_properties(appReproducejsonbug PROPERTIES
WIN32_EXECUTABLE TRUE
)

target_link_libraries(appReproducejsonbug
PRIVATE Qt6::Quick
)
43 changes: 43 additions & 0 deletions json_bug_repro/ci/qtapps/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
IFS=$'\n\t'

THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source ${THISDIR}/utils.bash # will compute UTILS_WE_ARE_RUNNING_IN_CI

if [[ -n ${UTILS_WE_ARE_RUNNING_IN_CI-} ]];
# The '-' hyphen above tests without angering the 'set -u' about unbound variables
then
echo "C.I. environment was detected."

# Try various ways to print OS version info.
# This lets us keep a record of this in our CI logs,
# in case the CI docker images change.
uname -a || true
lsb_release -a || true
gcc --version || true # oddly, gcc often prints great OS information
cat /etc/issue || true

# What environment variables did the C.I. system set? Print them:
env

if [[ "$OSTYPE" != "cygwin" && "$OSTYPE" != "msys" ]]; then
${THISDIR}/../verify_authors.sh

${THISDIR}/linux_apt_get_qt_deps.sh
${THISDIR}/get_qt_libs.sh
elif [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
${THISDIR}/provision_win.sh
fi

else
echo "Assuming we are NOT in cloud C.I. environment."
fi


THIS_FILENAME=$(basename "$0")
echo 'We assume this was run with '\''set -e'\'' (look at upper lines of this script).'
echo 'Assuming so, then getting here means:'
echo "${THIS_FILENAME} SUCCESS"
20 changes: 20 additions & 0 deletions json_bug_repro/ci/qtapps/provision_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source "${DIR}/rootdirhelper.bash"

DL_FOLDER=$CUR_GUICODE_ROOT/dl_third_party
if [[ -n ${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE-} ]]; then
DL_FOLDER=${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE}
fi

pip3 install -r ${DIR}/requirements.txt # https://github.com/miurahr/aqtinstall

python3 -m aqt install-qt --outputdir $DL_FOLDER/Qt_desktop \
windows desktop 6.5.3 win64_msvc2019_64 \
--modules \
qtconnectivity \
qtimageformats \
qt5compat
1 change: 1 addition & 0 deletions json_bug_repro/ci/qtapps/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aqtinstall==3.1.12
17 changes: 17 additions & 0 deletions json_bug_repro/ci/qtapps/rootdirhelper.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [ "${BASH_SOURCE[0]}" -ef "$0" ]
then
echo "Hey, you should source this script, not execute it!"
exit 1
fi

NESTED_GUI_ROOT="" # Populate this if you move the qt-qml-project beneath git root
CUR_GIT_ROOT=$(git rev-parse --show-toplevel)

export CUR_GUICODE_ROOT="${CUR_GIT_ROOT}/${NESTED_GUI_ROOT}/"

DL_FOLDER=$CUR_GUICODE_ROOT/dl_third_party
if [[ -n ${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE-} ]]; then
DL_FOLDER=${MYAPP_TEMPLATE_DL_FOLDER_OVERRIDE}
fi
27 changes: 27 additions & 0 deletions json_bug_repro/ci/qtapps/utils.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [ "${BASH_SOURCE[0]}" -ef "$0" ]
then
echo "Hey, you should source this script, not execute it!"
exit 1
fi

if [[ -n ${TERM-} && ${TERM-} != "dumb" && ${TERM-} != "emacs" ]]; then
# https://stackoverflow.com/a/20983251/10278
u_red=`tput setaf 1`
u_green=`tput setaf 2`
u_resetcolor=`tput sgr0` # keep reset LAST. The above do change the output.
else
u_red=''
u_green=''
u_resetcolor=''
fi

# https://web.archive.org/web/20191121235402/https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html
if [[ -n ${GITHUB_ACTIONS-} || -n ${BITBUCKET_REPO_OWNER-} || -n ${BITBUCKET_REPO_FULL_NAME-} ]];
# The '-' hyphens above test without angering the 'set -u' about unbound variables
then
export UTILS_WE_ARE_RUNNING_IN_CI=1
echo "Assuming C.I. environment."
echo "Found at least one of GITHUB_ACTIONS, BITBUCKET_REPO_OWNER, BITBUCKET_REPO_FULL_NAME in env."
fi
61 changes: 61 additions & 0 deletions json_bug_repro/ci/win_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

set -Eeuo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
IFS=$'\n\t'

THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CUR_GIT_ROOT=$(git rev-parse --show-toplevel)

if [[ "$OSTYPE" != "cygwin" && "$OSTYPE" != "msys" ]]; then
echo "This script is for use on Microsoft Windows"
exit 1
fi

if [[ -z ${VCToolsInstallDir-} ]]; then
echo "WHOOPS. vcvars64 (or vcvarsall) was not called yet."
echo "You MUST start a VISUAL STUDIO command prompt. (Then start git-bash from within it.)"
echo "Read the above and try again."
exit 1
fi


"${THISDIR}"/qtapps/ci.sh

source "${THISDIR}"/qtapps/rootdirhelper.bash

MSVCPATHFORBUILDING=$(cygpath -u "${VCToolsInstallDir}/bin/HOSTx64/x64")
export PATH="${MSVCPATHFORBUILDING}:$PATH" # make sure MSVC link.exe is found (not bash/unix 'link' tool)

WINDLPATH=$(cygpath -u $DL_FOLDER)

# Variables used by CMakeLists
export Qt6_DIR="${WINDLPATH}/Qt_desktop/6.5.3/msvc2019_64/lib/cmake/Qt6/"

# Put qmake on the PATH:
export PATH="${WINDLPATH}/Qt_desktop/6.5.3/msvc2019_64/bin:$PATH"



mkdir -p cbuild
pushd cbuild

cmake "-G" "NMake Makefiles" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON $THISDIR/..

# See: https://forum.qt.io/topic/146961/building-qt6-5-with-nmake-error
# Workaround for bug in Qt6CoreMacros.cmake:
#buggy_genfile=meta_types/qt6appreproducejsonbug_debug_metatypes.json
#if [ ! -s "$buggy_genfile" ]; then
# echo "{}" >> "$buggy_genfile"
#fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if for any reason you have to use 6.5.3 and work around this bug, then uncomment the workaround shown here on lines 46,47,48,49


nmake


popd # pushd cbuild



THIS_FILENAME=$(basename "$0")
echo 'We assume this was run with '\''set -e'\'' (look at upper lines of this script).'
echo 'Assuming so, then getting here means:'
echo "${THIS_FILENAME} SUCCESS"
18 changes: 18 additions & 0 deletions json_bug_repro/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>

#include <QObject>


int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QQmlApplicationEngine engine;
engine.loadFromModule("Reproducejsonbug", "Main");

app.exec();
}
7 changes: 7 additions & 0 deletions json_bug_repro/qml/Main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import QtQuick

Window {
width: 1200
height: 600
visible: true
}
Loading