Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
[#449] [9.1] Initial project updates for 9.1 to get things building /…
Browse files Browse the repository at this point in the history
… running

* Updated target framework
* updated PackageReference's to use new nuget feed
  * No NoReference packages
  * New versioning
  * Included script for converting PackageReference in projects
  * Organized / cleaned up other nuget-related scripts
  * Script to add NoWarn tags for NU1603, which pops up from the new nuget structure
* Allow for conditional local assembly references (for development against internal Sitecore previews)
* Other tweaks / upgrades to references (e.g. MVC, DI, Owin, Logging, Newtonsoft versions)
* Added many missing references that were broken previous to 9.0 and then fixed, likely being saved by CopyLocal?
* Some minor breaking API changes
* Updated CopyLocal on test projects to make assemblies available
* Added some missing runtime dependencies to unit tests
  • Loading branch information
nickwesselman committed Nov 27, 2018
1 parent eca6ab0 commit 4f15bc6
Show file tree
Hide file tree
Showing 83 changed files with 2,888 additions and 1,155 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,4 @@ results
npm-debug.log
.DS_Store

/BuildConfiguration.csproj
90 changes: 90 additions & 0 deletions scripts/NuGet/AddLocalReferences.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
$ns = @{x = 'http://schemas.microsoft.com/developer/msbuild/2003'}

function Add-XMLAttribute([System.Xml.XmlNode] $Node, $Name, $Value)
{
$attrib = $Node.OwnerDocument.CreateAttribute($Name)
$attrib.Value = $Value
$node.Attributes.Append($attrib)
}

function Create-XMLElement([System.Xml.XmlNode] $Node, $Name)
{
$Node.OwnerDocument.CreateElement($Name, $ns.x)
}

Get-ChildItem *.csproj -recurse | % {
New-Object psobject -Property @{
File = $_
ProjectXml = [xml](gc $_ -Raw)
}
} | % {
$_.ProjectXml.Project.ItemGroup | % {
$itemGroup = $_
$projectNode = $itemGroup.ParentNode
$packageReferences = @()

# collect the package references
if ($itemGroup.PackageReference.Count -lt 1) {
return
}
$itemGroup.PackageReference | ? {
$_.Include.StartsWith("Sitecore") -and -not $_.Include.Contains("FakeDb")
} | % {
$packageReferences += $_
}
if ($packageReferences.Count -lt 1) {
return
}

# remove package references from existing item group
$packageReferences | % {
$itemGroup.RemoveChild($_)
}

# add the build config import
$import = Create-XMLElement -Node $projectNode -Name Import
Add-XMLAttribute -Node $import -Name Project -Value '$(SolutionDir)\BuildConfiguration.csproj' | out-null
Add-XMLAttribute -Node $import -Name Condition -Value 'Exists(''$(SolutionDir)\BuildConfiguration.csproj'')' | out-null
$projectNode.PrependChild($import)

# create the choose which will replace existing item group, and the conditional
$choose = Create-XMLElement -Node $projectNode -Name Choose
$when = Create-XMLElement -Node $projectNode -Name When
Add-XMLAttribute -Node $when -Name Condition -Value '''$(LocalReferences)'' == ''true''' | out-null
$choose.AppendChild($when)

# create the new item group to go in the conditional
$localReferenceGroup = Create-XMLElement -Node $_ -Name ItemGroup
$packageReferences | % {
$assembly = $_.Include.Replace('.NoReferences', '')
$reference = Create-XMLElement -Node $_ -Name Reference
Add-XMLAttribute -Node $reference -Name Include -Value $assembly | out-null
$hintPath = Create-XMLElement -Node $_ -Name HintPath
$hintPath.InnerText = "`$(SitecorePath)\bin\$assembly.dll"
$reference.AppendChild($hintPath)
$private = Create-XMLElement -Node $_ -Name Private
$private.InnerText = "False"
$reference.AppendChild($private)
$localReferenceGroup.AppendChild($reference)
}
$when.AppendChild($localReferenceGroup)

# add the package reference item group as default
$otherwise = Create-XMLElement -Node $projectNode -Name Otherwise
$choose.AppendChild($otherwise)
$packageReferenceGroup = Create-XMLElement -Node $_ -Name ItemGroup
$otherwise.AppendChild($packageReferenceGroup)
$packageReferences | % {
$packageReferenceGroup.AppendChild($_)
}

# add the choose
$projectNode.InsertAfter($choose, $itemGroup)

# remove the original item group if empty
if (-not $itemGroup.HasChildNodes) {
$projectNode.RemoveChild($itemGroup)
}
}
$_.ProjectXml.Save($_.File)
}
24 changes: 24 additions & 0 deletions scripts/NuGet/AddNoWarnNu1603.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$ns = @{x = 'http://schemas.microsoft.com/developer/msbuild/2003'}
$noWarn = "NU1603"

function Create-XMLElement([System.Xml.XmlNode] $Node, $Name)
{
$Node.OwnerDocument.CreateElement($Name, $ns.x)
}

## Find all Visual Studio projects and parse their XML
Get-ChildItem *.csproj -recurse | % {
New-Object psobject -Property @{
File = $_
ProjectXml = [xml](gc $_ -Raw)
}
} | % {
$propertyGroup = $_.ProjectXml.Project.PropertyGroup[0]
if (-not $propertyGroup) {
return
}
$noWarnElement = Create-XMLElement -Node $propertyGroup -Name NoWarn
$noWarnElement.InnerText = $noWarn
$propertyGroup.AppendChild($noWarnElement) | out-null
$_.ProjectXml.Save($_.File)
}
95 changes: 95 additions & 0 deletions scripts/NuGet/ConvertToNewNuget.ps1

Large diffs are not rendered by default.

92 changes: 0 additions & 92 deletions scripts/NuGet/CreateLocalNugetFeed.ps1

This file was deleted.

92 changes: 0 additions & 92 deletions scripts/NuGet/nugetify.ps1

This file was deleted.

1 change: 0 additions & 1 deletion src/Feature/Accounts/Tests/AccountTrackerServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Ploeh.AutoFixture.Xunit2;
using Sitecore.Analytics;
using Sitecore.Analytics.Data.Items;
using Sitecore.Analytics.Outcome.Extensions;
using Sitecore.Analytics.Tracking;
using Sitecore.Data;
using Sitecore.Data.Items;
Expand Down
Loading

0 comments on commit 4f15bc6

Please sign in to comment.