ソースを参照

vslol: more robust error checking.

legacy
Sam Hocevar sam 12年前
コミット
dd120a2eec
3個のファイルの変更36行の追加28行の削除
  1. +3
    -3
      tools/vslol/AssemblyInfo.cs
  2. +31
    -23
      tools/vslol/MenuGenerateCompilers.cs
  3. +2
    -2
      tools/vslol/source.extension.vsixmanifest

+ 3
- 3
tools/vslol/AssemblyInfo.cs ファイルの表示

@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("VsLol")]
[assembly: AssemblyDescription("VsSDK reference sample for Menus and Commands")]
[assembly: AssemblyDescription("Lol Engine Productivity Tools")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Lol")]
[assembly: AssemblyProduct("VsLol")]
@@ -20,5 +20,5 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58968f91-edb8-4a4c-9f4f-ba39fdb4a21a")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

+ 31
- 23
tools/vslol/MenuGenerateCompilers.cs ファイルの表示

@@ -94,11 +94,11 @@ namespace Lol.VisualStudio.Plugin
cmd.ClearOutputPane();
cmd.WriteToOutputPane("------ Build started: Generating Compilers ------\n");

int scanner_count = 0, parser_count = 0;
int scanner_count = 0, parser_count = 0, error_count = 0;

foreach (Project project in cmd.projects)
{
cmd.WriteToOutputPane("Project " + project.FullName + "\n");
cmd.WriteToOutputPane("Project " + project.Name + "\n");

string project_path = Path.GetDirectoryName(project.FullName);

@@ -128,45 +128,47 @@ namespace Lol.VisualStudio.Plugin

if (item.Name.EndsWith("-scanner.l"))
{
cmd.WriteToOutputPane(" flex.exe " + filename + "\n");
cmd.WriteToOutputPane("flex.exe " + filename + "\n");

string basename = Path.GetFileName(filename.Substring(0, filename.LastIndexOf("-scanner.l")));
cmd.Run(project_path,
flex_path + "\\bin\\flex.exe",
"-v -o "
+ "generated/" + basename + "-scanner.cpp "
+ filename,
"");
if (!cmd.Run(project_path,
flex_path + "\\bin\\flex.exe",
"-v -o "
+ "generated/" + basename + "-scanner.cpp "
+ filename,
""))
++error_count;

++scanner_count;
}

if (item.Name.EndsWith("-parser.y"))
{
cmd.WriteToOutputPane(" bison.exe " + filename + "\n");
cmd.WriteToOutputPane("bison.exe " + filename + "\n");

string basename = Path.GetFileName(filename.Substring(0, filename.LastIndexOf("-parser.y")));
cmd.Run(project_path,
bison_path + "\\bin\\bison.exe",
"-v -o "
+ "generated/" + basename + "-parser.cpp "
+ "--defines=generated/" + basename + "-parser.h "
+ "-d "
+ "-b "
+ "generated/" + basename + " "
+ filename,
"BISON_PKGDATADIR=" + bison_path + "\\share\\bison");
if (!cmd.Run(project_path,
bison_path + "\\bin\\bison.exe",
"-v -o "
+ "generated/" + basename + "-parser.cpp "
+ "--defines=generated/" + basename + "-parser.h "
+ "-d "
+ "-b "
+ "generated/" + basename + " "
+ filename,
"BISON_PKGDATADIR=" + bison_path + "\\share\\bison"))
++error_count;

++parser_count;
}
}
}

cmd.WriteToOutputPane(string.Format("========== Done. {0} scanner(s), {1} parser(s) ==========\n",
scanner_count, parser_count));
cmd.WriteToOutputPane(string.Format("========== Done: {0} scanner(s), {1} parser(s), {2} error(s) ==========\n",
scanner_count, parser_count, error_count));
}

void Run(string directory, string executable, string arguments, string env)
bool Run(string directory, string executable, string arguments, string env)
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = executable;
@@ -193,12 +195,18 @@ namespace Lol.VisualStudio.Plugin
p.WaitForExit();
WriteToOutputPane(output);
if (p.ExitCode != 0)
{
WriteToOutputPane("Error: " + executable + " exited with code " + p.ExitCode + "\n");
return false;
}
}
catch (Exception e)
{
WriteToOutputPane("Error: failed to launch " + executable + "\n");
return false;
}

return true;
}

private void ClearOutputPane()


+ 2
- 2
tools/vslol/source.extension.vsixmanifest ファイルの表示

@@ -3,8 +3,8 @@
<Identifier Id="VsLol.Sample">
<Name>VsLol</Name>
<Author>Lol</Author>
<Version>0.0</Version>
<Description xml:space="preserve">Lol Engine productivity tools.</Description>
<Version>1.0.0.1</Version>
<Description xml:space="preserve">Lol Engine Productivity Tools.</Description>
<Locale>1033</Locale>
<InstalledByMsi>false</InstalledByMsi>
<SupportedProducts>


読み込み中…
キャンセル
保存