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

fix: pharmacist putting contents of lock file into .cs file. #113

Merged
merged 3 commits into from
Feb 6, 2020
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
5 changes: 3 additions & 2 deletions src/Pharmacist.MsBuild.NuGet/PharmacistNuGetTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ [new Guid("A3F8F2AB-B479-4A4A-A458-A89E7DC349F1")] = "Xamarin.Mac",
/// <inheritdoc />
public override bool Execute()
{
var jsonSettings = new JsonSerializerSettings() { Formatting = Formatting.Indented };
var funcLogManager = new FuncLogManager(type => new WrappingFullLogger(new WrappingPrefixLogger(new MsBuildLogger(Log, LogLevel.Debug), type)));
Locator.CurrentMutable.RegisterConstant(funcLogManager, typeof(ILogManager));

Expand All @@ -108,7 +109,7 @@ public override bool Execute()
try
{
var fileContents = File.ReadAllText(LockFile);
var lockedLibraries = JsonConvert.DeserializeObject<List<LibraryRange>>(fileContents);
var lockedLibraries = JsonConvert.DeserializeObject<List<LibraryRange>>(fileContents, jsonSettings);
if (lockedLibraries != null && lockedLibraries.Count == packages.Count && lockedLibraries.All(packages.Contains))
{
return true;
Expand Down Expand Up @@ -139,7 +140,7 @@ public override bool Execute()
}
}

File.WriteAllText(LockFile, JsonConvert.SerializeObject(packages));
File.WriteAllText(LockFile, JsonConvert.SerializeObject(packages, jsonSettings));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PharmacistTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Full'">$(MSBuildThisFileDirectory)..\..\build\netstandard2.0\Pharmacist.MSBuild.dll</PharmacistTaskAssemblyFile>
<PharmacistTaskAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Full'">$(MSBuildThisFileDirectory)..\..\build\net461\Pharmacist.MSBuild.dll</PharmacistTaskAssemblyFile>
<PharmacistOutputFile>$(IntermediateOutputPath)\Pharmacist.NuGet.g.cs</PharmacistOutputFile>
<PharmacistLockFile>$(IntermediateOutputPath)\Pharmacist.NuGet.g.cs</PharmacistLockFile>
<PharmacistLockFile>$(IntermediateOutputPath)\Pharmacist.NuGet.g.cs.lock</PharmacistLockFile>
</PropertyGroup>

<UsingTask TaskName="Pharmacist.MsBuild.NuGet.PharmacistNuGetTask" AssemblyFile="$(PharmacistTaskAssemblyFile)" />
Expand Down