Skip to content

Commit

Permalink
Merge pull request #21 from dawoe/feature/v9-support
Browse files Browse the repository at this point in the history
Feature/v9 support
  • Loading branch information
dawoe authored Mar 17, 2022
2 parents ec0a061 + e40dec2 commit 4ebd8e5
Show file tree
Hide file tree
Showing 60 changed files with 1,126 additions and 7,764 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ src/.vs/
src/packages/
testsites/
Packaging/NugetCoreBuild/
tools/

!/src/**/[Bb]uild
dist/
89 changes: 89 additions & 0 deletions Packaging/BuildPackage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
param($versionSuffix)


$CurrentDir = Split-Path $MyInvocation.MyCommand.Path
$RootDir = Split-Path -Path $CurrentDir -Parent
$UtilitiesDir = "$RootDir\Utilities"
$DistDir = "$RootDir\dist"
$SrcDir = "$RootDir\src"
$SolutionFile = "$SrcDir\Dawoe.OEmbedPickerPropertyEditor.sln"

#Remove dist folder
if(Test-Path -Path $DistDir)
{
Remove-Item -Recurse -Force $DistDir;
}

Write-Host "Preparing solution"

#Prepare build
. $UtilitiesDir\Prepare.ps1

Prepare-Solution -CurrentDir $UtilitiesDir -Configuration 'Release'

$buildFolder = Join-Path -Path $RootDir -ChildPath 'build';

Write-Host "Create nuget packages"

if(-Not([string]::IsNullOrEmpty($versionSuffix)))
{
if(-Not([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_NUMBER)))
{
$VersionSuffix = "$VersionSuffix-$env:APPVEYOR_BUILD_NUMBER"
}
dotnet pack $SolutionFile -c Release -o $DistDir --version-suffix $VersionSuffix --no-build
}
else
{
dotnet pack $SolutionFile -c Release -o $DistDir --no-build
}

Write-Host "Getting version for package"

#Get version number
$buildPropsXml = New-Object System.Xml.XmlDocument
$buildPropsXml.Load("$SrcDir\Directory.Build.props")

$version = Select-XML -xml $buildPropsXml -XPath '(//VersionPrefix)[1]'

if(-Not([string]::IsNullOrEmpty($versionSuffix)))
{
$version = "$version-$VersionSuffix"
}

Write-Host "Assembling Umbraco Package"

$umbFolder = Join-Path -Path $buildFolder -ChildPath "__umb";
if (!(Test-Path -Path $umbFolder)) {New-Item -Path $umbFolder -Type Directory;}

$umbracoManifest = Join-Path -Path $CurrentDir -ChildPath "manifest-umbraco.xml";
$umbracoPackageXml = [xml](Get-Content $umbracoManifest);
$umbracoPackageXml.umbPackage.info.package.version = "$($version)";

$filesXml = $umbracoPackageXml.CreateElement("files");

$assetFiles = Get-ChildItem -Path $buildFolder -File -Recurse;
foreach($assetFile in $assetFiles){

$hash = Get-FileHash -Path $assetFile.FullName -Algorithm MD5;
$guid = $hash.Hash.ToLower() + $assetFile.Extension;
$orgPath = "~" + $assetFile.Directory.FullName.Replace($buildFolder, "").Replace("\", "/");

$fileXml = $umbracoPackageXml.CreateElement("file");
$fileXml.set_InnerXML("<guid>${guid}</guid><orgPath>${orgPath}</orgPath><orgName>$($assetFile.Name)</orgName>");
$filesXml.AppendChild($fileXml);

Copy-Item -Path $assetFile.FullName -Destination "${umbFolder}\${guid}";
}

$umbracoPackageXml.umbPackage.ReplaceChild($filesXml, $umbracoPackageXml.SelectSingleNode("/umbPackage/files")) | Out-Null;
$umbracoPackageXml.Save("${umbFolder}\package.xml");

Write-Host "Creating Umbraco Package zip file"

Compress-Archive -Path "${umbFolder}\*" -DestinationPath "${DistDir}\Dawoe.OEmbedPickerPropertyEditor_$version.zip" -Force;


# Tidy up folders
Write-Host "Cleaning up"
Remove-Item -Recurse -Force $buildFolder;
37 changes: 0 additions & 37 deletions Packaging/Package.xml

This file was deleted.

49 changes: 0 additions & 49 deletions Packaging/Tools/AppVeyorUmbraco/AppVeyorUmbraco.targets

This file was deleted.

Binary file not shown.
104 changes: 0 additions & 104 deletions Packaging/Tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.Targets

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 4ebd8e5

Please sign in to comment.