summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorunknown <andarno@.redmond.corp.microsoft.com>2009-09-27 22:16:17 -0700
committerunknown <andarno@.redmond.corp.microsoft.com>2009-09-27 22:16:17 -0700
commit927dc2db54daaa41383a1a9f492ff031caac18ae (patch)
tree885990e41029b8738c9293057199c3af3abe54b5
parentb9c010dfab0a2e526a4719fdf7c1454ef20660b3 (diff)
downloadDotNetOpenAuth-927dc2db54daaa41383a1a9f492ff031caac18ae.zip
DotNetOpenAuth-927dc2db54daaa41383a1a9f492ff031caac18ae.tar.gz
DotNetOpenAuth-927dc2db54daaa41383a1a9f492ff031caac18ae.tar.bz2
Fixed issues with Javascript minification.
-rw-r--r--lib/DotNetOpenAuth.BuildTasks.dllbin21504 -> 34816 bytes
-rw-r--r--lib/DotNetOpenAuth.BuildTasks.pdbbin60928 -> 91648 bytes
-rw-r--r--src/DotNetOpenAuth.BuildTasks/JsPack.cs6
-rw-r--r--src/DotNetOpenAuth.BuildTasks/TaskStrings.Designer.cs4
-rw-r--r--src/DotNetOpenAuth.BuildTasks/TaskStrings.resx4
-rw-r--r--src/DotNetOpenAuth/DotNetOpenAuth.csproj2
-rw-r--r--tools/JavascriptPacker.targets37
7 files changed, 37 insertions, 16 deletions
diff --git a/lib/DotNetOpenAuth.BuildTasks.dll b/lib/DotNetOpenAuth.BuildTasks.dll
index d11865f..49c4a3d 100644
--- a/lib/DotNetOpenAuth.BuildTasks.dll
+++ b/lib/DotNetOpenAuth.BuildTasks.dll
Binary files differ
diff --git a/lib/DotNetOpenAuth.BuildTasks.pdb b/lib/DotNetOpenAuth.BuildTasks.pdb
index dda205e..7376e5f 100644
--- a/lib/DotNetOpenAuth.BuildTasks.pdb
+++ b/lib/DotNetOpenAuth.BuildTasks.pdb
Binary files differ
diff --git a/src/DotNetOpenAuth.BuildTasks/JsPack.cs b/src/DotNetOpenAuth.BuildTasks/JsPack.cs
index ee119ec..a6a5b27 100644
--- a/src/DotNetOpenAuth.BuildTasks/JsPack.cs
+++ b/src/DotNetOpenAuth.BuildTasks/JsPack.cs
@@ -48,9 +48,13 @@ namespace DotNetOpenAuth.BuildTasks {
for (int i = 0; i < this.Inputs.Length; i++) {
if (!File.Exists(this.Outputs[i].ItemSpec) || File.GetLastWriteTime(this.Outputs[i].ItemSpec) < File.GetLastWriteTime(this.Inputs[i].ItemSpec)) {
- Log.LogMessage(MessageImportance.Normal, TaskStrings.PackingJsFile, this.Inputs[i].ItemSpec);
+ Log.LogMessage(MessageImportance.Normal, TaskStrings.PackingJsFile, this.Inputs[i].ItemSpec, this.Outputs[i].ItemSpec);
string input = File.ReadAllText(this.Inputs[i].ItemSpec);
string output = this.packer.Pack(input);
+ if (!Directory.Exists(Path.GetDirectoryName(this.Outputs[i].ItemSpec))) {
+ Directory.CreateDirectory(Path.GetDirectoryName(this.Outputs[i].ItemSpec));
+ }
+
File.WriteAllText(this.Outputs[i].ItemSpec, output, Encoding.UTF8);
} else {
Log.LogMessage(MessageImportance.Low, TaskStrings.SkipPackingJsFile, this.Inputs[i].ItemSpec);
diff --git a/src/DotNetOpenAuth.BuildTasks/TaskStrings.Designer.cs b/src/DotNetOpenAuth.BuildTasks/TaskStrings.Designer.cs
index c786150..17647fd 100644
--- a/src/DotNetOpenAuth.BuildTasks/TaskStrings.Designer.cs
+++ b/src/DotNetOpenAuth.BuildTasks/TaskStrings.Designer.cs
@@ -88,7 +88,7 @@ namespace DotNetOpenAuth.BuildTasks {
}
/// <summary>
- /// Looks up a localized string similar to Packing {0}....
+ /// Looks up a localized string similar to Packing javascript resource &quot;{0}&quot; into &quot;{1}&quot;..
/// </summary>
internal static string PackingJsFile {
get {
@@ -97,7 +97,7 @@ namespace DotNetOpenAuth.BuildTasks {
}
/// <summary>
- /// Looks up a localized string similar to Skip packing {0} because its packed version is up to date..
+ /// Looks up a localized string similar to Skip packing &quot;{0}&quot; because its packed version is up to date..
/// </summary>
internal static string SkipPackingJsFile {
get {
diff --git a/src/DotNetOpenAuth.BuildTasks/TaskStrings.resx b/src/DotNetOpenAuth.BuildTasks/TaskStrings.resx
index 19e162e..50e1592 100644
--- a/src/DotNetOpenAuth.BuildTasks/TaskStrings.resx
+++ b/src/DotNetOpenAuth.BuildTasks/TaskStrings.resx
@@ -127,10 +127,10 @@
<value>No web site with the name '{0}' found.</value>
</data>
<data name="PackingJsFile" xml:space="preserve">
- <value>Packing {0}...</value>
+ <value>Packing javascript resource "{0}" into "{1}".</value>
</data>
<data name="SkipPackingJsFile" xml:space="preserve">
- <value>Skip packing {0} because its packed version is up to date.</value>
+ <value>Skip packing "{0}" because its packed version is up to date.</value>
</data>
<data name="WebApplicationNotFoundSoNotDeleted" xml:space="preserve">
<value>Web application '{0}' was not found, so it was not deleted.</value>
diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj
index 06e6090..d9b1135 100644
--- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj
+++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj
@@ -629,7 +629,7 @@
<EmbeddedResource Include="Strings.sr.resx" />
<EmbeddedResource Include="Xrds\XrdsStrings.sr.resx" />
</ItemGroup>
- <Import Project="..\..\tools\JavascriptPacker.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" />
+ <Import Project="..\..\tools\JavascriptPacker.targets" />
</Project> \ No newline at end of file
diff --git a/tools/JavascriptPacker.targets b/tools/JavascriptPacker.targets
index 213a515..e1a3a8c 100644
--- a/tools/JavascriptPacker.targets
+++ b/tools/JavascriptPacker.targets
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <Import Project="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.targets" />
+ <PropertyGroup>
+ <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..</ProjectRoot>
+ </PropertyGroup>
- <ItemGroup>
- <JavascriptInputs Include="@(EmbeddedResource)" Condition="'%(Extension)' == '.js'" />
- <JavascriptOutputs Include="@(JavascriptInputs->'$(IntermediateOutputPath)%(ItemSpec)')">
- <ResourceName Condition="'%(ResourceName)' == ''">%(ItemSpec)</ResourceName>
- </JavascriptOutputs>
- </ItemGroup>
+ <Import Project="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.targets" />
<PropertyGroup>
<PackJs Condition="'$(PackJs)' == '' and '$(Configuration)' == 'Release'">true</PackJs>
@@ -15,12 +12,32 @@
$(PrepareResourcesDependsOn);
PackJavascriptResources;
</PrepareResourcesDependsOn>
+ <CleanDependsOn>
+ $(CleanDependsOn);
+ CleanPackedJavascriptResources;
+ </CleanDependsOn>
</PropertyGroup>
- <Target Name="PackJavascriptResources" Inputs="@(JavascriptInputs)" Outputs="@(JavascriptOutputs)">
+ <!-- We depend on CreateManifestResourceNames because we'll be changing the paths
+ from which resources are embedded, which will alter their names if that target
+ runs after us. -->
+ <Target Name="PackJavascriptResources" DependsOnTargets="CreateManifestResourceNames">
+ <ItemGroup>
+ <JavascriptInputs Include="@(EmbeddedResource)" Condition="'%(Extension)' == '.js'" />
+ <JavascriptOutputs Include="@(JavascriptInputs->'$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension)')" />
+ <EmbeddedResource Remove="@(JavascriptInputs)" />
+ <EmbeddedResource Include="@(JavascriptOutputs)" />
+ </ItemGroup>
+
<JsPack Inputs="@(JavascriptInputs)" Outputs="@(JavascriptOutputs)" />
+ </Target>
- <EmbeddedResource Remove="@(JavascriptInputs)" />
- <EmbeddedResource Include="@(JavascriptOutputs)"/>
+ <Target Name="CleanPackedJavascriptResources">
+ <ItemGroup>
+ <_JavascriptOutputsToClean
+ Include="@(EmbeddedResource->'$(IntermediateOutputPath)%(RelativeDir)%(Filename)%(Extension)')"
+ Condition="'%(Extension)' == '.js'" />
+ </ItemGroup>
+ <Delete Files="@(_JavascriptOutputsToClean)" />
</Target>
</Project> \ No newline at end of file