Skip to content

Commit b2081e9

Browse files
committed
Merge pull request #37 from degrim/DotnetCLI
Use Dotnet CLI
2 parents 5463128 + 85a4691 commit b2081e9

30 files changed

+315
-560
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.8.0 May 20, 2016
2+
- Switch to .NET CLI from DNX
3+
- Add support for RC2 apps
4+
- Remove support for RC1 and lower apps using DNX
5+
- detect now looks for project.json files or *.runtimeconfig.json files from publish output
6+
- global.json is no longer used to specify runtime version
7+
- Remove support for lucid64 stack
8+
19
## v0.7.0 Sep 30, 2015
210
- Make NuGet.Config optional, detect only looks for project.json files
311
- Support published apps for offline mode and faster staging

Dockerfile.gettext

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# To build gettext and extract the files from the Docker container:
2+
# export CF_STACK=cflinuxfs2
3+
# export GETTEXT_VERSION=0.19.7
4+
# cat Dockerfile.gettext | envsubst | docker build -t gettext-${CF_STACK}-${GETTEXT_VERSION} -
5+
# docker run -v /somehostdir:/built --rm gettext-${CF_STACK}-${GETTEXT_VERSION} /bin/bash -c "cd /usr/local && tar czf /built/gettext-${CF_STACK}-${GETTEXT_VERSION}.tar.gz ./lib/**"
6+
7+
FROM cloudfoundry/$CF_STACK
8+
9+
RUN curl -sSL http://ftpmirror.gnu.org/gettext/gettext-${GETTEXT_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
10+
&& cd /usr/local/src/gettext-${GETTEXT_VERSION} \
11+
&& ./configure \
12+
&& make \
13+
&& make install \
14+
&& rm -rf /usr/local/src/gettext-${GETTEXT_VERSION}

Dockerfile.libunwind

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
FROM cloudfoundry/$CF_STACK
88

9-
RUN curl -SSL wget http://download.savannah.gnu.org/releases/libunwind/libunwind-${LIBUNWIND_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
9+
RUN curl -sSL http://download.savannah.gnu.org/releases/libunwind/libunwind-${LIBUNWIND_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
1010
&& cd /usr/local/src/libunwind-${LIBUNWIND_VERSION} \
1111
&& ./configure \
1212
&& make \
13-
&& make install
13+
&& make install \
1414
&& rm -rf /usr/local/src/libunwind-${LIBUNWIND_VERSION}

Dockerfile.libuv

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cloud Foundry buildpack: ASP.NET 5
22

3-
A Cloud Foundry buildpack for ASP.NET 5 web applications. Tested with [beta8][] applications that target .NET Core.
3+
A Cloud Foundry buildpack for ASP.NET 5 web applications. Tested with [RC2][] applications that target .NET Core.
44

55
For more information about ASP.NET 5 see:
66

@@ -13,18 +13,27 @@ For more information about ASP.NET 5 see:
1313
cf push my_app -b https://github.com/cloudfoundry-community/asp.net5-buildpack.git
1414
```
1515

16-
This buildpack will be used if there are one or more `project.json` files in the pushed application.
16+
This buildpack will be used if there are one or more `project.json` files in the pushed application, or if the application is pushed from the output directory of the `dotnet publish` command.
1717

18-
Also make sure the application includes a `kestrel` or a `web` command and the corresponding Microsoft.AspNet.Server.Kestrel dependency because the buildpack will use [Kestrel][] to run the application.
19-
20-
Use a `global.json` file to specify the desired DNX version if different than the latest stable beta release. Use a `NuGet.Config` file to specify non-default package sources.
18+
Use a `NuGet.Config` file to specify non-default package sources.
2119

2220
For a basic example see this [Hello World sample][].
2321

22+
## Legacy DNX support (used for RC1 apps)
23+
24+
With the introduction of support for the Dotnet CLI in buildpack version 0.8, apps which relied on the older DNX toolchain will no longer work with the current buildpack. If you need to keep your app running on DNX for now until you can update it to use the Dotnet CLI, use the following command:
25+
26+
```bash
27+
cf push my_app -b https://github.com/cloudfoundry-community/asp.net5-buildpack.git#dnx
28+
```
29+
30+
Keep in mind that this support provided to allow users time to update their apps to use the Dotnet CLI, and you should switch to using the main branch of the buildpack (using the command further above) as soon as possible.
31+
2432
## Disconnected environments
33+
2534
The binaries in `manifest.yml` can be cached with the buildpack.
2635

27-
Applications can be pushed with their other dependencies after "publishing" the application like `dnu publish` or `dnu publish --runtime ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-beta7`. Then push from the `bin/output` director.
36+
Applications can be pushed with their other dependencies after "publishing" the application like `dotnet publish`. Then push from the `bin/<Debug|Release>/<framework>/publish` directory.
2837

2938
## Building
3039

@@ -57,11 +66,11 @@ These steps only apply to admins who wish to install the buildpack into their Cl
5766
5. Use in Cloud Foundry
5867

5968
Upload the buildpack to your Cloud Foundry and optionally specify it by name
60-
69+
6170
```bash
6271
cf create-buildpack custom_aspnet5_buildpack aspnet5_buildpack-cached-custom.zip 1
6372
cf push my_app -b custom_aspnet5_buildpack
64-
```
73+
```
6574

6675
## Contributing
6776

@@ -73,5 +82,5 @@ Open an issue on this project.
7382

7483

7584
[Hello World sample]: https://github.com/IBM-Bluemix/asp.net5-helloworld
76-
[beta8]: https://github.com/aspnet/Home/releases/tag/v1.0.0-beta8
85+
[RC2]: https://github.com/aspnet/Home/releases/tag/v1.0.0-rc2-final
7786
[Kestrel]: https://github.com/aspnet/KestrelHttpServer

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.0
1+
0.8.0

compile-extensions

lib/buildpack.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ def self.compiler(build_dir, cache_dir)
3434
Compiler.new(
3535
build_dir,
3636
cache_dir,
37-
LibuvInstaller.new(build_dir, shell),
3837
LibunwindInstaller.new(build_dir, shell),
39-
DnvmInstaller.new(shell),
40-
DnxInstaller.new(shell),
41-
DNU.new(shell),
38+
GetTextInstaller.new(build_dir, shell),
39+
DotnetInstaller.new(shell),
40+
Dotnet.new(shell),
4241
Copier.new,
4342
out)
4443
end

lib/buildpack/app_dir.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Encoding: utf-8
22
# ASP.NET 5 Buildpack
3-
# Copyright 2015 the original author or authors.
3+
# Copyright 2015-2016 the original author or authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -48,13 +48,29 @@ def deployment_file_project
4848
paths = with_project_json
4949
deployment_file = File.expand_path(File.join(@dir, DEPLOYMENT_FILE_NAME))
5050
File.foreach(deployment_file, encoding: 'utf-8') do |line|
51-
m = /project = (.*)/.match(line)
51+
m = /project[ \t]*=[ \t]*(.*)/i.match(line)
5252
if m
53-
path = Pathname.new(m[1])
53+
n = /.*([.](xproj|csproj))/i.match(m[1])
54+
path = n ? Pathname.new(File.dirname(m[1])) : Pathname.new(m[1])
5455
return path if paths.include?(path)
5556
end
5657
end if File.exist?(deployment_file)
5758
nil
5859
end
60+
61+
def main_project_path
62+
path = deployment_file_project
63+
project_paths = with_project_json
64+
multiple_paths = project_paths.any? && !project_paths.one?
65+
fail 'Multiple paths contain a project.json file, but no .deployment file was used' if multiple_paths unless path
66+
path = project_paths.first unless path
67+
path if path
68+
end
69+
70+
def published_project
71+
config_files = Dir.glob(File.join(@dir, '*.runtimeconfig.json'))
72+
m = /(.*)[.]runtimeconfig[.]json/i.match(Pathname.new(config_files.first).basename.to_s) if config_files.one?
73+
m[1].to_s unless m.nil?
74+
end
5975
end
6076
end

lib/buildpack/compile/compiler.rb

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Encoding: utf-8
22
# ASP.NET 5 Buildpack
3-
# Copyright 2014-2015 the original author or authors.
3+
# Copyright 2014-2016 the original author or authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -14,26 +14,24 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
require_relative 'libuv_installer.rb'
1817
require_relative 'libunwind_installer.rb'
19-
require_relative 'dnvm_installer.rb'
20-
require_relative 'dnx_installer.rb'
21-
require_relative 'dnu.rb'
18+
require_relative 'gettext_installer.rb'
19+
require_relative 'dotnet_installer.rb'
20+
require_relative 'dotnet.rb'
2221
require_relative '../bp_version.rb'
2322

2423
require 'json'
2524
require 'pathname'
2625

2726
module AspNet5Buildpack
2827
class Compiler
29-
def initialize(build_dir, cache_dir, libuv_binary, libunwind_binary, dnvm_installer, dnx_installer, dnu, copier, out)
28+
def initialize(build_dir, cache_dir, libunwind_binary, gettext_binary, dotnet_installer, dotnet, copier, out)
3029
@build_dir = build_dir
3130
@cache_dir = cache_dir
32-
@libuv_binary = libuv_binary
3331
@libunwind_binary = libunwind_binary
34-
@dnvm_installer = dnvm_installer
35-
@dnx_installer = dnx_installer
36-
@dnu = dnu
32+
@gettext_binary = gettext_binary
33+
@dotnet_installer = dotnet_installer
34+
@dotnet = dotnet
3735
@copier = copier
3836
@out = out
3937
end
@@ -42,11 +40,10 @@ def compile
4240
puts "ASP.NET 5 buildpack version: #{BuildpackVersion.new.version}\n"
4341
puts "ASP.NET 5 buildpack starting compile\n"
4442
step('Restoring files from buildpack cache', method(:restore_cache))
45-
step('Extracting libuv', method(:extract_libuv))
4643
step('Extracting libunwind', method(:extract_libunwind))
47-
step('Installing DNVM', method(:install_dnvm))
48-
step('Installing DNX with DNVM', method(:install_dnx))
49-
step('Restoring dependencies with DNU', method(:restore_dependencies))
44+
step('Extracting gettext', method(:extract_gettext))
45+
step('Installing Dotnet CLI', method(:install_dotnet))
46+
step('Restoring dependencies with Dotnet CLI', method(:restore_dependencies))
5047
step('Saving to buildpack cache', method(:save_cache))
5148
puts "ASP.NET 5 buildpack is done creating the droplet\n"
5249
return true
@@ -57,36 +54,32 @@ def compile
5754

5855
private
5956

60-
def extract_libuv(out)
61-
libuv_binary.extract(File.join(build_dir, 'libuv'), out) unless File.exist? File.join(build_dir, 'libuv')
62-
end
63-
6457
def extract_libunwind(out)
6558
libunwind_binary.extract(File.join(build_dir, 'libunwind'), out) unless File.exist? File.join(build_dir, 'libunwind')
6659
end
6760

68-
def restore_cache(out)
69-
copier.cp(File.join(cache_dir, '.dnx'), build_dir, out) if File.exist? File.join(cache_dir, '.dnx')
70-
copier.cp(File.join(cache_dir, 'libuv'), build_dir, out) if File.exist? File.join(cache_dir, 'libuv')
71-
copier.cp(File.join(cache_dir, 'libunwind'), build_dir, out) if File.exist? File.join(cache_dir, 'libunwind')
61+
def extract_gettext(out)
62+
gettext_binary.extract(File.join(build_dir, 'gettext'), out) unless File.exist? File.join(build_dir, 'gettext')
7263
end
7364

74-
def install_dnvm(out)
75-
dnvm_installer.install(build_dir, out) unless File.exist? File.join(build_dir, 'approot', 'runtimes')
65+
def restore_cache(out)
66+
copier.cp(File.join(cache_dir, '.nuget'), build_dir, out) if File.exist? File.join(cache_dir, '.nuget')
67+
copier.cp(File.join(cache_dir, 'libunwind'), build_dir, out) if File.exist? File.join(cache_dir, 'libunwind')
68+
copier.cp(File.join(cache_dir, 'gettext'), build_dir, out) if File.exist? File.join(cache_dir, 'gettext')
7669
end
7770

78-
def install_dnx(out)
79-
dnx_installer.install(build_dir, out) unless File.exist? File.join(build_dir, 'approot', 'runtimes')
71+
def install_dotnet(out)
72+
dotnet_installer.install(build_dir, out) unless File.exist? File.join(build_dir, 'approot', 'runtimes')
8073
end
8174

8275
def restore_dependencies(out)
83-
dnu.restore(build_dir, out) unless File.exist? File.join(build_dir, 'approot', 'packages')
76+
dotnet.restore(build_dir, out) unless File.exist? File.join(build_dir, 'approot', 'packages')
8477
end
8578

8679
def save_cache(out)
87-
copier.cp(File.join(build_dir, '.dnx'), cache_dir, out) if File.exist? File.join(build_dir, '.dnx')
88-
copier.cp(File.join(build_dir, 'libuv'), cache_dir, out) unless File.exist? File.join(cache_dir, 'libuv')
80+
copier.cp(File.join(build_dir, '.nuget'), cache_dir, out) if File.exist? File.join(build_dir, '.nuget')
8981
copier.cp(File.join(build_dir, 'libunwind'), cache_dir, out) unless File.exist? File.join(cache_dir, 'libunwind')
82+
copier.cp(File.join(build_dir, 'gettext'), cache_dir, out) unless File.exist? File.join(cache_dir, 'gettext')
9083
end
9184

9285
def step(description, method)
@@ -103,12 +96,11 @@ def step(description, method)
10396

10497
attr_reader :build_dir
10598
attr_reader :cache_dir
106-
attr_reader :libuv_binary
10799
attr_reader :libunwind_binary
108-
attr_reader :dnvm_installer
109-
attr_reader :dnx_installer
100+
attr_reader :gettext_binary
101+
attr_reader :dotnet_installer
110102
attr_reader :mozroots
111-
attr_reader :dnu
103+
attr_reader :dotnet
112104
attr_reader :copier
113105
attr_reader :out
114106
end

0 commit comments

Comments
 (0)