Author: hans Date: Mon Dec 2 11:31:52 2013 New Revision: 196122 URL: http://llvm.org/viewvc/llvm-project?rev=196122&view=rev Log: clang-format vs plugin: bake clang-format.exe into the vsix
This makes the clang-format plugin self-contained. Instead of requiring clang-format.exe to be available on the PATH, this includes it in the plugin's installer (.vsix file) and runs it from the install directory. Differential Revision: http://llvm-reviews.chandlerc.com/D2281 Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs cfe/trunk/tools/clang-format-vs/README.txt Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj?rev=196122&r1=196121&r2=196122&view=diff ============================================================================== --- cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj (original) +++ cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormat.csproj Mon Dec 2 11:31:52 2013 @@ -178,6 +178,9 @@ <None Include="Resources\Images_32bit.bmp" /> </ItemGroup> <ItemGroup> + <Content Include="clang-format.exe"> + <IncludeInVSIX>true</IncludeInVSIX> + </Content> <Content Include="Resources\Package.ico" /> </ItemGroup> <ItemGroup> Modified: cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs?rev=196122&r1=196121&r2=196122&view=diff ============================================================================== --- cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs (original) +++ cfe/trunk/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Mon Dec 2 11:31:52 2013 @@ -22,6 +22,7 @@ using System; using System.ComponentModel; using System.ComponentModel.Design; using System.IO; +using System.Reflection; using System.Runtime.InteropServices; using System.Xml.Linq; @@ -128,9 +129,12 @@ namespace LLVM.ClangFormat /// </summary> private string RunClangFormat(string text, int offset, int length, string path) { + string vsixPath = Path.GetDirectoryName(Uri.UnescapeDataString( + new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)); + System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; - process.StartInfo.FileName = "clang-format.exe"; + process.StartInfo.FileName = vsixPath + "\\clang-format.exe"; // Poor man's escaping - this will not work when quotes are already escaped // in the input (but we don't need more). string style = GetStyle().Replace("\"", "\\\""); Modified: cfe/trunk/tools/clang-format-vs/README.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format-vs/README.txt?rev=196122&r1=196121&r2=196122&view=diff ============================================================================== --- cfe/trunk/tools/clang-format-vs/README.txt (original) +++ cfe/trunk/tools/clang-format-vs/README.txt Mon Dec 2 11:31:52 2013 @@ -5,3 +5,6 @@ Build prerequisites are: - Visual Studio 2012 Professional - Visual Studio 2010 Professional - Visual Studio 2010 SDK. + +clang-format.exe must be copied into the ClangFormat/ directory before building. +It will be bundled into the .vsix file. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
