Running Xcode Docc Documentation via Apache Locally on Macos

Running Xcode DocC documentation via Apache locally on macOS

  • Get the SlothCreator example project and build the documentation archive in Xcode or the command line as described in Distributing Documentation to External Developers

  • Install httpd via Homebrew:

    brew install httpd
  • Copy SlothCreator.doccarchive to /opt/homebrew/var/www/ (paths are for M1 Macs)

  • Edit /opt/homebrew/etc/httpd/httpd.conf:

    • Allow AllowOverride All for the DocumentRoot Directory

    • Enable LoadModule rewrite_module

  • Edit /opt/homebrew/var/www/.htaccess and use the example configuration as provided by Apple in Distributing Documentation to External Developers

  • Restart Apache: sudo apachectl restart

  • You should now be able to open http://localhost:8080/documentation/slothcreator/ and http://localhost:8080/tutorials/slothcreator/

Enjoy!

Notarize existing Java application for MacOS Catalina

Update as of 3rd Feb 2020 Apple have tightened the notarization requirements, answer rewritten.

Note:I required the AdoptJdk Java 11.0.7 JRE, earlier versions did not work for me.

These are my steps

  • Setup new machine (setup src code ectera)
  • Install XCode then go to Preferences:Downloads and select Install Command Line Tools
  • Using KeyChain Export Developer Id Certificate as .p12 format and import into new machine
  • Purchase and install DmgCanvas 3 ($30USD)
  • Renew Apple Developer Account
  • Setup two-step authorisation for my AppleId account (this is partly done on website and partly with iCloud app)
  • Create app specific password (make a note will need for dmgCanvas options)
  • Install AdoptJdk Java 11.0.7 for building
  • Install AdoptJdk Java 11.0.7 JRE for bundling inside app
  • Create songkong.entitlements file
  • Configure build.xml file used by Appbundler InfiniteKind fork to refer directly to the AdoptOpenJDK JRe build
  • Configure build script to sign the bundle created by appbundler, ensuring we use the new signing options required (e.g -runtime, --entitlements, --timestamp)
  • The build script then create a dmg using dmgCanvas, and this additionally signs the dmg and sends it to Apple for notarization

build.xml includes:

<runtime dir="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jre/Contents/Home"/>

buildosx.sh is

#!/bin/bash
#set -x

cd /Users/paul/code/jthink/songkong
sudo rm -fr /Applications/SongKong.app
mvn -f pommacos.xml -DskipTests=true install
rm -fr target/songkong-6.9
unzip target/songkong-6.9-distribution.zip -d target
ant
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
/usr/bin/codesign --timestamp --options runtime \
--entitlements /Users/paul/code/jthink/songkong/songkong.entitlements \
--sign "Developer ID Application: P Taylor" \
--force --deep --verbose /Applications/SongKong.app
/usr/bin/codesign -vvv --deep --strict /Applications/SongKong.app
spctl -a -t exec -vv /Applications/SongKong.app
cd /Users/paul/code/jthink/SongKong
/usr/local/bin/dmgcanvas /Users/paul/code/jthink/SongKong/dmgCanvas_songkong.dmgCanvas \
/Users/paul/songkong-osx.dmg \
-v SongKong -identity "Developer ID Application: P Taylor" \
-notarizationAppleID paultaylor@jthink.net \
-notarizationPassword password \
-notarizationPrimaryBundleID songkong

SongKong entitlements file is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>

Note:I have also tried this with referring to AdoptJdk Java 11.0.7 JDK build.xml and that also builds without issue (although of course end up witha much larger dmg)



Related Topics



Leave a reply



Submit