diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a1a118c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "CarthageScripts"] + path = CarthageScripts + url = https://github.com/flinto/CarthageScripts.git diff --git a/.travis.yml b/.travis.yml index b134812..9431cf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: script: xcodebuild test -scheme RK4Spring_iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.0' before_deploy: -- ./script/build.sh --no-skip-current +- ./CarthageScripts/build-static-framework.sh - carthage archive $FRAMEWORK_NAME deploy: provider: releases diff --git a/CarthageScripts b/CarthageScripts new file mode 160000 index 0000000..5eddecb --- /dev/null +++ b/CarthageScripts @@ -0,0 +1 @@ +Subproject commit 5eddecb42cbe14da3c41030b1bdee562e64f6e2f diff --git a/RK4SpringDemo.xcodeproj/project.pbxproj b/RK4SpringDemo.xcodeproj/project.pbxproj index c1a06f5..3064b77 100644 --- a/RK4SpringDemo.xcodeproj/project.pbxproj +++ b/RK4SpringDemo.xcodeproj/project.pbxproj @@ -199,6 +199,7 @@ 6E3BBB531F1E757800894AF1 /* Frameworks */, 6E3BBB541F1E757800894AF1 /* Headers */, 6E3BBB551F1E757800894AF1 /* Resources */, + 6EDE4D551F1EA742007374E1 /* Copy framework to Carthage folder */, ); buildRules = ( ); @@ -217,6 +218,7 @@ 6E3BBB651F1E759800894AF1 /* Frameworks */, 6E3BBB661F1E759800894AF1 /* Headers */, 6E3BBB671F1E759800894AF1 /* Resources */, + 6EE360371F1EB3E80055A1DB /* Copy framework to Carthage folder */, ); buildRules = ( ); @@ -276,6 +278,7 @@ TargetAttributes = { 6E3BBB561F1E757800894AF1 = { CreatedOnToolsVersion = 9.0; + LastSwiftMigration = 0900; }; 6E3BBB681F1E759800894AF1 = { CreatedOnToolsVersion = 9.0; @@ -287,7 +290,7 @@ }; 6E3C28B51C20A02200CAD137 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; }; }; @@ -345,6 +348,37 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 6EDE4D551F1EA742007374E1 /* Copy framework to Carthage folder */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy framework to Carthage folder"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "$SRCROOT/CarthageScripts/copy_framework.sh\n "; + }; + 6EE360371F1EB3E80055A1DB /* Copy framework to Carthage folder */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy framework to Carthage folder"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "$SRCROOT/CarthageScripts/copy_framework.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 6E3BBB521F1E757800894AF1 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -728,7 +762,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.flinto.RK4SpringDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -742,7 +776,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.flinto.RK4SpringDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/RK4SpringDemo/ViewController.swift b/RK4SpringDemo/ViewController.swift index e4726c7..8fe972f 100644 --- a/RK4SpringDemo/ViewController.swift +++ b/RK4SpringDemo/ViewController.swift @@ -7,6 +7,7 @@ // import Cocoa +import RK4Spring class CustomView : NSView { @@ -16,9 +17,9 @@ class CustomView : NSView { class ViewController: NSViewController { - dynamic var tension:Double = 950 - dynamic var friction:Double = 60 - dynamic var velocity:Double = 0 + @objc dynamic var tension:Double = 950 + @objc dynamic var friction:Double = 60 + @objc dynamic var velocity:Double = 0 @IBOutlet weak var customView:CustomView! var shape:CAShapeLayer! diff --git a/script/build.sh b/script/build.sh deleted file mode 100755 index 3b551f0..0000000 --- a/script/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) -trap 'rm -f "$xcconfig"' INT TERM HUP EXIT - -echo "LD = $PWD/script/ld.py" >> $xcconfig -echo "DEBUG_INFORMATION_FORMAT = dwarf" >> $xcconfig - -export XCODE_XCCONFIG_FILE="$xcconfig" - -carthage build "$@" \ No newline at end of file diff --git a/script/ld.py b/script/ld.py deleted file mode 100755 index c86bc48..0000000 --- a/script/ld.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python - -import argparse -import subprocess - - -def ld_command(arch, isysroot, filelist, output): - return [ - "libtool", - "-static", - "-arch_only", arch, - "-syslibroot", isysroot, - "-filelist", filelist, - "-o", output, - ] - - -def build_parser(): - parser = argparse.ArgumentParser() - parser.add_argument("-arch", required=True) - parser.add_argument("-isysroot", required=True) - parser.add_argument("-filelist", required=True) - parser.add_argument("-o", dest="output", required=True) - return parser - -if __name__ == "__main__": - arguments, _ = build_parser().parse_known_args() - command = ld_command(arguments.arch, arguments.isysroot, - arguments.filelist, arguments.output) - print("-------------------------------------------------------------") - print(" ".join(command)) - print(subprocess.check_output(command)) \ No newline at end of file