80 lines
3.6 KiB
JavaScript
80 lines
3.6 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.buildAssetArchiveAsync = undefined;
|
|
|
|
/**
|
|
* Compile a .car file from the icons in a manifest.
|
|
*/
|
|
let buildAssetArchiveAsync = (() => {
|
|
var _ref = _asyncToGenerator(function* (context, destinationCARPath, intermediatesDirectory) {
|
|
if (context.type !== 'service') {
|
|
throw new Error('buildAssetArchive is only supported for service standalone contexts.');
|
|
}
|
|
(_mkdirp || _load_mkdirp()).default.sync(intermediatesDirectory);
|
|
|
|
// copy expoSourceRoot/.../Images.xcassets into intermediates
|
|
yield (0, (_ExponentTools || _load_ExponentTools()).spawnAsyncThrowError)('/bin/cp', ['-R', _path.default.join(context.data.expoSourcePath, 'Exponent', 'Images.xcassets'), _path.default.join(intermediatesDirectory, 'Images.xcassets')], {
|
|
stdio: 'inherit'
|
|
});
|
|
|
|
// make the new xcassets contain the project's icon
|
|
yield (_IosIcons || _load_IosIcons()).createAndWriteIconsToPathAsync(context, _path.default.join(intermediatesDirectory, 'Images.xcassets', 'AppIcon.appiconset'));
|
|
|
|
// compile asset archive
|
|
let xcrunargs = [].concat(['actool'], ['--minimum-deployment-target', '9.0'], ['--platform', 'iphoneos'], ['--app-icon', 'AppIcon'], ['--output-partial-info-plist', 'assetcatalog_generated_info.plist'], ['--compress-pngs'], ['--enable-on-demand-resources', 'YES'], ['--product-type', 'com.apple.product-type.application'], ['--target-device', 'iphone'], ['--target-device', 'ipad'], ['--compile', _path.default.relative(intermediatesDirectory, destinationCARPath)], ['Images.xcassets']);
|
|
/*
|
|
* Note: if you want to debug issues with `actool`, try changing to stdio: 'inherit'.
|
|
* In both success and failure cases, actool will write an enormous .plist to stdout
|
|
* which may contain the key `com.apple.actool.errors`. Great work Apple
|
|
*/
|
|
yield (0, (_ExponentTools || _load_ExponentTools()).spawnAsyncThrowError)('xcrun', xcrunargs, {
|
|
stdio: ['ignore', 'ignore', 'inherit'], // only stderr
|
|
cwd: intermediatesDirectory
|
|
});
|
|
|
|
return;
|
|
});
|
|
|
|
return function buildAssetArchiveAsync(_x, _x2, _x3) {
|
|
return _ref.apply(this, arguments);
|
|
};
|
|
})();
|
|
|
|
var _mkdirp;
|
|
|
|
function _load_mkdirp() {
|
|
return _mkdirp = _interopRequireDefault(require('mkdirp'));
|
|
}
|
|
|
|
var _path = _interopRequireDefault(require('path'));
|
|
|
|
var _ExponentTools;
|
|
|
|
function _load_ExponentTools() {
|
|
return _ExponentTools = require('./ExponentTools');
|
|
}
|
|
|
|
var _IosIcons;
|
|
|
|
function _load_IosIcons() {
|
|
return _IosIcons = _interopRequireWildcard(require('./IosIcons'));
|
|
}
|
|
|
|
var _StandaloneContext;
|
|
|
|
function _load_StandaloneContext() {
|
|
return _StandaloneContext = _interopRequireDefault(require('./StandaloneContext'));
|
|
}
|
|
|
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
|
|
exports.buildAssetArchiveAsync = buildAssetArchiveAsync;
|
|
//# sourceMappingURL=../__sourcemaps__/detach/IosAssetArchive.js.map
|