Mauricio Scheffer avatar Mauricio Scheffer committed faca58f

Merged BuildMagicDownload and BuildMagicExtract tasks

Comments (0)

Files changed (1)

BuildMagic.targets

     <BuildDependsOn>BuildMagicRestore;$(BuildDependsOn)</BuildDependsOn>
   </PropertyGroup>
 
-  <UsingTask TaskName="BuildMagicDownload" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
+  <UsingTask TaskName="BuildMagicDownloadAndExtract" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
     <ParameterGroup>
       <Address ParameterType="System.String" Required="true" />
-      <DestinationFile ParameterType="System.String" Required="true" />
-    </ParameterGroup>
-    <Task>
-      <Code Type="Fragment" Language="cs">
-        <![CDATA[
-          using (var client = new System.Net.WebClient())
-          {
-            Directory.CreateDirectory(Path.GetDirectoryName(DestinationFile));
-            client.DownloadFile(Address, DestinationFile);
-            return true;
-          }
-        ]]>
-      </Code>
-    </Task>
-  </UsingTask>
-
-  <UsingTask TaskName="BuildMagicExtract" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
-    <ParameterGroup>
       <ZipFile ParameterType="System.String" Required="true" />
       <PathInZipFile ParameterType="System.String" Required="true" />
       <DestinationFile ParameterType="System.String" Required="true" />
       <Reference Include="WindowsBase" />
       <Code Type="Fragment" Language="cs">
         <![CDATA[
+          using (var client = new System.Net.WebClient())
+          {
+            Directory.CreateDirectory(Path.GetDirectoryName(ZipFile));
+            client.DownloadFile(Address, ZipFile);
+          }
           using (var pkg = System.IO.Packaging.ZipPackage.Open(ZipFile, FileMode.Open))
           {
             var part = pkg.GetParts().First(x => x.Uri.ToString() == PathInZipFile);
     <PropertyGroup>
       <BuildMagicNuGetZip>$(BuildMagicNuGetLocation).zip</BuildMagicNuGetZip>
     </PropertyGroup>
-    <BuildMagicDownload Address="$(BuildMagicNuGetUrl)" DestinationFile="$(BuildMagicNuGetZip)" />
-    <BuildMagicExtract ZipFile="$(BuildMagicNuGetZip)" PathInZipFile="/tools/NuGet.exe" DestinationFile="$(BuildMagicNuGetLocation)" />
+    <BuildMagicDownloadAndExtract Address="$(BuildMagicNuGetUrl)" ZipFile="$(BuildMagicNuGetZip)" PathInZipFile="/tools/NuGet.exe" DestinationFile="$(BuildMagicNuGetLocation)"/>
   </Target>
 
   <Target Name="BuildMagicRestore" Condition="Exists('$(BuildMagicPackagesConfig)')" DependsOnTargets="BuildMagicInstallNuget">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.