Skip to content
Permalink
Browse files

[Build] Lot of adjustments for new NuGet resolver system (incl Connec…

…tionRouter, VS Package, etc...)
  • Loading branch information
xen2 committed Nov 8, 2018
1 parent e507146 commit cee640deef9b3d107f5143875a5762546f25d42b
Showing with 694 additions and 656 deletions.
  1. +4 −0 build/Xenko.sln
  2. +0 −175 sources/assets/Xenko.Core.Assets.CompilerApp/NuGetAssemblyResolver.cs
  3. +2 −1 sources/assets/Xenko.Core.Assets.CompilerApp/Xenko.Core.Assets.CompilerApp.csproj
  4. +0 −10 sources/assets/Xenko.Core.Assets.CompilerClient/Program.cs
  5. +0 −67 sources/assets/Xenko.Core.Assets/DirectoryHelper.cs
  6. +65 −42 sources/assets/Xenko.Core.Assets/PackageSessionHelper.Solution.cs
  7. +7 −0 sources/assets/Xenko.Core.Assets/PackageStore.cs
  8. +44 −72 sources/assets/Xenko.Core.Packages/NugetStore.cs
  9. +7 −2 sources/assets/Xenko.Core.Packages/PackageFile.cs
  10. +2 −1 sources/assets/Xenko.Core.Packages/Xenko.Core.Packages.csproj
  11. +9 −0 sources/core/Xenko.Core.Translation/Xenko.Core.Translation.csproj
  12. +2 −4 sources/editor/Xenko.Assets.Presentation/EffectCompilerServerSession.cs
  13. +5 −14 sources/editor/Xenko.Core.Assets.Editor/ViewModel/EditorViewModel.cs
  14. +11 −1 sources/editor/Xenko.Core.Assets.Editor/Xenko.Core.Assets.Editor.csproj
  15. +15 −2 sources/editor/Xenko.GameStudio/Xenko.GameStudio.csproj
  16. +1 −1 sources/engine/Xenko.Engine/Shaders.Compiler/RemoteEffectCompilerClient.cs
  17. +1 −2 sources/engine/Xenko.Graphics/Xenko.Graphics.csproj
  18. +2 −1 sources/engine/Xenko/Xenko.csproj
  19. +12 −12 sources/engine/{Xenko.Graphics → Xenko}/runtime.json
  20. +1 −1 sources/launcher/Xenko.Launcher/Launcher.cs
  21. +19 −0 sources/launcher/Xenko.Launcher/PackageFilterExtensions.cs
  22. +2 −2 sources/launcher/Xenko.Launcher/ViewModels/LauncherViewModel.cs
  23. +3 −3 sources/launcher/Xenko.Launcher/ViewModels/RecentProjectViewModel.cs
  24. +5 −1 sources/launcher/Xenko.Launcher/Xenko.Launcher.csproj
  25. +11 −1 sources/presentation/Xenko.Core.Presentation.Graph/Xenko.Core.Presentation.Graph.csproj
  26. +9 −0 sources/presentation/Xenko.Core.Presentation/Xenko.Core.Presentation.csproj
  27. +111 −0 sources/shared/Xenko.NuGetResolver/NuGetAssemblyResolver.cs
  28. +106 −0 sources/shared/Xenko.NuGetResolver/RestoreHelper.cs
  29. +25 −0 sources/shared/Xenko.NuGetResolver/Xenko.NuGetResolver.projitems
  30. +13 −0 sources/shared/Xenko.NuGetResolver/Xenko.NuGetResolver.shproj
  31. +7 −7 sources/targets/Xenko.GlobalSettings.targets
  32. +13 −14 sources/tools/Xenko.ConnectionRouter/Router.cs
  33. +8 −56 sources/tools/Xenko.ConnectionRouter/RouterHelper.cs
  34. +4 −11 sources/tools/Xenko.ConnectionRouter/Xenko.ConnectionRouter.csproj
  35. +1 −1 sources/tools/Xenko.EffectCompilerServer/EffectCompilerServer.cs
  36. +2 −1 sources/tools/Xenko.EffectCompilerServer/Xenko.EffectCompilerServer.csproj
  37. +1 −1 sources/tools/Xenko.SamplesTestServer/SamplesTestServer.cs
  38. +1 −0 sources/tools/Xenko.SamplesTestServer/Xenko.SamplesTestServer.csproj
  39. +14 −2 sources/tools/Xenko.TestRunner/Xenko.TestRunner.csproj
  40. +2 −2 sources/tools/Xenko.VisualStudio.Commands/XenkoCommands.cs
  41. +122 −82 sources/tools/Xenko.VisualStudio.Package/Commands/XenkoCommandsProxy.cs
  42. +5 −2 sources/tools/Xenko.VisualStudio.Package/Xenko.VisualStudio.Package.csproj
  43. +3 −3 sources/tools/Xenko.VisualStudio.Package/Xenko.VisualStudio.Package.nuspec
  44. +8 −6 sources/tools/Xenko.VisualStudio.Package/XenkoCommands.cs
  45. +7 −51 sources/tools/Xenko.VisualStudio.Package/XenkoPackage.cs
  46. +2 −2 sources/tools/Xenko.VisualStudio.Package/source.extension.vsixmanifest
@@ -457,8 +457,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xenko.Samples.Tests", "..\s
{50D1A3BB-4B41-4EF5-8D2F-3618A3B6C698} = {50D1A3BB-4B41-4EF5-8D2F-3618A3B6C698}
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Xenko.NuGetResolver", "..\sources\shared\Xenko.NuGetResolver\Xenko.NuGetResolver.shproj", "{00B72ED7-00E9-47F7-868D-8162027CD068}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\sources\shared\Xenko.NuGetResolver\Xenko.NuGetResolver.projitems*{00b72ed7-00e9-47f7-868d-8162027cd068}*SharedItemsImports = 13
..\sources\assets\Xenko.Core.Assets.Yaml\Xenko.Core.Assets.Yaml.projitems*{0bd41add-2704-4a77-a9ab-15460a2abdc6}*SharedItemsImports = 4
..\sources\assets\Xenko.Core.Assets.Yaml\Xenko.Core.Assets.Yaml.projitems*{1e54a9a2-4439-4444-ae57-6d2ed3c0dc47}*SharedItemsImports = 4
..\sources\shared\Xenko.Core.ShellHelper\Xenko.Core.ShellHelper.projitems*{1e54a9a2-4439-4444-ae57-6d2ed3c0dc47}*SharedItemsImports = 4
@@ -4047,6 +4050,7 @@ Global
{DA355C86-866F-4843-9B4D-63A173C750FB} = {4C142567-C42B-40F5-B092-798882190209}
{AB574F65-1402-4476-9314-74DCDAF19097} = {5D2D3BE8-9910-45CA-8E45-95660DA4C563}
{2FC40214-A4AA-45DC-9C93-72ED800C40B0} = {75608B5C-1C03-4B38-810E-14EED5165E59}
{00B72ED7-00E9-47F7-868D-8162027CD068} = {1AE1AC60-5D2F-4CA7-AE20-888F44551185}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF877973-604D-4EA7-B5F5-A129961F9EF2}

This file was deleted.

@@ -1,4 +1,4 @@
<Project>
<Project>
<PropertyGroup>
<XenkoPlatform>Windows</XenkoPlatform>
</PropertyGroup>
@@ -57,6 +57,7 @@
<ProjectReference Include="..\Xenko.Core.Assets\Xenko.Core.Assets.csproj" />
</ItemGroup>
<Import Project="..\..\tools\Xenko.Core.VisualStudio\Xenko.Core.VisualStudio.projitems" Label="Shared" />
<Import Project="..\..\shared\Xenko.NuGetResolver\Xenko.NuGetResolver.projitems" Label="Shared" />
<Import Project="$(XenkoPostSettingsTargets)" />
<Import Project="Sdk.targets" Sdk="MSBuild.Sdk.Extras" Version="1.6.55" />

@@ -33,16 +33,6 @@ public static int Main(string[] args)
Environment.CurrentDirectory
};

// Set the XenkoDir environment variable
var installDir = DirectoryHelper.GetInstallationDirectory("Xenko");
Environment.SetEnvironmentVariable("XenkoDir", installDir);

// Use shadow caching only in dev environment
if (DirectoryHelper.IsRootDevDirectory(installDir))
{
newArgs.Insert(0, "/shadow");
}

newArgs.AddRange(args);
var result = serverApp.Run(newArgs.ToArray());

@@ -14,54 +14,6 @@ public static class DirectoryHelper
private const string XenkoNuspec = @"xenko.nuspec";
private static string packageDirectoryOverride;

/// <summary>
/// Gets the directory of the package from which the <see cref="Xenko.Core.Assets"/> assembly has been loaded.
/// </summary>
/// <param name="packageName">The name of the expected package.</param>
/// <returns>A string representing the path of the package directory.</returns>
/// <exception cref="InvalidOperationException">The package from which the <see cref="Xenko.Core.Assets"/> assembly has been loaded does not match the <paramref name="packageName"/>.</exception>
public static string GetPackageDirectory(string packageName)
{
var appDomain = AppDomain.CurrentDomain;
var baseDirectory = new DirectoryInfo(appDomain.BaseDirectory);
var defaultPackageDirectoryTemp = baseDirectory.Parent?.Parent;
// If we have a root directory, then store it as the default package directory
if ((defaultPackageDirectoryTemp != null) && IsPackageDirectory(defaultPackageDirectoryTemp.FullName, packageName))
{
return defaultPackageDirectoryTemp.FullName;
}

throw new InvalidOperationException($"The current AppDomain.BaseDirectory [{baseDirectory}] is not part of the package [{packageName}]");
}

/// <summary>
/// Gets the installation directory from which the <see cref="Xenko.Core.Assets"/> assembly has been loaded.
/// </summary>
/// <param name="packageName">The name of the package from which the <see cref="Xenko.Core.Assets"/> assembly has been loaded..</param>
/// <returns>A string representing the path of the package directory.</returns>
/// <remarks>When executing from a development build, this method returns the root directory of the repository.</remarks>
/// <exception cref="InvalidOperationException">The package from which the <see cref="Xenko.Core.Assets"/> assembly has been loaded does not match the <paramref name="packageName"/>.</exception>
public static string GetInstallationDirectory(string packageName)
{
var packageDirectory = GetPackageDirectory(packageName);
if (packageDirectory == null)
return null;

var packageDirectoryInfo = new DirectoryInfo(packageDirectory);
var installationDirectoryTemp = packageDirectoryInfo.Parent?.Parent;
// Check if we have a regular distribution
if ((installationDirectoryTemp != null) && IsNugetInstalledDirectory(packageDirectoryInfo.FullName))
{
return installationDirectoryTemp.FullName;
}
if (IsRootDevDirectory(packageDirectoryInfo.FullName))
{
// we have a dev distribution
return packageDirectory;
}
return null;
}

/// <summary>
/// Gets the path to the file corresponding to the given package name in the given directory.
/// </summary>
@@ -74,18 +26,6 @@ public static string GetPackageFile(string directory, string packageName)
return Path.Combine(directory, packageName + Package.PackageFileExtension);
}

/// <summary>
/// Indicates whether the given directory is the result of a NuGet installation.
/// </summary>
/// <param name="directory">The directory to check.</param>
/// <returns><c>True</c> if the given directory is a nuget installation directory, <c>false</c> otherwise.</returns>
public static bool IsNugetInstalledDirectory(string directory)
{
if (directory == null) throw new ArgumentNullException(nameof(directory));
var xenkoNuspec = Path.Combine(directory, XenkoNuspec);
return File.Exists(xenkoNuspec);
}

/// <summary>
/// Indicates whether the given directory is the root directory of the repository, when executing from a development build.
/// </summary>
@@ -97,12 +37,5 @@ public static bool IsRootDevDirectory(string directory)
var xenkoSolution = Path.Combine(directory, XenkoSolution);
return File.Exists(xenkoSolution);
}

private static bool IsPackageDirectory(string directory, string packageName)
{
if (directory == null) throw new ArgumentNullException(nameof(directory));
var packageFile = GetPackageFile(directory, packageName);
return File.Exists(packageFile);
}
}
}

0 comments on commit cee640d

Please sign in to comment.
You can’t perform that action at this time.