mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Move BuildConfig and BuildResult into dedicated files
this fixed the circular dependency in the build_and_publish script than internally imports the macos_sign
This commit is contained in:
parent
fdbf077f0e
commit
325c47f87b
@ -8,6 +8,8 @@ import argparse
|
|||||||
import time
|
import time
|
||||||
import zipfile
|
import zipfile
|
||||||
import defines
|
import defines
|
||||||
|
from build_result import BuildResult
|
||||||
|
from build_config import BuildConfig
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import macos_sign
|
import macos_sign
|
||||||
@ -25,55 +27,6 @@ def clean_build_dir(build_dir):
|
|||||||
build_dir.mkdir(parents=True, exist_ok=True)
|
build_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
class BuildResult:
|
|
||||||
# Windows example with absolute paths:
|
|
||||||
# [...]/build-x64-windows-release/
|
|
||||||
build: Path
|
|
||||||
# [...]/build-x64-windows-release/bin
|
|
||||||
bin: Path
|
|
||||||
# [...]/build-x64-windows-release/ScreenPlay-Installer.exe
|
|
||||||
installer: Path
|
|
||||||
# [...]/build-x64-windows-release/ScreenPlay-Installer.zip
|
|
||||||
installer_zip: Path
|
|
||||||
# [...]/build-x64-windows-release/ScreenPlay-0.X.0-RCX-x64-windows-release.zip
|
|
||||||
build_zip: Path
|
|
||||||
# [...]/build-x64-windows-release/ScreenPlay-0.X.0-RCX-x64-windows-release.txt :sha256, needed for scoop
|
|
||||||
build_hash: Path
|
|
||||||
# x64, arm64, universal
|
|
||||||
build_arch: str
|
|
||||||
|
|
||||||
|
|
||||||
class BuildConfig:
|
|
||||||
root_path: str
|
|
||||||
cmake_osx_architectures: str
|
|
||||||
cmake_target_triplet: str
|
|
||||||
package: bool
|
|
||||||
osx_bundle: str
|
|
||||||
package_command: str
|
|
||||||
executable_file_ending: str
|
|
||||||
# qt_* use either aqt or from the maintenance tool
|
|
||||||
qt_path: str # C:\Qt
|
|
||||||
qt_bin_path: str # C:\Qt\6.3.2\msvc2019_64
|
|
||||||
qt_version: str
|
|
||||||
qt_ifw_version: str
|
|
||||||
ifw_root_path: str
|
|
||||||
cmake_toolchain_file: str
|
|
||||||
aqt_install_qt_packages: str
|
|
||||||
aqt_install_tool_packages: str
|
|
||||||
executable_file_ending: str
|
|
||||||
build_folder: str
|
|
||||||
bin_dir: str
|
|
||||||
screenplay_version: str
|
|
||||||
# CMake variables need str: "ON" or "OFF"
|
|
||||||
build_steam: str
|
|
||||||
build_tests: str
|
|
||||||
build_deploy: str
|
|
||||||
build_type: str
|
|
||||||
build_architecture: str
|
|
||||||
create_installer: str
|
|
||||||
sign_osx: bool
|
|
||||||
|
|
||||||
|
|
||||||
def execute(
|
def execute(
|
||||||
build_config: BuildConfig
|
build_config: BuildConfig
|
||||||
) -> BuildResult:
|
) -> BuildResult:
|
||||||
@ -118,7 +71,8 @@ def execute(
|
|||||||
|
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
if (build_config.sign_osx):
|
if (build_config.sign_osx):
|
||||||
print(f"Sign ScreenPlay-installer.dmg at: {build_config.bin_dir}")
|
print(
|
||||||
|
f"Sign ScreenPlay-installer.dmg at: {build_config.bin_dir}")
|
||||||
macos_sign.sign_dmg(build_config=build_config)
|
macos_sign.sign_dmg(build_config=build_config)
|
||||||
|
|
||||||
# Create a zip file of the build
|
# Create a zip file of the build
|
||||||
|
@ -9,6 +9,8 @@ from pathlib import Path
|
|||||||
import platform
|
import platform
|
||||||
import paramiko
|
import paramiko
|
||||||
import defines
|
import defines
|
||||||
|
from build_result import BuildResult
|
||||||
|
from build_config import BuildConfig
|
||||||
from util import sftp_exists, get_latest_git_tag, parse_semver, semver_to_string
|
from util import sftp_exists, get_latest_git_tag, parse_semver, semver_to_string
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
|
||||||
@ -51,9 +53,9 @@ if __name__ == "__main__":
|
|||||||
print("No git tags found.")
|
print("No git tags found.")
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
build_result = build.BuildResult()
|
build_result = BuildResult()
|
||||||
|
|
||||||
build_config = build.BuildConfig()
|
build_config = BuildConfig()
|
||||||
build_config.qt_version = defines.QT_VERSION
|
build_config.qt_version = defines.QT_VERSION
|
||||||
build_config.qt_ifw_version = defines.QT_IFW_VERSION
|
build_config.qt_ifw_version = defines.QT_IFW_VERSION
|
||||||
build_config.build_steam = "ON"
|
build_config.build_steam = "ON"
|
||||||
|
29
Tools/build_config.py
Normal file
29
Tools/build_config.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
class BuildConfig:
|
||||||
|
root_path: str
|
||||||
|
cmake_osx_architectures: str
|
||||||
|
cmake_target_triplet: str
|
||||||
|
package: bool
|
||||||
|
osx_bundle: str
|
||||||
|
package_command: str
|
||||||
|
executable_file_ending: str
|
||||||
|
# qt_* use either aqt or from the maintenance tool
|
||||||
|
qt_path: str # C:\Qt
|
||||||
|
qt_bin_path: str # C:\Qt\6.3.2\msvc2019_64
|
||||||
|
qt_version: str
|
||||||
|
qt_ifw_version: str
|
||||||
|
ifw_root_path: str
|
||||||
|
cmake_toolchain_file: str
|
||||||
|
aqt_install_qt_packages: str
|
||||||
|
aqt_install_tool_packages: str
|
||||||
|
executable_file_ending: str
|
||||||
|
build_folder: str
|
||||||
|
bin_dir: str
|
||||||
|
screenplay_version: str
|
||||||
|
# CMake variables need str: "ON" or "OFF"
|
||||||
|
build_steam: str
|
||||||
|
build_tests: str
|
||||||
|
build_deploy: str
|
||||||
|
build_type: str
|
||||||
|
build_architecture: str
|
||||||
|
create_installer: str
|
||||||
|
sign_osx: bool
|
20
Tools/build_result.py
Normal file
20
Tools/build_result.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class BuildResult:
|
||||||
|
# Windows example with absolute paths:
|
||||||
|
# [...]/build-x64-windows-release/
|
||||||
|
build: Path
|
||||||
|
# [...]/build-x64-windows-release/bin
|
||||||
|
bin: Path
|
||||||
|
# [...]/build-x64-windows-release/ScreenPlay-Installer.exe
|
||||||
|
installer: Path
|
||||||
|
# [...]/build-x64-windows-release/ScreenPlay-Installer.zip
|
||||||
|
installer_zip: Path
|
||||||
|
# [...]/build-x64-windows-release/ScreenPlay-0.X.0-RCX-x64-windows-release.zip
|
||||||
|
build_zip: Path
|
||||||
|
# [...]/build-x64-windows-release/ScreenPlay-0.X.0-RCX-x64-windows-release.txt :sha256, needed for scoop
|
||||||
|
build_hash: Path
|
||||||
|
# x64, arm64, universal
|
||||||
|
build_arch: str
|
@ -1,16 +1,14 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
||||||
from build import BuildConfig
|
from build_config import BuildConfig
|
||||||
from util import run
|
from util import run
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
import time
|
|
||||||
|
|
||||||
stdout.reconfigure(encoding='utf-8')
|
stdout.reconfigure(encoding='utf-8')
|
||||||
|
|
||||||
|
|
||||||
def sign(build_config: BuildConfig):
|
def sign(build_config: BuildConfig):
|
||||||
print("Run codedesign")
|
print("Run codedesign")
|
||||||
#run("codesign -f -s 'Developer ID Application: Elias Steurer (V887LHYKRH)' --verbose --force --timestamp --options 'runtime' -f --entitlements '../../ScreenPlay/entitlements.plist' 'ScreenPlay.app/' ",
|
# run("codesign -f -s 'Developer ID Application: Elias Steurer (V887LHYKRH)' --verbose --force --timestamp --options 'runtime' -f --entitlements '../../ScreenPlay/entitlements.plist' 'ScreenPlay.app/' ",
|
||||||
# cwd=build_config.bin_dir)
|
# cwd=build_config.bin_dir)
|
||||||
# Do not use --deep https://developer.apple.com/forums/thread/129980
|
# Do not use --deep https://developer.apple.com/forums/thread/129980
|
||||||
# base_sign_command = "codesign -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --verbose --force --timestamp --options \"runtime\" \"ScreenPlay.app/Contents/MacOS/{app}\""
|
# base_sign_command = "codesign -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --verbose --force --timestamp --options \"runtime\" \"ScreenPlay.app/Contents/MacOS/{app}\""
|
||||||
@ -19,7 +17,6 @@ def sign(build_config: BuildConfig):
|
|||||||
run("codesign --deep -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --verbose --force --timestamp --options \"runtime\" --entitlements \"../../ScreenPlay/entitlements.plist\" \"ScreenPlay.app/\"",
|
run("codesign --deep -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --verbose --force --timestamp --options \"runtime\" --entitlements \"../../ScreenPlay/entitlements.plist\" \"ScreenPlay.app/\"",
|
||||||
cwd=build_config.bin_dir)
|
cwd=build_config.bin_dir)
|
||||||
|
|
||||||
|
|
||||||
print("Run codedesign verify")
|
print("Run codedesign verify")
|
||||||
run("codesign --verify --verbose=4 'ScreenPlay.app/'",
|
run("codesign --verify --verbose=4 'ScreenPlay.app/'",
|
||||||
cwd=build_config.bin_dir)
|
cwd=build_config.bin_dir)
|
||||||
@ -28,7 +25,8 @@ def sign(build_config: BuildConfig):
|
|||||||
# xcrun notarytool submit "ScreenPlay.app.zip" --keychain-profile "ScreenPlay" --wait
|
# xcrun notarytool submit "ScreenPlay.app.zip" --keychain-profile "ScreenPlay" --wait
|
||||||
# xcrun stapler staple "ScreenPlay.app"
|
# xcrun stapler staple "ScreenPlay.app"
|
||||||
print("Packing .apps for upload")
|
print("Packing .apps for upload")
|
||||||
run("ditto -c -k --keepParent 'ScreenPlay.app' 'ScreenPlay.app.zip'", cwd=build_config.bin_dir)
|
run("ditto -c -k --keepParent 'ScreenPlay.app' 'ScreenPlay.app.zip'",
|
||||||
|
cwd=build_config.bin_dir)
|
||||||
|
|
||||||
# run this if you get an error:
|
# run this if you get an error:
|
||||||
# `xcrun notarytool log --apple-id "xxxxx@xxxx.com" --password "xxxx-xxxx-xxxx-xxxx" --team-id "xxxxxxxxxxx" <ID>`
|
# `xcrun notarytool log --apple-id "xxxxx@xxxx.com" --password "xxxx-xxxx-xxxx-xxxx" --team-id "xxxxxxxxxxx" <ID>`
|
||||||
@ -36,7 +34,8 @@ def sign(build_config: BuildConfig):
|
|||||||
# id: xxxxxx-xxxxxx-xxxx-xxxxx-xxxxx
|
# id: xxxxxx-xxxxxx-xxxx-xxxxx-xxxxx
|
||||||
# status: Invalid
|
# status: Invalid
|
||||||
print("Run xcnotary submit")
|
print("Run xcnotary submit")
|
||||||
run("xcrun notarytool submit --keychain-profile 'ScreenPlay' ScreenPlay.app.zip --wait", cwd=build_config.bin_dir)
|
run("xcrun notarytool submit --keychain-profile 'ScreenPlay' ScreenPlay.app.zip --wait",
|
||||||
|
cwd=build_config.bin_dir)
|
||||||
|
|
||||||
print("Run stapler staple")
|
print("Run stapler staple")
|
||||||
run("xcrun stapler staple ScreenPlay.app", cwd=build_config.bin_dir)
|
run("xcrun stapler staple ScreenPlay.app", cwd=build_config.bin_dir)
|
||||||
@ -46,24 +45,30 @@ def sign(build_config: BuildConfig):
|
|||||||
print("Remove ScreenPlay.app.zip.")
|
print("Remove ScreenPlay.app.zip.")
|
||||||
run("rm ScreenPlay.app.zip", cwd=build_config.bin_dir)
|
run("rm ScreenPlay.app.zip", cwd=build_config.bin_dir)
|
||||||
|
|
||||||
|
|
||||||
def sign_dmg(build_config: BuildConfig):
|
def sign_dmg(build_config: BuildConfig):
|
||||||
# Sign the DMG
|
# Sign the DMG
|
||||||
run("codesign -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
|
run("codesign -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Verify the DMG's signature
|
# Verify the DMG's signature
|
||||||
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
|
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg\"",
|
||||||
|
cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Pack the DMG for notarization
|
# Pack the DMG for notarization
|
||||||
run("ditto -c -k --keepParent ScreenPlay-Installer.dmg ScreenPlay-Installer.dmg.zip", cwd=build_config.build_folder)
|
run("ditto -c -k --keepParent ScreenPlay-Installer.dmg ScreenPlay-Installer.dmg.zip",
|
||||||
|
cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Notarize the DMG using notarytool
|
# Notarize the DMG using notarytool
|
||||||
run("xcrun notarytool submit ScreenPlay-Installer.dmg.zip --keychain-profile 'ScreenPlay' --wait", cwd=build_config.build_folder)
|
run("xcrun notarytool submit ScreenPlay-Installer.dmg.zip --keychain-profile 'ScreenPlay' --wait",
|
||||||
|
cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Staple the notarization ticket to the DMG
|
# Staple the notarization ticket to the DMG
|
||||||
run("xcrun stapler staple ScreenPlay-Installer.dmg", cwd=build_config.build_folder)
|
run("xcrun stapler staple ScreenPlay-Installer.dmg",
|
||||||
|
cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Check the notarization status for the DMG
|
# Check the notarization status for the DMG
|
||||||
run("spctl --assess --verbose \"ScreenPlay-Installer.dmg\"", cwd=build_config.build_folder)
|
run("spctl --assess --verbose \"ScreenPlay-Installer.dmg\"",
|
||||||
|
cwd=build_config.build_folder)
|
||||||
|
|
||||||
# Clean up the zip file
|
# Clean up the zip file
|
||||||
run("rm ScreenPlay-Installer.dmg.zip", cwd=build_config.build_folder)
|
run("rm ScreenPlay-Installer.dmg.zip", cwd=build_config.build_folder)
|
||||||
|
Loading…
Reference in New Issue
Block a user