Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msbuild] Port the BTouch task to subclass XamarinTask. #21616

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/build-apps/build-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ See also:
* The [AppIcon](build-properties.md#AppIcon) property.
* The [IncludeAllAppIcons](build-properties.md#IncludeAllAppIcons) property.

## BGenReferencePath

The list of assembly references to pass to the `bgen` tool (binding generator).

Typically this is handled automatically by adding references as
`ProjectReference` or `PackageReference` items instead.

## PartialAppManifest

`PartialAppManifest` can be used to add additional partial app manifests that
Expand Down
22 changes: 22 additions & 0 deletions docs/build-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ See also:
* The [AlternateAppIcon](build-items.md#AlternateAppIcon) item group.
* The [IncludeAllAppIcons](#IncludeAllAppIcons) property.

### BGenEmitDebugInformation

Whether the `bgen` tool (the binding generator) should emit debug information or not.

The default behavior is `true` when the `Debug` property is set to `true`.

## BGenExtraArgs

Any extra arguments to the `bgen` tool (the binding generator).

## BGenToolExe

The name of the `bgen` executable (a tool used by binding projects to generate bindings).

The default behavior is to use the `bgen` tool shipped with our workload.

## BGenToolPath

The directory to where the `bgen` ([BGenToolExe](#BGenToolExe)) is located.

The default behavior is to use the `bgen` tool shipped with our workload.

## DittoPath

The full path to the `ditto` executable.
Expand Down
4 changes: 2 additions & 2 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,8 @@

<Target Name="_ComputeBindingVariables" DependsOnTargets="_ComputeFrameworkVariables" Condition="'$(IsBindingProject)' == 'true'">
<PropertyGroup>
<BTouchToolExe>bgen.dll</BTouchToolExe>
<BTouchToolPath>$(_XamarinSdkRootDirectory)\tools\lib\bgen</BTouchToolPath>
<BGenToolExe>bgen.dll</BGenToolExe>
<BGenToolPath>$(_XamarinSdkRootDirectory)\tools\lib\bgen</BGenToolPath>
<BaseLibDllPath>$(_XamarinRefAssemblyPath)</BaseLibDllPath>
<_GeneratorAttributeAssembly>$(_XamarinSdkRootDirectory)/tools/lib/Xamarin.Apple.BindingAttributes.dll</_GeneratorAttributeAssembly>
<_DotNetCscCompiler>$(RoslynTargetsPath)\bincore\csc.dll</_DotNetCscCompiler>
Expand Down
28 changes: 28 additions & 0 deletions msbuild/Xamarin.MacDev.Tasks/CommandLineArgumentBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;

Expand Down Expand Up @@ -229,5 +230,32 @@ public string CreateResponseFile (Task task, string responseFilePath, IList<stri
// Generate the command line
return actualArgs.ToString ();
}

public static List<string> CreateResponseFile (Task task, string responseFilePath, IList<string> responseArguments, IList<string> nonResponseArguments)
{
// Generate a response file
var responseFile = Path.GetFullPath (responseFilePath);

if (File.Exists (responseFile))
File.Delete (responseFile);

try {
File.WriteAllLines (responseFile, StringUtils.Quote (responseArguments.ToArray ()));
} catch (Exception ex) {
task.Log.LogWarning ("Failed to create response file '{0}': {1}", responseFile, ex);
}

// Some arguments can not safely go in the response file and are
// added separately. They must go _after_ the response file
// as they may override options passed in the response file
var actualArgs = new List<string> ();

actualArgs.Add ($"@{responseFile}");
if (nonResponseArguments is not null)
actualArgs.AddRange (nonResponseArguments);

// Generate the command line
return actualArgs;
}
}
}
Loading