]> granicus.if.org Git - clang/commitdiff
Fix VS2015 build of clang-format-vsix by using NuGet to pull in required assemblies
authorHans Wennborg <hans@hanshq.net>
Thu, 1 Dec 2016 18:05:41 +0000 (18:05 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 1 Dec 2016 18:05:41 +0000 (18:05 +0000)
Also added a gitignore to help track the right items to commit.

Patch by Antonio Maiorano <amaiorano@gmail.com>!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288393 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format-vs/.gitignore [new file with mode: 0644]
tools/clang-format-vs/CMakeLists.txt
tools/clang-format-vs/ClangFormat/ClangFormat.csproj
tools/clang-format-vs/ClangFormat/packages.config [new file with mode: 0644]
tools/clang-format-vs/README.txt

diff --git a/tools/clang-format-vs/.gitignore b/tools/clang-format-vs/.gitignore
new file mode 100644 (file)
index 0000000..6453dd8
--- /dev/null
@@ -0,0 +1,11 @@
+# Visual Studio files
+.vs/
+/packages/
+/ClangFormat/obj/
+/ClangFormat/bin/
+
+# Generated and copied files
+/ClangFormat/Key.snk
+/ClangFormat/license.txt
+/ClangFormat/clang-format.exe
+/ClangFormat/source.extension.vsixmanifest
index fd0d6b028c66b05f1e7071712b3d8788b8f96b5e..6d2ef73632a833481590f6bb7a7828b3f2c2ddd5 100644 (file)
@@ -18,8 +18,15 @@ if (BUILD_CLANG_FORMAT_VS_PLUGIN)
   configure_file("source.extension.vsixmanifest.in"
       "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest")
 
+  find_program(NUGET_EXE nuget PATHS ${NUGET_EXE_DIR})
+  if (NOT NUGET_EXE)
+    message(FATAL_ERROR "Could not find nuget.exe. Download from https://www.nuget.org/nuget.exe"
+                        " and add parent directory to PATH or pass it via NUGET_EXE_DIR var.")
+  endif()
+
   add_custom_target(clang_format_vsix ALL
-      devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release
+      COMMAND ${NUGET_EXE} restore "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln"
+      COMMAND devenv "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat.sln" /Build Release
       DEPENDS clang_format_exe_for_vsix "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/source.extension.vsixmanifest"
       COMMAND ${CMAKE_COMMAND} -E copy_if_different
       "${CMAKE_CURRENT_SOURCE_DIR}/ClangFormat/bin/Release/ClangFormat.vsix"
index d4107733a1223e145ce729bed7fc0f0f9fb9d653..5ce601d649bf76040cb1435787a71d90eb9b43df 100644 (file)
@@ -35,6 +35,7 @@
     <IsWebBootstrapper>false</IsWebBootstrapper>\r
     <UseApplicationTrust>false</UseApplicationTrust>\r
     <BootstrapperEnabled>true</BootstrapperEnabled>\r
+    <TargetFrameworkProfile />\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
@@ -44,6 +45,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <RunCodeAnalysis>true</RunCodeAnalysis>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
   </PropertyGroup>\r
   <ItemGroup>\r
+    <Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.DTE.7.0.3\lib\net20\envdte.dll</HintPath>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </Reference>\r
     <Reference Include="Microsoft.CSharp" />\r
-    <Reference Include="Microsoft.VisualStudio.CoreUtility, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.Editor, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.OLE.Interop" />\r
-    <Reference Include="Microsoft.VisualStudio.Shell.Interop" />\r
-    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />\r
-    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />\r
+    <Reference Include="Microsoft.VisualStudio.CoreUtility, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.CoreUtility.10.0.4\lib\net40\Microsoft.VisualStudio.CoreUtility.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Editor, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Editor.10.0.4\lib\net40\Microsoft.VisualStudio.Editor.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.OLE.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>\r
+      <Private>True</Private>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Shell.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Shell.10.10.0.3\lib\net40\Microsoft.VisualStudio.Shell.10.0.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Shell.Immutable.10.10.0.3\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.Shell.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>\r
+      <Private>True</Private>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.Shell.Interop.8.8.0.3\lib\net20\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>\r
+      <Private>True</Private>\r
+      <Private>False</Private>\r
+    </Reference>\r
     <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />\r
-    <Reference Include="Microsoft.VisualStudio.TextManager.Interop" />\r
-    <Reference Include="Microsoft.VisualStudio.Shell.10.0">\r
-      <Private>false</Private>\r
-    </Reference>\r
-    <Reference Include="Microsoft.VisualStudio.Text.Data, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.Text.Logic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.Text.UI, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />\r
-    <Reference Include="Microsoft.VisualStudio.TextManager.Interop" />\r
-    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />\r
+    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.Shell.Interop.9.9.0.3\lib\net20\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>\r
+      <Private>True</Private>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Text.Data, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.Data.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Text.Logic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.Logic.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Text.UI, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.UI.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\VSSDK.Text.10.0.4\lib\net40\Microsoft.VisualStudio.Text.UI.Wpf.dll</HintPath>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.TextManager.Interop">\r
+      <HintPath>..\packages\VSSDK.TextManager.Interop.7.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.TextManager.Interop.8.8.0.4\lib\net20\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>\r
+      <Private>True</Private>\r
+      <Private>False</Private>\r
+    </Reference>\r
+    <Reference Include="PresentationCore" />\r
+    <Reference Include="PresentationFramework" />\r
+    <Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+      <HintPath>..\packages\VSSDK.DTE.7.0.3\lib\net20\stdole.dll</HintPath>\r
+      <EmbedInteropTypes>False</EmbedInteropTypes>\r
+    </Reference>\r
     <Reference Include="System" />\r
+    <Reference Include="System.ComponentModel.Composition" />\r
     <Reference Include="System.Core" />\r
     <Reference Include="System.Data" />\r
     <Reference Include="System.Design" />\r
     <Reference Include="System.Windows.Forms" />\r
     <Reference Include="System.Xml" />\r
     <Reference Include="System.Xml.Linq" />\r
+    <Reference Include="WindowsBase" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <COMReference Include="EnvDTE">\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="Key.snk" />\r
+    <None Include="packages.config" />\r
     <None Include="source.extension.vsixmanifest">\r
       <SubType>Designer</SubType>\r
     </None>\r
   <Target Name="AfterBuild">\r
   </Target>\r
   -->\r
-</Project>\r
+</Project>
\ No newline at end of file
diff --git a/tools/clang-format-vs/ClangFormat/packages.config b/tools/clang-format-vs/ClangFormat/packages.config
new file mode 100644 (file)
index 0000000..38f64ed
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="VSSDK.CoreUtility" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.CoreUtility.10" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.DTE" version="7.0.3" targetFramework="net40" />
+  <package id="VSSDK.Editor" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.Editor.10" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.IDE" version="7.0.4" targetFramework="net40" />
+  <package id="VSSDK.IDE.10" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.IDE.8" version="8.0.4" targetFramework="net40" />
+  <package id="VSSDK.IDE.9" version="9.0.3" targetFramework="net40" />
+  <package id="VSSDK.OLE.Interop" version="7.0.4" targetFramework="net40" />
+  <package id="VSSDK.Shell.10" version="10.0.3" targetFramework="net40" />
+  <package id="VSSDK.Shell.Immutable.10" version="10.0.3" targetFramework="net40" />
+  <package id="VSSDK.Shell.Interop" version="7.0.4" targetFramework="net40" />
+  <package id="VSSDK.Shell.Interop.8" version="8.0.3" targetFramework="net40" />
+  <package id="VSSDK.Shell.Interop.9" version="9.0.3" targetFramework="net40" />
+  <package id="VSSDK.Text" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.Text.10" version="10.0.4" targetFramework="net40" />
+  <package id="VSSDK.TextManager.Interop" version="7.0.4" targetFramework="net40" />
+  <package id="VSSDK.TextManager.Interop.8" version="8.0.4" targetFramework="net40" />
+</packages>
\ No newline at end of file
index b23355d0cebcc64dde4f7cc653c9ea868249e15c..edfffed774c1570d46da00f111b95582df1a1a66 100644 (file)
@@ -2,13 +2,23 @@ This directory contains a VSPackage project to generate a Visual Studio extensio
 for clang-format.\r
 \r
 Build prerequisites are:\r
-- Visual Studio 2013 Professional\r
-- Visual Studio 2013 SDK\r
-- Visual Studio 2010 Professional (?)\r
-- Visual Studio 2010 SDK (?)\r
+- Visual Studio 2015\r
+- Extensions SDK (you'll be prompted to install it if you open ClangFormat.sln)\r
 \r
-The extension is built using CMake by setting BUILD_CLANG_FORMAT_VS_PLUGIN=ON\r
-when configuring a Clang build, and building the clang_format_vsix target.\r
+The extension is built using CMake to generate the usual LLVM.sln by setting\r
+the following CMake vars:\r
+\r
+- BUILD_CLANG_FORMAT_VS_PLUGIN=ON\r
+\r
+- NUGET_EXE_PATH=path/to/nuget_dir (unless nuget.exe is already available in PATH)\r
+\r
+example:\r
+  cd /d C:\code\llvm\r
+  mkdir build & cd build\r
+  cmake -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DNUGET_EXE_PATH=C:\nuget ..\r
+\r
+Once LLVM.sln is generated, build the clang_format_vsix target, which will build\r
+ClangFormat.sln, the C# extension application.\r
 \r
 The CMake build will copy clang-format.exe and LICENSE.TXT into the ClangFormat/\r
 directory so they can be bundled with the plug-in, as well as creating\r