diff options
-rw-r--r-- | .vscode/launch.json | 27 | ||||
-rw-r--r-- | .vscode/tasks.json | 18 | ||||
-rw-r--r-- | Documentation/README.md | 1 | ||||
-rw-r--r-- | Documentation/how-to-build-and-run-ilcompiler-in-vscode.md | 54 | ||||
-rw-r--r-- | src/BuildIntegration/Microsoft.NETCore.Native.targets | 2 | ||||
-rw-r--r-- | src/ILCompiler/src/ILCompiler.csproj | 8 | ||||
-rwxr-xr-x | src/ILCompiler/src/ilc.runtimeconfig.json | 8 | ||||
-rw-r--r-- | src/Test.CoreLib/readme.md | 2 | ||||
-rw-r--r-- | src/packaging/packages.targets | 8 |
9 files changed, 125 insertions, 3 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..46d40ef7b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "", + "osx": { + "program": "${workspaceRoot}/bin/Product/OSX.x64.Debug/packaging/publish1/ilc.dll" + }, + "linux": { + "program": "${workspaceRoot}/bin/Product/Linux.x64.Debug/packaging/publish1/ilc.dll" + }, + "args": [], + "cwd": "${workspaceRoot}", + "stopAtEntry": false, + "externalConsole": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command.pickProcess}" + } + ] +}
\ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..3420cc476 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,18 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "0.1.0", + "command": "${workspaceRoot}/build.sh", + "isShellCommand": false, + "args": [], + "tasks": [ + { + "taskName": "build", + "args": [ ], + "isBuildCommand": true, + "showOutput": "silent", + "suppressTaskName" : true, + "problemMatcher": "$msCompile" + } + ] +} diff --git a/Documentation/README.md b/Documentation/README.md index bcca1faeb..1f099ff2c 100644 --- a/Documentation/README.md +++ b/Documentation/README.md @@ -12,5 +12,6 @@ This is the repo for CoreRT, the .NET Core runtime optimized for AOT (Ahead of T - [Prerequisites for building](prerequisites-for-building.md) - [How to build and run from the Command Line](how-to-build-and-run-ilcompiler-in-console-shell-prompt.md) - [How to build and run from Visual Studio](how-to-build-and-run-ilcompiler-in-visual-studio-2015.md) +- [How to build and run from VSCode](how-to-build-and-run-ilcompiler-in-vscode.md) - [How to run tests](how-to-run-tests.md) - [Cross Compilation for ARM on Linux](cross-building.md) diff --git a/Documentation/how-to-build-and-run-ilcompiler-in-vscode.md b/Documentation/how-to-build-and-run-ilcompiler-in-vscode.md new file mode 100644 index 000000000..df1f3fe9b --- /dev/null +++ b/Documentation/how-to-build-and-run-ilcompiler-in-vscode.md @@ -0,0 +1,54 @@ +_Please ensure that [pre-requisites](prerequisites-for-building.md) are installed for a successful build of the repo._ + +_Note_: + +* Instructions below assume ```~/corert``` is the repo root. + +# Setting up # + +Please make sure you have latest VS Code, C# extension, and .NET Core available. This guide is tested under C# 1.6.2 + VS Code 1.8.1 + CLI 1.0.0-preview4-004233. + +This guide assumes that your VS code workspace is set to the root of the repo. + +# Running VS Code + +We've checked-in reasonable default ```launch.json``` and ```tasks.json``` under ```corert/.vscode``` directory. You only need to run vscode form corert root: + +``` +code ~/corert +``` + +And then press SHIFT+COMMAND+B to start the build. + +# Debugging ILC.exe using .NET Core Debugger # + +Go to the debug pane and click Debug, choose .NET Core as the environment. If needed, you can change program property in launch.json (the gear button) to point to a different flavor of ilc: + +```json + "osx": { + "program": "${workspaceRoot}/bin/Product/OSX.x64.Debug/packaging/publish1/ilc.dll" + }, + "linux": { + "program": "${workspaceRoot}/bin/Product/Linux.x64.Debug/packaging/publish1/ilc.dll" + }, +``` + +By default we've disabled automatic build before debug. If you want to change that, you can change the ```preLaunchTask``` property to ```"build"```. But this is not currently recommended. + +# Getting ILC response files + +A ```.ilc.rsp``` file path can be easily obtained from a .NET core project that you want to debug by following command: + +``` +dotnet build /t:LinkNative /t:Rebuild /v:Detailed | grep ".ilc.rsp" +``` + +Once you have the ilc path, you can change ```launch.json``` accordingly: + +```json + "args": ["@obj/Debug/netcoreapp1.0/native/<netcore_app_name>.ilc.rsp"], + "cwd": "<netcore_app_root_folder>", +``` + +* ```args``` - the argument to ILC +* ```cwd``` - the current directory where ILC is running. You can set it to the .NET Core project root. diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.targets b/src/BuildIntegration/Microsoft.NETCore.Native.targets index 9d1325eff..c45f6636f 100644 --- a/src/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/BuildIntegration/Microsoft.NETCore.Native.targets @@ -91,7 +91,7 @@ See the LICENSE file in the project root for more information. <TestHost Condition="'$(OS)' != 'Windows_NT'">corerun</TestHost> </PropertyGroup> - <Exec Command=""$(IlcPath)\$(TestHost)" "$(IlcPath)\ilc.exe" @"$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp""> + <Exec Command=""$(IlcPath)\$(TestHost)" "$(IlcPath)\ilc.dll" @"$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp""> </Exec> </Target> diff --git a/src/ILCompiler/src/ILCompiler.csproj b/src/ILCompiler/src/ILCompiler.csproj index 1121a50ee..3ffc7651a 100644 --- a/src/ILCompiler/src/ILCompiler.csproj +++ b/src/ILCompiler/src/ILCompiler.csproj @@ -7,6 +7,10 @@ <ProjectGuid>{DD5B6BAA-D41A-4A6E-9E7D-83060F394B10}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>ILCompiler</RootNamespace> + <!-- This is needed for VS Code debugging for ILC - it only likes DLL extension --> + <!-- This also aligns with .NET Core applications model --> + <!-- Note that we can't change the OutputType to be library - there is no entry point --> + <TargetExt>.dll</TargetExt> <AssemblyName>ilc</AssemblyName> <DefaultLanguage>en-US</DefaultLanguage> <FileAlignment>512</FileAlignment> @@ -44,6 +48,10 @@ </ItemGroup> <ItemGroup> <None Include="project.json" /> + <!-- This is needed for VS Code debugging for ILC --> + <Content Include="ilc.runtimeconfig.json"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\ILCompiler.Compiler\src\ILCompiler.Compiler.csproj"> diff --git a/src/ILCompiler/src/ilc.runtimeconfig.json b/src/ILCompiler/src/ilc.runtimeconfig.json new file mode 100755 index 000000000..d0437745b --- /dev/null +++ b/src/ILCompiler/src/ilc.runtimeconfig.json @@ -0,0 +1,8 @@ +{ + "runtimeOptions": { + "framework": { + "name": "Microsoft.NETCore.App", + "version": "1.0.1" + } + } +}
\ No newline at end of file diff --git a/src/Test.CoreLib/readme.md b/src/Test.CoreLib/readme.md index d05eca4ff..878302f80 100644 --- a/src/Test.CoreLib/readme.md +++ b/src/Test.CoreLib/readme.md @@ -14,7 +14,7 @@ csc /noconfig /nostdlib Program.cs /r:<repo_root>\bin\Product\Windows_NT.x64.Deb 2. Compile the IL with ILC -Use ilc.exe that was built with the repo to compile the program. +Use ilc.dll that was built with the repo to compile the program. ``` ilc repro.exe -o:repro.obj -r:<repo_root>\bin\Product\Windows_NT.x64.Debug\Test.CoreLib\Test.CoreLib.dll --systemmodule Test.CoreLib diff --git a/src/packaging/packages.targets b/src/packaging/packages.targets index f362e52cd..00b505047 100644 --- a/src/packaging/packages.targets +++ b/src/packaging/packages.targets @@ -33,7 +33,7 @@ </PropertyGroup> <ItemGroup> <!-- IL.Compiler target files --> - <ILCompilerFiles Include="ilc.exe" /> + <ILCompilerFiles Include="ilc.dll" /> <ILCompilerFiles Include="ILCompiler.Compiler.dll" /> <ILCompilerFiles Include="ILCompiler.DependencyAnalysisFramework.dll" /> <ILCompilerFiles Include="ILCompiler.MetadataTransform.dll" /> @@ -74,6 +74,12 @@ <ILCompilerBinPlace Include="@(ILCompilerContentFiles)"> <Text><![CDATA[ <file src="src/%(Identity)" target="runtimes/$(NuPkgRid)/native/%(Filename)%(Extension)" /> ]]></Text> </ILCompilerBinPlace> + + <!-- This is needed for VS Code debugging for ILC --> + <ILCompilerJsonContentFiles Include="ilc.runtimeconfig.json" /> + <ILCompilerBinPlace Include="@(ILCompilerJsonContentFiles)"> + <Text><![CDATA[ <file src="src/ILCompiler/src/%(Identity)" target="runtimes/$(NuPkgRid)/native/%(Filename)%(Extension)" /> ]]></Text> + </ILCompilerBinPlace> <!-- IL.Compiler.SDK target files --> <ILCompilerSdkFiles Include="Runtime" /> |