Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions build-tools/xa-prep-tasks/xa-prep-tasks.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="$(OutputPath)xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.DownloadUri" />
<UsingTask AssemblyFile="$(OutputPath)xa-prep-tasks.dll" TaskName="Xamarin.Android.BuildTools.PrepTasks.SystemUnzip" />
<Import Project="..\bundle\bundle-path.targets" />
<Import Project="..\scripts\XAVersionInfo.targets" />
<PropertyGroup>
<_AzureBaseUri>https://xamjenkinsartifact.blob.core.windows.net/xamarin-android/xamarin-android/bin/</_AzureBaseUri>
<_NuGetUri>https://dist.nuget.org/win-x86-commandline/latest/nuget.exe</_NuGetUri>
<_NuGetPath>$(MSBuildThisFileDirectory)\..\..\.nuget</_NuGetPath>
</PropertyGroup>
<Target Name="_CreateVersion"
DependsOnTargets="GetXAVersionInfo"
Expand Down Expand Up @@ -67,6 +69,17 @@
DestinationFiles="$(_BundlePath)"
/>
</Target>
<Target Name="_DownloadNuGet"
Inputs=""
Outputs="$(_NuGetPath)\NuGet.exe">
<MakeDir
Directories="$(_NuGetPath)"
/>
<DownloadUri
SourceUris="$(_NuGetUri)"
DestinationFiles="$(_NuGetPath)\NuGet.exe"
/>
</Target>
<Target Name="_ExtractBundle"
Condition=" Exists('$(_BundlePath)') "
Inputs="$(_BundlePath)"
Expand All @@ -84,6 +97,6 @@
</Target>
<Target Name="_DownloadAndExtractBundle"
AfterTargets="Build"
DependsOnTargets="_GetBundleOutputPath;_DownloadBundle;_ExtractBundle">
DependsOnTargets="_GetBundleOutputPath;_DownloadBundle;_ExtractBundle;_DownloadNuGet">
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using Microsoft.Build.Construction;
using System.Diagnostics;
using System.Text;
using NuGet;

namespace Xamarin.ProjectTools
{
Expand Down Expand Up @@ -380,12 +379,12 @@ public void NuGetRestore (string directory, string packagesDirectory = null)
if (!Packages.Any ())
return;

IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository ("https://packages.nuget.org/api/v2");
PackageManager packageManager = new PackageManager (repo, Path.Combine (Root, directory, "..", "packages"));

foreach (var package in Packages) {
packageManager.InstallPackage (package.Id, new SemanticVersion (package.Version));
}
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
var psi = new ProcessStartInfo (isWindows ? "NuGet.exe" : "mono") {
Arguments = $"{(isWindows ? "" : "\"" + Path.Combine (Root,"NuGet.exe") + "\"")} restore -PackagesDirectory \"{Path.Combine (Root, directory, "..", "packages")}\" \"{Path.Combine (Root, directory, "packages.config")}\"",
};
var process = Process.Start (psi);
process.WaitForExit ();
}

public string ProcessSourceTemplate (string source)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -38,9 +38,6 @@
<Reference Include="Microsoft.Web.XmlTransform">
<HintPath>..\..\..\..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
</Reference>
<Reference Include="NuGet.Core">
<HintPath>..\..\..\..\packages\NuGet.Core.2.11.1\lib\net40-Client\NuGet.Core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down Expand Up @@ -145,6 +142,10 @@
Include="..\..\..\..\bin\$(Configuration)\lib\xbuild\Xamarin\Android\libzip.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content
Include="..\..\..\..\.nuget\NuGet.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibZipSharpSourceFullPath)\libZipSharp.csproj">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net45" />
<package id="NuGet.Core" version="2.11.1" targetFramework="net45" />
<package id="Unofficial.Ionic.Zip" version="1.9.1.8" targetFramework="net45" />
<package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net451" />
</packages>