Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for custom packages repository path #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
20 changes: 17 additions & 3 deletions MSBuild.NugetContentRestore.Tasks/NugetContentRestoreTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ public class NugetContentRestoreTask : Task
public string[] AdditionalFolders { get; set; }
public string[] AdditionalIgnoreFilePatterns { get; set; }

[Required]
public string SolutionDir { get; set; }

[Required]
public string ProjectDir { get; set; }

public string RepositoryPath { get; set; }

/// <summary>
/// Enable SmartRestore (default: true)
///
Expand Down Expand Up @@ -67,15 +68,17 @@ public override bool Execute()
var startTime = System.DateTime.Now;

Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: SolutionDir='{0}'", SolutionDir);
Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: RepositoryPath='{0}'", RepositoryPath);
Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: ProjectDir='{0}'", ProjectDir);
Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: ConfigFileFullPath='{0}'", ConfigFileFullPath);
Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: EnableSmartRestore='{0}'", EnableSmartRestore.ToString());

// Get NuGet Package Configuration
var packages = GetPackages();
var packagesPath = RepositoryPath ?? Path.Combine(SolutionDir, "packages");
foreach (var package in packages)
{
var packageFullPath = Path.Combine(SolutionDir, "packages", package.FolderName);
var packageFullPath = Path.Combine(packagesPath, package.FolderName);
Log.LogMessage(MessageImportance.Low, "NugetContentRestore :: {0} :: FullPath='{1}'", package.FolderName, packageFullPath);
if (!Directory.Exists(packageFullPath)) continue;

Expand Down Expand Up @@ -126,12 +129,23 @@ public override bool Execute()

private bool IsValidInput()
{
if (!Directory.Exists(SolutionDir))
if (SolutionDir == null && RepositoryPath == null)
{
Log.LogError("NugetContentRestore :: At least one value must be not null SolutionDir='{0}', RepositoryPath='{1}'", SolutionDir);
return false;
}
if (SolutionDir != null && !Directory.Exists(SolutionDir))
{
Log.LogError("NugetContentRestore :: Could not find directory SolutionDir='{0}'", SolutionDir);
return false;
}

if (RepositoryPath != null && !Directory.Exists(RepositoryPath))
{
Log.LogError("NugetContentRestore :: Could not find directory RepositoryPath='{0}'", RepositoryPath);
return false;
}

if (!Directory.Exists(ProjectDir))
{
Log.LogError("NugetContentRestore :: Could not find directory ProjectDir='{0}'", ProjectDir);
Expand Down
2 changes: 1 addition & 1 deletion MSBuild.NugetContentRestore.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package>
<metadata>
<id>MSBuild.NugetContentRestore</id>
<version>0.1.7</version>
<version>0.1.8-alpha</version>
<authors>Francisco Lopez</authors>
<owners>Francisco Lopez</owners>
<projectUrl>https://github.com/panchilo/MSBuild.NugetContentRestore</projectUrl>
Expand Down
15 changes: 3 additions & 12 deletions MSBuild.NugetContentRestore.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuild.NugetContentRestore.Tasks", "MSBuild.NugetContentRestore.Tasks\MSBuild.NugetContentRestore.Tasks.csproj", "{101AC75D-C470-4614-80F2-1F8D5A08418A}"
ProjectSection(ProjectDependencies) = postProject
{CE4F1D48-3030-4637-8349-794F2B4BD0D0} = {CE4F1D48-3030-4637-8349-794F2B4BD0D0}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,14 +19,6 @@ Global
{101AC75D-C470-4614-80F2-1F8D5A08418A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{101AC75D-C470-4614-80F2-1F8D5A08418A}.Release|Any CPU.Build.0 = Release|Any CPU
{101AC75D-C470-4614-80F2-1F8D5A08418A}.Release|x64.ActiveCfg = Release|Any CPU
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Debug|x64.ActiveCfg = Debug|x64
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Debug|x64.Build.0 = Debug|x64
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Release|Any CPU.Build.0 = Release|Any CPU
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Release|x64.ActiveCfg = Release|x64
{CE4F1D48-3030-4637-8349-794F2B4BD0D0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down