forked from aspnet/Mvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updating project structure to use the src, test, build, samples format
* Adding build scripts to use K compilation.
- Loading branch information
Showing
104 changed files
with
223 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ PublishProfiles/ | |
*.log | ||
*.vspx | ||
/.symbols | ||
nuget.exe |
44 changes: 0 additions & 44 deletions
44
Microsoft.AspNet.CoreServices/Compilation/CompilerCache.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
src/Microsoft.AspNet.CoreServices/Compilation/CompilerCache.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
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.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.