jensmeder / phoenx Goto Github PK
View Code? Open in Web Editor NEWA ruby gem to automate Xcode project generation.
Home Page: https://rubygems.org/gems/phoenx
License: MIT License
A ruby gem to automate Xcode project generation.
Home Page: https://rubygems.org/gems/phoenx
License: MIT License
Using phoenix version 0.2.3
When creating my project I get:
Generating project Test.xcodeproj
Abort trap: 6
The generated Xcode project seems ok.
Test.pxproject
From the carthage docs:
It would be very useful if phoenx could automatically check if a dSYM file is present in the same folder a framework is referenced in and include all of them a new copy build phase as described above. Example:
target.frameworks = ["../Frameworks/SZTextView.framework"]
Check if ../Frameworks/SZTextView.framework.dSYM
exist and include it if possible.
In the Specification Reference: https://github.com/jensmeder/Phoenx/wiki/Specification-Reference
The Line:
target.dependencies "name", true, "path/to/project.xcodeproj"
should be replaced with:
target.dependency "name", true, "path/to/project.xcodeproj"
And it should be mentioned how multiple dependencies can be added.
Also it seems a little bit confusing that frameworks, system frameworks and libraries are are added with a different syntax, with an =.
Executing "phoenx project extract" on an existing project creates the config files with a random(?) order. Sorting the list (by user or program) is therefore necessary.
phoenx version: 0.2.3
On a logical view support_files are not target specific.
Example:
Phoenx::Project.new do |project|
project.project_name = "Test"
project.config_files["Debug"] = "Configuration/Project/debug.xcconfig"
project.config_files["Release"] = "Configuration/Project/release.xcconfig"
project.target "TestApp", :application, :osx, '10.11' do |target|
target.config_files["Debug"] = "Configuration/App/debug.xcconfig"
target.config_files["Release"] = "Configuration/App/release.xcconfig"
target.sources = ["SourcesApp/**/*.{h,m,c,swift}"]
target.resources = ["SourcesApp/**/*.{json,png,storyboard,strings,xib}"]
target.support_files = ["Configuration/**/*.{xcconfig,plist,entitlements}","*.{pxproject}","Makefile",".gitignore"]
end
project.target "TestFramework", :framework, :osx, '10.11' do |target|
target.config_files["Debug"] = "Configuration/Framework/debug.xcconfig"
target.config_files["Release"] = "Configuration/Framework/release.xcconfig"
target.sources = ["SourcesFramework/**/*.{h,m,c,swift}"]
target.resources = ["SourcesFramework/**/*.{json,png,storyboard,strings,xib}"]
target.support_files = ["Configuration/**/*.{xcconfig,plist,entitlements}","*.{pxproject}","Makefile",".gitignore"]
end
end
In this example the support files are defined twice, but I only need them once. Adding them to the app or the framework only seems not right. The correct solution should be
project.support_files = ["Configuration/**/*.{xcconfig,plist,entitlements}","*.{pxproject}","Makefile",".gitignore"]
Maybe there are support_files that a user wants to add to a specific target (e.g. the configuration files in the example). So my suggestion is to support both solutions.
Is there a way to create a framework project without the automatically added dependency "Foundation"?
Background: I've implemented some pure swift objects. But I wasn't able to generate a framework without the linked Foundation.
Phoenx Version: 0.3.3
Right now translation folders (.lproj
) are just added as groups to the project and the .strings
files are just copied over to the bundle. This leads to the .strings
files overriding each other because they have the same name (e.g. Localisable.strings
) and are put into the same folder (the root of the bundle).
In addition they are not correctly rendered by Xcode.
Potential solution: CocoaPods/Xcodeproj#85 (comment)
It seems that phoenx do not support every type of the base xcodeproj. For example I can't generate an app_extension.
Supported target types from Xcodeproj::constants.rb
PRODUCT_TYPE_UTI = {
:application => 'com.apple.product-type.application',
:framework => 'com.apple.product-type.framework',
:dynamic_library => 'com.apple.product-type.library.dynamic',
:static_library => 'com.apple.product-type.library.static',
:bundle => 'com.apple.product-type.bundle',
:octest_bundle => 'com.apple.product-type.bundle',
:unit_test_bundle => 'com.apple.product-type.bundle.unit-test',
:ui_test_bundle => 'com.apple.product-type.bundle.ui-testing',
:app_extension => 'com.apple.product-type.app-extension',
:command_line_tool => 'com.apple.product-type.tool',
:watch_app => 'com.apple.product-type.application.watchapp',
:watch2_app => 'com.apple.product-type.application.watchapp2',
:watch_extension => 'com.apple.product-type.watchkit-extension',
:watch2_extension => 'com.apple.product-type.watchkit2-extension',
:tv_extension => 'com.apple.product-type.tv-app-extension',
:messages_application => 'com.apple.product-type.application.messages',
:messages_extension => 'com.apple.product-type.app-extension.messages',
:sticker_pack => 'com.apple.product-type.app-extension.messages-sticker-pack',
:xpc_service => 'com.apple.product-type.xpc-service',
}.freeze
Example:
Test.pxproject
phoenx version: 0.2.3
xcodeproj version: 1.3.3
When executing phoenx project build
with version 0.2.3
the generation crashes with the following stacktrace. phoenx workspace build
works flawlessly as well phoenx project build
when using version 0.2.2
.
Would be nice if you could have a look.
Cheers :-)
NoMethodError: undefined method `find_file_by_path' for nil:NilClass
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/use_cases/generate_project.rb:84:in `block in add_config_files'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/use_cases/generate_project.rb:76:in `each'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/use_cases/generate_project.rb:76:in `add_config_files'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/use_cases/generate_project.rb:27:in `build'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/cli_factory.rb:106:in `block in project_command'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:47:in `call'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:47:in `parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:59:in `block (2 levels) in parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:53:in `each'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:53:in `block in parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:51:in `each'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:51:in `parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:59:in `block (2 levels) in parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:53:in `each'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:53:in `block in parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:51:in `each'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/lib/phoenx/cli/command.rb:51:in `parse'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/gems/phoenx-0.2.3/bin/phoenx:9:in `<top (required)>'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/bin/phoenx:23:in `load'
/Users/simon/Development/COBI/iOS/COBIUtils/vendor/bundle/ruby/2.0.0/bin/phoenx:23:in `<top (required)>'
Currently the build phase to copy the frameworks is just called Copy Files
, Embed Frameworks
would be a more suitable name.
Probably has to be done here:
I've tried to use phoenx to generate a framework target and its unitest target from one folder.
Currently I use the following lines:
framework.sources = ["SourcesFramework/**/*[!c].{h,m,c,swift}"]
test.sources = ["SourcesFramework/**/*Spec.{h,m,c,swift}"]
Example:
The files *.Spec are unittest code, the other files are framework code.
Now I see a unit test file directly below the matching code file. I do not have to manage a second file structure, I can take a look into the specification without searching the unit test first and i see that StoredBoolSpec.swift is missing!.
This is amazing and only possible with phoenx!
BUT: It was only possible for me by excluding all files ending with 'c' 😒 I didn't find a better way to exclude all files ending to 'Spec'.
This doesn't work:
framework.sources = ["SourcesFramework/**/*[!Spec].{h,m,c,swift}"]
framework.sources = ["SourcesFramework/**/*[!S][!p][!e][!c].{h,m,c,swift}"]
I think, the possibilities to exclude files are currently very limited. Maybe you have a better idea.
I searched for the problem and found stackoverflow. So I think we need an additional excludedsources.
Example:
framework.sources = ["SourcesFramework/**/*.{h,m,c,swift}"]
framework.excludedsources = ["SourcesFramework/**/*Spec.{h,m,c,swift}"]
test.sources = ["SourcesFramework/**/*Spec.{h,m,c,swift}"]
What do you think about this feature?
When creating a test target with „target.test_target "MyAppUITests" do …“ the resulting target seems to be a unit test target and not a ui test target. After executing the default test case (created by new projects) it results in an error.
class MyAppUITests: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
XCUIApplication().launch() // <— error
}
override func tearDown() {
super.tearDown()
}
func testExample() {
}
}
caught "NSInternalInconsistencyException", "No target application path specified via test configuration: <XCTestConfiguration: 0x7f9d5d003a00>
testBundleURL:file:///Users/xxx/Library/Developer/Xcode/DerivedData/XXX-bklyihcfcdaewthgfqnbgffnhgnb/Build/Products/Debug-iphonesimulator/MyAppUITests.xctest/
testBundleRelativePath:(null)
productModuleName:MyAppUITests
testsToSkip:(null)
testsToRun:MyAppUITests/testExample
reportResultsToIDE:YES
sessionIdentifier:B4F9972B-…-71257DD4B42C
pathToXcodeReportingSocket:(null)
disablePerformanceMetrics:no
treatMissingBaselinesAsFailures:no
baselineFileURL:(null)
baselineFileRelativePath:(null)
targetApplicationPath:(null)
targetApplicationBundleID:(null)
testApplicationDependencies:(null)
testApplicationUserOverrides:(null)
targetApplicationArguments:
targetApplicationEnvironment:(null)
reportActivities:YES
testsMustRunOnMainThread:no
initializeForUITesting:no
aggregateStatisticsBeforeCrash:{
XCSuiteRecordsKey = {
};
}
automationFrameworkPath:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework
emitOSLogs:no
systemAttachmentLifetime:1
userAttachmentLifetime:1
"
See: https://stackoverflow.com/a/32706701 for a reason of this error.
Is it possible that Phoenx currently do not support UI Test targets?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.