Simplify compile options and use comprehensive edition logic (#7365)

* Simplify options

* Use more sensible edition logic

* Use set instead of option for string

* Improve macro for product name

* Add tests launch config

* Restore unregistered state

* Reorganize cases for title and improve function name

* Code coverage on by default

* Fixed copyright

* Improve code coverage and test readability

* Separate build-all and build-coverage

* Back out coverage on by default

* Fixed bad var in cmake

* More verbose logging for coverage

* Restore tasks

* Restore preLaunchTask

* Use default comparitor

* Move temp files to temp dir

* Add tasks for tests

* Support for wstring

* Upgrade sonar-scanner to 6 on Debian 12

* Use modern pip install

* Install python for sonarcloud

* Use Ubuntu and install deps

* Fixed sonar-scanner URL

* Fix exported dir

* Persist build dir

* Don't use venv for pip install gcovr

* Fixed another path

* Update actions/checkout to v4 for SonarCloud analysis workflow

* Add coverage task

* Improve coverage for SerialKeyEdition.cpp

* Enable licensing for builds

* Fixed invalid macro names, missing arguments, etc

* Fixed more copyright

* Fixed incorrect use of "enterprise"

* Fixed incorrect use of "business"

* Experiment with environment

* Make package prefix variable

* Add environment matrix to all OS

* Improve job names

* Make job names easier to read

* Roll back environment matrix (too much noise)

* Fixed: default should override required

* Refactor CI with vars

* Fixed arg for env.get_env
This commit is contained in:
Nick Bolton
2024-07-04 10:14:54 +01:00
committed by GitHub
parent 37bb0f989e
commit 4690b61551
46 changed files with 533 additions and 487 deletions

View File

@ -62,14 +62,21 @@ def get_linux_distro():
return name, name_like, version
def get_env(name, required=True):
"""Returns an env var (stripped) or optionally raises an error if not set."""
def get_env(name, required=True, default=None):
"""
Returns an env var (stripped) or optionally raises an error if not set.
If `default` is set, it will be returned even if `required` is True.
"""
value = os.getenv(name)
if value:
value = value.strip()
if required and not value:
raise ValueError(f"Required env var not set: {name}")
if not value:
if default:
return default
elif required:
raise ValueError(f"Required env var not set: {name}")
return value

View File

@ -7,7 +7,7 @@ from lib.certificate import Certificate
cmake_env_var = "CMAKE_PREFIX_PATH"
shell_rc = "~/.zshrc"
dist_dir = "dist"
product_name = "Synergy"
product_name = "Synergy 1"
settings_file = "res/dist/macos/dmgbuild/settings.py"
app_path = "build/bundle/Synergy.app"
security_path = "/usr/bin/security"

View File

@ -4,7 +4,7 @@ import platform
import lib.env as env
env_file = ".env"
package_name = "synergy"
default_package_prefix = "synergy"
def main():
@ -32,6 +32,8 @@ def main():
def get_filename_base(version, use_linux_distro=True):
os = env.get_os()
machine = platform.machine().lower()
package_base = env.get_env("SYNERGY_PACKAGE_PREFIX", default=default_package_prefix)
if os == "linux" and use_linux_distro:
distro_name, _distro_like, distro_version = env.get_linux_distro()
if not distro_name:
@ -43,9 +45,9 @@ def get_filename_base(version, use_linux_distro=True):
else:
distro = distro_name
return f"{package_name}-{distro}-{machine}-{version}"
return f"{package_base}-{distro}-{machine}-{version}"
else:
return f"{package_name}-{os}-{machine}-{version}"
return f"{package_base}-{os}-{machine}-{version}"
def windows_package(filename_base):