Skip to content

Commit

Permalink
Updated the project references to utilize the new TypeScript properties.
Browse files Browse the repository at this point in the history
- Updated version to prep for new release.
- Removed complex pieces of the insane build.ps1 file for EndGate.Core.JS
  • Loading branch information
NTaylorMullen committed Dec 6, 2013
1 parent 9896c2e commit f6d7645
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 153 deletions.
20 changes: 12 additions & 8 deletions EndGate/EndGate.Core.JS/EndGate.Core.JS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<UseIISExpress>false</UseIISExpress>
<TypeScriptToolsVersion>0.9</TypeScriptToolsVersion>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
Expand Down Expand Up @@ -42,10 +43,16 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<RootNamespace>EndGate.Core.JS</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptEnableCompileOnSave>true</TypeScriptEnableCompileOnSave>
<TypeScriptGeneratesDeclarations>True</TypeScriptGeneratesDeclarations>
<TypeScriptOutDir>Scripts</TypeScriptOutDir>
<TypeScriptOutFile>Scripts/endgate.js</TypeScriptOutFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES5</TypeScriptTarget>
Expand Down Expand Up @@ -163,6 +170,9 @@
<DependentUpon>Range.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="Tweening\ColorTween.ts" />
<Content Include="Scripts\endgate.js">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Tweening\ColorTween.js">
<DependentUpon>ColorTween.ts</DependentUpon>
</Content>
Expand Down Expand Up @@ -500,12 +510,6 @@
<Content Include="Scripts\endgate.d.ts">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\endgate.js">
<DependentUpon>endgate.ts</DependentUpon>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Scripts\endgate.ts" />
<Content Include="Scripts\_references.js" />
<CodeAnalysisDictionary Include="Sound\AudioClip.ts" />
<Content Include="Sound\AudioClip.js">
<DependentUpon>AudioClip.ts</DependentUpon>
Expand Down Expand Up @@ -542,8 +546,8 @@
<Content Include="build.ps1" />
</ItemGroup>
<ItemGroup />
<Import Project="$(SolutionDir)\build\Microsoft.TypeScript.targets" Condition="Exists('$(SolutionDir)\build\Microsoft.TypeScript.targets')" />
<Target Name="BeforeBuild">
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />
<Target Name="AfterBuild">
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass .\build.ps1" WorkingDirectory="$(ProjectDir)" Condition=" '$(OS)' == 'Windows_NT'" />
</Target>
</Project>
1 change: 0 additions & 1 deletion EndGate/EndGate.Core.JS/Scripts/_references.js

This file was deleted.

140 changes: 1 addition & 139 deletions EndGate/EndGate.Core.JS/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,148 +4,10 @@
$inpath = ".\"
$outFolder = "Scripts"

$outputJS = "endgate.js"
$outputTS = "endgate.ts"
$outputDeclaration = "endgate.d.ts"

$outputJSPath = $outFolder + "\" + $outputJS
$outputTSPath = $outFolder + "\" + $outputTS
$outputDeclarationPath = $outFolder + "\" + $outputDeclaration

###### DEPENDENCY RESOLUTION ######
$allFiles = Get-ChildItem -path $inpath -recurse |?{ ! $_.PSIsContainer } |?{($_.name).contains(".ts")} |?{!($_.name).Contains($outputTS)} |?{!($_.name).Contains($outputDeclaration)}

Function GetDependencies($file)
{
$content = Get-Content $file.FullName
return $content -match "^/// <reference path=`"(.*)`"" | %{$_.Split("`"")[1]}
}

Function GetFile([string]$filePathName)
{
$pieces = $filePathName.Split("/");
$filename;

if($pieces.Length -gt 1)
{
$filename = $pieces[$pieces.Length - 1]
}
else
{
$filename = $pieces[0];
}

Foreach($file in $allFiles)
{
if($file.Name.Trim() -eq $filename.Trim())
{
return $file;
}
}
}

Function DependenciesContainFile($needle, $haystack)
{
$i = 0

Foreach($file in $haystack)
{
$i++;

if($file.Name -eq $needle.Name)
{
return $i;
}
}

return -1;
}

Function AddDependencies($baseFile)
{
$location = DependenciesContainFile ($baseFile) ($script:dependencyArray)
if($location -eq -1)
{
$dependencies = GetDependencies($baseFile);

Foreach($dependency in $dependencies)
{
$file = GetFile($dependency)
$location = DependenciesContainFile($file) ($script:pendingAdditions)

if($location -ne -1)
{
continue;
}

$script:pendingAdditions += $file
AddDependencies ($file);
$script:pendingAdditions = $script:pendingAdditions |? {$_.Name -ne $file.Name}
}

$location = DependenciesContainFile ($baseFile) ($script:dependencyArray)
if($location -eq -1)
{
$script:dependencyArray += $baseFile;
}
}
}

$dependencyArray = @()
$pendingAdditions = @()

Write-Host "Resolving file dependencies... " -NoNewline -ForegroundColor Yellow
Foreach($file in $allFiles)
{
AddDependencies ($file) ($dependencyArray);
}
Write-Host "done" -ForegroundColor Green

# Files in the order they must be combined

###### TYPESCRIPT DECLARATION FILE ######
Write-Host "Building $outputDeclaration... " -NoNewline -ForegroundColor Yellow
$allFilesStr = ""
foreach($file in $dependencyArray)
{
if($file)
{
$allFilesStr += "`"" + $file.FullName + "`" "
}
}

if (Test-Path $outputDeclarationPath) {
Clear-Content $outputDeclarationPath
}
else {
New-Item $outputDeclarationPath -type file
}


tsc --out $outputDeclarationPath --declaration $allFilesStr --target ES5

# Since TypeScript will not push imports into declaration files I need to append the alias via the build step
Add-Content $outputDeclarationPath "import eg = EndGate;"
Write-Host "done" -ForegroundColor Green

###### TYPESCRIPT FILE ######
Write-Host "Building $outputTS... " -NoNewline -ForegroundColor Yellow

$files = $dependencyArray;
$referenceReplacer = "^/// <reference( )+?path.*$"
Remove-Item $outputTSPath -Force -ErrorAction SilentlyContinue
foreach ($file in $files) {
if ($file)
{
Add-Content -Path $outputTSPath -Value "/* $file */"
Get-Content -Path $file.FullName | Foreach-Object {$_ -replace $referenceReplacer, ""} | Add-Content -Path $outputTSPath
}
}
Write-Host "done" -ForegroundColor Green

###### JS FILE ######
Write-Host "Building $outputJS... " -NoNewline -ForegroundColor Yellow

tsc $outputTSPath --target ES5

Write-Host "done" -ForegroundColor Green
Write-Host "done" -ForegroundColor Green
5 changes: 3 additions & 2 deletions EndGate/EndGate.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{781B19E3-47EF-4A88-8F67-35BBA654B563}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
Expand Down Expand Up @@ -28,7 +30,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3B69DE52
ProjectSection(SolutionItems) = preProject
build\Build.proj = build\Build.proj
build\EndGate.Versions.targets = build\EndGate.Versions.targets
build\Microsoft.TypeScript.targets = build\Microsoft.TypeScript.targets
build\MSBuild.Community.Tasks.dll = build\MSBuild.Community.Tasks.dll
build\MSBuild.Community.Tasks.targets = build\MSBuild.Community.Tasks.targets
EndProjectSection
Expand Down
2 changes: 1 addition & 1 deletion EndGate/build/EndGate.Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<MajorVersion>0</MajorVersion>
<MinorVersion>2</MinorVersion>
<PatchVersion>0</PatchVersion>
<PatchVersion>1</PatchVersion>
<VersionQuality></VersionQuality>
<QualityEnding Condition="$(VersionQuality) != ''">-$(VersionQuality)</QualityEnding>
<EndGateVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)$(QualityEnding)</EndGateVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<TypeScriptToolsVersion>0.9</TypeScriptToolsVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>EndGate.Core.JS.Samples</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
Expand Down Expand Up @@ -847,7 +851,7 @@
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(SolutionDir)\build\Microsoft.TypeScript.targets" Condition="Exists('$(SolutionDir)\build\Microsoft.TypeScript.targets')" />
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<IISExpressUseClassicPipelineMode />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TypeScriptToolsVersion>0.9</TypeScriptToolsVersion>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>EndGate.Core.JS.Tests</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -197,7 +201,7 @@
</BuildScriptTags>
<FileUpdate Files="index.html" Regex="&lt;!-- ##JS## --&gt;((.|\r|\n)*?)&lt;!-- ##JS## --&gt;" ReplacementText="&lt;!-- ##JS## --&gt;$(JSTests)&lt;!-- ##JS## --&gt;" Condition=" '$(OS)' == 'Windows_NT'" />
</Target>
<Import Project="$(SolutionDir)\build\Microsoft.TypeScript.targets" Condition="Exists('$(SolutionDir)\build\Microsoft.TypeScript.targets')" />
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets')" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit f6d7645

Please sign in to comment.