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

Xamarin.Android.Build.Tasks:_Foo - Set Inputs and Outputs to fix .. #8

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.Android.Tools.BootstrapTasks.GenerateProfile" AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" />
<Target Name="_Foo" BeforeTargets="CoreCompile">
<ItemGroup>
<SharedRuntimeBuildPath Include="..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@(SharedRuntimeBuildPath) should have a _ prefix, as it's not an overridable value.

Additionally, it looks like it should be a property, given that you're not using any **\* expansion. Doing so would also shorten the @(_SharedRuntimeAssemblies) group:

<_SharedRuntimeAssemblies Include="$(_SharedRuntimeBuildPath)\v1.0\*.dll;$(_SharedRuntimeBuildPath)\$(AndroidFrameworkVersion)\*.dll" />

Additionally, this shouldn't hardcode v6.0, it should instead use $(AndroidFrameworkVersion), as done above, because if the developer overrides the $(AndroidFrameworkVersion) value in Configuration.Override.props, the v6.0 directory reference won't exist.

<_SharedRuntimeAssemblies Include="@(SharedRuntimeBuildPath->'%(Identity)\\v1.0\*.dll');@(SharedRuntimeBuildPath->'%(Identity)\\v6.0\*.dll')"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the double \\ and replace with a single \.

</ItemGroup>

<Target Name="_Foo" BeforeTargets="CoreCompile"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really shouldn't call this target _Foo. Please rename to a better name. :-)

Inputs="@(_SharedRuntimeAssemblies)"
Outputs="$(_GeneratedProfileClass)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's this work, given that $(_GeneratedProfileClass) is a property declared within this target, 3 lines down?

I mean, if that does work, that's kinda cool, but I didn't think that this was possible/supported in xbuild/MSBuild...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is a mistake. It didn't show up in my "quick" testing as the target _Foo didn't run since the Output was effectively ''.

>
<PropertyGroup>
<_GeneratedProfileClass>$(IntermediateOutputPath)Profile.g.cs</_GeneratedProfileClass>
</PropertyGroup>
<ItemGroup>
<SharedRuntimeBuildPath Include="..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\" />
</ItemGroup>
<CreateItem Include="@(SharedRuntimeBuildPath->'%(Identity)\\v1.0\*.dll');@(SharedRuntimeBuildPath->'%(Identity)\\v6.0\*.dll')">
<Output TaskParameter="Include" ItemName="_SharedRuntimeAssemblies" />
</CreateItem>
<GenerateProfile Files="@(_SharedRuntimeAssemblies)" OutputFile="$(_GeneratedProfileClass)" />
<ItemGroup>
<Compile Include="$(_GeneratedProfileClass)" />
Expand Down