From 700e48ae2231e06daf10b075280d9f5a47dd80e4 Mon Sep 17 00:00:00 2001 From: Pasin Suriyentrakorn Date: Fri, 3 Mar 2017 17:47:08 -0800 Subject: [PATCH] Add a script to generate the release zip files * Added Scripts/generate_release_zip.sh * Added Scripts/Support/License/LICENSE_*.txt for release. * Added CBL_VERSION_STRING in Xcode project file so that the version string can be set from the generate_release_zip.sh script. * Adjusted platform output folder name and modified podspec accordingly #1650 --- CouchbaseLite.podspec | 14 +-- CouchbaseLiteSwift.podspec | 14 +-- Objective-C/Info.plist | 2 +- Scripts/Support/License/LICENSE_community.txt | 17 +++ .../Support/License/LICENSE_enterprise.txt | 47 ++++++++ Scripts/build_framework.sh | 19 +++- Scripts/generate_release_zip.sh | 106 ++++++++++++++++++ Scripts/prepare_cocoapods.sh | 6 +- Swift/Info.plist | 2 +- xcconfigs/Project.xcconfig | 4 + 10 files changed, 209 insertions(+), 22 deletions(-) create mode 100644 Scripts/Support/License/LICENSE_community.txt create mode 100644 Scripts/Support/License/LICENSE_enterprise.txt mode change 100755 => 100644 Scripts/build_framework.sh create mode 100644 Scripts/generate_release_zip.sh diff --git a/CouchbaseLite.podspec b/CouchbaseLite.podspec index eedf82a3c..ae6e5e522 100644 --- a/CouchbaseLite.podspec +++ b/CouchbaseLite.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CouchbaseLite' - s.version = '2.0DB2' + s.version = '2.0DB002' s.license = 'Apache License, Version 2.0' s.homepage = 'http://mobile.couchbase.com' s.summary = 'An embedded syncable NoSQL database for iOS, tvOS, and MacOS apps.' @@ -11,14 +11,14 @@ Pod::Spec.new do |s| sh Scripts/prepare_cocoapods.sh "CBL ObjC" CMD - s.ios.preserve_paths = 'frameworks/CBL ObjC/ios/CouchbaseLite.framework' - s.ios.vendored_frameworks = 'frameworks/CBL ObjC/ios/CouchbaseLite.framework' + s.ios.preserve_paths = 'frameworks/CBL ObjC/iOS/CouchbaseLite.framework' + s.ios.vendored_frameworks = 'frameworks/CBL ObjC/iOS/CouchbaseLite.framework' - s.tvos.preserve_paths = 'frameworks/CBL ObjC/tvos/CouchbaseLite.framework' - s.tvos.vendored_frameworks = 'frameworks/CBL ObjC/tvos/CouchbaseLite.framework' + s.tvos.preserve_paths = 'frameworks/CBL ObjC/tvOS/CouchbaseLite.framework' + s.tvos.vendored_frameworks = 'frameworks/CBL ObjC/tvOS/CouchbaseLite.framework' - s.osx.preserve_paths = 'frameworks/CBL ObjC/macos/CouchbaseLite.framework' - s.osx.vendored_frameworks = 'frameworks/CBL ObjC/macos/CouchbaseLite.framework' + s.osx.preserve_paths = 'frameworks/CBL ObjC/macOS/CouchbaseLite.framework' + s.osx.vendored_frameworks = 'frameworks/CBL ObjC/macOS/CouchbaseLite.framework' s.ios.deployment_target = '8.0' s.tvos.deployment_target = '9.0' diff --git a/CouchbaseLiteSwift.podspec b/CouchbaseLiteSwift.podspec index 0c0d895cb..3a4e2d364 100644 --- a/CouchbaseLiteSwift.podspec +++ b/CouchbaseLiteSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CouchbaseLiteSwift' - s.version = '2.0DB2' + s.version = '2.0DB002' s.license = 'Apache License, Version 2.0' s.homepage = 'http://mobile.couchbase.com' s.summary = 'An embedded syncable NoSQL database for iOS, tvOS, and MacOS apps.' @@ -11,14 +11,14 @@ Pod::Spec.new do |s| sh Scripts/prepare_cocoapods.sh "CBL Swift" CMD - s.ios.preserve_paths = 'frameworks/CBL Swift/ios/CouchbaseLiteSwift.framework' - s.ios.vendored_frameworks = 'frameworks/CBL Swift/ios/CouchbaseLiteSwift.framework' + s.ios.preserve_paths = 'frameworks/CBL Swift/iOS/CouchbaseLiteSwift.framework' + s.ios.vendored_frameworks = 'frameworks/CBL Swift/iOS/CouchbaseLiteSwift.framework' - s.tvos.preserve_paths = 'frameworks/CBL Swift/tvos/CouchbaseLiteSwift.framework' - s.tvos.vendored_frameworks = 'frameworks/CBL Swift/tvos/CouchbaseLiteSwift.framework' + s.tvos.preserve_paths = 'frameworks/CBL Swift/tvOS/CouchbaseLiteSwift.framework' + s.tvos.vendored_frameworks = 'frameworks/CBL Swift/tvOS/CouchbaseLiteSwift.framework' - s.osx.preserve_paths = 'frameworks/CBL Swift/macos/CouchbaseLiteSwift.framework' - s.osx.vendored_frameworks = 'frameworks/CBL Swift/macos/CouchbaseLiteSwift.framework' + s.osx.preserve_paths = 'frameworks/CBL Swift/macOS/CouchbaseLiteSwift.framework' + s.osx.vendored_frameworks = 'frameworks/CBL Swift/macOS/CouchbaseLiteSwift.framework' s.ios.deployment_target = '8.0' s.tvos.deployment_target = '9.0' diff --git a/Objective-C/Info.plist b/Objective-C/Info.plist index 82f68085b..358cd5808 100644 --- a/Objective-C/Info.plist +++ b/Objective-C/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0DB2 + $(CBL_VERSION_STRING) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright diff --git a/Scripts/Support/License/LICENSE_community.txt b/Scripts/Support/License/LICENSE_community.txt new file mode 100644 index 000000000..bdf0aa1cc --- /dev/null +++ b/Scripts/Support/License/LICENSE_community.txt @@ -0,0 +1,17 @@ +Couchbase, Inc. Community Edition License Agreement + +IMPORTANT-READ CAREFULLY: BY CLICKING THE “I ACCEPT” BOX OR INSTALLING, DOWNLOADING OR OTHERWISE USING THIS SOFTWARE AND ANY ASSOCIATED DOCUMENTATION, YOU, ON BEHALF OF YOURSELF OR AS AN AUTHORIZED REPRESENTATIVE ON BEHALF OF AN ENTITY (“LICENSEE”) AGREE TO ALL THE TERMS OF THIS COMMUNITY EDITION LICENSE AGREEMENT (THE “AGREEMENT”) REGARDING YOUR USE OF THE SOFTWARE. YOU REPRESENT AND WARRANT THAT YOU HAVE FULL LEGAL AUTHORITY TO BIND THE LICENSEE TO THIS AGREEMENT. IF YOU DO NOT AGREE WITH ALL OF THESE TERMS, DO NOT SELECT THE “I ACCEPT” BOX AND DO NOT INSTALL, DOWNLOAD OR OTHERWISE USE THE SOFTWARE. THE EFFECTIVE DATE OF THIS AGREEMENT IS THE DATE ON WHICH YOU CLICK “I ACCEPT” OR OTHERWISE INSTALL, DOWNLOAD OR USE THE SOFTWARE. + +1. License Grant. Couchbase Inc. hereby grants Licensee, free of charge, the non-exclusive right to use, copy, 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 Licensee including the following copyright notice in all copies or substantial portions of the Software: + +Couchbase ® +http://www.couchbase.com +Copyright 2011 Couchbase, Inc. + +As used in this Agreement, “Software” means the object code version of the applicable elastic data management server software provided by Couchbase, Inc. + +2. Restrictions. Licensee will not: (a) reverse engineer, disassemble, or decompile the Software (except to the extent such restrictions are prohibited by law); + +3. Support. Couchbase, Inc. will provide Licensee with access to, and use of, the Couchbase, Inc. support forum available at the following URL: http://forums.Couchbase.org. Couchbase, Inc. may, at its discretion, modify, suspend or terminate support at any time. + +4. Warranty Disclaimer and Limitation of Liability. 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 COUCHBASE INC. OR THE AUTHORS OR COPYRIGHT HOLDERS IN THE SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES (INCLUDING, WITHOUT LIMITATION, DIRECT, INDIRECT OR CONSEQUENTIAL 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. diff --git a/Scripts/Support/License/LICENSE_enterprise.txt b/Scripts/Support/License/LICENSE_enterprise.txt new file mode 100644 index 000000000..bd032d565 --- /dev/null +++ b/Scripts/Support/License/LICENSE_enterprise.txt @@ -0,0 +1,47 @@ +COUCHBASE INC. ENTERPRISE LICENSE AGREEMENT - FREE EDITION + +IMPORTANT-READ CAREFULLY: BY CLICKING THE "I ACCEPT" BOX OR INSTALLING, +DOWNLOADING OR OTHERWISE USING THIS SOFTWARE AND ANY ASSOCIATED +DOCUMENTATION, YOU, ON BEHALF OF YOURSELF OR AS AN AUTHORIZED +REPRESENTATIVE ON BEHALF OF AN ENTITY ("LICENSEE") AGREE TO ALL THE +TERMS OF THIS ENTERPRISE LICENSE AGREEMENT - FREE EDITION (THE +"AGREEMENT") REGARDING YOUR USE OF THE SOFTWARE. YOU REPRESENT AND +WARRANT THAT YOU HAVE FULL LEGAL AUTHORITY TO BIND THE LICENSEE TO THIS +AGREEMENT. IF YOU DO NOT AGREE WITH ALL OF THESE TERMS, DO NOT SELECT +THE "I ACCEPT" BOX AND DO NOT INSTALL, DOWNLOAD OR OTHERWISE USE THE +SOFTWARE. THE EFFECTIVE DATE OF THIS AGREEMENT IS THE DATE ON WHICH YOU +CLICK "I ACCEPT" OR OTHERWISE INSTALL, DOWNLOAD OR USE THE SOFTWARE. + +1. License Grant. Subject to Licensee's compliance with the terms and +conditions of this Agreement, Couchbase Inc. hereby grants to Licensee a +perpetual, non-exclusive, non-transferable, non-sublicensable, +royalty-free, limited license to install and use the Software only for +Licensee's own internal non-production use for the purpose of +evaluation and/or development. + +2. Restrictions. Licensee will not reverse engineer, disassemble, or +decompile the Software (except to the extent such restrictions are +prohibited by law). + +3. Support. Couchbase Inc. will provide Licensee with: (a) periodic +Software updates to correct known bugs and errors to the extent +Couchbase Inc. incorporates such corrections into the free edition +version of the Software; and (b) access to, and use of, the Couchbase +Inc. support forum available at the following URL: +http://www.couchbase.org/forums/. Couchbase, Inc. may, at its +discretion, modify, suspend or terminate support at any time upon notice +to Licensee. + +4. Warranty Disclaimer and Limitation of Liability. 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 +COUCHBASE INC. OR THE AUTHORS OR COPYRIGHT HOLDERS IN THE SOFTWARE BE +LIABLE FOR ANY INDIRECT OR CONSEQUENTIAL DAMAGES, 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 OR FOR AN AMOUNT IN THE AGGREGATE EXCEEDING ONE HUNDRED DOLLARS. + +5. General. This Agreement is the entire agreement and is governed by California law. + + diff --git a/Scripts/build_framework.sh b/Scripts/build_framework.sh old mode 100755 new mode 100644 index 6fcf79bd3..cc3167352 --- a/Scripts/build_framework.sh +++ b/Scripts/build_framework.sh @@ -4,7 +4,7 @@ set -e function usage { - echo "\nUsage: ${0} -s -p -o \n\n" + echo "\nUsage: ${0} -s -p -o [-v ]\n" } while [[ $# -gt 1 ]] @@ -23,6 +23,10 @@ do OUTPUT_DIR=${2} shift ;; + -v) + VERSION=${2} + shift + ;; *) usage exit 3 @@ -46,12 +50,15 @@ PLATFORM_NAME=`echo $PLATFORM_NAME | tr '[:upper:]' '[:lower:]'` if [ ${PLATFORM_NAME} = "ios" ] then SDKS=("iphoneos" "iphonesimulator") + PLATFORM_NAME="iOS" elif [ ${PLATFORM_NAME} = "tvos" ] then SDKS=("appletvos" "appletvsimulator") + PLATFORM_NAME="tvOS" elif [ ${PLATFORM_NAME} = "macos" ] then SDKS=("macosx") + PLATFORM_NAME="macOS" fi OUTPUT_BASE_DIR=${OUTPUT_DIR}/${SCHEME}/${PLATFORM_NAME} @@ -74,11 +81,17 @@ for SDK in "${SDKS[@]}" CLEAN_CMD="" if [[ ${ROUND} == 0 ]] then - CLEAN_CMD="clean " + CLEAN_CMD="clean" fi #Run xcodebuild: - xcodebuild -scheme "${SCHEME}" -configuration Release -sdk ${SDK} OHTER_CFLAGS="-fembed-bitcode" ${CLEAN_CMD}build + BUILD_VERSION="" + if [ ! -z "$VERSION" ] + then + BUILD_VERSION="CBL_VERSION_STRING=${VERSION}" + fi + + xcodebuild -scheme "${SCHEME}" -configuration Release -sdk ${SDK} ${BUILD_VERSION} OHTER_CFLAGS="-fembed-bitcode" ${CLEAN_CMD} build # Get the XCode built framework and dsym file path: PRODUCTS_DIR=`xcodebuild -scheme "${SCHEME}" -configuration Release -sdk "${SDK}" -showBuildSettings|grep -w BUILT_PRODUCTS_DIR|head -n 1|awk '{ print $3 }'` diff --git a/Scripts/generate_release_zip.sh b/Scripts/generate_release_zip.sh new file mode 100644 index 000000000..7b73867a0 --- /dev/null +++ b/Scripts/generate_release_zip.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +set -e + +function usage +{ + echo "\nUsage: ${0} -o [-v ]\n" +} + +while [[ $# -gt 1 ]] +do + key=${1} + case $key in + -v) + VERSION=${2} + shift + ;; + -o) + OUTPUT_DIR=${2} + shift + ;; + *) + usage + exit 3 + ;; + esac + shift +done + +if [ -z "$OUTPUT_DIR" ] +then + usage + exit 4 +fi + +VERSION_SUFFIX="" +if [ ! -z "$VERSION" ] +then + VERSION_SUFFIX="_$VERSION" +fi + +BUILD_DIR=$OUTPUT_DIR/build + +OUTPUT_OBJC_COMMUNITY_DIR=$OUTPUT_DIR/objc_community +OUTPUT_OBJC_ENTERPRISE_DIR=$OUTPUT_DIR/objc_enterprise +OUTPUT_OBJC_COMMUNITY_ZIP=`pwd`/$OUTPUT_DIR/couchbase-lite-objc_community$VERSION_SUFFIX.zip +OUTPUT_OBJC_ENTERPRISE_ZIP=`pwd`/$OUTPUT_DIR/couchbase-lite-objc_enterprise$VERSION_SUFFIX.zip + +OUTPUT_SWIFT_COMMUNITY_DIR=$OUTPUT_DIR/swift_community +OUTPUT_SWIFT_ENTERPRISE_DIR=$OUTPUT_DIR/swift_enterprise +OUTPUT_SWIFT_COMMUNITY_ZIP=`pwd`/$OUTPUT_DIR/couchbase-lite-swift_community$VERSION_SUFFIX.zip +OUTPUT_SWIFT_ENTERPRISE_ZIP=`pwd`/$OUTPUT_DIR/couchbase-lite-swift_enterprise$VERSION_SUFFIX.zip + +rm -rf "$OUTPUT_DIR" + +sh Scripts/build_framework.sh -s "CBL ObjC" -p iOS -o "$BUILD_DIR" -v "$VERSION" +sh Scripts/build_framework.sh -s "CBL ObjC" -p tvOS -o "$BUILD_DIR" -v "$VERSION" +sh Scripts/build_framework.sh -s "CBL ObjC" -p macOS -o "$BUILD_DIR" -v "$VERSION" + +sh Scripts/build_framework.sh -s "CBL Swift" -p iOS -o "$BUILD_DIR" -v "$VERSION" +sh Scripts/build_framework.sh -s "CBL Swift" -p tvOS -o "$BUILD_DIR" -v "$VERSION" +sh Scripts/build_framework.sh -s "CBL Swift" -p macOS -o "$BUILD_DIR" -v "$VERSION" + +# Objective-C Community +mkdir -p "$OUTPUT_OBJC_COMMUNITY_DIR" +cp -R "$BUILD_DIR/CBL ObjC"/* "$OUTPUT_OBJC_COMMUNITY_DIR" +cp Scripts/Support/License/LICENSE_community.txt "$OUTPUT_OBJC_COMMUNITY_DIR"/LICENSE.txt +pushd "$OUTPUT_OBJC_COMMUNITY_DIR" +zip -ry "$OUTPUT_OBJC_COMMUNITY_ZIP" * +popd + +# Objective-C Enterprise +mkdir -p "$OUTPUT_OBJC_ENTERPRISE_DIR" +cp -R "$BUILD_DIR/CBL ObjC"/* "$OUTPUT_OBJC_ENTERPRISE_DIR" +cp Scripts/Support/License/LICENSE_enterprise.txt "$OUTPUT_OBJC_ENTERPRISE_DIR/LICENSE.txt" +pushd "$OUTPUT_OBJC_ENTERPRISE_DIR" +zip -ry "$OUTPUT_OBJC_ENTERPRISE_ZIP" * +popd + +# Swift Community +mkdir -p "$OUTPUT_SWIFT_COMMUNITY_DIR" +cp -R "$BUILD_DIR/CBL Swift"/* "$OUTPUT_SWIFT_COMMUNITY_DIR" +cp Scripts/Support/License/LICENSE_community.txt "$OUTPUT_SWIFT_COMMUNITY_DIR"/LICENSE.txt +pushd "$OUTPUT_SWIFT_COMMUNITY_DIR" +zip -ry "$OUTPUT_SWIFT_COMMUNITY_ZIP" * +popd + +# Swift Enterprise +mkdir -p "$OUTPUT_SWIFT_ENTERPRISE_DIR" +cp -R "$BUILD_DIR/CBL Swift"/* "$OUTPUT_SWIFT_ENTERPRISE_DIR" +cp Scripts/Support/License/LICENSE_enterprise.txt "$OUTPUT_SWIFT_ENTERPRISE_DIR/LICENSE.txt" +pushd "$OUTPUT_SWIFT_ENTERPRISE_DIR" +zip -ry "$OUTPUT_SWIFT_ENTERPRISE_ZIP" * +popd + +# Generate MD5 file: +pushd "$OUTPUT_DIR" +md5 *.zip > MD5.txt +popd + +# Cleanup +rm -rf "$BUILD_DIR" +rm -rf "$OUTPUT_OBJC_COMMUNITY_DIR" +rm -rf "$OUTPUT_OBJC_ENTERPRISE_DIR" +rm -rf "$OUTPUT_SWIFT_COMMUNITY_DIR" +rm -rf "$OUTPUT_SWIFT_ENTERPRISE_DIR" diff --git a/Scripts/prepare_cocoapods.sh b/Scripts/prepare_cocoapods.sh index 1aadc6410..dd874d226 100644 --- a/Scripts/prepare_cocoapods.sh +++ b/Scripts/prepare_cocoapods.sh @@ -8,6 +8,6 @@ fi echo "Preparing CouchbaseLite framework ..." rm -rf frameworks -sh Scripts/build_framework.sh -s "$SCHEME" -p ios -o frameworks > ios-build.log -sh Scripts/build_framework.sh -s "$SCHEME" -p tvos -o frameworks > tvos-build.log -sh Scripts/build_framework.sh -s "$SCHEME" -p macos -o frameworks > macos-build.log +sh Scripts/build_framework.sh -s "$SCHEME" -p iOS -o frameworks > ios-build.log +sh Scripts/build_framework.sh -s "$SCHEME" -p tvOS -o frameworks > tvos-build.log +sh Scripts/build_framework.sh -s "$SCHEME" -p macOS -o frameworks > macos-build.log diff --git a/Swift/Info.plist b/Swift/Info.plist index 82f68085b..358cd5808 100644 --- a/Swift/Info.plist +++ b/Swift/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0DB2 + $(CBL_VERSION_STRING) CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright diff --git a/xcconfigs/Project.xcconfig b/xcconfigs/Project.xcconfig index 5566c288f..faf9f0c2b 100644 --- a/xcconfigs/Project.xcconfig +++ b/xcconfigs/Project.xcconfig @@ -105,3 +105,7 @@ CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK = YES + +// Versioning +CBL_VERSION_STRING = 2.0DB002 +