feat(core): first steps in creating a macOS bundle

This commit is contained in:
Federico Terzi 2021-06-05 19:10:31 +02:00
parent 7e322f93dd
commit 4ddd061a0f
3 changed files with 65 additions and 0 deletions

View File

@ -1,6 +1,35 @@
[config] [config]
default_to_workspace = false default_to_workspace = false
[tasks.build-debug]
command = "cargo"
args = ["build"]
# TODO: we need to pass the version (debug/release) to the create-bundle task
[tasks.create-bundle]
script = '''
TARGET_DIR=target/mac/Espanso.app
VERSION=$(cat espanso/Cargo.toml | grep version | head -1 | awk -F '"' '{ print $2 }')
mkdir -p $TARGET_DIR/Contents
mkdir -p $TARGET_DIR/Contents/MacOS
mkdir -p $TARGET_DIR/Contents/Resources
sed -e "s/VERSION/$VERSION/" espanso/src/res/macos/Info.plist > $TARGET_DIR/Contents/Info.plist
/bin/echo "APPL????" > $TARGET_DIR/Contents/PkgInfo
cp -f espanso/src/res/macos/icon.icns $TARGET_DIR/Contents/Resources/icon.icns
cp -f target/debug/espanso $TARGET_DIR/Contents/MacOS/espanso
'''
dependencies=["build-debug"]
[tasks.run-debug-bundle]
command="target/mac/Espanso.app/Contents/MacOS/espanso"
args=["${@}"]
dependencies=["create-bundle"]
[tasks.test] [tasks.test]
command = "cargo" command = "cargo"
args = ["test", "--workspace", "--exclude", "espanso-modulo", "--no-default-features"] args = ["test", "--workspace", "--exclude", "espanso-modulo", "--no-default-features"]

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIdentifier</key>
<string>com.federicoterzi.espanso</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>espanso</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleName</key>
<string>Espanso</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>VERSION</string>
<key>CFBundleShortVersionString</key>
<string>VERSION</string>
<key>CFBundleGetInfoString</key>
<string>Espanso version VERSION (C) 2019-2021 Federico Terzi</string>
<key>CFBundleLongVersionString</key>
<string>VERSION (C) 2019-2021 Federico Terzi</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2019-2021 Federico Terzi</string>
<key>LSRequiresCarbon</key>
<true/>
</dict>
</plist>

Binary file not shown.