From 657cb566cdb7db066da59ec4040122e7146d7a75 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 23 Sep 2018 15:25:51 +0200 Subject: [PATCH 1/3] Automate version/build numbers --- TunnelKit-iOS/Info.plist | 2 +- TunnelKit-macOS/Info.plist | 2 +- TunnelKit.xcodeproj/project.pbxproj | 12 ++++++------ TunnelKitHost/Info.plist | 2 +- TunnelKitTests/Info.plist | 2 +- ci/set_version.sh | 6 ++++++ 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100755 ci/set_version.sh diff --git a/TunnelKit-iOS/Info.plist b/TunnelKit-iOS/Info.plist index 1007fd9..a5ae6f9 100644 --- a/TunnelKit-iOS/Info.plist +++ b/TunnelKit-iOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/TunnelKit-macOS/Info.plist b/TunnelKit-macOS/Info.plist index 1007fd9..a5ae6f9 100644 --- a/TunnelKit-macOS/Info.plist +++ b/TunnelKit-macOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/TunnelKit.xcodeproj/project.pbxproj b/TunnelKit.xcodeproj/project.pbxproj index 5e7eb7f..ce36f05 100644 --- a/TunnelKit.xcodeproj/project.pbxproj +++ b/TunnelKit.xcodeproj/project.pbxproj @@ -1102,7 +1102,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 169; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1166,7 +1166,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 169; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1199,7 +1199,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; + DYLIB_CURRENT_VERSION = 169; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/TunnelKit-iOS/Info.plist"; @@ -1222,7 +1222,7 @@ DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; + DYLIB_CURRENT_VERSION = 169; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/TunnelKit-iOS/Info.plist"; @@ -1245,7 +1245,7 @@ COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; + DYLIB_CURRENT_VERSION = 169; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/TunnelKit-macOS/Info.plist"; @@ -1268,7 +1268,7 @@ COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; + DYLIB_CURRENT_VERSION = 169; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/TunnelKit-macOS/Info.plist"; diff --git a/TunnelKitHost/Info.plist b/TunnelKitHost/Info.plist index 16be3b6..c09e8fa 100644 --- a/TunnelKitHost/Info.plist +++ b/TunnelKitHost/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/TunnelKitTests/Info.plist b/TunnelKitTests/Info.plist index 6c40a6c..af63fea 100644 --- a/TunnelKitTests/Info.plist +++ b/TunnelKitTests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.0 + 1.1.0 CFBundleVersion 1 diff --git a/ci/set_version.sh b/ci/set_version.sh new file mode 100755 index 0000000..d4b32a8 --- /dev/null +++ b/ci/set_version.sh @@ -0,0 +1,6 @@ +#!/bin/sh +VERSION="1.1.0" +BUILD=`git rev-list HEAD --count` + +agvtool new-marketing-version $VERSION +agvtool new-version $BUILD From 4cbf935dea16959951b3a456a2ff290b24349359 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 23 Sep 2018 15:33:39 +0200 Subject: [PATCH 2/3] Pick version from shared file Reuse for podspec. --- TunnelKit.podspec | 2 +- ci/VERSION | 1 + ci/set_version.sh | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 ci/VERSION diff --git a/TunnelKit.podspec b/TunnelKit.podspec index 31e1bb4..c9f6a0d 100644 --- a/TunnelKit.podspec +++ b/TunnelKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "TunnelKit" - s.version = "1.1.0" + s.version = File.read("ci/VERSION") s.summary = "Non-official OpenVPN client for Apple platforms." s.homepage = "https://github.com/keeshux/tunnelkit" diff --git a/ci/VERSION b/ci/VERSION new file mode 100644 index 0000000..9084fa2 --- /dev/null +++ b/ci/VERSION @@ -0,0 +1 @@ +1.1.0 diff --git a/ci/set_version.sh b/ci/set_version.sh index d4b32a8..ac043b4 100755 --- a/ci/set_version.sh +++ b/ci/set_version.sh @@ -1,6 +1,6 @@ #!/bin/sh -VERSION="1.1.0" +PWD=`dirname $0` +VERSION=`cat $PWD/VERSION` BUILD=`git rev-list HEAD --count` - agvtool new-marketing-version $VERSION agvtool new-version $BUILD From 24dabe273949a640c24c25ec587e9a13dea753d5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 23 Sep 2018 15:29:40 +0200 Subject: [PATCH 3/3] Set peer-info version from bundle Omit build number for now, seems more complex than expected to accomplish with CocoaPods. --- TunnelKit/Sources/Core/CoreConfiguration.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/TunnelKit/Sources/Core/CoreConfiguration.swift b/TunnelKit/Sources/Core/CoreConfiguration.swift index 90ff95e..068afcf 100644 --- a/TunnelKit/Sources/Core/CoreConfiguration.swift +++ b/TunnelKit/Sources/Core/CoreConfiguration.swift @@ -40,7 +40,20 @@ import __TunnelKitNative struct CoreConfiguration { static let identifier = "com.algoritmico.TunnelKit" - static let version = "1.1.0-dev" + static let version: String = { + let bundle = Bundle(for: SessionProxy.self) + guard let info = bundle.infoDictionary else { + return "" + } +// guard let version = info["CFBundleShortVersionString"] as? String else { +// return "" +// } +// guard let build = info["CFBundleVersion"] as? String else { +// return version +// } +// return "\(version) (\(build))" + return info["CFBundleShortVersionString"] as? String ?? "" + }() // MARK: Session