xctool
2013-11-05 21:11
302 查看
http://nshipster.com/xctool/
Control the build system, and you control the destiny of the language, its ecosystem, and community.
Objective-C has changed so very much in such a very short timespan. In just a few short years, the language has gone from humdrum NeXT vestige to a position
of commanding influence. A significant portion of these prolific contributions from the open source community for Objective-C has been directly enabled and encouraged by increased ownership around tooling.
CocoaPods, in particular, exemplifies the compounding influences of technology and community. Now two years into the project, there are over 2,700 community-submitted
libraries and frameworks that can be integrated into your own project with a simple
Dependency management is just one of the many aspects of iOS and Mac OS X development that have been dramatically improved by the community. Other examples include provisioning
and distribution automation, bug reporting, and documentation.
But this week, our focus is on a tool that redefines the actual build process itself, to serve as the foundation for a new generation of tooling and integration:
by Fred Potter that came from his work on build system automation at Facebook.
It is a drop-in replacement for
the utility underlying Xcode.app itself.
When you click "Build & Run" in Xcode, all of the project, build target, and scheme settings are passed to
build commands to create and then launch an
Don't get me wrong—it's a blessing that things work in this way, instead of, say, Xcode wrapping its own private build system in a way that was inaccessible from outside the application. But anyone who has ever attempted to interact with
Terminal.app can attest to its... less-than-streamlined experience.
Rather than belabor the point by enumerating all of the flaws in this decade-old utility, let's cut to the hero of the story—XCtool—to show how it improves on the status quo:
The first you'll notice about
As consumers of Apple hardware and software ourselves, the role of design cannot be under-stated. In this respect,
nails it. Every step of the build process is neatly organized and reported in a way that is understandable and visually appealing, with ANSI colorization and a splash of Unicode ornamentation.
But xctool's beauty is not just skin-deep: build progress can also be reported in formats that can be read by other tools:
output.
but with with no colors or Unicode.
tool.
XML file with test results.
Compilation Database of build events which can be used by Clang Tooling based tools, e.g. OCLint.
Another major improvement over
run application tests in your project in the same way Xcode.app does (
targets, let alone run them in the simulator)
For this reason alone, xctool has great implications for the emerging discipline of continuous integration testing within the Objective-C community.
Travis CI offers free continuous integration services for open source projects (as well as a paid
plan for commercial software), and is rather unique for supporting Objective-C. It can be configured to run your test suite on every
To add Travis CI to your own Objective-C project, create an account and webservice hook, and create a
in your repository:
OCLint is a static code analyzer that inspects Objective-C (as well as C and C++) code for common sources of problems, like empty
local variables and parameters, complicated code with high NCSS or cyclomatic / NPath complexity, redundant code, code smells, and other bad practices.
Remember
option? Well, that output can be read directly by OCLint to do its magical static analysis.
At the time of writing, there is still a ways to go before this becomes widely adopted, but my hope is that, now that the cat is out of the bag, some enterprising individuals might work together to make an insanely great experience around this promising tool.
Just as with the growth population within cities, infrastructure makes all of difference. One way or another, whether by local government
mandate, emergent self-organization, or somewhere in-between, environments are changed to accommodate this growth.
Objective-C has and continues to undergo rapid growth based on the popularity of iOS. It is up to the community, in working with (and sometimes against) Apple to create infrastructure necessary to integrate so many new developers. How successful we are in this
respect determines how we understand and communicate our roles and responsibilities as professional developers.
Are we clumsy amateurs, or do we take an active role in refining our craft?
xctool, like so many other tools from the community, provide hope and, indeed, inspiration about the future of the language and its ecosystem. Let's continue to build upon these tools, to create a developer experience that we can be proud of.
Control the build system, and you control the destiny of the language, its ecosystem, and community.
Objective-C has changed so very much in such a very short timespan. In just a few short years, the language has gone from humdrum NeXT vestige to a position
of commanding influence. A significant portion of these prolific contributions from the open source community for Objective-C has been directly enabled and encouraged by increased ownership around tooling.
CocoaPods, in particular, exemplifies the compounding influences of technology and community. Now two years into the project, there are over 2,700 community-submitted
libraries and frameworks that can be integrated into your own project with a simple
pod installcommand.
Dependency management is just one of the many aspects of iOS and Mac OS X development that have been dramatically improved by the community. Other examples include provisioning
and distribution automation, bug reporting, and documentation.
But this week, our focus is on a tool that redefines the actual build process itself, to serve as the foundation for a new generation of tooling and integration:
xctool.
xctoolis an open source project
by Fred Potter that came from his work on build system automation at Facebook.
It is a drop-in replacement for
xcodebuild,
the utility underlying Xcode.app itself.
When you click "Build & Run" in Xcode, all of the project, build target, and scheme settings are passed to
xcodebuild, which invokes
build commands to create and then launch an
.ipaexecutable on the device or simulator.
Don't get me wrong—it's a blessing that things work in this way, instead of, say, Xcode wrapping its own private build system in a way that was inaccessible from outside the application. But anyone who has ever attempted to interact with
xcodebuildfrom
Terminal.app can attest to its... less-than-streamlined experience.
Rather than belabor the point by enumerating all of the flaws in this decade-old utility, let's cut to the hero of the story—XCtool—to show how it improves on the status quo:
Aesthetics & Style Points
The first you'll notice about xctoolis its gorgeous, colorized output.
As consumers of Apple hardware and software ourselves, the role of design cannot be under-stated. In this respect,
xctoolabsolutely
nails it. Every step of the build process is neatly organized and reported in a way that is understandable and visually appealing, with ANSI colorization and a splash of Unicode ornamentation.
But xctool's beauty is not just skin-deep: build progress can also be reported in formats that can be read by other tools:
xctool -reporter plain:output.txt build
Reporters
pretty: (default) a text-based reporter that uses ANSI colors and unicode symbols for pretty
output.
plain: like
pretty,
but with with no colors or Unicode.
phabricator: outputs a JSON array of build/test results which can be fed into thePhabricator code-review
tool.
junit: produces a JUnit/xUnit compatible
XML file with test results.
json-stream: a stream of build/test events as JSON dictionaries, one per line (example output).
json-compilation-database: outputs a JSON
Compilation Database of build events which can be used by Clang Tooling based tools, e.g. OCLint.
Build System Integration
Another major improvement over xcodebuildis that
xctoolwill
run application tests in your project in the same way Xcode.app does (
xcodebuildcan't discern which targets in your scheme are test
targets, let alone run them in the simulator)
For this reason alone, xctool has great implications for the emerging discipline of continuous integration testing within the Objective-C community.
Travis CI
Travis CI offers free continuous integration services for open source projects (as well as a paidplan for commercial software), and is rather unique for supporting Objective-C. It can be configured to run your test suite on every
git pushto GitHub (or your favorite SCM host), and will notify you if your most recent change-set breaks the build.
To add Travis CI to your own Objective-C project, create an account and webservice hook, and create a
.travis.ymlfile
in your repository:
.travis.yml
language: objective-c before_install: - brew update - brew install xctool script: xctool -workspace MyApp.xcworkspace -scheme MyApp test
OCLint
OCLint is a static code analyzer that inspects Objective-C (as well as C and C++) code for common sources of problems, like empty if/
else/
try/
catch/
finallystatements,unused
local variables and parameters, complicated code with high NCSS or cyclomatic / NPath complexity, redundant code, code smells, and other bad practices.
Remember
xctool's
json-compilation-databasereporter
option? Well, that output can be read directly by OCLint to do its magical static analysis.
At the time of writing, there is still a ways to go before this becomes widely adopted, but my hope is that, now that the cat is out of the bag, some enterprising individuals might work together to make an insanely great experience around this promising tool.
Just as with the growth population within cities, infrastructure makes all of difference. One way or another, whether by local government
mandate, emergent self-organization, or somewhere in-between, environments are changed to accommodate this growth.
Objective-C has and continues to undergo rapid growth based on the popularity of iOS. It is up to the community, in working with (and sometimes against) Apple to create infrastructure necessary to integrate so many new developers. How successful we are in this
respect determines how we understand and communicate our roles and responsibilities as professional developers.
Are we clumsy amateurs, or do we take an active role in refining our craft?
xctool, like so many other tools from the community, provide hope and, indeed, inspiration about the future of the language and its ecosystem. Let's continue to build upon these tools, to create a developer experience that we can be proud of.
相关文章推荐
- 《推荐系统实践》 阅读笔记
- SAM4E单片机之旅——5、LED呼吸和PWM
- Expression Blend实例中文教程(4) - 布局控件快速入门Canvas
- 页面局部加载,适合Ajax Loading场景(Demo整理)
- [Unity3d]U3d中基本GUI控件
- 【PS】简单操作
- java socket编程
- [Unity3d]U3d中基本GUI控件
- 管理类
- FZU 2087 统计树边 Kruskal变形求边的数目
- 做到30条业绩翻十倍
- linux安装pylab
- Vlan间路由
- HashMap实现原理分析
- shell模拟seq功能及shellfor循环总结
- uva 11176 - Winning Streak(期望)
- P1092全排列
- codechef (大数据素数筛法)
- Windows驱动_WSK驱动之二WSK的操作
- 容器的end()方法