Merge pull request #5877 from piotrpMSFT/piotrpMSFT/infra/chmodfaster

Clean up chmod usage
This commit is contained in:
Piotr Puszkiewicz 2017-02-28 21:46:49 -08:00 committed by GitHub
commit 5aed4714bb
4 changed files with 17 additions and 47 deletions

View file

@ -22,32 +22,6 @@
Configuration="$(Configuration)"
ProjectPath="$(RootProject)" />
<!-- Corehostify Binaries -->
<ItemGroup Condition=" '$(OSName)' != 'win' ">
<SdkOutputChmodTargets Remove="*" />
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.exe;
$(SdkOutputDirectory)/**/*.dll" >
<!-- Managed assemblies do not need execute -->
<Mode>u=rw,g=r,o=r</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.dylib;
$(SdkOutputDirectory)/**/*.so" >
<!-- Generally, dylibs and sos have 'x' -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*"
Exclude="$(SdkOutputDirectory)/**/*.*" >
<!-- Executables need x -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
</ItemGroup>
<Chmod Condition=" '$(OSName)' != 'win' "
File="%(SdkOutputChModTargets.FullPath)"
Mode="%(SdkOutputChModTargets.Mode)" />
<ItemGroup>
<FilesToClean Include="$(OutputDirectory)/sdk/**/vbc.exe" />
</ItemGroup>

View file

@ -65,7 +65,8 @@
<Target Name="BuildTests"
DependsOnTargets="RestoreTests;">
<DotNetBuild ToolPath="$(OutputDirectory)"
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;" />
ProjectPath="&quot;$(TestDirectory)/Microsoft.DotNet.Cli.Tests.sln&quot;"
MaxCpuCount="1" />
</Target>
<Target Name="CreateTestAssetPackageNuPkgs"

View file

@ -9,27 +9,13 @@ namespace Microsoft.DotNet.Cli.Build
public class Chmod : ToolTask
{
[Required]
public string File { get; set; }
public string Glob { get; set; }
[Required]
public string Mode { get; set; }
public bool Recursive { get; set; }
protected override bool ValidateParameters()
{
base.ValidateParameters();
if (!System.IO.File.Exists(File))
{
Log.LogError($"File '{File} does not exist.");
return false;
}
return true;
}
protected override string ToolName
{
get { return "chmod"; }
@ -47,12 +33,12 @@ namespace Microsoft.DotNet.Cli.Build
protected override string GenerateCommandLineCommands()
{
return $"{GetRecursive()} {GetMode()} {GetFilePath()}";
return $"{GetRecursive()} {GetMode()} {GetGlob()}";
}
private string GetFilePath()
private string GetGlob()
{
return File;
return Glob;
}
private string GetMode()

View file

@ -144,8 +144,8 @@
<!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 -->
<Chmod Condition=" '$(OSName)' != 'win' "
File="$(CrossgenPath)"
Mode="u+x" />
Glob="$(CrossgenPath)"
Mode="u+x" />
<Crossgen SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)"
@ -160,4 +160,13 @@
<Move SourceFiles="@(NETCore10Assemblies->'$(PublishDir)/%(Filename)%(Extension).bak')"
DestinationFiles="@(NETCore10Assemblies)" />
</Target>
<Target Name="ChmodPublishDir"
AfterTargets="CrossgenPublishDir"
Condition=" '$(OSName)' != 'win' ">
<Exec Command="find $(SdkOutputDirectory) -type d -exec chmod 755 {} \;" />
<Exec Command="find $(SdkOutputDirectory) -type f -exec chmod 644 {} \;" />
<Chmod Mode="755" Glob="$(SdkOutputDirectory)/Roslyn/RunCsc.sh" />
</Target>
</Project>