🐛 Fix paths for building distribution package

This commit is contained in:
Ben Chatelain 2019-01-03 16:20:15 -08:00
parent f20935517f
commit d1ba43bdd9
3 changed files with 23 additions and 17 deletions

View file

@ -4,7 +4,7 @@
<array>
<dict>
<key>BundleIsVersionChecked</key>
<false/>
<true/>
<key>BundleOverwriteAction</key>
<string>upgrade</string>
<key>ChildBundles</key>
@ -13,13 +13,13 @@
<key>BundleOverwriteAction</key>
<string></string>
<key>RootRelativeBundlePath</key>
<string>Frameworks/MasKit.framework/Versions/A/Frameworks/Commandant.framework</string>
<string>Frameworks/MasKit.framework/Versions/A/Frameworks/Result.framework</string>
</dict>
<dict>
<key>BundleOverwriteAction</key>
<string></string>
<key>RootRelativeBundlePath</key>
<string>Frameworks/MasKit.framework/Versions/A/Frameworks/Result.framework</string>
<string>Frameworks/MasKit.framework/Versions/A/Frameworks/Commandant.framework</string>
</dict>
</array>
<key>RootRelativeBundlePath</key>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="2">
<pkg-ref id="com.mphys.mas-cli"/>
<pkg-ref id="com.mphys.mas-cli" version="1.0.0" onConclusion="none">mas_components.pkg</pkg-ref>
<domains enable_localSystem="true" enable_anywhere="true" enable_currentUserHome="false" />
<options customize="never" require-scripts="false"/>
<volume-check>
@ -17,5 +17,4 @@
<choice id="com.mphys.mas-cli" visible="false">
<pkg-ref id="com.mphys.mas-cli"/>
</choice>
<pkg-ref id="com.mphys.mas-cli" version="1.0.0" onConclusion="none">../build/mas_temp.pkg</pkg-ref>
</installer-gui-script>

View file

@ -1,16 +1,22 @@
#!/bin/bash -e
BUILD_DIR="$PWD/build"
INTERNAL_PACKAGE="$BUILD_DIR/mas_temp.pkg"
OUTPUT_PACKAGE="$BUILD_DIR/mas.pkg"
COMPONENT_PACKAGE="$BUILD_DIR/mas_components.pkg"
DISTRIBUTION_PACKAGE="$BUILD_DIR/mas.pkg"
IDENTIFIER="com.mphys.mas-cli"
COMPONENTS_PLIST="Homebrew/Components.plist"
DISTRIBUTION_PLIST="Homebrew/Distribution.plist"
# Component package definition
COMPONENTS_PLIST="Package/Components.plist"
# Distribution package definition
# https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html
DISTRIBUTION_PLIST="Package/Distribution.plist"
# Destination for `xcodebuild install`
# DSTROOT will be updated if unset.
INSTALL_TEMPORARY_FOLDER=${DSTROOT:-build/distributions}
mkdir -p $INSTALL_TEMPORARY_FOLDER
VERSION=$(agvtool what-marketing-version -terse1)
@ -19,23 +25,24 @@ script/install
echo "==> 📦 Assemble an installer package"
# Assemble pkg. Using /usr/local prefix to avoid the following errors with "/"
# Assemble macOS installer component package (aka "product archive").
# Using /usr/local prefix to avoid the following errors with "/"
# - installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
# - GUI warning: This package is incompatible with this version of macOS and may fail to install. (may damage your system... )
pkgbuild \
--component-plist "$COMPONENTS_PLIST" \
--identifier "$IDENTIFIER" \
--install-location "/usr/local" \
--root "$INSTALL_TEMPORARY_FOLDER" \
--version "$VERSION" \
"$INTERNAL_PACKAGE"
--root "$INSTALL_TEMPORARY_FOLDER" \
--component-plist "$COMPONENTS_PLIST" \
"$COMPONENT_PACKAGE"
# Build 2nd pkg from 1st. Not sure why, but this is how Carthage does it.
# Build distribution package (aka "product archive"). Not sure why, but this is how Carthage does it.
# https://github.com/Carthage/Carthage/blob/master/Makefile#L87
productbuild \
--distribution "$DISTRIBUTION_PLIST" \
--package-path "$INTERNAL_PACKAGE" \
"$OUTPUT_PACKAGE"
--package-path "$BUILD_DIR" \
"$DISTRIBUTION_PACKAGE"
echo "==> 🔢 Files Hashes"
shasum -a 256 mas.pkg
shasum -a 256 "$DISTRIBUTION_PACKAGE"