Commit e02d857
authored
[build] Remove globalPackagesFolder override (#948)
Context: dec2e39
How does one run NUnit unit-tests? `dotnet test` is an answer --
and perhaps we should consider fully migrating to it -- but for now
we currently use `nunit3-console.exe`.
How do we find the path to `nunit3-console.exe`? *This* is why we
set the [`globalPackagesFolder`][0] property in `NuGet.config` in
commit dec2e39: `globalPackagesFolder` tells NuGet where to place
downloaded NuGet packages. By setting `globalPackagesFolder`, we
knew where the `NUnit.ConsoleRunner` artifacts were installed, and
could construct a path to `nunit3-console.exe`.
The problem with `globalPackagesFolder` is that it's duplication:
the `packages` folder is our own special copy of our NuGet packages,
unshared by anything else on the system. This increases disk space
requirements, and slows down provisioning, as those artifacts need
to be re-downloaded whenever the repo is `git clean`ed.
There is an alternative: when the
[`%(PackageReference.GeneratePathProperty)`][1] property is True,
a `$(Pkg[NuGet_Package_Name])` property is created, which contains
the path to where the NuGet package is installed. Thus, instead of
using a relative path that partially hard-codes NuGet paths:
packages\nunit.consolerunner\3.12.0\tools\nunit3-console.exe
we can instead use:
$(PkgNUnit_ConsoleRunner)/tools/nunit3-console.exe
…in theory.
In practice, `$(PkgNUnit_ConsoleRunner)` isn't set until after
`@(PackageReference)` is processed and (lots of) other MSBuild
targets are run. Targets which *aren't* run when our `RunTests`
MSBuild target is run.
Allow `RunNUnitTests.targets` to use `$(PkgNUnit_ConsoleRunner)`
by adding a new `Java.Interop.BootstrapTasks.targets` file, which
which will create `bin/Build$(Configuration)/PackagePaths.props` as
part of the `Java.Interop.BootstrapTasks.csproj` build.
`RunNUnitTests.targets` can then import `PackagePaths.props`,
obtaining access to `$(PkgNUnit_ConsoleRunner)`.
A "philosophical" problem arises, around *how to build*
`PackagePaths.csproj` from `make prepare`. We effectively have two
separate and overlapping build systems: the original `make` system,
and a `dotnet build`-based system:
% make prepare
% make all
% make run-all-tests
% make prepare-core
% dotnet build -t:Prepare
% dotnet build
# run various tests via YAML…
*Begin* unifying these systems, by updating `make prepare` to run
`msbuild -target:Prepare Java.Interop.sln`, and removing make targets
which overlap with the `Prepare` MSBuild target. This allows
`make prepare` to create `PackagePaths.props`, and reduces the amount
of Makefile code that we need to maintain.
Additionally, this helps speed up `make prepare`; when
`globalPackagesFolder` is used, ~573MB of data must be extracted, and
all NuGet packages downloaded:
# commit f91b077
% time make prepare
…
make prepare 37.11s user 15.57s system 85% cpu 1:01.58 total
% du -sh packages
573M packages
Compare to the approach taken here:
% time make prepare
…
make prepare 14.21s user 5.32s system 83% cpu 23.344 total
`make prepare` now takes ~38% of the time, and reduces disk usage by
573MB.
Quasi-related:
Rename the `<GenerateVersionFile/>` task to `<ReplaceFileContents/>`.
This better matches what the task actually does.
Remove `jdk.mk` and `jdk.targets`. These are no longer needed.
Move `Java.Runtime.Environment.dll.config` generation *out of*
`Makefile`, and into `Java.Runtime.Environment.targets`. This helps
with build system unification.
[0]: https://docs.microsoft.com/en-us/nuget/Consume-Packages/managing-the-global-packages-and-cache-folders
[1]: https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#generatepathproperty1 parent 7dc270d commit e02d857
File tree
13 files changed
+84
-107
lines changed- build-tools
- Java.Interop.BootstrapTasks
- Java.Interop.BootstrapTasks
- scripts
- src
- Java.Interop
- Java.Runtime.Environment
13 files changed
+84
-107
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | | - | |
58 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
59 | 60 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 61 | + | |
73 | 62 | | |
74 | 63 | | |
75 | 64 | | |
76 | 65 | | |
77 | | - | |
78 | 66 | | |
79 | 67 | | |
80 | | - | |
| 68 | + | |
81 | 69 | | |
82 | 70 | | |
83 | 71 | | |
| |||
86 | 74 | | |
87 | 75 | | |
88 | 76 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 77 | | |
94 | 78 | | |
95 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 14 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | | - | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments