<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Daniel Duan's Articles About Carthage</title>
        <link>https://duan.ca/tag/carthage/</link>
        <atom:link href="https://duan.ca/tag/carthage/feed.xml" rel="self" type="application/rss+xml" />
            <item>
                <title>Making An Open-Source Swift Project</title>
                <description>&#60;p&#62;This video shows what it takes to open source a Swift project. Starting from some code in a playground,
I created a framework that supports distribution via Swift Package Manager, CocoaPods, Xcode project and
Carthage. The framework can be used across iOS, macOS, watchOS, tvOS and Linux. In addition, we also added
SwiftLint to the project, added a Makefile, put everything on GitHub and set up continuous integration via
Travis. README, COC, LICENSE and CHANGELOG are stubbed in as well.&#60;/p&#62;
&#60;div class=&#34;video-container&#34;&#62;
    &#60;iframe src=&#34;https://www.youtube.com/embed/pA0T1CdqMt8&#34; frameborder=&#34;0&#34; gesture=&#34;media&#34; allow=&#34;encrypted-media&#34; allowfullscreen&#62;&#60;/iframe&#62;
&#60;/div&#62;
&#60;p&#62;This is not at all a comprehensive list of things a good Open Source project should have. We are still missing
the version tag, documentation generation, automatic Carthage binary generation, test coverage...&#60;/p&#62;
&#60;p&#62;Anyways, here&#39;s some stuff mentioned in the video:&#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;Sample project from the video: &#60;a href=&#34;https://github.com/dduan/BitArray&#34;&#62;https://github.com/dduan/BitArray&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;Video of me writing the code in this project: &#60;a href=&#34;https://www.youtube.com/watch?v=-k_jrIoD56k&#34;&#62;https://www.youtube.com/watch?v=-k_jrIoD56k&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;Swift Package Manager: &#60;a href=&#34;https://swift.org/package-manager/&#34;&#62;https://swift.org/package-manager/&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;CocoaPods: &#60;a href=&#34;https://cocoapods.org&#34;&#62;https://cocoapods.org&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;Carthage: &#60;a href=&#34;https://github.com/Carthage/Carthage&#34;&#62;https://github.com/Carthage/Carthage&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;Xcconfigs for universal framework: &#60;a href=&#34;https://github.com/mrackwitz/xcconfigs&#34;&#62;https://github.com/mrackwitz/xcconfigs&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;SwiftLint: &#60;a href=&#34;https://github.com/realm/SwiftLint&#34;&#62;https://github.com/realm/SwiftLint&#60;/a&#62;&#60;/li&#62;
&#60;li&#62;Travis CI: &#60;a href=&#34;https://travis-ci.org&#34;&#62;https://travis-ci.org&#60;/a&#62;&#60;/li&#62;
&#60;/ul&#62;
</description>
                <pubDate>Sun, 17 Dec 2017 21:24:43 -0800</pubDate>
                <link>https://duan.ca/2017/12/17/making-an-open-source-swift-project/</link>
                <guid isPermaLink="true">https://duan.ca/2017/12/17/making-an-open-source-swift-project/</guid>
            </item>
            <item>
                <title>Distribution Tests</title>
                <description>&#60;p&#62;There are several ways to build dependencies for a Swift 3 project:
Swift Package Manager, Cocoapods, Carthage, etc. Many have an opinion on which
is the best choice for their projects. As a library author who want to help as
many people as possible, however, they can&#39;t ignore any of them.&#60;/p&#62;
&#60;p&#62;I sometimes question the sanity of that conclusion: instead of becoming an
export in each package manager, I find myself a novice of all. Did I break
support for any of them with this project change? Is it still working on
a particular platform, say, tvOS? Can I &#60;em&#62;really&#60;/em&#62; know?&#60;/p&#62;
&#60;p&#62;The only way to &#60;em&#62;really&#60;/em&#62; know is to verify yourself: both Cocoapods and
Carthage support four platforms -- iOS, macOS, watchOS, tvOS; Swift Package
Manager only works on Mac or Linux. So that&#39;s 2*4+1=9 targets. All these
targets need is have the library in question fetched and imported. Every Swift
library author should have such verification before publishing updates of
their project.&#60;/p&#62;
&#60;p&#62;The steps to verify can be triggered with commands: fetch and build
dependencies, build Xcode/Swift project. To automate the process, put these
commands in a script or a Makefile. But wait, there&#39;s more! One shouldn&#39;t have
to create these dummy projects every time they create a new library. If all
these projects do is importing a library and attempt to build, they should
work for &#60;em&#62;any&#60;/em&#62; library. The config in &#60;code&#62;Package.swift&#60;/code&#62;/&#60;code&#62;Cocoapods&#60;/code&#62;/&#60;code&#62;Cartfile&#60;/code&#62;
and the &#60;code&#62;import&#60;/code&#62; statements just needs some strings replaced: name of the next
library, URL for its git repository, etc. And that&#39;s a scriptable process as
well!&#60;/p&#62;
&#60;p&#62;To recap, one could, in theory, copy in some dummy projects, run a command to
inject information about a new library, run another command to build all these
project, verifying that support for those package managers remain functional.&#60;/p&#62;
&#60;p&#62;In reality, I have created &#60;a href=&#34;https://github.com/dduan/DistributionTests&#34;&#62;DistributionTests&#60;/a&#62; and put it
on &#60;a href=&#34;https://github.com/dduan/DistributionTests&#34;&#62;Github&#60;/a&#62; 😉.&#60;/p&#62;
&#60;p&#62;The script &#60;code&#62;customize&#60;/code&#62; requires 3 pieces of information of the library: its
import name, its git repository URL and a major version number. The assumption
here is the library generates uniformly named artifacts: the file name for
&#60;code&#62;.framework&#60;/code&#62; and the name users use to import it are the same. Testing
distribution of a library is as simple as:&#60;/p&#62;
&#60;ol&#62;
&#60;li&#62;clone the project.&#60;/li&#62;
&#60;li&#62;customize the project with &#60;code&#62;customize&#60;/code&#62;.&#60;/li&#62;
&#60;li&#62;run &#60;code&#62;make&#60;/code&#62;.&#60;/li&#62;
&#60;/ol&#62;
&#60;p&#62;If you do step 1 and 2, include the projects in library&#39;s repository, then
only step 3 is necessary! This makes testing distribution methods trivial on
a continuous integration server.&#60;/p&#62;
&#60;p&#62;Go forth and create fearlessly!&#60;/p&#62;
</description>
                <pubDate>Mon, 10 Oct 2016 10:34:49 -0700</pubDate>
                <link>https://duan.ca/2016/10/10/distribution-tests/</link>
                <guid isPermaLink="true">https://duan.ca/2016/10/10/distribution-tests/</guid>
            </item>
    </channel>
</rss>