From 6ded559c54871fd7a94a0c7fabe51e096bb1e392 Mon Sep 17 00:00:00 2001 From: Aaron Liberatore Date: Fri, 29 Sep 2017 13:47:47 -0500 Subject: [PATCH] Backward Compatibility (#62) * Revert "Swift 4 (#61)" This reverts commit 57984f68dacf2545f54830acfe5bd97d1ad09fd7. * Reverts backward compatability * Updates package.swift * Updates configuration version --- .swift-version | 2 +- .travis.yml | 13 ++++++++++++ Package.pins | 5 +++++ Package.swift | 27 +++++++------------------ Package@swift-4.0.swift | 45 +++++++++++++++++++++++++++++++++++++++++ README.md | 4 ++-- docker-compose.yml | 6 +++--- 7 files changed, 76 insertions(+), 26 deletions(-) create mode 100644 Package.pins create mode 100644 Package@swift-4.0.swift diff --git a/.swift-version b/.swift-version index 5186d07..94ff29c 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +3.1.1 diff --git a/.travis.yml b/.travis.yml index 6651519..f8b7112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,22 @@ matrix: - os: linux dist: trusty sudo: required + - os: linux + dist: trusty + sudo: required + env: SWIFT_SNAPSHOT=4.0 + - os: linux + dist: trusty + sudo: required + services: docker + env: DOCKER_IMAGE=ubuntu:16.04 SWIFT_SNAPSHOT=4.0 + - os: osx + osx_image: xcode8.3 + sudo: required - os: osx osx_image: xcode9 sudo: required + env: SWIFT_SNAPSHOT=4.0 before_install: - git clone https://github.com/IBM-Swift/Package-Builder.git diff --git a/Package.pins b/Package.pins new file mode 100644 index 0000000..e0570d6 --- /dev/null +++ b/Package.pins @@ -0,0 +1,5 @@ +{ + "autoPin": false, + "pins": [], + "version": 1 +} diff --git a/Package.swift b/Package.swift index 19ba5e6..9cd91b7 100644 --- a/Package.swift +++ b/Package.swift @@ -1,8 +1,5 @@ -// swift-tools-version:4.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. - /** - * Copyright IBM Corporation 2016, 2017 + * Copyright IBM Corporation 2016,2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,25 +18,15 @@ import PackageDescription let package = Package( name: "CloudFoundryEnv", - products: [ - .library( + targets: [ + Target( name: "CloudFoundryEnv", - targets: ["CloudFoundryEnv"] - ) + dependencies: [] + ), ], dependencies: [ //.Package(url: "https://github.com/behrang/YamlSwift.git", majorVersion: 1), - .package(url: "https://github.com/IBM-Swift/LoggerAPI.git", .upToNextMajor(from: "2.0.0")), - .package(url: "https://github.com/IBM-Swift/Configuration.git", .upToNextMajor(from: "2.0.0")), - ], - targets: [ - .target( - name: "CloudFoundryEnv", - dependencies: ["LoggerAPI", "Configuration"] - ), - .testTarget( - name: "CloudFoundryEnvTests", - dependencies: ["CloudFoundryEnv"] - ), + .Package(url: "https://github.com/IBM-Swift/LoggerAPI.git", majorVersion: 1), + .Package(url: "https://github.com/IBM-Swift/Configuration.git", majorVersion: 1), ] ) diff --git a/Package@swift-4.0.swift b/Package@swift-4.0.swift new file mode 100644 index 0000000..c284b6e --- /dev/null +++ b/Package@swift-4.0.swift @@ -0,0 +1,45 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +/** + * Copyright IBM Corporation 2016, 2017 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +import PackageDescription + +let package = Package( + name: "CloudFoundryEnv", + products: [ + .library( + name: "CloudFoundryEnv", + targets: ["CloudFoundryEnv"] + ) + ], + dependencies: [ + //.Package(url: "https://github.com/behrang/YamlSwift.git", majorVersion: 1), + .package(url: "https://github.com/IBM-Swift/LoggerAPI.git", .upToNextMajor(from: "1.7.0")), + .package(url: "https://github.com/IBM-Swift/Configuration.git", .upToNextMajor(from: "1.0.0")), + ], + targets: [ + .target( + name: "CloudFoundryEnv", + dependencies: ["LoggerAPI", "Configuration"] + ), + .testTarget( + name: "CloudFoundryEnvTests", + dependencies: ["CloudFoundryEnv"] + ), + ] +) diff --git a/README.md b/README.md index c42481f..5019ae0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/IBM-Swift/Swift-cfenv.svg?branch=master)](https://travis-ci.org/IBM-Swift/Swift-cfenv) +[![Build Status - Master](https://travis-ci.org/IBM-Swift/Swift-cfenv.svg?branch=master)](https://travis-ci.org/IBM-Swift/Swift-cfenv) ![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat) ![Linux](https://img.shields.io/badge/os-linux-green.svg?style=flat) @@ -11,7 +11,7 @@ This library determines if you are running your application "locally" or on the For the implementation of this Swift package, we used as inspiration a similar module that had been developed for Node.js applications, [node-cfenv](https://github.com/cloudfoundry-community/node-cfenv). ## Swift version -The latest version of Swift-cfenv works with the `4.0` version of the Swift binaries. You can download this version of the Swift binaries by following this [link](https://swift.org/download/#snapshots). +The latest version of Swift-cfenv works with the `Swift 3.1.1` or newer. You can download this version of the Swift binaries by following this [link](https://swift.org/download/#snapshots). ## Configuration The latest version of Swift-cfenv relies on the [Configuration](https://github.com/IBM-Swift/Configuration) package to load and merge configuration data from multiple sources, such as environment variables or JSON files. In previous versions of Swift-cfenv, the library was responsible for accessing the environment variables directly. Moving forward, newer versions of Swift-cfenv will continue to depend on the configuration data loaded into a `ConfigurationManager` instance. For further details on the Configuration package, see its [README](https://github.com/IBM-Swift/Configuration) file. diff --git a/docker-compose.yml b/docker-compose.yml index 1279803..f2fa356 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ # docker-compose up app: - image: ibmcom/swift-ubuntu:4.0 + image: ibmcom/swift-ubuntu:3.1.1 ports: - "8080:8080" volumes: - - .:/Swift-cfenv - command: bash -c "cd /Swift-cfenv && swift package --build-path .build-ubuntu clean && swift build --build-path .build-ubuntu && swift test --build-path .build-ubuntu" + - .:/root/Swift-cfenv + command: bash -c "cd /root/Swift-cfenv && rm -rf Packages && swift build --clean && swift build && swift test"