Runtime: Remove `clean.sh` and `clean.cmd`

Created on 24 Aug 2019  ยท  15Comments  ยท  Source: dotnet/runtime

I'm trying to clean the working directory while working on stuffs. I was able to do cleanups by passing -clean argument to the build script when I was working on corefx; it appears that for coreclr, such argument isn't present and I have to use the clean.cmd or clean.sh.

However, when I try to execute the script, MSBuild seem to output some error that seems to depend on some files present in a specific folder. Here's the output from build.cmd:

C:\Users\gotos\source\repos\coreclr>clean
Installing dotnet using Arcade...
running: powershell -NoProfile -ExecutionPolicy unrestricted -Command ". C:\Users\gotos\source\repos\coreclr\eng\configure-toolset.ps1; . C:\Users\gotos\source\repos\coreclr\eng\common\tools.ps1; InitializeBuildTool"

Name                           Value
----                           -----
Path                           C:\Users\gotos\source\repos\coreclr\.dotnet\dotnet.exe
Command                        msbuild
Tool                           dotnet
Framework                      netcoreapp2.1


Running: dotnet msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false /flp:v=normal;LogFile=clean.log /t:CleanAllProjects
C:\Users\gotos\source\repos\coreclr\all.locproj(14,3): error MSB4019: ๊ฐ€์ ธ์˜จ "C:\tools\devdiv\loc\Loctask\Localization.settings.targets" ํ”„๋กœ์ ํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. <Import> ์„ ์–ธ์— ์ง€์ •ํ•œ ๊ฒฝ๋กœ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ๊ทธ๋ฆฌ๊ณ  ํŒŒ์ผ์ด ๋””์Šคํฌ์— ์žˆ๋Š”์ง€ ํ™•์ธ ํ•˜์„ธ์š”.

๋นŒ๋“œํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.

C:\Users\gotos\source\repos\coreclr\all.locproj(14,3): error MSB4019: ๊ฐ€์ ธ์˜จ "C:\tools\devdiv\loc\Loctask\Localization.settings.targets" ํ”„๋กœ์ ํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. <Import> ์„ ์–ธ์— ์ง€์ •ํ•œ ๊ฒฝ๋กœ๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ์ง€ ๊ทธ๋ฆฌ๊ณ  ํŒŒ์ผ์ด ๋””์Šคํฌ์— ์žˆ๋Š”์ง€ ํ™•์ธ ํ•˜์„ธ์š”.
    ๊ฒฝ๊ณ  0๊ฐœ
    ์˜ค๋ฅ˜ 1๊ฐœ

๊ฒฝ๊ณผ ์‹œ๊ฐ„: 00:00:00.10

(yes, it's in Korean... but it's the same as the one from build.sh, which is in English)
and here's the one from build.sh, ran on WSL2 Ubuntu:

ganbarukamo@DESKTOP-DH26CRU:~/source/repos/coreclr$ ./clean.sh
Running init-dotnet.sh
Installing dotnet using Arcade...
Running: /home/ganbarukamo/source/repos/coreclr/.dotnet/dotnet msbuild /nologo /verbosity:minimal /clp:Summary /flp:v=normal;LogFile=clean.log /t:CleanAllProjects
/home/ganbarukamo/source/repos/coreclr/all.locproj(14,3): error MSB4019: The imported project "/tools/devdiv/loc/Loctask/Localization.settings.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Build FAILED.

/home/ganbarukamo/source/repos/coreclr/all.locproj(14,3): error MSB4019: The imported project "/tools/devdiv/loc/Loctask/Localization.settings.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.09
ERROR: An error occurred in /home/ganbarukamo/source/repos/coreclr/.dotnet/dotnet msbuild /nologo /verbosity:minimal /clp:Summary /flp:v=normal;LogFile=clean.log /t:CleanAllProjects. Check logs under /home/ganbarukamo/source/repos/coreclr.

What is that C:\tools\devdiv\loc\Loctask\Localization.settings.targets project about? is the script an internal tool only and not supposed to run outside?

area-Infrastructure-coreclr

All 15 comments

Wrong label ๐Ÿ˜’

clean.sh and clean.cmd are deprecated and ready to be removed. The current guidance is to use git clean ... to cleanup the repository artifacts. /cc @dotnet/coreclr-infra

@Gnbrkm41 The safest workflow for cleaning is as follows:

Use the following to verify what git will remove:
git clean -xdn

To actually clean the repository use the following:
git clean -xdf

@jashook @AaronRobinsonMSFT One thing clean.cmd/sh can/could do is clean out the NuGet caches that don't live in the source clone. Is there a recommended alternative scripting for doing that?

It is unclear if we want to do that. It is possible there is another project that uses the global nuget cache and nuking it from some script in the coreclr repo silently could cause problems elsewhere.

It is possible there is another project that uses the global nuget cache and nuking it from some script in the coreclr repo silently could cause problems elsewhere.

Agreed.

Another aspect of this is that to my knowledge there isn't a surgical way to remove specific NuGet packages but leave others. In order to do the targeted removal we would probably need to write some script that searches and then deletes only those we want to remove, which seems like an onerous task and has the added complexity referred to by @jashook.

This script is / would be only run manually, not automatically.

And the nuget cache is a cache, right, so anything there can always be restored?

I have only ever used it when it ask myself "hey, why do I have so little disk space after I've cleaned everything on this machine? Oh, nuget is eating XXXX MB of space..."

The comment still stands as it would silently modify global machine state. In my opinion this should be done very explicitly by the user.

@BruceForstall AFAIK the recommended way to do that is

dotnet nuget locals --clear global-packages

If that works (I'll have to try...), that makes sense.

So then looks like the scripts are not in use anymore & there are alternatives to achieve the same. I'll leave this issue to track the deletion of the build.sh/build.cmdclean.sh/clean.cmd files then.

Just for clarity - I think this is actually about deleting the scripts clean.sh / clean.cmd, not build.sh / build.cmd - the build scripts are still used and, while there are discussions about partially or completely switching them over to use an msbuild script instead, this hasn't been done yet and in fact there's not even a complete agreement on the team yet how that should be done.

Oops. I meant clean.cmd and clean.sh...

Thank you!

clean.cmd/sh scripts do not exist in dotnet/runtime repo anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jkotas picture jkotas  ยท  3Comments

aggieben picture aggieben  ยท  3Comments

nalywa picture nalywa  ยท  3Comments

btecu picture btecu  ยท  3Comments

GitAntoinee picture GitAntoinee  ยท  3Comments