Skip to content

Commit

Permalink
plist/xml -> binary is generic
Browse files Browse the repository at this point in the history
  • Loading branch information
L1ghtmann authored and 0cyn committed Jan 13, 2024
1 parent c9a8051 commit cf3d65f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/dragon/config/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ bundle:
name: "Bundle Resources"
desc: "Copying Bundle Resources"
cmd: "mkdir -p $dragon_data_dir/_$location/ && cp -R $resource_dir/ $dragon_data_dir/_$location"
plist:
name: "plutil compilation"
desc: "Compiling $in"
cmd: "$plutil -convert binary1 $in -o $out"
debug:
name: "DsymUtil"
desc: "Generating Debug Symbols for $name"
Expand Down
29 changes: 29 additions & 0 deletions src/dragon/shscripts/building
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,35 @@ build()
true
else
cp -R $DRAGON_DIR/_ "$DRAGON_DATA_DIR" 2>/dev/null

if [[ $release -eq 1 ]]; then
if command -v plutil &> /dev/null; then
cmd=plutil
elif command -v ply &> /dev/null; then
cmd=ply
elif command -v plistutill &> /dev/null; then
cmd=plistutil
fi

if ! [[ -z $cmd ]]; then
prefix_print "Converting plist/xml resources to binary"
find "$DRAGON_DATA_DIR" \( -name \*.plist -o -name \*.strings \) | while read i; do
head="$(od -c "$i" | head)"
clean_head="${head//[^[:alpha:]]/}"
magic_bytes="${clean_head:0:6}"

if ! [[ $magic_bytes == bplist ]]; then
if [[ $cmd == plutil ]]; then
plutil -convert binary1 "$i"
elif [[ $cmd == ply ]]; then
ply -c binary "$i"
else
plistutil -i "$i" -f bin -o "$i"
fi
fi
done
fi
fi
fi

cd "$projroot" || drexit
Expand Down
3 changes: 0 additions & 3 deletions src/dragongen/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ def generate_vars(self, module_variables: dict, target: str) -> dict:
project_dict['lipo'] = toolchain.lipo
if 'dsym' not in project_dict:
project_dict['dsym'] = toolchain.dsym
if 'plutil' not in project_dict:
project_dict['plutil'] = toolchain.plutil
if 'ld' not in project_dict:
project_dict['ld'] = toolchain.ld
if 'codesign' not in project_dict:
Expand Down Expand Up @@ -410,7 +408,6 @@ def generate_ninja_outline(self) -> list:
Var('lipo'),
Var('logos'),
Var('optool'),
Var('plutil'),
Var('swift'),
___,
Var('targetvers'),
Expand Down
3 changes: 0 additions & 3 deletions src/dragongen/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def __init__(self):
self.ld = ""
self.codesign = ""
self.dsym = ""
self.plutil = ""
self.lipo = ""
self.tapi = ""

Expand Down Expand Up @@ -50,7 +49,6 @@ def locate_macos_toolchain(cls, use_objcs: bool):
tc.ld = tc_dir + 'clang++'
tc.codesign = 'ldid'
tc.dsym = tc_dir + 'dsymutil'
tc.plutil = 'plutil'
# FIXME: hardcoded while I wait on a real distribution of llvm-objcs
if use_objcs:
tc.lipo = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo'
Expand Down Expand Up @@ -79,7 +77,6 @@ def locate_linux_toolchain(cls, use_objcs: bool):
tc.ld = tc_dir + 'clang++'
tc.codesign = tc_dir + 'ldid'
tc.dsym = tc_dir + 'dsymutil'
tc.plutil = 'plutil' # TODO: fixme
tc.lipo = tc_dir + 'lipo'
tc.tapi = tc_dir + 'tapi'

Expand Down

0 comments on commit cf3d65f

Please sign in to comment.