Skip to content

Commit 0beb13f

Browse files
committed
Fix compilation of GitTfs plugin...
1 parent 2bb477c commit 0beb13f

File tree

6 files changed

+166
-2
lines changed

6 files changed

+166
-2
lines changed

.nuget/NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
</configuration>

.nuget/NuGet.exe

636 KB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' Or '$(OS)' != 'Windows_NT' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup>
29+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
30+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
31+
<PackagesConfig>packages.config</PackagesConfig>
32+
</PropertyGroup>
33+
34+
<PropertyGroup>
35+
<!-- NuGet command -->
36+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
37+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
38+
39+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
40+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
41+
42+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
43+
44+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
45+
<!-- Commands -->
46+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
47+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
48+
49+
<!-- We need to ensure packages are restored prior to assembly resolve -->
50+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
51+
RestorePackages;
52+
$(BuildDependsOn);
53+
</BuildDependsOn>
54+
55+
<!-- Make the build depend on restore packages -->
56+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
57+
$(BuildDependsOn);
58+
BuildPackage;
59+
</BuildDependsOn>
60+
</PropertyGroup>
61+
62+
<Target Name="CheckPrerequisites">
63+
<!-- Raise an error if we're unable to locate nuget.exe -->
64+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
65+
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
66+
<!--
67+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
68+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
69+
parallel builds will have to wait for it to complete.
70+
-->
71+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
72+
</Target>
73+
74+
<Target Name="_DownloadNuGet">
75+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
76+
</Target>
77+
78+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
79+
<Exec Command="$(RestoreCommand)" Condition="Exists('$(PackagesConfig)')" />
80+
</Target>
81+
82+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
83+
<Exec Command="$(BuildCommand)" />
84+
</Target>
85+
86+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
87+
<ParameterGroup>
88+
<OutputFilename ParameterType="System.String" Required="true" />
89+
</ParameterGroup>
90+
<Task>
91+
<Reference Include="System.Core" />
92+
<Using Namespace="System" />
93+
<Using Namespace="System.IO" />
94+
<Using Namespace="System.Net" />
95+
<Using Namespace="Microsoft.Build.Framework" />
96+
<Using Namespace="Microsoft.Build.Utilities" />
97+
<Code Type="Fragment" Language="cs">
98+
<![CDATA[
99+
try {
100+
OutputFilename = Path.GetFullPath(OutputFilename);
101+
102+
Log.LogMessage("Downloading latest version of NuGet.exe...");
103+
WebClient webClient = new WebClient();
104+
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
105+
106+
return true;
107+
}
108+
catch (Exception ex) {
109+
Log.LogErrorFromException(ex);
110+
return false;
111+
}
112+
]]>
113+
</Code>
114+
</Task>
115+
</UsingTask>
116+
117+
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
118+
<ParameterGroup>
119+
<EnvKey ParameterType="System.String" Required="true" />
120+
<EnvValue ParameterType="System.String" Required="true" />
121+
</ParameterGroup>
122+
<Task>
123+
<Using Namespace="System" />
124+
<Code Type="Fragment" Language="cs">
125+
<![CDATA[
126+
try {
127+
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
128+
}
129+
catch {
130+
}
131+
]]>
132+
</Code>
133+
</Task>
134+
</UsingTask>
135+
</Project>

.nuget/Nuget.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
if [ ! -d 'packages' ]; then
4+
mkdir packages
5+
fi
6+
if [ "$1" = "NoMono" ] ; then
7+
8+
find ./ -name packages.config -exec .nuget/NuGet.exe install {} -o packages \;
9+
10+
else
11+
find ./ -name packages.config -exec mono --runtime=v4.0.30319 .nuget/NuGet.exe install {} -o packages \;
12+
fi
13+

GitTfsPlugin.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ namespace GitTfs.GitExtensions.Plugin
99
{
1010
public class GitTfsPlugin : IGitPlugin
1111
{
12+
public IEnumerable<ISetting> GetSettings()
13+
{
14+
return new List<ISetting>();
15+
}
16+
1217
public void Register(IGitUICommands gitUiCommands)
1318
{
1419
var existingKeys = Settings.GetAvailableSettings();
@@ -22,7 +27,6 @@ public void Register(IGitUICommands gitUiCommands)
2227
{
2328
Settings.AddSetting(settingToAdd, string.Empty);
2429
}
25-
2630
}
2731

2832
public void Unregister(IGitUICommands gitUiCommands)
@@ -31,7 +35,7 @@ public void Unregister(IGitUICommands gitUiCommands)
3135

3236
public bool Execute(GitUIBaseEventArgs gitUiCommands)
3337
{
34-
if (string.IsNullOrEmpty(gitUiCommands.GitModule.GitWorkingDir))
38+
if (string.IsNullOrEmpty(gitUiCommands.GitModule.WorkingDir))
3539
{
3640
return true;
3741
}
@@ -63,6 +67,8 @@ public string Description
6367
get { return "git-tfs"; }
6468
}
6569

70+
ISettingsSource IGitPlugin.Settings { get; set; }
71+
6672
public IGitPluginSettingsContainer Settings { get; set; }
6773

6874
public SettingsContainer PluginSettings

packages/repositories.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<repositories>
3+
<repository path="..\gitextensions\Plugins\GitUIPluginInterfaces\packages.config" />
4+
</repositories>

0 commit comments

Comments
 (0)