Class: Motion::Project::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/motion/project/project.rb

Instance Method Summary collapse

Instance Method Details

#codesign_with_sparkle(config, platform) ⇒ Object Also known as: codesign

The XPC services are already residing in the Sparkle package. But we need to re-sign the entire package to ensure all executables have the hardened runtime and correct certificate.




38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/motion/project/project.rb', line 38

def codesign_with_sparkle(config, platform)
  if App.config.embedded_frameworks.any? { |item| item.to_s.include?('Sparkle.framework') }
    bundle_path = App.config.app_bundle('MacOSX')
    sparkle_path = File.join(bundle_path, 'Frameworks', 'Sparkle.framework')

    # strip out any header files, as they are not needed for a built product, and Xcode
    # typically does this.  Their permissions are set such that it conflicts
    # with building the deltas. See https://github.com/sparkle-project/Sparkle/issues/1972
    `rm -fr "#{sparkle_path}/Versions/B/PrivateHeaders"`
    `rm "#{sparkle_path}/PrivateHeaders"`
    `rm -fr "#{sparkle_path}/Versions/B/Headers"`
    `rm "#{sparkle_path}/Headers"`

    `/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/Autoupdate"`
    `/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/Updater.app"`
    `/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}/Versions/B/XPCServices/Installer.xpc"`
    `/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime --entitlements "./vendor/Pods/Sparkle/Entitlements/Downloader.entitlements" "#{sparkle_path}/Versions/B/XPCServices/Downloader.xpc"` # rubocop:disable Layout/LineLength

    `/usr/bin/codesign -f -s "#{config.codesign_certificate}" -o runtime "#{sparkle_path}"`
  end

  codesign_without_sparkle(config, platform)
end