Skip to content
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

Carthage supports #9

Open
shoheiyokoyama opened this issue Aug 13, 2018 · 3 comments
Open

Carthage supports #9

shoheiyokoyama opened this issue Aug 13, 2018 · 3 comments

Comments

@shoheiyokoyama
Copy link

shoheiyokoyama commented Aug 13, 2018

Hi

Thanks for this great library.

The Chronology release version is not available now.
I installed with master branch by using Carthage, but it is useful to release the current version.
Thanks.

@shoheiyokoyama shoheiyokoyama changed the title Release version Carthage supports Aug 13, 2018
@elitalon
Copy link
Contributor

There is ongoing work (Carthage/Carthage#1945) to support this from Carthage's side, but it seems to be a tricky problem to solve.

In the meantime we could attach pre-built frameworks to releases, which Carthage can pick up instead of building the library from scratch. Some automation would be needed for that, though.

@elitalon
Copy link
Contributor

This script shows how we could build a universal framework for iOS:

#!/usr/bin/env bash

set -o nounset
set -o errexit

readonly FRAMEWORK=Time
readonly BUILD=build
readonly FRAMEWORK_PATH=${FRAMEWORK}.framework

function prepare_environment {
    swift package generate-xcodeproj

    rm -rf ${BUILD}
    rm -f ${FRAMEWORK}-iOS.framework.tar.gz

    xcodebuild clean
}

function archive_platform_frameworks {
    xcodebuild archive -sdk iphoneos SYMROOT=${BUILD}
    xcodebuild build -sdk iphonesimulator SYMROOT=${BUILD}

    cp -RL ${BUILD}/Release-iphoneos ${BUILD}/Release-universal
    cp -RL ${BUILD}/Release-iphonesimulator/${FRAMEWORK_PATH}/Modules/${FRAMEWORK}.swiftmodule/* \
        ${BUILD}/Release-universal/${FRAMEWORK_PATH}/Modules/${FRAMEWORK}.swiftmodule
}

function generate_universal_framework {
    lipo -create \
        ${BUILD}/Release-iphoneos/${FRAMEWORK_PATH}/${FRAMEWORK} \
        ${BUILD}/Release-iphonesimulator/${FRAMEWORK_PATH}/${FRAMEWORK} \
        -output ${BUILD}/Release-universal/${FRAMEWORK_PATH}/${FRAMEWORK}
}

function package_framework_and_dsym {
    tar -czv -C ${BUILD}/Release-universal -f ${FRAMEWORK}-iOS.tar.gz \
        ${FRAMEWORK_PATH} ${FRAMEWORK_PATH}.dSYM
}


function main {
    prepare_environment
    archive_platform_frameworks
    generate_universal_framework
    package_framework_and_dsym
}

main

I attached the resulting framework to the 0.9.0 release of my fork and tested using an example iOS project.

@davedelong Do you think it's worth continuing in this direction?

@davedelong
Copy link
Owner

This would be a great addition! If you could get this to work via Github Actions (perhaps with this? https://github.com/actions/create-release) I'll merge it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants