Skip to content

Commit 73fb9cd

Browse files
authored
Merge pull request #384 from filipw/version/0.27.0
Version/0.27.0
2 parents 640f365 + 04b3c87 commit 73fb9cd

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,20 @@ dotnet script exec {path_to_dll} -- arg1 arg2
255255

256256
### Caching
257257

258-
#### Restore Cache
258+
We provide two types of caching, the `dependency cache` and the `execution cache` which is explained in detail below. In order for any of these caches to be enabled, it is required that all NuGet package references are specified using an exact version number. The reason for this constraint is that we need to make sure that we don't execute a script with a stale dependency graph.
259259

260-
Under the hood, Dotnet-Script performs a `dotnet restore` to resolve the dependencies needed to execute the script(s). This is an out-of-process operation and typically takes roughly one second. The `restore cache` ensures that we only do a `dotnet restore` if the dependencies has changed. For this cache to kick in, it is required for all NuGet package references to be specified using an exact version number.
260+
#### Dependency Cache
261261

262-
This cache an be disabled using the `--nocache` flag.
262+
In order to resolve the dependencies for a script, a `dotnet restore` is executed under the hood to produce a `project.assets.json` file from which we can figure out all the dependencies we need to add to the compilation.
263+
This is an out-of-process operation and represents a significant overhead to the script execution. So this cache works by looking at all the dependencies specified in the script(s) either in the form of NuGet package references or assembly file references. If these dependencies matches the dependencies from the last script execution, we skip the restore and read the dependencies from the already generated `project.assets.json` file. If any of the dependencies has changed, we must restore again to obtain the new dependency graph.
263264

264-
#### DLL Cache
265+
#### Execution cache
265266

266-
Dotnet-Script will automatically create a DLL on first execution of a script and as long as the source code has not changed it will continue to
267-
use that DLL significantlly speeding up the execution of your scripts (by 8x). The cached DLL's are stored in the user %tmp%/dotnet-script folder.
267+
In order to execute a script it needs to be compiled first and since that is a CPU and time consuming operation, we make sure that we only compile when the source code has changed. This works by creating a SHA256 hash from all the script files involved in the execution. This hash is written to a temporary location along with the DLL that represents the result of the script compilation. When a script is executed the hash is computed and compared with the hash from the previous compilation. If they match there is no need to recompile and we run from the already compiled DLL. If the hashes don't match, the cache is invalidated and we recompile.
268268

269-
You can override this automatic caching by passing **--nocache** flag, which will cause your script to be dynamically compiled everytime you run it.
269+
> You can override this automatic caching by passing **--nocache** flag, which will bypass both caches and cause dependency resolution and script compilation to happen every time we execute the script.
270+
271+
###
270272

271273
### Debugging
272274

src/Dotnet.Script.Core/Dotnet.Script.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.</Description>
5-
<VersionPrefix>0.26.1</VersionPrefix>
5+
<VersionPrefix>0.27.0</VersionPrefix>
66
<Authors>filipw</Authors>
77
<TargetFramework>netstandard2.0</TargetFramework>
88
<AssemblyName>Dotnet.Script.Core</AssemblyName>

src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<RepositoryUrl>https://github.com/filipw/dotnet-script.git</RepositoryUrl>
1212
<RepositoryType>git</RepositoryType>
1313
<PackageTags>script;csx;csharp;roslyn;omnisharp</PackageTags>
14-
<Version>0.7.0</Version>
14+
<Version>0.8.0</Version>
1515
<LangVersion>latest</LangVersion>
1616
</PropertyGroup>
1717

src/Dotnet.Script/Dotnet.Script.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Dotnet CLI tool allowing you to run C# (CSX) scripts.</Description>
4-
<VersionPrefix>0.26.1</VersionPrefix>
4+
<VersionPrefix>0.27.0</VersionPrefix>
55
<Authors>filipw</Authors>
66
<PackageId>Dotnet.Script</PackageId>
77
<TargetFramework>netcoreapp2.1</TargetFramework>
@@ -20,7 +20,7 @@
2020
<PackAsTool>false</PackAsTool>
2121
<IsPackable>true</IsPackable>
2222
<LangVersion>latest</LangVersion>
23-
</PropertyGroup>
23+
</PropertyGroup>
2424
<ItemGroup>
2525
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.9.0" />
2626
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.2" />

0 commit comments

Comments
 (0)