BuildIOS.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var fs = require('fs-extra');
  2. var path = require("path");
  3. var host = require("./Host");
  4. var os = require('os');
  5. var jenkinsBuild = process.env.ATOMIC_JENKINS_BUILD == 1;
  6. var atomicRoot = host.atomicRoot;
  7. var buildDir = host.artifactsRoot + "Build/IOS/";
  8. namespace('build', function() {
  9. task('ios_native', {
  10. async: true
  11. }, function() {
  12. var options = host.options;
  13. var cleanBuild = options["noclean"] ? false : true;
  14. var debug = options["debug"] ? true : false;
  15. var NETNativeSrcDir = buildDir + "Source/AtomicNET/NETNative/" + (debug ? "Debug" : "Release") + "-iphoneos/";
  16. var NETNativeDestDir = host.artifactsRoot + "AtomicNET/" + (debug ? "Debug" : "Release") + "/Native/iOS/";
  17. host.setupDirs(cleanBuild, [buildDir, NETNativeDestDir]);
  18. process.chdir(buildDir);
  19. var cmds = [];
  20. cmds.push("cmake -DIOS=1 -DATOMIC_DEV_BUILD=0 -G Xcode ../../../");
  21. if (jenkinsBuild) {
  22. cmds.push("security -v list-keychains -d system -s /Users/jenkins/Library/Keychains/codesign.keychain");
  23. cmds.push("security -v unlock-keychain /Users/jenkins/Library/Keychains/codesign.keychain");
  24. }
  25. cmds.push("xcodebuild -configuration " + (debug ? "Debug" : "Release") + " -parallelizeTargets -jobs 4");
  26. // Note that this install_name_tool invocation invalidates the code signing, Xamarin/Visual Studio should resign the binary on deploy to device
  27. cmds.push("cd \"" + NETNativeSrcDir + "\" && install_name_tool -id @rpath/AtomicNETNative.framework/AtomicNETNative AtomicNETNative.framework/AtomicNETNative");
  28. //cmds.push("cd \"" + NETNativeSrcDir + "\" && codesign --deep --force --verify --sign \"iPhone Developer\" ./AtomicNETNative.framework/");
  29. cmds.push("cd \"" + NETNativeSrcDir + "\" && zip -r AtomicNETNative.framework.zip AtomicNETNative.framework");
  30. jake.exec(cmds, function() {
  31. fs.copySync(NETNativeSrcDir + "AtomicNETNative.framework", NETNativeDestDir + "AtomicNETNative.framework");
  32. fs.copySync(NETNativeSrcDir + "AtomicNETNative.framework.zip", NETNativeDestDir + "AtomicNETNative.framework.zip");
  33. complete();
  34. }, {
  35. printStdout: true,
  36. printStderr: true
  37. });
  38. });
  39. }); // end of build namespace