Skip to content

Commit

Permalink
feat(ios): support app clips
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn authored and sgtcoolguy committed Sep 23, 2020
1 parent 93f91ff commit 56b8da4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ iOSBuilder.prototype.initTiappSettings = function initTiappSettings() {
productType: productType,
isWatchAppV1Extension: productType === 'com.apple.product-type.watchkit-extension',
isExtension: containsExtension && (!containsWatchKit || productType === 'com.apple.product-type.watchkit-extension'),
isAppClip: productType === 'com.apple.product-type.application.on-demand-install-capable',
isWatchAppV1: productType === 'com.apple.product-type.application.watchapp',
isWatchAppV2orNewer: containsWatchApp && productType !== 'com.apple.product-type.application.watchapp',
sdkRoot: productType === 'com.apple.product-type.application.watchapp' ? 'watchos' : (buildSettings.SDKROOT || globalBuildSettings.SDKROOT || null),
Expand Down Expand Up @@ -3721,9 +3722,16 @@ iOSBuilder.prototype.createXcodeProject = function createXcodeProject(next) {
this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'PlugIns', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
} else if (targetInfo.isWatchAppV2orNewer) {
this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'Watch', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
} else if (targetInfo.isAppClip) {
const xcodeProj = path.basename(ext.projectPath);
const originPath = path.join(ext.projectPath.split(xcodeProj)[0], ext.targets[0].name);
const destinationPath = path.join(this.buildDir, ext.targets[0].name);

this.unmarkBuildDirFiles(path.join(this.xcodeAppDir, 'AppClips', xobjs.PBXFileReference[productUuid].path.replace(/^"/, '').replace(/"$/, '')));
this.copyDirSync(originPath, destinationPath);
}

if (targetInfo.isExtension || targetInfo.isWatchAppV2orNewer) {
if (targetInfo.isExtension || targetInfo.isWatchAppV2orNewer || targetInfo.isAppClip) {
// add this target as a dependency of the titanium app's project
const proxyUuid = this.generateXcodeUuid(xcodeProject);
xobjs.PBXContainerItemProxy || (xobjs.PBXContainerItemProxy = {});
Expand Down Expand Up @@ -3801,8 +3809,10 @@ iOSBuilder.prototype.createXcodeProject = function createXcodeProject(next) {

if (targetInfo.isWatchAppV2orNewer) {
addEmbedBuildPhase.call(this, 'Embed Watch Content', '$(CONTENTS_FOLDER_PATH)/Watch', 16 /* type "watch app" */);
} else {
} else if (targetInfo.isExtension) {
addEmbedBuildPhase.call(this, 'Embed App Extensions', null, 13 /* type "plugin" */);
} else if (targetInfo.isAppClip) {
addEmbedBuildPhase.call(this, 'Embed App Clips', '$(CONTENTS_FOLDER_PATH)/AppClips', 16 /* type "application.on-demand-install-capable" */);
}
}
}, this);
Expand Down

0 comments on commit 56b8da4

Please sign in to comment.