-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathpre.py
More file actions
45 lines (39 loc) · 1.89 KB
/
pre.py
File metadata and controls
45 lines (39 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
pre-command
'''
import shutil
import sys
import subprocess
from performance.logger import setup_loggers, getLogger
from shared import const
from shared.mauisharedpython import remove_aab_files, install_latest_maui, MauiNuGetConfigContext
from shared.precommands import PreCommands
from shared.versionmanager import versions_write_json, get_sdk_versions
from test import EXENAME
setup_loggers(True)
precommands = PreCommands()
install_latest_maui(precommands)
precommands.print_dotnet_info()
# Use context manager to temporarily merge MAUI's NuGet feeds into repo config
# This ensures both dotnet new and dotnet build/publish have access to MAUI packages
with MauiNuGetConfigContext(precommands.framework):
# Setup the Maui folder - will use merged NuGet.config with MAUI feeds
precommands.new(template='maui',
output_dir=const.APPDIR,
bin_dir=const.BINDIR,
exename=EXENAME,
working_directory=sys.path[0],
no_restore=False)
# Build the IPA - will use merged NuGet.config
# TODO: Remove /p:TargetsCurrent=true once https://github.com/dotnet/performance/issues/5055 is resolved
precommands.execute(['/p:EnableCodeSigning=false', '/p:ApplicationId=net.dot.mauitesting', '/p:TargetsCurrent=true'])
# NuGet.config is automatically restored after this block
# Remove the aab files as we don't need them, this saves space
output_dir = const.PUBDIR
if precommands.output:
output_dir = precommands.output
remove_aab_files(output_dir)
# Extract the versions of used SDKs from the linked folder DLLs
version_dict = get_sdk_versions(rf"./{const.APPDIR}/obj/Release/{precommands.framework}/ios-arm64/linked", False)
versions_write_json(version_dict, rf"{output_dir}/versions.json")
print(f"Versions: {version_dict} from location " + rf"./{const.APPDIR}/obj/Release/{precommands.framework}/ios-arm64/linked")