From 5cc4d45c074c18e192605188ee028c646a5cea20 Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Tue, 18 May 2021 15:55:45 +0100 Subject: [PATCH 1/6] fixed test --- Tests/RiveDelegatesTest.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/RiveDelegatesTest.swift b/Tests/RiveDelegatesTest.swift index 1fff6379..7f53dd77 100644 --- a/Tests/RiveDelegatesTest.swift +++ b/Tests/RiveDelegatesTest.swift @@ -246,7 +246,7 @@ class DelegatesTest: XCTestCase { XCTAssertEqual(delegate.states.count, 0) // lets just start, expect 1 change. - view.fireState(stateMachineName: "State Machine 1", inputName: "right") + view.fireState("State Machine 1", inputName: "right") // TODO: looks like we got a bit of a bug here. if we do not call this advance, // the first animation doesnt seem to get the delta applied. i think its all because of // how the @@ -273,7 +273,7 @@ class DelegatesTest: XCTestCase { XCTAssertEqual(0, delegate.states.count) // ok lets change thigns up again. - view.fireState(stateMachineName: "State Machine 1", inputName: "change") + view.fireState("State Machine 1", inputName: "change") view.advance(delta:0.0) view.advance(delta:0.4) XCTAssertEqual(true, view.isPlaying) From 54a7b4de8050ff6e9941c2bb3e5b4a0c701f2672 Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Tue, 18 May 2021 15:56:05 +0100 Subject: [PATCH 2/6] add callstacks build /merge framework scripts --- scripts/buildFramework.sh | 32 ++++++++++++++++++++++++++++++++ scripts/mergeFrameworks.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100755 scripts/buildFramework.sh create mode 100755 scripts/mergeFrameworks.sh diff --git a/scripts/buildFramework.sh b/scripts/buildFramework.sh new file mode 100755 index 00000000..11e54a2d --- /dev/null +++ b/scripts/buildFramework.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +CLEAR='\033[0m' +RED='\033[0;31m' + +function usage() { + if [ -n "$1" ]; then + echo -e "${RED}👉 $1${CLEAR}\n"; + fi + echo "Usage: $0 [-t target] [-c configuration]" + echo " -t, --target Target (iphoneos / iphonesimulator)" + echo " -c, --configuration Configuration (Debug / Release)" + echo "" + echo "Example: $0 --target iphoneos --configuration Debug" + exit 1 +} + +# parse params +while [[ "$#" > 0 ]]; do case $1 in + -t|--target) TARGET="$2"; shift;shift;; + -c|--configuration) CONFIGURATION="$2";shift;shift;; + *) usage "Unknown parameter passed: $1"; shift; shift;; +esac; done + +# verify params +if [ -z "$TARGET" ]; then usage "Target is not set"; fi; +if [ -z "$CONFIGURATION" ]; then usage "Configuration is not set."; fi; + +echo -e "Build Rive Framework" +echo -e "Configuration -> ${CONFIGURATION}, target -> ${TARGET}" + +xcodebuild -project RiveRuntime.xcodeproj -scheme RiveRuntime -sdk ${TARGET} -derivedDataPath build -configuration ${CONFIGURATION} | xcpretty \ No newline at end of file diff --git a/scripts/mergeFrameworks.sh b/scripts/mergeFrameworks.sh new file mode 100755 index 00000000..fa5dc37b --- /dev/null +++ b/scripts/mergeFrameworks.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +BASEDIR=$(pwd) + +CLEAR='\033[0m' +RED='\033[0;31m' + +function usage() { + if [ -n "$1" ]; then + echo -e "${RED}👉 $1${CLEAR}\n"; + fi + echo "Usage: $0 [-c configuration]" + echo " -c, --configuration Configuration (Debug / Release)" + echo "" + echo "Example: $0 --target iphoneos --configuration Debug" + exit 1 +} + +# parse params +while [[ "$#" > 0 ]]; do case $1 in + -c|--configuration) CONFIGURATION="$2";shift;shift;; + *) usage "Unknown parameter passed: $1"; shift; shift;; +esac; done + +echo -e "Merge Rive Frameworks" +xcodebuild -create-xcframework -framework "${BASEDIR}/build/Build/Products/${CONFIGURATION}-iphoneos/RiveRuntime.framework" -framework "${BASEDIR}/build/Build/Products/${CONFIGURATION}-iphonesimulator/RiveRuntime.framework" -output "${BASEDIR}/build/RiveRuntime.xcframework" | xcpretty \ No newline at end of file From bc6420445d25da74dd1d20e9acbf7d452a79eac8 Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Tue, 18 May 2021 15:56:33 +0100 Subject: [PATCH 3/6] add some schemes and project files.... --- RiveRuntime.xcodeproj/project.pbxproj | 12 +-- .../xcschemes/RiveRuntime.xcscheme | 81 +++++++++++++++++++ .../xcschemes/RiveRuntimeTests.xcscheme | 52 ++++++++++++ 3 files changed, 140 insertions(+), 5 deletions(-) create mode 100644 RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntime.xcscheme create mode 100644 RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntimeTests.xcscheme diff --git a/RiveRuntime.xcodeproj/project.pbxproj b/RiveRuntime.xcodeproj/project.pbxproj index 8a5d0cb2..c0d7dff8 100644 --- a/RiveRuntime.xcodeproj/project.pbxproj +++ b/RiveRuntime.xcodeproj/project.pbxproj @@ -730,8 +730,8 @@ C9C741F324FC510200EF9516 /* Rive.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Rive.mm; sourceTree = ""; }; C9CE8252263B716F00F98DDB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; C9CE825F263B7CC200F98DDB /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/iOSSupport/System/Library/Frameworks/SwiftUI.framework; sourceTree = DEVELOPER_DIR; }; - C9D60DA92512B01600AAA3A6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; - C9D60DAB2512B04B00AAA3A6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; + C9D60DA92512B01600AAA3A6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; + C9D60DAB2512B04B00AAA3A6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -2027,7 +2027,7 @@ C9C73EE624FC478900EF9516 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - BUILD_LIBRARY_FOR_DISTRIBUTION = NO; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; @@ -2058,7 +2058,7 @@ C9C73EE724FC478900EF9516 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - BUILD_LIBRARY_FOR_DISTRIBUTION = NO; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; @@ -2068,7 +2068,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; - "HEADER_SEARCH_PATHS[arch=*]" = Rive/include; + "HEADER_SEARCH_PATHS[arch=*]" = "submodules/rive-cpp/include"; INFOPLIST_FILE = Source/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( @@ -2077,9 +2077,11 @@ "@loader_path/Frameworks", ); MARKETING_VERSION = 0.6.5; + MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = rive.app.ios.runtime.RiveRuntime; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntime.xcscheme b/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntime.xcscheme new file mode 100644 index 00000000..d49ac5bf --- /dev/null +++ b/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntime.xcscheme @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntimeTests.xcscheme b/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntimeTests.xcscheme new file mode 100644 index 00000000..88b032ea --- /dev/null +++ b/RiveRuntime.xcodeproj/xcshareddata/xcschemes/RiveRuntimeTests.xcscheme @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + From 8e471b4e09f973e3256cf243c50f140bb31ab5fa Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Tue, 18 May 2021 15:58:28 +0100 Subject: [PATCH 4/6] adding podspec template --- .github/workflows/podspec.txt | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/podspec.txt diff --git a/.github/workflows/podspec.txt b/.github/workflows/podspec.txt new file mode 100644 index 00000000..b89c3387 --- /dev/null +++ b/.github/workflows/podspec.txt @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = "RiveRuntime" + spec.version = "$RELEASE_VERSION" + spec.summary = "iOS SDK for Rive" + spec.description = "Rive iOS framework" + spec.homepage = "https://rive.app" + spec.license = { :type => "MIT", :text => <<-LICENSE + Copyright (c) 2020-2021 Rive + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + } + spec.authors = { "$GITHUB_AUTHOR" => "$(git config user.email)" } + spec.platform = :ios, '11.3' + spec.ios.deployment_target = '11.3' + spec.swift_version = '5.0' + spec.source = { + :git => "https://github.com/rive-app/ios-test.git", + :tag => "v#{spec.version}" + } + spec.ios.vendored_frameworks = 'RiveRuntime.xcframework' + spec.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } + spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } +end \ No newline at end of file From e9d4751fbcba3024c2d1f04d88c0f836676354d9 Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Tue, 18 May 2021 16:02:48 +0100 Subject: [PATCH 5/6] added build frameworks yaml --- .github/workflows/build_frameworks.yml | 98 ++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/build_frameworks.yml diff --git a/.github/workflows/build_frameworks.yml b/.github/workflows/build_frameworks.yml new file mode 100644 index 00000000..c59a02f7 --- /dev/null +++ b/.github/workflows/build_frameworks.yml @@ -0,0 +1,98 @@ +name: Build Rive framework + +on: + release: + types: [released] + +jobs: + build_frameworks: + name: Create RiveRuntime.xcframework + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.RIVE_REPO_PAT }} + submodules: recursive + - name: Init submodule + run: git submodule update --init + - id: build_iphoneos + name: Build release iphoneos framework + run: sh ./scripts/buildFramework.sh -t iphoneos -c Release + - id: build_iphonesimulator + name: Build release iphonesimulator framework + run: sh ./scripts/buildFramework.sh -t iphonesimulator -c Release + - id: merge_frameworks + if: steps.build_iphoneos.conclusion == 'success' && steps.build_iphonesimulator.conclusion == 'success' + name: Merge created frameworks + run: sh ./scripts/mergeFrameworks.sh -c Release + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: RiveRuntime.xcframework + path: build/RiveRuntime.xcframework + + create_podspec_file: + name: Create RiveRuntime.podspec + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + token: ${{ secrets.RIVE_REPO_PAT }} + submodules: recursive + - name: Read podspec.txt file + uses: pCYSl5EDgo/cat@master + id: podspec + with: + path: .github/workflows/podspec.txt + - name: Create *.podspec + run: | + cat > RiveRuntime.podspec <<-EOF + ${{ steps.podspec.outputs.text }} + EOF + env: + GITHUB_AUTHOR: ${{ github.actor }} + RELEASE_VERSION: ${{ github.event.release.tag_name }} + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: RiveRuntime.podspec + path: RiveRuntime.podspec + + upload_cocoapods: + name: Update podspec repository + runs-on: macos-latest + timeout-minutes: 10 + needs: [create_podspec_file, build_frameworks] + steps: + - name: Checkout podspec repo + uses: actions/checkout@v2 + with: + repository: rive-app/test-ios + token: ${{ secrets.RIVE_REPO_PAT }} + - name: Clean + run: | + rm -rf RiveRuntime.podspec + rm -rf RiveRuntime.xcframework + - name: Download framework artifact + uses: actions/download-artifact@v2 + with: + name: RiveRuntime.xcframework + path: RiveRuntime.xcframework + - name: Download podspec artifact + uses: actions/download-artifact@v2 + with: + name: RiveRuntime.podspec + - name: Lint pod + run: pod lib lint --allow-warnings + - name: Push pod to test-ios repo + run: | + git status + git config --local user.email 'hello@rive.app' + git config --local user.name ${{ github.actor }} + git add . + git commit -m "Update podspec repo tag:${{ github.event.release.tag_name }}" + git push + env: + API_TOKEN_GITHUB: ${{ secrets.RIVE_REPO_PAT }} \ No newline at end of file From e99aced818114a463925e0fb3f94f759aa594047 Mon Sep 17 00:00:00 2001 From: Maxwell Talbot Date: Wed, 19 May 2021 10:19:39 +0100 Subject: [PATCH 6/6] update license string to include license :facepalm: --- .github/workflows/podspec.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/podspec.txt b/.github/workflows/podspec.txt index b89c3387..685190bb 100644 --- a/.github/workflows/podspec.txt +++ b/.github/workflows/podspec.txt @@ -24,6 +24,7 @@ Pod::Spec.new do |spec| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + LICENSE } spec.authors = { "$GITHUB_AUTHOR" => "$(git config user.email)" } spec.platform = :ios, '11.3'