Reduce chmod

This commit is contained in:
Piotr Puszkiewicz 2017-02-28 18:16:51 -08:00
parent b2429da437
commit 664f089985
3 changed files with 12 additions and 46 deletions

View file

@ -22,32 +22,6 @@
Configuration="$(Configuration)" Configuration="$(Configuration)"
ProjectPath="$(RootProject)" /> 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> <ItemGroup>
<FilesToClean Include="$(OutputDirectory)/sdk/**/vbc.exe" /> <FilesToClean Include="$(OutputDirectory)/sdk/**/vbc.exe" />
</ItemGroup> </ItemGroup>

View file

@ -9,27 +9,13 @@ namespace Microsoft.DotNet.Cli.Build
public class Chmod : ToolTask public class Chmod : ToolTask
{ {
[Required] [Required]
public string File { get; set; } public string Glob { get; set; }
[Required] [Required]
public string Mode { get; set; } public string Mode { get; set; }
public bool Recursive { 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 protected override string ToolName
{ {
get { return "chmod"; } get { return "chmod"; }
@ -47,12 +33,12 @@ namespace Microsoft.DotNet.Cli.Build
protected override string GenerateCommandLineCommands() 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() private string GetMode()

View file

@ -144,8 +144,8 @@
<!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 --> <!-- Ensure crossgen tool is executable. See https://github.com/NuGet/Home/issues/4424 -->
<Chmod Condition=" '$(OSName)' != 'win' " <Chmod Condition=" '$(OSName)' != 'win' "
File="$(CrossgenPath)" Glob="$(CrossgenPath)"
Mode="u+x" /> Mode="u+x" />
<Crossgen SourceAssembly="%(CrossgenTargets.FullPath)" <Crossgen SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)" DestinationPath="%(CrossgenTargets.FullPath)"
@ -160,4 +160,10 @@
<Move SourceFiles="@(NETCore10Assemblies->'$(PublishDir)/%(Filename)%(Extension).bak')" <Move SourceFiles="@(NETCore10Assemblies->'$(PublishDir)/%(Filename)%(Extension).bak')"
DestinationFiles="@(NETCore10Assemblies)" /> DestinationFiles="@(NETCore10Assemblies)" />
</Target> </Target>
<Target Name="ChmodPublishDir"
AfterTargets="CrossgenPublishDir">
<Chmod Glob="$(SdkOutputDirectory)/**/*" Mode="u=rw,g=r,o=r" />
</Target>
</Project> </Project>