Skip to content

Commit 5a00f15

Browse files
committed
Merge branch 'develop' of https://github.com/IBM-Swift/swift-buildpack into develop
2 parents 0b31174 + 8f3cd8f commit 5a00f15

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

bin/compile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929
# Global variables
3030
BUILD_DIR=$1
3131
CACHE_DIR=$2
32-
DEFAULT_SWIFT_VERSION=3.0
32+
DEFAULT_SWIFT_VERSION=3.0.1
3333
CLANG_VERSION=3.8.0
3434
compile_buildpack_dir=$(cd $(dirname $0); cd ..; pwd)
3535
compile_buildpack_bin=$compile_buildpack_dir/bin
@@ -134,7 +134,7 @@ mkdir -p $CACHE_DIR
134134
cd $CACHE_DIR
135135

136136
# Download and unpack Swift binaries
137-
download_dependency $SWIFT_NAME_VERSION $SWIFT_VERSION "tar.gz" $DEFAULT_SWIFT_VERSION
137+
download_dependency $SWIFT_NAME_VERSION $SWIFT_VERSION "tar.gz" "swift-$DEFAULT_SWIFT_VERSION"
138138
SWIFT_PATH=$CACHE_DIR/$(echo $SWIFT_NAME_VERSION/swift*)
139139

140140
# Download and unpack clang

compile-extensions/bin/download_dependency

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ original_url = ARGV[0]
2626
install_directory = ARGV[1]
2727
if ARGV.size == 3
2828
default_swift_version = ARGV[2]
29+
requested_swift_version = original_url.gsub(/.tar.gz/, '')
2930
end
3031

3132
# Define utility functions
@@ -49,31 +50,30 @@ debug "DEBUG: dependency_md5 '#{dependency_md5}'"
4950

5051
if translated_uri.nil?
5152
# Assumption is that the requested dependency is a Swift development or release snapshot
52-
custom_swift_version = original_url.gsub(/.tar.gz/, '')
5353
STDERR.puts "WARNING: You are requesting a custom version of Swift (defined in your .swift-version)"
5454
STDERR.puts "WARNING: Default supported Swift version: #{default_swift_version}"
55-
STDERR.puts "WARNING: Custom Swift version for your app: #{custom_swift_version}"
55+
STDERR.puts "WARNING: Requested Swift version for your app: #{requested_swift_version}"
5656
STDERR.puts "WARNING: The buildpack will attempt to download requested version from Swift.org"
5757

5858
# Determine snapshot type, swift version, url...
59-
if custom_swift_version.downcase.include? "development"
59+
if requested_swift_version.downcase.include? "development"
6060
snapshot_type = "development"
6161
else
62-
snapshot_type = custom_swift_version.downcase
62+
snapshot_type = requested_swift_version.downcase
6363
if snapshot_type.include? "preview"
6464
# Preview snapshot... nothing to update
6565
else
6666
# Assuming release snapshot
6767
if !(snapshot_type.include? "release")
6868
snapshot_type = "#{snapshot_type}-release"
69-
custom_swift_version = "#{custom_swift_version}-RELEASE"
69+
requested_swift_version = "#{requested_swift_version}-RELEASE"
7070
end
7171
end
7272
end
7373
debug "DEBUG: snapshot_type #{snapshot_type}"
7474

75-
swift_file = "#{custom_swift_version}-ubuntu14.04.tar.gz"
76-
translated_uri = "https://swift.org/builds/#{snapshot_type}/ubuntu1404/#{custom_swift_version}/#{swift_file}"
75+
swift_file = "#{requested_swift_version}-ubuntu14.04.tar.gz"
76+
translated_uri = "https://swift.org/builds/#{snapshot_type}/ubuntu1404/#{requested_swift_version}/#{swift_file}"
7777
debug "DEBUG: Using the following URL for downloading the specified dependency: #{translated_uri}"
7878
status_code = `curl -I -s #{translated_uri} | head -n 1 | cut -d ' ' -f2`
7979
status_code = status_code.strip
@@ -84,6 +84,11 @@ if translated_uri.nil?
8484
STDERR.puts "ERROR: Could not find/download requested custom Swift version from Swift.org: #{translated_uri}"
8585
exit 3
8686
end
87+
else
88+
if !(default_swift_version.nil? || default_swift_version.empty?) && !(default_swift_version.eql? requested_swift_version)
89+
STDERR.puts "WARNING: Default supported Swift version: #{default_swift_version}"
90+
STDERR.puts "WARNING: Requested Swift version for your app: #{requested_swift_version}"
91+
end
8792
end
8893

8994
in_cache = false
@@ -107,7 +112,7 @@ debug "DEBUG: generated_md5 '#{generated_md5}'"
107112
puts in_cache
108113

109114
if dependency_md5.nil?
110-
debug "DEBUG: md5 value for dependency could not be validated; more than likely the dependency is not found in the MANIFEST file"
115+
debug "DEBUG: md5 value for dependency could not be validated; more than likely the dependency is not found in the MANIFEST file."
111116
exit 0
112117
else
113118
if dependency_md5 == generated_md5

manifest.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ dependencies:
3131
md5: 88edb298674199f015235aa4eaa058fe
3232
cf_stacks:
3333
- cflinuxfs2
34+
- name: swift
35+
version: 3.0.1
36+
uri: https://swift.org/builds/swift-3.0.1-release/ubuntu1404/swift-3.0.1-RELEASE/swift-3.0.1-RELEASE-ubuntu14.04.tar.gz
37+
md5: 4a5d82edb2f31aa3373b15faa973d2e1
38+
cf_stacks:
39+
- cflinuxfs2
3440
- name: clang
3541
version: 3.8.0
3642
uri: http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz

0 commit comments

Comments
 (0)