Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
The scripting system I used to run the information generator has died…
Browse files Browse the repository at this point in the history
…, meaning bad version info got into the thing. Replaced it.
  • Loading branch information
malware-dev committed May 7, 2023
1 parent 0e2f3fd commit fbb09a7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 9 deletions.
37 changes: 37 additions & 0 deletions Source/MDK/MDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,43 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="..\Mixin.SteamAndSE\Mixin.SteamAndSE.projitems" Label="Shared" />
<UsingTask TaskName="FindCsi" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<CsiPath ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.Diagnostics" />
<Using Namespace="System.IO" />
<Using Namespace="System.Linq" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var vsWherePath = Path.Combine(programFiles, @"Microsoft Visual Studio\Installer\vswhere.exe");
var startInfo = new ProcessStartInfo(vsWherePath)
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
Arguments = "-latest -products * -requires Microsoft.Component.MSBuild -property installationPath"
};
var process = new Process { StartInfo = startInfo };
process.Start();
var vsInstallDir = process.StandardOutput.ReadToEnd().Trim();
process.WaitForExit();
var roslynPath = Directory.GetDirectories(Path.Combine(vsInstallDir, @"MSBuild\Current\Bin"), "Roslyn", SearchOption.AllDirectories).FirstOrDefault();
CsiPath = roslynPath != null ? Path.Combine(roslynPath, "csi.exe") : string.Empty;
]]>
</Code>
</Task>
</UsingTask>
<Target Name="BeforeBuild">
<FindCsi>
<Output TaskParameter="CsiPath" PropertyName="CsiExePath" />
</FindCsi>
<Exec Command="&quot;$(CsiExePath)&quot; &quot;MDKPackage.GeneratedInfo.csx&quot;" />
</Target>

<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)deploy.bat" $(ConfigurationName) "$(ProjectDir)..\..\Release" "$(TargetDir)$(TargetName).vsix"</PostBuildEvent>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Source/MDK/MDKPackage.GeneratedInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace MDK
{
[InstalledProductRegistration("#110", "#112", "1.4", IconResourceID = 400)] // Info on this package for Help/About
[InstalledProductRegistration("#110", "#112", "1.5", IconResourceID = 400)] // Info on this package for Help/About
public partial class MDKPackage
{
/// <summary>
/// The current package version
/// </summary>
public static readonly Version Version = new Version("1.4.14");
public static readonly Version Version = new Version("1.5.16");

/// <summary>
/// The required IDE version
Expand Down Expand Up @@ -69,4 +69,4 @@ public partial class MDKPackage

}.ToImmutableArray();
}
}
}
20 changes: 15 additions & 5 deletions Source/MDK/MDKPackage.GeneratedInfo.csx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
using System;
#r "System.Xml"
#r "System.Xml.Linq"

using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;

const string Xmlns = "http://schemas.microsoft.com/developer/msbuild/2003";
readonly string ProjectFilePath = Path.GetFullPath("MDK.csproj");

Console.WriteLine("GENERATING PACKAGE INFORMATION");

var namespaceName = "MDK";
var manifest = XDocument.Load(Path.Combine(Path.GetDirectoryName(Context.ProjectFilePath), "source.extension.vsixmanifest"));
var manifest = XDocument.Load(Path.Combine(Path.GetDirectoryName(ProjectFilePath), "source.extension.vsixmanifest"));
var identity = manifest
.Element(XName.Get("PackageManifest", "http://schemas.microsoft.com/developer/vsx-schema/2011"))
.Element(XName.Get("Metadata", "http://schemas.microsoft.com/developer/vsx-schema/2011"))
Expand All @@ -20,7 +26,7 @@ var gameAssemblies = new List<string>();
var utilityAssemblies = new List<string>();
var gameFiles = new List<string>();
var utilityFiles = new List<string>();
var projectTemplate = XDocument.Load(Path.Combine(Path.GetDirectoryName(Context.ProjectFilePath), "..\\IngameScriptTemplate\\ProjectTemplate.csproj"));
var projectTemplate = XDocument.Load(Path.Combine(Path.GetDirectoryName(ProjectFilePath), "..\\IngameScriptTemplate\\ProjectTemplate.csproj"));
var xmlns = new XmlNamespaceManager(new NameTable());
xmlns.AddNamespace("ms", Xmlns);
foreach (var element in projectTemplate.XPathSelectElements("/ms:Project/ms:ItemGroup/ms:Reference", xmlns))
Expand All @@ -40,14 +46,18 @@ foreach (var element in projectTemplate.XPathSelectElements("/ms:Project/ms:Item
utilityFiles.Add($"\"{include.Substring(16).Replace("\\", "\\\\")}\"");
}

var other = XDocument.Load(Path.Combine(Path.GetDirectoryName(Context.ProjectFilePath), "other.xml"));
var other = XDocument.Load(Path.Combine(Path.GetDirectoryName(ProjectFilePath), "other.xml"));
var isPrerelease = string.Equals(other.XPathSelectElement("/Other/IsPrerelease")?.Value ?? "True", "true", StringComparison.CurrentCultureIgnoreCase)? "true" : "false";
var helpPageUrl = other.XPathSelectElement("/Other/HelpPageUrl")?.Value ?? "";
var releasePageUrl = other.XPathSelectElement("/Other/ReleasePageUrl")?.Value ?? "";
var issuesPageUrl = other.XPathSelectElement("/Other/IssuesPageUrl")?.Value ?? "";
var requiredIdeVersion = other.XPathSelectElement("/Other/RequiredIdeVersion")?.Value ?? "";

Context.Output.WriteLine($@"using System;

readonly string TargetFileName = Path.Combine(Path.GetDirectoryName(ProjectFilePath), "MDKPackage.GeneratedInfo.cs");
Console.WriteLine(TargetFileName);

File.WriteAllText(TargetFileName, $@"using System;
using System.Collections.Immutable;
using Microsoft.VisualStudio.Shell;
Expand Down
2 changes: 1 addition & 1 deletion Source/MDK/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="MDK.Morten Aune Lyrstad.e02b602e-3099-44a5-88c6-cb30cab978f6" Version="1.5.15" Language="en-US" Publisher="Morten Aune Lyrstad" />
<Identity Id="MDK.Morten Aune Lyrstad.e02b602e-3099-44a5-88c6-cb30cab978f6" Version="1.5.16" Language="en-US" Publisher="Morten Aune Lyrstad" />
<DisplayName>MDK/SE</DisplayName>
<Description xml:space="preserve">A toolkit to help with ingame script (programmable block) development for Keen Software House's space sandbox Space Engineers.

Expand Down

0 comments on commit fbb09a7

Please sign in to comment.