This commit is contained in:
1 parent
a5ee0bec73
commit
15a968a2f7
6 files changed
+290
-37
No files matched your search
+12
-11
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import json, os, shutil, urllib.parse, xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
from common import ROOT, COMMIT, VERSION, CPUS, ProbeError, safe_relative, sha256, write_json
|
||||
from source_audit import search_paths
|
||||
from source_resolution import build_source_resolution
|
||||
|
||||
UPSTREAM_DEFINES=['DBG_SKIP_SECURE_AUTH'] # Existing upstream switch; private multiplayer authentication is out of scope.
|
||||
COMPILER_OPTIONS=['-B','-CX-','-XX-','-k--no-undefined','-k--no-gc-sections']
|
||||
@@ -76,7 +76,7 @@ def asset_inventory(root:Path|None, includes:list[str]|None=None)->list[dict]:
|
||||
return result
|
||||
|
||||
def make_target(project:Path,profile:dict,cpu:str,build_id:str,source:Path|None,
|
||||
extras:dict,assets_root:Path|None=None,assets:list[dict]|None=None)->dict:
|
||||
validated:dict|None,assets_root:Path|None=None,assets:list[dict]|None=None)->dict:
|
||||
if project.exists():raise ProbeError('Target directory must be fresh: '+str(project))
|
||||
project.mkdir(parents=True)
|
||||
shutil.copytree(ROOT/'code',project/'code')
|
||||
@@ -100,13 +100,15 @@ def make_target(project:Path,profile:dict,cpu:str,build_id:str,source:Path|None,
|
||||
game_units=profile.get('game_unit','GameInitialize'),compiler='fpc',screen_orientation='landscape',fullscreen_immersive='true')
|
||||
ET.SubElement(root,'version',value=VERSION,code='30')
|
||||
options=ET.SubElement(root,'compiler_options');paths=ET.SubElement(options,'search_paths')
|
||||
ET.SubElement(paths,'path',value='code/')
|
||||
include=[]
|
||||
if units:
|
||||
if source is None:raise ProbeError('KaM source is required for '+profile['id'])
|
||||
include=search_paths(source)
|
||||
include.extend(Path(p).resolve() for p in extras.get('source_paths',[]))
|
||||
for p in include:
|
||||
if source is None or validated is None:raise ProbeError('KaM source resolution is required for '+profile['id'])
|
||||
resolution=build_source_resolution(validated,source,project/'code')
|
||||
compiler_source_paths=resolution['compiler_source_paths']
|
||||
library_paths=resolution['library_paths']
|
||||
else:
|
||||
compiler_source_paths=(project/'code',)
|
||||
library_paths=()
|
||||
for p in compiler_source_paths:
|
||||
if not p.is_dir():raise ProbeError('Source path missing: '+str(p))
|
||||
ET.SubElement(paths,'path',value=os.path.relpath(p,project).replace(os.sep,'/'))
|
||||
defines=ET.SubElement(options,'defines')
|
||||
@@ -114,15 +116,14 @@ def make_target(project:Path,profile:dict,cpu:str,build_id:str,source:Path|None,
|
||||
custom=ET.SubElement(options,'custom_options')
|
||||
for flag in COMPILER_OPTIONS:ET.SubElement(custom,'option').text=flag
|
||||
libraries=ET.SubElement(options,'library_paths')
|
||||
for p in extras.get('library_paths',[]):
|
||||
p=Path(p).resolve()
|
||||
for p in library_paths:
|
||||
if not p.is_dir():raise ProbeError('Native library path missing: '+str(p))
|
||||
ET.SubElement(libraries,'path',value=os.path.relpath(p,project).replace(os.sep,'/'))
|
||||
# Android SDK versions deliberately inherited from the locked CGE image.
|
||||
ET.indent(root)
|
||||
ET.ElementTree(root).write(project/'CastleEngineManifest.xml',encoding='utf-8',xml_declaration=True)
|
||||
description={'profile':profile['id'],'name':name,'package':'org.kammobile.archprobe.'+profile['id'].replace('_',''),
|
||||
'cpu':cpu,'units':units,'game_unit':profile.get('game_unit','GameInitialize'),'source_paths':[str(p) for p in include],
|
||||
'cpu':cpu,'units':units,'game_unit':profile.get('game_unit','GameInitialize'),'source_paths':[str(p) for p in compiler_source_paths],
|
||||
'compiler_options':COMPILER_OPTIONS,'upstream_defines':UPSTREAM_DEFINES if units else [],
|
||||
'assets':entries,'shims':False}
|
||||
write_json(project/'target.json',description)
|
||||
|
||||
Reference in new issue
Block a user