Skip to content

Commit 01c2877

Browse files
committed
Extract GitExtensions proj settings from csproj.
1 parent 0b70d66 commit 01c2877

File tree

5 files changed

+56
-19
lines changed

5 files changed

+56
-19
lines changed

src/GitExtensions.BundleBackuper/GitExtensions.BundleBackuper.csproj

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,30 @@ This plugin lets you create a .bundle containing all unpublished commits.</Descr
1212
</PropertyGroup>
1313

1414
<PropertyGroup>
15-
<GitExtensionsDebugPluginsPath>..\..\references\GitExtensions\Plugins\</GitExtensionsDebugPluginsPath>
16-
<GitExtensionsReferenceSource>github</GitExtensionsReferenceSource>
17-
<GitExtensionsReferenceVersion>v3.1</GitExtensionsReferenceVersion>
15+
<!--
16+
<GitExtensionsExtractPath>C:\Temp\GitExtensionsDebug</GitExtensionsExtractPath>
17+
<GitExtensionsReferenceVersion>v3.2.0.6060</GitExtensionsReferenceVersion>
18+
<GitExtensionsReferenceSource>appveyor</GitExtensionsReferenceSource>
19+
-->
1820
</PropertyGroup>
1921

22+
<Import Project="..\..\tools\GitExtensions.Extensibility.targets" />
23+
2024
<ItemGroup>
2125
<Reference Include="GitCommands">
22-
<HintPath>..\..\references\GitExtensions\GitCommands.dll</HintPath>
26+
<HintPath>$(GitExtensionsPath)\GitCommands.dll</HintPath>
2327
</Reference>
2428
<Reference Include="GitExtUtils">
25-
<HintPath>..\..\references\GitExtensions\GitExtUtils.dll</HintPath>
29+
<HintPath>$(GitExtensionsPath)\GitExtUtils.dll</HintPath>
2630
</Reference>
2731
<Reference Include="GitUI">
28-
<HintPath>..\..\references\GitExtensions\GitUI.dll</HintPath>
32+
<HintPath>$(GitExtensionsPath)\GitUI.dll</HintPath>
2933
</Reference>
3034
<Reference Include="GitUIPluginInterfaces">
31-
<HintPath>..\..\references\GitExtensions\GitUIPluginInterfaces.dll</HintPath>
35+
<HintPath>$(GitExtensionsPath)\GitUIPluginInterfaces.dll</HintPath>
3236
</Reference>
3337
<Reference Include="ResourceManager">
34-
<HintPath>..\..\references\GitExtensions\ResourceManager.dll</HintPath>
38+
<HintPath>$(GitExtensionsPath)\ResourceManager.dll</HintPath>
3539
</Reference>
3640
<Reference Include="System.ComponentModel.Composition" />
3741
<Reference Include="System.DirectoryServices" />
@@ -53,14 +57,6 @@ This plugin lets you create a .bundle containing all unpublished commits.</Descr
5357
</EmbeddedResource>
5458
</ItemGroup>
5559

56-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
57-
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(GitExtensionsDebugPluginsPath)" />
58-
</Target>
59-
60-
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
61-
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted ..\..\tools\Download-GitExtensions.ps1 -Version $(GitExtensionsReferenceVersion)" />
62-
</Target>
63-
6460
<Target Name="SetPackageProperties" BeforeTargets="GenerateNuspec">
6561
<PropertyGroup>
6662
<NuspecProperties>
@@ -84,4 +80,5 @@ This plugin lets you create a .bundle containing all unpublished commits.</Descr
8480
<Target Name="Zip" AfterTargets="Pack">
8581
<Exec Command="powershell -ExecutionPolicy Unrestricted $(MSBuildProjectDirectory)\..\..\tools\Zip-GitExtensionsPlugin.ps1 -Version $(PackageVersion) -Configuration $(Configuration)" />
8682
</Target>
83+
8784
</Project>

src/GitExtensions.BundleBackuper/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"GitExtensions.BundleBackuper": {
44
"commandName": "Executable",
5-
"executablePath": "$(SolutionDir)\\references\\GitExtensions\\GitExtensions.exe"
5+
"executablePath": "$(GitExtensionsPath)\\GitExtensions.exe"
66
}
77
}
88
}

tools/Download-GitExtensions.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
param([string] $Version, [string] $Source = "github")
1+
param([string] $ExtractRootPath, [string] $Version, [string] $Source = "github")
2+
3+
if (-not($ExtractRootPath))
4+
{
5+
Throw "Parameter -ExtractRootPath is required";
6+
}
27

38
if (-not($Version))
49
{
@@ -12,8 +17,10 @@ if (-not($Source -eq "github") -and -not($Source -eq "appveyor"))
1217

1318
Set-Location $PSScriptRoot
1419

20+
$ExtractRootPath = Resolve-Path $ExtractRootPath;
21+
Write-Host "Extraction root path is '$ExtractRootPath'.";
22+
1523
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
16-
$ExtractRootPath = '../references'
1724
$AssetToDownloadName = 'GitExtensions-' + $Version + '.zip';
1825
$AssetToDownloadUrl = $null;
1926

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<PropertyGroup>
4+
<GitExtensionsDownloadScriptPath Condition="$(GitExtensionsDownloadScriptPath) == ''">..\..\tools\Download-GitExtensions.ps1</GitExtensionsDownloadScriptPath>
5+
<GitExtensionsExtractPath Condition="$(GitExtensionsExtractPath) == ''">..\..\references</GitExtensionsExtractPath>
6+
<GitExtensionsPath Condition="$(GitExtensionsPath) == ''">$(GitExtensionsExtractPath)\GitExtensions</GitExtensionsPath>
7+
<GitExtensionsPluginsPath Condition="$(GitExtensionsPluginsPath) == ''">$(GitExtensionsPath)\Plugins</GitExtensionsPluginsPath>
8+
<GitExtensionsReferenceSource Condition="$(GitExtensionsReferenceSource) == ''">github</GitExtensionsReferenceSource>
9+
<GitExtensionsReferenceVersion Condition="$(GitExtensionsReferenceVersion) == ''">v3.1</GitExtensionsReferenceVersion>
10+
</PropertyGroup>
11+
12+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="GitExtensions.Extensibility.props" />
3+
4+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
5+
<MakeDir Directories="$(GitExtensionsPluginsPath)" />
6+
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(GitExtensionsPluginsPath)" />
7+
</Target>
8+
9+
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
10+
<PropertyGroup>
11+
<!-- It's required to pass absolute paths to the PS1 script, otherwise it's based wrong. -->
12+
<_GitExtensionsExtractPath>$([System.IO.Path]::Combine('$(ProjectDir)', '$(GitExtensionsExtractPath)'))</_GitExtensionsExtractPath>
13+
<_GitExtensionsDownloadScriptPath>$([System.IO.Path]::Combine('$(ProjectDir)', '$(GitExtensionsDownloadScriptPath)'))</_GitExtensionsDownloadScriptPath>
14+
<_GitExtensionsExecutablePath>$([System.IO.Path]::Combine('$(GitExtensionsPath)', 'GitExtensions.exe'))</_GitExtensionsExecutablePath>
15+
</PropertyGroup>
16+
<MakeDir Directories="$(_GitExtensionsExtractPath)" />
17+
<Error Condition="!Exists($(_GitExtensionsExecutablePath)) and !Exists($(_GitExtensionsDownloadScriptPath))" Text="Path to GitExtensions portable download script is wrong. Current value '$(_GitExtensionsDownloadScriptPath)'." />
18+
<Exec Condition="!Exists($(_GitExtensionsExecutablePath))" Command="powershell.exe -ExecutionPolicy Unrestricted $(_GitExtensionsDownloadScriptPath) -ExtractRootPath $(_GitExtensionsExtractPath) -Version $(GitExtensionsReferenceVersion) -Source $(GitExtensionsReferenceSource)" />
19+
</Target>
20+
21+
</Project>

0 commit comments

Comments
 (0)