-
Notifications
You must be signed in to change notification settings - Fork 100
Support watch2 apps/extensions #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b4d326f
adds watch2 target/product types
4ba466d
support adding watch2 app/extension targets
a0f2592
Merge remote-tracking branch 'upstream/master' into watchkit2-ability
b9da9d3
add watch app/extension test coverage
f13bd36
project formatting consistency
1a2c8cb
coverage for correct watch app extension path name
4438308
Merge remote-tracking branch 'upstream/master' into watchkit2-ability
9f2d745
coverage for target type
314c4c7
ensure non-watch2 extensions additions don't modify watch2 app
a1b0da2
revert comment - will fix in other pr
ed70f64
Merge remote-tracking branch 'upstream/master' into watchkit2-ability
ab22bc2
add test coverage for watch2 product types
b7bd745
watch2 file/product type test coverage
ceb33cf
watch2 coverage for target name/extension
c378c24
clarify watch2 test descriptions
96c30e0
update comment to keep consistent w/ project
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/** | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
'License'); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
var fullProject = require('./fixtures/full-project') | ||
fullProjectStr = JSON.stringify(fullProject), | ||
pbx = require('../lib/pbxProject'), | ||
pbxFile = require('../lib/pbxFile'), | ||
proj = new pbx('.'); | ||
|
||
function cleanHash() { | ||
return JSON.parse(fullProjectStr); | ||
} | ||
|
||
var TARGET_NAME = 'TestWatchApp', | ||
TARGET_TYPE = 'watch2_app', | ||
TARGET_SUBFOLDER_NAME = 'TestWatchAppFiles'; | ||
|
||
exports.setUp = function (callback) { | ||
proj.hash = cleanHash(); | ||
callback(); | ||
} | ||
|
||
exports.addWatchApp = { | ||
'should create a new watch2 app target with the correct product type': function (test) { | ||
var target = proj.addTarget(TARGET_NAME, TARGET_TYPE, TARGET_SUBFOLDER_NAME); | ||
|
||
test.ok(typeof target == 'object'); | ||
test.ok(target.uuid); | ||
test.ok(target.pbxNativeTarget); | ||
test.ok(target.pbxNativeTarget.isa); | ||
test.ok(target.pbxNativeTarget.name); | ||
test.ok(target.pbxNativeTarget.productName); | ||
test.ok(target.pbxNativeTarget.productReference); | ||
test.ok(target.pbxNativeTarget.productType); | ||
test.ok(target.pbxNativeTarget.buildConfigurationList); | ||
test.ok(target.pbxNativeTarget.buildPhases); | ||
test.ok(target.pbxNativeTarget.buildRules); | ||
test.ok(target.pbxNativeTarget.dependencies); | ||
|
||
test.equal(target.pbxNativeTarget.productType, '"com.apple.product-type.application.watchapp2"'); | ||
|
||
test.done(); | ||
}, | ||
'should create a new watch2 app target with the correct product type, without needing a subfolder name': function (test) { | ||
var target = proj.addTarget(TARGET_NAME, TARGET_TYPE); | ||
|
||
test.ok(typeof target == 'object'); | ||
test.ok(target.uuid); | ||
test.ok(target.pbxNativeTarget); | ||
test.ok(target.pbxNativeTarget.isa); | ||
test.ok(target.pbxNativeTarget.name); | ||
test.ok(target.pbxNativeTarget.productName); | ||
test.ok(target.pbxNativeTarget.productReference); | ||
test.ok(target.pbxNativeTarget.productType); | ||
test.ok(target.pbxNativeTarget.buildConfigurationList); | ||
test.ok(target.pbxNativeTarget.buildPhases); | ||
test.ok(target.pbxNativeTarget.buildRules); | ||
test.ok(target.pbxNativeTarget.dependencies); | ||
|
||
test.equal(target.pbxNativeTarget.productType, '"com.apple.product-type.application.watchapp2"'); | ||
|
||
test.done(); | ||
}, | ||
'should create a new watch2 app target and add source, framework, resource and header files and the corresponding build phases': function (test) { | ||
var target = proj.addTarget(TARGET_NAME, TARGET_TYPE, TARGET_SUBFOLDER_NAME), | ||
options = { 'target' : target.uuid }; | ||
|
||
var sourceFile = proj.addSourceFile('Plugins/file.m', options), | ||
sourcePhase = proj.addBuildPhase([], 'PBXSourcesBuildPhase', 'Sources', target.uuid), | ||
resourceFile = proj.addResourceFile('assets.bundle', options), | ||
resourcePhase = proj.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', target.uuid), | ||
frameworkFile = proj.addFramework('libsqlite3.dylib', options); | ||
frameworkPhase = proj.addBuildPhase([], 'PBXFrameworkBuildPhase', 'Frameworks', target.uuid), | ||
headerFile = proj.addHeaderFile('file.h', options); | ||
|
||
test.ok(sourcePhase); | ||
test.ok(resourcePhase); | ||
test.ok(frameworkPhase); | ||
|
||
test.equal(sourceFile.constructor, pbxFile); | ||
test.equal(resourceFile.constructor, pbxFile); | ||
test.equal(frameworkFile.constructor, pbxFile); | ||
test.equal(headerFile.constructor, pbxFile); | ||
|
||
test.ok(typeof target == 'object'); | ||
test.ok(target.uuid); | ||
test.ok(target.pbxNativeTarget); | ||
test.ok(target.pbxNativeTarget.isa); | ||
test.ok(target.pbxNativeTarget.name); | ||
test.ok(target.pbxNativeTarget.productName); | ||
test.ok(target.pbxNativeTarget.productReference); | ||
test.ok(target.pbxNativeTarget.productType); | ||
test.ok(target.pbxNativeTarget.buildConfigurationList); | ||
test.ok(target.pbxNativeTarget.buildPhases); | ||
test.ok(target.pbxNativeTarget.buildRules); | ||
test.ok(target.pbxNativeTarget.dependencies); | ||
|
||
test.done(); | ||
}, | ||
'should create a new watch2 app target and add watch build phase': function (test) { | ||
var target = proj.addTarget(TARGET_NAME, TARGET_TYPE); | ||
|
||
test.ok(typeof target == 'object'); | ||
test.ok(target.uuid); | ||
test.ok(target.pbxNativeTarget); | ||
test.ok(target.pbxNativeTarget.isa); | ||
test.ok(target.pbxNativeTarget.name); | ||
test.ok(target.pbxNativeTarget.productName); | ||
test.ok(target.pbxNativeTarget.productReference); | ||
test.ok(target.pbxNativeTarget.productType); | ||
test.ok(target.pbxNativeTarget.buildConfigurationList); | ||
test.ok(target.pbxNativeTarget.buildPhases); | ||
test.ok(target.pbxNativeTarget.buildRules); | ||
test.ok(target.pbxNativeTarget.dependencies); | ||
|
||
test.equal(target.pbxNativeTarget.productType, '"com.apple.product-type.application.watchapp2"'); | ||
|
||
var buildPhase = proj.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Watch Content', target.uuid); | ||
|
||
test.ok(buildPhase); | ||
test.ok(buildPhase.files); | ||
test.equal(buildPhase.files.length, 1); | ||
test.ok(buildPhase.dstPath); | ||
test.equal(buildPhase.dstPath, '"$(CONTENTS_FOLDER_PATH)/Watch"'); | ||
test.equal(buildPhase.dstSubfolderSpec, 16); | ||
|
||
test.done(); | ||
}, | ||
'should create a new watch2 app with appropriate target extension': function (test) { | ||
var target = proj.addTarget(TARGET_NAME, TARGET_TYPE); | ||
|
||
var buildPhase = proj.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Watch Content', target.uuid) | ||
|
||
var buildPhaseFile = buildPhase.files[0]; | ||
test.ok(buildPhaseFile.value); | ||
var buildPhaseFileSection = proj.pbxBuildFileSection()[buildPhaseFile.value]; | ||
test.ok(buildPhaseFileSection); | ||
test.ok(buildPhaseFileSection.fileRef); | ||
|
||
var buildPhaseFileRef = proj.pbxFileReferenceSection()[buildPhaseFileSection.fileRef]; | ||
test.ok(buildPhaseFileRef); | ||
test.ok(buildPhaseFileRef.name); | ||
test.ok(buildPhaseFileRef.path); | ||
|
||
var quotedTargetPath = "\"" + TARGET_NAME + ".app\""; | ||
test.equal(buildPhaseFileRef.name, quotedTargetPath); | ||
test.equal(buildPhaseFileRef.path, quotedTargetPath); | ||
|
||
test.done(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.