Skip to content

Commit

Permalink
* Updating project structure to use the src, test, build, samples format
Browse files Browse the repository at this point in the history
* Adding build scripts to use K compilation.
  • Loading branch information
pranavkm committed Jan 22, 2014
1 parent 5f4807d commit 7b8a54c
Show file tree
Hide file tree
Showing 104 changed files with 223 additions and 71 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ PublishProfiles/
*.log
*.vspx
/.symbols
nuget.exe
44 changes: 0 additions & 44 deletions Microsoft.AspNet.CoreServices/Compilation/CompilerCache.cs

This file was deleted.

7 changes: 0 additions & 7 deletions Microsoft.AspNet.CoreServices/project.json

This file was deleted.

18 changes: 14 additions & 4 deletions Microsoft.AspNet.Mvc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc", "Microsoft.AspNet.Mvc\Microsoft.AspNet.Mvc.csproj", "{2A0C26F1-0240-4AE1-AE00-4691C291B122}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc", "src\Microsoft.AspNet.Mvc\Microsoft.AspNet.Mvc.csproj", "{2A0C26F1-0240-4AE1-AE00-4691C291B122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample", "MvcSample\MvcSample.csproj", "{069EA0A1-BB68-41D1-A973-3429EC09264C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample", "samples\MvcSample\MvcSample.csproj", "{069EA0A1-BB68-41D1-A973-3429EC09264C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.CoreServices", "Microsoft.AspNet.CoreServices\Microsoft.AspNet.CoreServices.csproj", "{EC38534C-A2D1-413F-97D1-55EEF5D2FB71}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.CoreServices", "src\Microsoft.AspNet.CoreServices\Microsoft.AspNet.CoreServices.csproj", "{EC38534C-A2D1-413F-97D1-55EEF5D2FB71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor", "Microsoft.AspNet.Mvc.Razor\Microsoft.AspNet.Mvc.Razor.csproj", "{224A14D0-ECA7-441C-AE89-B6E66A57EF9B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor", "src\Microsoft.AspNet.Mvc.Razor\Microsoft.AspNet.Mvc.Razor.csproj", "{224A14D0-ECA7-441C-AE89-B6E66A57EF9B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{32285FA4-6B46-4D6B-A840-2B13E4C8B58E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -37,4 +41,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{069EA0A1-BB68-41D1-A973-3429EC09264C} = {DAAE4C74-D06F-4874-A166-33305D2643CE}
{EC38534C-A2D1-413F-97D1-55EEF5D2FB71} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{2A0C26F1-0240-4AE1-AE00-4691C291B122} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
{224A14D0-ECA7-441C-AE89-B6E66A57EF9B} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off
cd %~dp0

IF EXIST .nuget\NuGet.exe goto part2
echo Downloading latest version of NuGet.exe...
md .nuget
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '.nuget\NuGet.exe'"

:part2
.nuget\NuGet.exe install Sake -version 0.2 -o packages
packages\Sake.0.2\tools\Sake.exe -I build -f makefile.shade %*
17 changes: 17 additions & 0 deletions build/_k-build.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@{/*

k-build
Builds project. Downloads and executes k sdk tools.

projectFile=''
Required. Path to the project.json to build.

*/}

var projectFolder='${Path.GetDirectoryName(projectFile)}'
var projectName='${Path.GetFileName(projectFolder)}'
var projectBin='${Path.Combine(projectFolder, "bin")}'

-// directory delete="${projectBin}"
k command='build ${projectFolder}'
copy sourceDir='${projectBin}' outputDir='${Path.Combine(BUILD_DIR, projectName)}'
13 changes: 13 additions & 0 deletions build/_k-clean.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@{/*

k-clean
Cleans project. Downloads and executes k sdk tools.

projectFile=''
Required. Path to the project.json to build.

*/}

var projectFolder='${Path.GetDirectoryName(projectFile)}'

k command='clean ${projectFolder}'
43 changes: 43 additions & 0 deletions build/_k-standard-goals.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use namespace="System"
use namespace="System.IO"
use import="Files"

default BASE_DIR='${Directory.GetCurrentDirectory()}'
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'

@{
E("K_BUILD_VERSION", "t" + DateTime.UtcNow.ToString("yyMMddHHmmss"));
}

#target-dir-clean target="clean"
directory delete="${TARGET_DIR}"

#build-clean target='clean'
k-clean each='var projectFile in Files.Include("src/**/project.json")'

#build-compile target='compile'
k-build each='var projectFile in Files.Include("src/**/project.json")'
@{
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/*.nupkg")))
{
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
}
}

#nuget-install target='install' description='Copy NuGet packages to local repo'
@{
var HOME_DIR = E("HOME");
if (string.IsNullOrEmpty(HOME_DIR))
{
HOME_DIR = E("HOMEDRIVE") + E("HOMEPATH");
}
}
copy sourceDir='${BUILD_DIR}' include='*.nupkg' outputDir='${Path.Combine(HOME_DIR, ".nuget")}' overwrite='${true}'


functions @{
string E(string key) { return Environment.GetEnvironmentVariable(key); }
void E(string key, string value) { Environment.SetEnvironmentVariable(key, value); }
}
31 changes: 31 additions & 0 deletions build/_k.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@{/*

k
Run klr commands in your project. Downloads and executes k sdk.

kVersion='0.0.1-pre-30109-087'
May be passed to override the nuget package version holding xunit console runner.

kProgram='...'
May be passed to override the path to the xunit program that will be executed

command=''

*/}

default kLatestSuccessful='\\wsr-teamcity\Drops\ProjectK.Main\latest-successful\sdk'
default kVersion=''

test if='string.IsNullOrEmpty(kVersion)'
for each='var file in System.IO.Directory.EnumerateFiles(kLatestSuccessful).Select(System.IO.Path.GetFileName)'
test if='file.StartsWith("ProjectK.") && file.EndsWith(".nupkg")'
- kVersion = file.Substring("ProjectK.".Length, file.Length - "ProjectK.".Length - ".nupkg".Length);

default kProgram='packages/ProjectK.${kVersion}/tools/k.cmd'

-// Download xunit from nuget sources if not already present
test if='!File.Exists(kProgram)'
log info='Installing ProjectK ${kVersion} from ${kLatestSuccessful}'
nuget-install package='ProjectK' packageVersion='${kVersion}' outputDir='packages' extra='-Source ${kLatestSuccessful}'

exec program='${Path.GetFullPath(kProgram)}' commandline='${command}'
7 changes: 7 additions & 0 deletions makefile.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft'

use-standard-lifecycle
k-standard-goals
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@
<ItemGroup>
<Reference Include="Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Diagnostics">
<HintPath>..\packages\Microsoft.Owin.Diagnostics.2.0.2\lib\net40\Microsoft.Owin.Diagnostics.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.Diagnostics.2.0.2\lib\net40\Microsoft.Owin.Diagnostics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.FileSystems, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -76,15 +76,15 @@
<Compile Include="Startup.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNet.CoreServices\Microsoft.AspNet.CoreServices.csproj">
<ProjectReference Include="..\..\src\Microsoft.AspNet.CoreServices\Microsoft.AspNet.CoreServices.csproj">
<Project>{ec38534c-a2d1-413f-97d1-55eef5d2fb71}</Project>
<Name>Microsoft.AspNet.CoreServices</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.AspNet.Mvc.Razor\Microsoft.AspNet.Mvc.Razor.csproj">
<ProjectReference Include="..\..\src\Microsoft.AspNet.Mvc.Razor\Microsoft.AspNet.Mvc.Razor.csproj">
<Project>{224a14d0-eca7-441c-ae89-b6e66a57ef9b}</Project>
<Name>Microsoft.AspNet.Mvc.Razor</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.AspNet.Mvc\Microsoft.AspNet.Mvc.csproj">
<ProjectReference Include="..\..\src\Microsoft.AspNet.Mvc\Microsoft.AspNet.Mvc.csproj">
<Project>{2a0c26f1-0240-4ae1-ae00-4691c291b122}</Project>
<Name>Microsoft.AspNet.Mvc</Name>
</ProjectReference>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions samples/MvcSample/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<configuration>

<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>

</configuration>
34 changes: 34 additions & 0 deletions src/Microsoft.AspNet.CoreServices/Compilation/CompilerCache.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using Microsoft.Owin.FileSystems;

namespace Microsoft.AspNet.CoreServices
{
public class CompilerCache
{
private readonly ConcurrentDictionary<string, Type> _cache;

public CompilerCache()
{
_cache = new ConcurrentDictionary<string,Type>(StringComparer.OrdinalIgnoreCase);
}

public async Task<CompilationResult> GetOrAdd(IFileInfo file, Func<Task<CompilationResult>> compile)
{
// Generate a content id
string contentId = file.PhysicalPath + '|' + file.LastModified.Ticks;

Type compiledType;
if (!_cache.TryGetValue(contentId, out compiledType))
{
CompilationResult result = await compile();
_cache.TryAdd(contentId, result.CompiledType);

return result;
}

return CompilationResult.Successful(generatedCode: null, type: compiledType);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Owin.FileSystems">
<HintPath>..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Caching" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActivatorUtilities.cs" />
Expand Down
9 changes: 9 additions & 0 deletions src/Microsoft.AspNet.CoreServices/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": [
{ "Microsoft.Owin.FileSystems": { "version": "2.0.2" } }
],
"configurations": [
{ "net45": {} },
{ "k10": {} }
]
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
<ItemGroup>
<Reference Include="Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.FileSystems">
<HintPath>..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.FileSystems.2.1.0-rc1\lib\net40\Microsoft.Owin.FileSystems.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions src/Microsoft.AspNet.Mvc.Razor/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"dependencies": [
{ "Owin": { "version": "1.0" } },
{ "Newtonsoft.Json": { "version": "4.5.11" } },
{ "Microsoft.Owin": { "version": "2.0.2" } },
{ "Microsoft.Owin.FileSystems": { "version": "2.0.2" } },
{ "Microsoft.AspNet.WebApi.Client": { "version": "5.0.0" } },
{ "Microsoft.AspNet.CoreServices" : { } }
],
"configurations": [
{ "net45": {
"dependencies": [
{ "System.Net.Http" : { } }
]
},
"k10" : { }
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7b8a54c

Please sign in to comment.