Skip to content

Commit

Permalink
Merge pull request #85 from matty0ung/dbFixes
Browse files Browse the repository at this point in the history
Fixes for DB enum states in unexpected case
  • Loading branch information
matty0ung authored Sep 17, 2024
2 parents 95cd7ef + ccf3da6 commit c600e4b
Show file tree
Hide file tree
Showing 198 changed files with 7,439 additions and 5,117 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/linux-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
#
os: [ubuntu-22.04, ubuntu-24.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -111,17 +111,14 @@ jobs:
run: |
make
#
# On Linux, currently CMake
#
#- name: Test (via CMake)
# working-directory: ${{github.workspace}}/build
# shell: bash
# env:
# CTEST_OUTPUT_ON_FAILURE: TRUE
# QT_QPA_PLATFORM: minimal
# run: |
# make test
- name: Test (via CMake)
working-directory: ${{github.workspace}}/build
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: TRUE
QT_QPA_PLATFORM: minimal
run: |
make test
# Note that, although we continue to support CMake for local builds and installs, we no longer support packaging
# with CPack/CMake. The bt build script packaging gives us better control over the packaging process.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
#
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
]
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: temp
fetch-depth: 0
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
# Per https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html, "the value of this variable should
# be set prior to the first project() or enable_language() command invocation because it may influence configuration
# of the toolchain and flags".
set(CMAKE_OSX_ARCHITECTURES x86_64) # Build intel 64-bit binary.
set(CMAKE_OSX_ARCHITECTURES x86_64, arm64) # Build both x86_64 and arm64 for Apple silicon.
#set(CMAKE_OSX_ARCHITECTURES i386 x86_64) # Build intel binary.
#set(CMAKE_OSX_ARCHITECTURES ppc i386 ppc64 x86_64) # Build universal binary.
endif()
Expand All @@ -107,7 +107,8 @@ message(STATUS "PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
# Sometimes we do need the capitalised version of the project name
set(capitalisedProjectName Brewken)
# We use this in the program, to tell users where to get support.
set(CONFIG_HOMEPAGE_URL "https://github.com/${capitalisedProjectName}/${projectName}")
set(CONFIG_GITHUB_URL "https://github.com/${capitalisedProjectName}/${projectName}")
set(CONFIG_WEBSITE_URL "https://www.brewken.com/")
set(CONFIG_ORGANIZATION_DOMAIN "brewken.com")

#=======================================================================================================================
Expand Down Expand Up @@ -801,7 +802,7 @@ configure_file(src/config.in src/config.h)
#=======================================================================================================================
# We don't need to list the embedded resource files themselves here, just the "Resource Collection File" that lists what
# they are.
set(filesToCompile_qrc "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.qrc")
set(filesToCompile_qrc "${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc")

#=======================================================================================================================
#=========================================== Files included with the program ===========================================
Expand All @@ -816,7 +817,8 @@ set(filesToInstall_docs ${repoDir}/README.md)
set(filesToInstall_data ${repoDir}/data/default_db.sqlite
${repoDir}/data/DefaultContent001-OriginalDefaultData.xml
${repoDir}/data/DefaultContent002-BJCP_2021_Styles.json
${repoDir}/data/DefaultContent003-Ingredients-Hops-Yeasts.json)
${repoDir}/data/DefaultContent003-Ingredients-Hops-Yeasts.json
${repoDir}/data/DefaultContent004-MoreYeasts.json)

# Desktop files to install.
set(filesToInstall_desktop ${repoDir}/linux/${PROJECT_NAME}.desktop)
Expand Down
7 changes: 4 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,6 @@ commonSourceFiles = files([
'src/sortFilterProxyModels/YeastSortFilterProxyModel.cpp',
'src/tableModels/BoilStepTableModel.cpp',
'src/tableModels/BtTableModel.cpp',
'src/tableModels/BtTableModelInventory.cpp',
'src/tableModels/EquipmentTableModel.cpp',
'src/tableModels/FermentableTableModel.cpp',
'src/tableModels/FermentationStepTableModel.cpp',
Expand All @@ -794,6 +793,7 @@ commonSourceFiles = files([
'src/utils/EnumStringMapping.cpp',
'src/utils/FileSystemHelpers.cpp',
'src/utils/Fonts.cpp',
'src/utils/FuzzyCompare.cpp',
'src/utils/ImportRecordCount.cpp',
'src/utils/MetaTypes.cpp',
'src/utils/OStreamWriterForQFile.cpp',
Expand Down Expand Up @@ -1212,7 +1212,7 @@ installSubDir_translations = installSubDir_data + '/translations_qm'
#=======================================================================================================================

# Compile Qt's resources collection files (.qrc) into C++ files for compilation
generatedFromQrc = qt.compile_resources(sources : projectName + '.qrc')
generatedFromQrc = qt.compile_resources(sources : 'resources.qrc')

# Compile Qt's ui files (.ui) into header files.
generatedFromUi = qt.compile_ui(sources : uiFiles)
Expand Down Expand Up @@ -1338,7 +1338,8 @@ exportedVariables = {
'CONFIG_ORGANIZATION_NAME' : 'The ' + capitalisedProjectName + ' Team',

# Similarly, installers often want a URL link. We also use this in the program, to tell users where to get support.
'CONFIG_HOMEPAGE_URL' : 'https://github.com/' + capitalisedProjectName + '/' + projectName,
'CONFIG_GITHUB_URL' : 'https://github.com/' + capitalisedProjectName + '/' + projectName,
'CONFIG_WEBSITE_URL' : 'https://www.brewken.com/',
'CONFIG_ORGANIZATION_DOMAIN' : 'brewken.com',

#
Expand Down
39 changes: 31 additions & 8 deletions packaging/darwin/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
#=======================================================================================================================
# packaging/mac/Info.plist.in is part of Brewken, and is copyright the following authors 2023:
# packaging/darwin/Info.plist.in is part of Brewken, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewken is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand All @@ -21,12 +21,19 @@
# See comments in meson.build for how this file gets processed into mbuild/Info.plist. Then see comments in the build
# tool for how it ends up in the Mac application bundle.
#
# https://developer.apple.com/documentation/bundleresources/information_property_list and related pages give info on the
# individual parameters
#
# The following bundle parameters used in oldver versions of this file are AFAICT deprecated, so I have removed them:
# CFBundleLongVersionString
# CFBundleSignature
#
-->
<plist version="1.0">
<dict>
<!--
Language the system if it can't locate a resource for the user’s preferred language. Value should be a language ID
(ideally the two-letter ISO 639-1 standard) that identifies a language, dialect, or script.
Default language for the system if it can't locate a resource for the user’s preferred language. Value should be a
language ID (ideally the two-letter ISO 639-1 standard) that identifies a language, dialect, or script.
-->
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
Expand All @@ -42,25 +49,41 @@
-->
<key>CFBundleIconFile</key>
<string>@CONFIG_INSTALLER_APPLICATION_ICON@</string>
<!--
A bundle ID uniquely identifies a single app throughout the system. The bundle ID string must contain only
alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-), and periods (.). Typically, you use a reverse-DNS format
for bundle ID strings. Bundle IDs are case-insensitive.
-->
<key>CFBundleIdentifier</key>
<string>com.brewtarget.Brewtarget</string>
<string>com.brewken.Brewken</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>@CONFIG_APPLICATION_NAME_UC@</string>
<!--
This key consists of a four-letter code for the bundle type. For apps, the code is APPL, for frameworks, it's FMWK,
and for bundles, it's BNDL. The default value is derived from the bundle extension or, if it can't be derived, the
default value is BNDL.
-->
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@CONFIG_VERSION_STRING@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@CONFIG_VERSION_STRING@</string>
<!--
A Boolean value indicating whether the app's resources files should be mapped into memory.
-->
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>@CONFIG_COPYRIGHT_STRING@</string>
<!--
There isn't a great choice for us for application category from the list at
https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype
This value seemed as close as any.
-->
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions packaging/linux/control.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------------------------------------------------
# packaging/linux/control.in is part of Brewken, and is copyright the following authors 2023:
# packaging/linux/control.in is part of Brewken, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewken is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -121,4 +121,4 @@ Description: GUI beer brewing software
#
# Homepage (Optional)
#
Homepage: @CONFIG_HOMEPAGE_URL@
Homepage: @CONFIG_WEBSITE_URL@
4 changes: 2 additions & 2 deletions packaging/linux/rpm.spec.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------------------------------------------------
# packaging/linux/rpm.spec.in is part of Brewken, and is copyright the following authors 2023:
# packaging/linux/rpm.spec.in is part of Brewken, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewken is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -43,7 +43,7 @@ Group : Applications/Productivity
Summary : GUI beer brewing software

# URL supplying further information about the package, typically upstream website.
URL : @CONFIG_HOMEPAGE_URL@
URL : @CONFIG_WEBSITE_URL@
Vendor : @CONFIG_ORGANIZATION_NAME@

# Specifies the architecture which the resulting binary package will run on. Typically this is a CPU architecture.
Expand Down
8 changes: 4 additions & 4 deletions packaging/windows/NsisInstallerScript.nsi.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------------------------------------------------
# packaging/windows/NsisInstallerScript.nsi.in is part of Brewken, and is copyright the following authors 2023:
# packaging/windows/NsisInstallerScript.nsi.in is part of Brewken, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewken is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -119,15 +119,15 @@ RequestExecutionLevel admin
#
# Other variables injected from Meson
#
# Similarly, although we could use other injected variables directly, we don't to avoid another gotcha. When Meson
# Similarly, although we could use other injected variables directly, we don't, to avoid another gotcha. When Meson
# is processing the file to do @BLAH@ substitutions, if it sees a backslash followed by an @, then it will think you're
# escaping the first @ symbol, so, eg "C:\Blah\@CONFIG_APPLICATION_NAME_UC@" will not get converted to
# "C:\Blah\Brewtarget" or "C:\Blah\Brewken". Instead, we take the injected variable into an NSIS compile-time constant
# (aka a 'define') via:
# !define INJECTED_APPLICATION_NAME_UC "@CONFIG_APPLICATION_NAME_UC@"
# and then we can write "C:\Blah\${INJECTED_APPLICATION_NAME_UC}" and the right substitutions will happen. (The
# alternative, of adding an extra slash, eg "C:\Blah\\@CONFIG_APPLICATION_NAME_UC@", would work but seems a bit less
# robust.
# robust.)
#
!define INJECTED_APPLICATION_NAME_UC "@CONFIG_APPLICATION_NAME_UC@"
!define INJECTED_APPLICATION_NAME_LC "@CONFIG_APPLICATION_NAME_LC@"
Expand All @@ -136,7 +136,7 @@ RequestExecutionLevel admin
!define INJECTED_DESCRIPTION_STRING "@CONFIG_DESCRIPTION_STRING@"
!define INJECTED_COPYRIGHT_STRING "@CONFIG_COPYRIGHT_STRING@"
!define INJECTED_ORGANIZATION_NAME "@CONFIG_ORGANIZATION_NAME@"
!define INJECTED_HOMEPAGE_URL "@CONFIG_HOMEPAGE_URL@"
!define INJECTED_HOMEPAGE_URL "@CONFIG_WEBSITE_URL@"

#=======================================================================================================================
#==================================================== Our Constants ====================================================
Expand Down
File renamed without changes.
34 changes: 32 additions & 2 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,27 @@ def installDependencies():
# 'xerces-c'
]
for packageToInstall in installListBrew:
log.debug('Installing ' + packageToInstall + ' via Homebrew')
btUtils.abortOnRunFail(subprocess.run(['brew', 'install', packageToInstall]))
#
# If we try to install a Homebrew package that is already installed, we'll get a warning. This isn't
# horrendous, but it looks a bit bad on the GitHub automated builds (because a lot of things are already
# installed by the time this script runs). As explained at
# https://apple.stackexchange.com/questions/284379/with-homebrew-how-to-check-if-a-software-package-is-installed,
# the simplest (albeit perhaps not the most elegant) way to check whether a package is already installed is
# to run `brew list`, throw away the output, and look at the return code, which will be 0 if the package is
# already installed and 1 if it is not. In the shell, we can use the magic of short-circuit evaluation
# (https://en.wikipedia.org/wiki/Short-circuit_evaluation) to, at a small legibility cost, do the whole
# check-and-install, in a single line. But in Python, it's easier to do it in two steps.
#
log.debug('Checking ' + packageToInstall)
brewListResult = subprocess.run(['brew', 'list', packageToInstall],
stdout = subprocess.DEVNULL,
stderr = subprocess.DEVNULL,
capture_output = False)
if (brewListResult.returncode == 0):
log.debug('Homebrew reports ' + packageToInstall + ' already installed')
else:
log.debug('Installing ' + packageToInstall + ' via Homebrew')
btUtils.abortOnRunFail(subprocess.run(['brew', 'install', packageToInstall]))
#
# By default, even once Qt5 is installed, Meson will not find it
#
Expand Down Expand Up @@ -1428,6 +1447,8 @@ def doPackage():
#
# Copy the Debian Binary package control file to where it belongs
#
# The meson build will have generated this file from packaging/linux/control.in
#
log.debug('Copying deb package control file')
copyWithoutCommentsOrFolds(dir_build.joinpath('control').as_posix(),
dir_packages_deb_control.joinpath('control').as_posix())
Expand Down Expand Up @@ -2022,6 +2043,8 @@ def doPackage():
# [projectName]_[versionNumber].app
# └── Contents
# ├── Info.plist ❇ <── "Information property list" file = required configuration information (in XML)
# │ This includes things such as Bundle ID. It is generated by the Meson build
# │ from packaging/darwin/Info.plist.in
# ├── Frameworks <── Contains any private shared libraries and frameworks used by the executable
# │ ├── QtCore.framework * NB: Directory and its contents * 🟢
# │ ├── [Other Qt .framework directories and their contents] 🟢
Expand Down Expand Up @@ -2311,6 +2334,13 @@ def doPackage():
# a lot simpler to let macdeployqt create the disk image, and we currently don't think we need to do further
# fix-up work after it's run. A custom icon on the disk image would be nice, but is far from essential.
#
# .:TBD:. Ideally we would sign our application here using the `-codesign=<ident>` command line option to
# macdeployqt. For the GitHub builds, we would have to import a code signing certificate using
# https://github.com/Apple-Actions/import-codesign-certs.
#
# However, getting an identity and certificate with which to sign is a bit complicated. For a start,
# Apple pretty much require you to sign up to their $99/year developer program.
#
log.debug('Running macdeployqt')
os.chdir(dir_packages_platform)
btUtils.abortOnRunFail(
Expand Down
2 changes: 1 addition & 1 deletion src/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ AboutDialog::AboutDialog(QWidget * parent) :
" </p>"
"</html>"
)
.arg(CONFIG_APPLICATION_NAME_UC, CONFIG_VERSION_STRING, CONFIG_HOMEPAGE_URL)
.arg(CONFIG_APPLICATION_NAME_UC, CONFIG_VERSION_STRING, CONFIG_GITHUB_URL)
);
return;
}
Expand Down
Loading

0 comments on commit c600e4b

Please sign in to comment.