You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.7 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPaths = getPaths;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* paths returned:
* iosProjectDirectory - root directory of an (uncompiled) xcworkspace and obj-c source tree
* projectName - xcworkspace project name normalized from context.config
* supportingDirectory - location of Info.plist, xib files, etc. during configuration.
* for an unbuilt app this is underneath iosProjectDirectory. for a compiled app it's just
* a path to the flat xcarchive.
* intermediatesDirectory - temporary spot to write whatever files are needed during the
* detach/build process but can be discarded afterward.
*/
function getPaths(context) {
let iosProjectDirectory;
let projectName;
let supportingDirectory;
let projectRootDirectory;
if (context.build.isExpoClientBuild()) {
projectName = 'Exponent';
} else if (context.isAnonymous()) {
projectName = 'ExpoKitApp';
} else if (context.config && context.config.name) {
const projectNameLabel = context.config.name;
projectName = projectNameLabel.replace(/[^a-z0-9_-]/gi, '-').toLowerCase();
} else {
throw new Error('Cannot configure an Expo project with no name.');
}
if (context.type === 'user') {
projectRootDirectory = context.data.projectPath;
iosProjectDirectory = _path().default.join(context.data.projectPath, 'ios');
supportingDirectory = _path().default.join(iosProjectDirectory, projectName, 'Supporting');
} else if (context.type === 'service') {
projectRootDirectory = _path().default.dirname(context.build.ios.workspaceSourcePath);
iosProjectDirectory = context.build.ios.workspaceSourcePath;
if (context.data.archivePath) {
// compiled archive has a flat NSBundle
supportingDirectory = context.data.archivePath;
} else {
supportingDirectory = _path().default.join(iosProjectDirectory, projectName, 'Supporting');
}
} else {
throw new Error(`Unsupported StandaloneContext type: ${context.type}`);
}
// sandbox intermediates directory by workspace so that concurrently operating
// contexts do not interfere with one another.
const intermediatesDirectory = _path().default.join(iosProjectDirectory, context.build.isExpoClientBuild() ? 'ExponentIntermediates' : 'ExpoKitIntermediates');
return {
projectRootDirectory,
intermediatesDirectory,
iosProjectDirectory,
projectName,
supportingDirectory
};
}
//# sourceMappingURL=IosWorkspace.js.map