scripts/build-ios-app.sh

fb4402de470e935f9add3b08fd338ec154a65045
orgstar/scripts/build-ios-app.sh

146 lines · 5028 bytes · executable

  1#!/bin/sh
  2# Builds Orgstar.app for the iOS Simulator in .build/ios-app from the OrgstarMobile product,
  3# signed ad hoc. Install with `xcrun simctl install booted .build/ios-app/Orgstar.app`.
  4# Usage: scripts/build-ios-app.sh [version]
  5set -eu
  6
  7cd "$(dirname "$0")/.."
  8version="${1:-0.1.0}"
  9app=".build/ios-app/Orgstar.app"
 10products=".build/ios/Build/Products/Debug-iphonesimulator"
 11
 12for scheme in OrgstarMobile OrgstarQuickLook; do
 13    xcodebuild -scheme "$scheme" -destination 'generic/platform=iOS Simulator' -derivedDataPath .build/ios build -quiet
 14done
 15
 16rm -rf "$app"
 17mkdir -p "$app"
 18cp "$products/OrgstarMobile" "$app/OrgstarMobile"
 19for bundle in "$products"/*.bundle; do
 20    [ -e "$bundle" ] && cp -R "$bundle" "$app/"
 21done
 22
 23cat > "$app/Info.plist" <<PLIST
 24<?xml version="1.0" encoding="UTF-8"?>
 25<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 26<plist version="1.0">
 27<dict>
 28    <key>CFBundleIdentifier</key>
 29    <string>sh.krz.orgstar</string>
 30    <key>CFBundleName</key>
 31    <string>Orgstar</string>
 32    <key>CFBundleDisplayName</key>
 33    <string>Orgstar</string>
 34    <key>CFBundleExecutable</key>
 35    <string>OrgstarMobile</string>
 36    <key>CFBundlePackageType</key>
 37    <string>APPL</string>
 38    <key>CFBundleShortVersionString</key>
 39    <string>${version}</string>
 40    <key>CFBundleVersion</key>
 41    <string>${version}</string>
 42    <key>CFBundleSupportedPlatforms</key>
 43    <array><string>iPhoneSimulator</string></array>
 44    <key>MinimumOSVersion</key>
 45    <string>26.0</string>
 46    <key>UIDeviceFamily</key>
 47    <array><integer>1</integer><integer>2</integer></array>
 48    <key>UILaunchScreen</key>
 49    <dict/>
 50    <key>UIApplicationSceneManifest</key>
 51    <dict>
 52        <key>UIApplicationSupportsMultipleScenes</key>
 53        <true/>
 54    </dict>
 55    <key>UISupportedInterfaceOrientations</key>
 56    <array>
 57        <string>UIInterfaceOrientationPortrait</string>
 58        <string>UIInterfaceOrientationLandscapeLeft</string>
 59        <string>UIInterfaceOrientationLandscapeRight</string>
 60    </array>
 61    <key>UISupportedInterfaceOrientations~ipad</key>
 62    <array>
 63        <string>UIInterfaceOrientationPortrait</string>
 64        <string>UIInterfaceOrientationPortraitUpsideDown</string>
 65        <string>UIInterfaceOrientationLandscapeLeft</string>
 66        <string>UIInterfaceOrientationLandscapeRight</string>
 67    </array>
 68    <!-- public.text, not public.plain-text as on the Mac: iOS previews plain text itself and
 69         never asks the Quick Look extension. -->
 70    <key>UTImportedTypeDeclarations</key>
 71    <array>
 72        <dict>
 73            <key>UTTypeIdentifier</key>
 74            <string>org.orgmode.org</string>
 75            <key>UTTypeDescription</key>
 76            <string>Org document</string>
 77            <key>UTTypeConformsTo</key>
 78            <array><string>public.text</string></array>
 79            <key>UTTypeTagSpecification</key>
 80            <dict>
 81                <key>public.filename-extension</key>
 82                <array><string>org</string><string>org_archive</string></array>
 83            </dict>
 84        </dict>
 85    </array>
 86    <key>CFBundleURLTypes</key>
 87    <array>
 88        <dict>
 89            <key>CFBundleURLName</key>
 90            <string>org-protocol</string>
 91            <key>CFBundleURLSchemes</key>
 92            <array><string>org-protocol</string></array>
 93        </dict>
 94    </array>
 95</dict>
 96</plist>
 97PLIST
 98
 99# Quick Look previews of org files, in Files and wherever else Quick Look shows them.
100appex="$app/PlugIns/OrgstarQuickLook.appex"
101mkdir -p "$appex"
102cp "$products/OrgstarQuickLook" "$appex/OrgstarQuickLook"
103cat > "$appex/Info.plist" <<PLIST
104<?xml version="1.0" encoding="UTF-8"?>
105<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
106<plist version="1.0">
107<dict>
108    <key>CFBundleIdentifier</key>
109    <string>sh.krz.orgstar.quicklook</string>
110    <key>CFBundleName</key>
111    <string>OrgstarQuickLook</string>
112    <key>CFBundleDisplayName</key>
113    <string>Orgstar</string>
114    <key>CFBundleExecutable</key>
115    <string>OrgstarQuickLook</string>
116    <key>CFBundlePackageType</key>
117    <string>XPC!</string>
118    <key>CFBundleShortVersionString</key>
119    <string>${version}</string>
120    <key>CFBundleVersion</key>
121    <string>${version}</string>
122    <key>CFBundleSupportedPlatforms</key>
123    <array><string>iPhoneSimulator</string></array>
124    <key>MinimumOSVersion</key>
125    <string>26.0</string>
126    <key>NSExtension</key>
127    <dict>
128        <key>NSExtensionPointIdentifier</key>
129        <string>com.apple.quicklook.preview</string>
130        <key>NSExtensionPrincipalClass</key>
131        <string>PreviewProvider</string>
132        <key>NSExtensionAttributes</key>
133        <dict>
134            <key>QLSupportedContentTypes</key>
135            <array><string>org.orgmode.org</string></array>
136            <key>QLIsDataBasedPreview</key>
137            <true/>
138        </dict>
139    </dict>
140</dict>
141</plist>
142PLIST
143codesign --force --sign - "$appex"
144
145codesign --force --sign - "$app"
146echo "$app"
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form