Skip to content

Commit

Permalink
Move build extensions into nuget package
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcollins committed May 31, 2024
1 parent b6bdb35 commit 27b7422
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 31 deletions.
4 changes: 2 additions & 2 deletions eng/Common.android.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$(MSBuildThisFileDirectory)Common.targets" Condition=" '$(CommonTargetsImported)' != 'true' " />

<UsingTask TaskName="Gradle" AssemblyFile="$(BindingExtBuildTasksAssembly)"/>

<PropertyGroup>
<CommonAndroidTargetsImported>true</CommonAndroidTargetsImported>
<GradleProjectConfiguration Condition=" '$(GradleProjectConfiguration)' == '' ">Release</GradleProjectConfiguration>
</PropertyGroup>

Expand All @@ -29,7 +29,7 @@
<!-- TODO: Improve BeforeTargets to instead use tbd *DependsOn extension point-->
<Target Name="_BuildGradleProjects"
Condition=" '@(GradleProjectReference->Count())' != '0' and $(TargetFramework.Contains('android')) "
DependsOnTargets="_ResolveMonoAndroidSdks;_EnsureBuildTasksAssembly;_GetBuildGradleProjectsInputs"
DependsOnTargets="_ResolveMonoAndroidSdks;_GetBuildGradleProjectsInputs"
BeforeTargets="$(CompileDependsOn)"
Inputs="@(_GradleInputs)"
Outputs="@(GradleProjectReference->'%(FullPath)/%(ModuleName)/build/outputs/aar/%(ModuleName)-$(GradleProjectConfiguration).aar')" >
Expand Down
6 changes: 3 additions & 3 deletions eng/Common.macios.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<Import Project="$(MSBuildThisFileDirectory)Common.targets" Condition=" '$(CommonTargetsImported)' != 'true' " />

<UsingTask TaskName="Sharpie" AssemblyFile="$(BindingExtBuildTasksAssembly)"/>
<UsingTask TaskName="XcodeBuild" AssemblyFile="$(BindingExtBuildTasksAssembly)"/>

<PropertyGroup>
<CommonMaciosTargetsImported>true</CommonMaciosTargetsImported>
<XcodeProjectConfiguration Condition=" '$(XcodeProjectConfiguration)' == '' ">Release</XcodeProjectConfiguration>
<XcodeBuildiOS Condition=" '$(XcodeBuildiOS)' == '' ">true</XcodeBuildiOS>
<XcodeBuildiOSSimulator Condition=" '$(XcodeBuildiOSSimulator)' == '' ">true</XcodeBuildiOSSimulator>
Expand Down Expand Up @@ -44,7 +44,7 @@

<Target Name="_BuildXcodeProjects"
Condition=" '@(XcodeProjectReference->Count())' != '0' "
DependsOnTargets="_EnsureBuildTasksAssembly;_GetBuildXcodeProjectsInputs;$(BuildXcodeProjectsDependsOnTargets)"
DependsOnTargets="_GetBuildXcodeProjectsInputs;$(BuildXcodeProjectsDependsOnTargets)"
Inputs="@(_XcbInputs)"
Outputs="@(XcodeProjectReference->'%(RootDir)%(Directory)build/%(SchemeName).xcframework/Info.plist')" >

Expand Down
19 changes: 0 additions & 19 deletions eng/Common.targets

This file was deleted.

12 changes: 12 additions & 0 deletions eng/Microsoft.Maui.BindingExtensions.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<BindingExtBuildTasksAssembly Condition= " !Exists('$(BindingExtBuildTasksAssembly)') ">Microsoft.Maui.BindingExtensions.Build.Tasks.dll</BindingExtBuildTasksAssembly>
<HOME Condition=" '$(HOME)' == '' ">$(USERPROFILE)</HOME>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Common.android.targets" Condition=" '$(CommonAndroidTargetsImported)' != 'true' and $(TargetFramework.Contains('android')) " />
<Import Project="$(MSBuildThisFileDirectory)Common.macios.targets" Condition=" '$(CommonMaciosTargetsImported)' != 'true' and ($(TargetFramework.Contains('ios')) or $(TargetFramework.Contains('maccatalyst')))" />

</Project>
44 changes: 44 additions & 0 deletions eng/src/Microsoft.Maui.BindingExtensions.Build.Tasks/nuget.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
***********************************************************************************************
This project file is used to create the Microsoft.Maui.BindingExtensions NuGet.
***********************************************************************************************
-->
<Project Sdk="Microsoft.Build.NoTargets/3.7.56">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDependencyFile>false</GenerateDependencyFile>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<PropertyGroup>
<PackageId> Microsoft.Maui.BindingExtensions</PackageId>
<Description>Build tasks and extensions for .NET MAUI, .NET for Android, and .NET for iOS binding projects</Description>
<PackageVersion>0.0.1</PackageVersion>
</PropertyGroup>

<PropertyGroup>
<BeforePack>
_GetPackItems;
$(BeforePack);
</BeforePack>
</PropertyGroup>

<ItemGroup>
<ProjectReference
Include="$(MSBuildThisFileDirectory)Microsoft.Maui.BindingExtensions.Build.Tasks.csproj"
ReferenceOutputAssembly="false"
Private="true" />
</ItemGroup>

<Target Name="_GetPackItems" >
<ItemGroup>
<_PackageFiles Include="$(MSBuildThisFileDirectory)../../Microsoft.Maui.BindingExtensions.targets" PackagePath="build" />
<_PackageFiles Include="$(MSBuildThisFileDirectory)../../Common.android.targets" PackagePath="build" />
<_PackageFiles Include="$(MSBuildThisFileDirectory)../../Common.macios.targets" PackagePath="build" />
<_PackageFiles Include="$(MSBuildThisFileDirectory)/bin/$(Configuration)/netstandard2.0/Microsoft.Maui.BindingExtensions.Build.Tasks.dll" PackagePath="build" />
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<AndroidGenerateResourceDesigner>false</AndroidGenerateResourceDesigner>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.BindingExtensions" Version="0.0.1" />
</ItemGroup>

<!-- Metadata applicable to @(AndroidLibrary) will be used if set -->
<ItemGroup>
<GradleProjectReference Include="../native" >
Expand All @@ -17,5 +21,4 @@
</GradleProjectReference>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\..\eng\Common.android.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
</PropertyGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs"/>
<PackageReference Include="Microsoft.Maui.BindingExtensions" Version="0.0.1" />
</ItemGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs"/>
<XcodeProjectReference Include="../native/MauiFacebook.xcodeproj">
<SchemeName>MauiFacebook</SchemeName>
<SharpieNamespace>Facebook</SharpieNamespace>
Expand All @@ -21,5 +22,4 @@
</XcodeProjectReference>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\..\eng\Common.macios.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
</PropertyGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
<PackageReference Include="Microsoft.Maui.BindingExtensions" Version="0.0.1" />
</ItemGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
<XcodeProjectReference Include="../native/MauiFirebase.xcodeproj">
<SchemeName>MauiFirebase</SchemeName>
<SharpieNamespace>Firebase</SharpieNamespace>
Expand All @@ -22,5 +23,4 @@
</XcodeProjectReference>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\..\eng\Common.macios.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
</PropertyGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
<PackageReference Include="Microsoft.Maui.BindingExtensions" Version="0.0.1" />
</ItemGroup>

<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
<XcodeProjectReference Include="../native/MauiGoogleCast.xcodeproj">
<SchemeName>MauiGoogleCast</SchemeName>
<SharpieNamespace>GoogleCast</SharpieNamespace>
Expand All @@ -37,5 +38,4 @@
<Exec Command="unzip -q -o -d $([System.IO.Path]::GetFullPath($(MSBuildProjectDirectory)/../native/build/deps)) @(GoogleCastiOSSdkArchives)" />
</Target>

<Import Project="$(MSBuildThisFileDirectory)..\..\..\eng\Common.macios.targets" />
</Project>
6 changes: 6 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local" value="eng/src/Microsoft.Maui.BindingExtensions.Build.Tasks/bin/Release" />
</packageSources>
</configuration>

0 comments on commit 27b7422

Please sign in to comment.