-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] define UnixFilePermissions.xml (#6010)
Context: dotnet/sdk#16894 Context: dotnet/sdk#17299 On non-Windows platforms, the `dotnet workload install` command needs to ensure that certain files are executable after extracting them from the workload package, via `chmod 755 FILE`. This is currently done for all files in the `tools` folder for [select workloads][0]. dotnet/sdk/#16894 proposes using a new `data/UnixFilePermissions.xml` file to explicitly specify which files within the workload should have which Unix file permissions applied: <FileList> <File Path="tools/Darwin/aapt2" Permission="755" /> </FileList> Update `Microsoft.Android.Sdk.proj` to create a `data/UnixFilePermissions.xml` file, when building .NET 6+ installers on Linux and macOS platforms. `UnixFilePermissions.xml` is generated with the new `<GenerateUnixFilePermissions/>` task, building upon the `@(AndroidSdkBuildTools)` & related item groups in `create-installers.targets`. This is being done *before* `dotnet workload install` is updated to use `data/UnixFilePermissions.xml`. We also found that the following files should be *removed* from our .NET workload packs: * `aprofutil` * `mono` * `mono-symbolicate` `aprofutil` is needed for AOT use, and AOT is not currently supported under .NET 6. `mono` was only needed for `jnimarshalmethod-gen.exe`, which doesn't work on .NET 6, and `mono-symbolicate` *should* come from Mono-related workload packages, not Android-related packages, and also doesn't work. [0]: https://github.com/dotnet/sdk/blob/17c734cde97c6dde9d4bf298e7a2a7a342263ce6/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs#L186-L191
- Loading branch information
1 parent
46677fd
commit 8ad7f52
Showing
3 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
....Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/GenerateUnixFilePermissions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System.Xml; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace Xamarin.Android.Tools.BootstrapTasks | ||
{ | ||
/// <summary> | ||
/// Creates data/UnixFilePermissions.xml | ||
/// NOTE: not currently intended to run on Windows | ||
/// </summary> | ||
public class GenerateUnixFilePermissions : Task | ||
{ | ||
[Required] | ||
public string Output { get; set; } | ||
|
||
public string PackagePath { get; set; } = ""; | ||
|
||
public ITaskItem [] Files { get; set; } | ||
|
||
public override bool Execute () | ||
{ | ||
var settings = new XmlWriterSettings { | ||
OmitXmlDeclaration = true, | ||
Indent = true, | ||
}; | ||
|
||
/* | ||
<FileList> | ||
<File Path="tools/Darwin/aapt2" Permission="755" /> | ||
</FileList> | ||
*/ | ||
|
||
using var xml = XmlWriter.Create (Output, settings); | ||
xml.WriteStartElement ("FileList"); | ||
if (Files != null) { | ||
var files = | ||
from f in Files | ||
let path = f.GetMetadata ("RelativePath") | ||
let permission = f.GetMetadata ("Permission") | ||
where !string.IsNullOrEmpty (path) && !string.IsNullOrEmpty (permission) | ||
orderby path | ||
select (path, permission); | ||
foreach (var (path, permission) in files) { | ||
xml.WriteStartElement ("File"); | ||
xml.WriteAttributeString ("Path", Path.Combine (PackagePath, path)); | ||
xml.WriteAttributeString ("Permission", permission); | ||
xml.WriteEndElement (); | ||
} | ||
} | ||
xml.WriteEndDocument (); | ||
|
||
return !Log.HasLoggedErrors; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters