From 19408db5a4eaa309d3f84f6a2d056c5b8b7c8fcb Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 17 Jul 2018 06:13:35 +0200 Subject: monogame-patcher: Refactor method ref finding So far we have searched for methods in two steps: First get all the types and then find all of the constructors or method definitions. The match for the actual method definition was done first for the type and then again for the full definition of the method/constructor. For the replace-call subcommand this also means that we don't have a very good way to find the type, because if we wanted to keep doing this in two steps we would need to parse the type name out of the one given as the replacement string in replace-call. So now we recurse through *all* the constructors and methods and do a full match against the specified replacement string, both for replace-call and for fix-filestreams. Compared to the implementation so far we also do this just once instead of every time we find a call or FileStream constructor. I also overhauled the way we do testing, because in the end writing tests using NUnit would introduce a lot of code churn because we need to make a lot of external calls. The shell is especially useful for exactly that and our tests are now just a plain shell script. Signed-off-by: aszlig --- .../build-support/monogame-patcher/default.nix | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'pkgs/games/build-support/monogame-patcher/default.nix') diff --git a/pkgs/games/build-support/monogame-patcher/default.nix b/pkgs/games/build-support/monogame-patcher/default.nix index 457d124a..bd7b8c9c 100644 --- a/pkgs/games/build-support/monogame-patcher/default.nix +++ b/pkgs/games/build-support/monogame-patcher/default.nix @@ -20,26 +20,8 @@ buildDotnetPackage { sha256 = "0wf8mzr16d2ni008m60rrk738v8ypk74llk6g8mlyx7rrlchnxaf"; outputFiles = [ "lib/net45/*" ]; }) - - (fetchNuGet { - baseName = "NUnit"; - version = "3.10.1"; - sha256 = "159m1wpb9yy2x77x7nl0647jkpzj5j801a2inhdl7hcjys8xrqxi"; - outputFiles = [ "lib/net45/*" ]; - }) - - (fetchNuGet { - baseName = "NUnit.ConsoleRunner"; - version = "3.8.0"; - sha256 = "1gspqzfhvpc8yapni7zcr5h2y025swihv78cw07v048l3myf3pzk"; - outputFiles = [ "tools/*" ]; - }) ]; - doCheck = true; - checkPhase = '' - nunitLibs="$(pkg-config nunit.framework --variable=Libraries)" - MONO_PATH="$(dirname "$nunitLibs")" HOME="$PWD" \ - nunit3-console bin/Release/monogame-patcher.exe - ''; + doInstallCheck = true; + installCheckPhase = "$SHELL -e test.sh"; } -- cgit 1.4.1