Skip to content

Commit

Permalink
Lots of incremental build and multitargeting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcollins committed Jun 5, 2024
1 parent 009deb0 commit 5ed42b1
Show file tree
Hide file tree
Showing 28 changed files with 169 additions and 132 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,27 @@ jobs:
run: mkdir -p ${{ runner.temp }}/logs/

- name: Build and test build tasks
working-directory: ./eng
working-directory: ./src
run: >-
dotnet test Microsoft.Maui.BindingExtensions.Build.Tasks.sln
dotnet test CommunityToolkit.Maui.BindingExtensions.sln
--logger trx --results-directory ${{ runner.temp }}/logs/TestResults-build-tasks
-bl:${{ runner.temp }}/logs/build-tasks.binlog
- name: Pack build tasks
working-directory: ./src/CommunityToolkit.Maui.BindingExtensions
run: dotnet pack CommunityToolkit.Maui.BindingExtensions.csproj -bl:${{ runner.temp }}/logs/build-tasks-pack.binlog

- name: Build facebook
working-directory: ./facebook
run: dotnet build -m:1 -bl:${{ runner.temp }}/logs/facebook.binlog
run: dotnet build -bl:${{ runner.temp }}/logs/facebook.binlog

- name: Build firebase
working-directory: ./firebase/macios
run: dotnet build -m:1 -bl:${{ runner.temp }}/logs/firebase-macios.binlog
run: dotnet build -bl:${{ runner.temp }}/logs/firebase-macios.binlog

- name: Build googlecast
working-directory: ./googlecast/macios
run: dotnet build -m:1 -bl:${{ runner.temp }}/logs/googlecast-macios.binlog
run: dotnet build -bl:${{ runner.temp }}/logs/googlecast-macios.binlog

- name: Upload logs
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ FodyWeavers.xsd

xcuserdata/

build/
**/native/build/
.build/
*.xcframework
Pods/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The goal is to have bindings and samples building 100% through normal MSBuild in

Each .NET Binding project contains some additional MSBuild logic to help obtain and build the native SDK dependencies along with the native slim binding project. In some cases, the target may also download native SDKs if they are not already present. In this way, the expected native artifacts are available in the expected working directories.

In the [```eng/```](/eng/) folder you will find a solution with custom build tasks/targets to help with this. These build extensions are available in a Microsoft.Maui.BindingExtensions NuGet package that the binding projects reference.
In the [```src/```](/src/) folder you will find a solution with custom build tasks/targets to help with this. These build extensions are available in a CommunityToolkit.Maui.BindingExtensions NuGet package that the binding projects reference.

Android binding projects generate the API definition automatically taking into account any optional manual modifications like those implemented via the [```Metadata.xml```](https://learn.microsoft.com/xamarin/android/platform/binding-java-library/customizing-bindings/java-bindings-metadata#metadataxml-transform-file) transform file.

Expand Down
Binary file added build/nuget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions eng/Microsoft.Maui.BindingExtensions.targets

This file was deleted.

This file was deleted.

44 changes: 0 additions & 44 deletions eng/src/Microsoft.Maui.BindingExtensions.Build.Tasks/nuget.proj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

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

<!-- Metadata applicable to @(AndroidLibrary) will be used if set -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
<ImplicitUsings>true</ImplicitUsings>
<IsBindingProject>true</IsBindingProject>

<XcodeBuildMacCatalyst>False</XcodeBuildMacCatalyst>
<BuildXcodeProjectsDependsOnTargets>$(BuildXcodeProjectsDependsOnTargets);NativeDependencies</BuildXcodeProjectsDependsOnTargets>
</PropertyGroup>

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

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local" value="eng/src/Microsoft.Maui.BindingExtensions.Build.Tasks/bin/Release" />
<add key="local" value="src/CommunityToolkit.Maui.BindingExtensions/bin/Release/" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.34809.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.BindingExtensions.Build.Tasks", "src\Microsoft.Maui.BindingExtensions.Build.Tasks\Microsoft.Maui.BindingExtensions.Build.Tasks.csproj", "{D1497B0B-A62D-49AD-833B-EFE4F87B1BEE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.BindingExtensions", "CommunityToolkit.Maui.BindingExtensions\CommunityToolkit.Maui.BindingExtensions.csproj", "{D1497B0B-A62D-49AD-833B-EFE4F87B1BEE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Maui.BindingExtensions.Build.Tests", "test\Microsoft.Maui.BindingExtensions.Build.Tests\Microsoft.Maui.BindingExtensions.Build.Tests.csproj", "{7BF30708-BC47-4379-8DC0-E7093AC2FED6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Maui.BindingExtensions.Tests", "CommunityToolkit.Maui.BindingExtensions.Tests\CommunityToolkit.Maui.BindingExtensions.Tests.csproj", "{7BF30708-BC47-4379-8DC0-E7093AC2FED6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<PackageId>CommunityToolkit.Maui.BindingExtensions</PackageId>
<Summary>Toolkit with build tasks and extensions that support .NET MAUI slim binding projects</Summary>
<Authors>Microsoft</Authors>
<Owners>Microsoft</Owners>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Redth/DotNet.Platform.SlimBindings</PackageProjectUrl>
<RepositoryUrl>https://github.com/Redth/DotNet.Platform.SlimBindings</RepositoryUrl>
<Title>CommunityToolkit.Maui.BindingExtensions</Title>
<Description>CommunityToolkit.Maui.BindingExtensions is a set of build tasks and extensions for .NET MAUI, .NET for Android, and .NET for iOS binding projects</Description>
<PackageIcon>nuget.png</PackageIcon>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
<Version>0.0.1-pre1</Version>
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>net,maui,netmaui,toolkit,kit,communitytoolkit,netmauitoolkit,mauicommunitytoolkit,slimbinding,binding</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="$(MSBuildPackageReferenceVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MSBuildPackageReferenceVersion)" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)../../build/nuget.png" Pack="true" PackagePath="/" />
<None Include="$(MSBuildThisFileDirectory)../../README.md" Pack="true" PackagePath="/" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.targets" Pack="true" PackagePath="build" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.targets" Pack="true" PackagePath="buildMultiTargeting" />
<None Include="$(MSBuildThisFileDirectory)targets/CommunityToolkit.Maui.BindingExtensions.multitargeting.props" Pack="true" PackagePath="buildMultiTargeting/CommunityToolkit.Maui.BindingExtensions.props" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.props" Pack="true" PackagePath="tools" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.android.targets" Pack="true" PackagePath="tools" />
<None Include="$(MSBuildThisFileDirectory)targets/Common.macios.targets" Pack="true" PackagePath="tools" />
<None Include="$(MSBuildThisFileDirectory)/bin/$(Configuration)/netstandard2.0/CommunityToolkit.Maui.BindingExtensions.dll" Pack="true" PackagePath="tools" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<UsingTask TaskName="Gradle" AssemblyFile="$(BindingExtBuildTasksAssembly)"/>

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

Expand All @@ -16,23 +15,36 @@
</GradleProjectReference>
</ItemDefinitionGroup>

<PropertyGroup>
<_BuildGradleProjectsBeforeTargets Condition=" '$(IsRunningOuterBuild)' == 'true' ">
DispatchToInnerBuilds;
</_BuildGradleProjectsBeforeTargets>
<_BuildGradleProjectsDependsOn Condition=" '$(IsRunningOuterBuild)' != 'true' ">
_ResolveMonoAndroidSdks;
</_BuildGradleProjectsDependsOn>
</PropertyGroup>


<Target Name="_GetBuildGradleProjectsInputs">
<ItemGroup>
<_GradleInputs Include="$(MSBuildProjectFullPath)" />
<_GradleInputs Include="%(GradleProjectReference.FullPath)/**/*.java" />
<_GradleInputs Include="%(GradleProjectReference.FullPath)/**/*.gradle" />
<_GradleInputs Include="%(GradleProjectReference.FullPath)/**/*.xml" />
<_GradleInputs Include="%(GradleProjectReference.FullPath)/**/*.properties"/>
<_GradleInputs Remove="%(GradleProjectReference.FullPath)/%(GradleProjectReference.ModuleName)/build/**/*" />
<_GradleOutputs Include="@(GradleProjectReference->'%(FullPath)/%(ModuleName)/build/outputs/aar/%(ModuleName)-$(GradleProjectConfiguration).aar')" />
</ItemGroup>
</Target>

<!-- TODO: Improve BeforeTargets to instead use tbd *DependsOn extension point-->
<Target Name="_BuildGradleProjects"
Condition=" '@(GradleProjectReference->Count())' != '0' and $(TargetFramework.Contains('android')) "
DependsOnTargets="_ResolveMonoAndroidSdks;_GetBuildGradleProjectsInputs"
BeforeTargets="$(CompileDependsOn)"
Condition=" '@(GradleProjectReference->Count())' != '0' and $(OnlyBuildOuterIfMultiTargeting) "
DependsOnTargets="_GetBuildGradleProjectsInputs;$(_BuildGradleProjectsDependsOn)"
BeforeTargets="$(_BuildGradleProjectsBeforeTargets);$(CompileDependsOn)"
Inputs="@(_GradleInputs)"
Outputs="@(GradleProjectReference->'%(FullPath)/%(ModuleName)/build/outputs/aar/%(ModuleName)-$(GradleProjectConfiguration).aar')" >
Outputs="@(_GradleOutputs)" >

<RemoveDir Directories="@(GradleProjectReference->'%(FullPath)/%(ModuleName)/build/outputs')" />

<Gradle ToolPath="%(GradleProjectReference.FullPath)"
AndroidSdkDirectory="$(AndroidSdkDirectory)"
Expand All @@ -42,7 +54,7 @@
</Gradle>

<ItemGroup>
<AndroidLibrary Include="@(GradleProjectReference->'%(FullPath)/%(ModuleName)/build/outputs/aar/%(ModuleName)-$(GradleProjectConfiguration).aar')">
<AndroidLibrary Include="@(_GradleOutputs)">
<Bind>%(GradleProjectReference.Bind)</Bind>
<Pack>%(GradleProjectReference.Pack)</Pack>
<Visible>%(GradleProjectReference.Visible)</Visible>
Expand Down
Loading

0 comments on commit 5ed42b1

Please sign in to comment.