Граф коммитов

70 Коммитов

Автор SHA1 Сообщение Дата
Kyriakos Sidiropoulos fae492d607
Probe for VS Community, Professional, BuildTools (#59)
Fixes: https://github.com/xamarin/Xamarin.Legacy.Sdk/issues/58

* fix (Xamarin.VsInstallRoot.targets): we now probe for VS2022 Community and VS2019 Community (in this order)
* fix (Xamarin.VsInstallRoot.targets): add 'exists' checks for the paths of vs2019
* feat (Xamarin.VsInstallRoot.targets): add additional heuristic for '$(MSBuildProgramFiles32)/Microsoft Visual Studio/2019/BuildTools/'
* doc (Xamarin.VsInstallRoot.targets): enhance comments to explain why we dont check for VS2022 'build tools' folders
* fix (Xamarin.VsInstallRoot.targets): we now also check for 'professional' flavours of vs
2023-09-28 12:44:06 -05:00
Jonathan Peppers 08f8859290 Bump to 0.2.0-alpha4 2023-03-20 17:12:50 -05:00
Jonathan Peppers 510e8a08d9
[android] add .NET 8 multi-targeting support (#50)
Context: https://github.com/xamarin/xamarin-android/pull/7900

After attempted removal of .NET 6 (from .NET 8), we got the build error:

    Xamarin.Legacy.Android.targets(33,3): error : Could not resolve SDK "Microsoft.Android.Sdk.net6". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
    Xamarin.Legacy.Android.targets(33,3): error :   SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
    Xamarin.Legacy.Android.targets(33,3): error :   The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
    Xamarin.Legacy.Android.targets(33,3): error :   MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Android.Sdk.net6" because directory "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/sdk/8.0.100-preview.3.23163.4/Sdks/Microsoft.Android.Sdk.net6/Sdk" did not exist.

Add support for the .NET 8 SDK, I am unsure how it was working at all
before? It must have somehow imported the .NET 6 targets.
2023-03-20 17:05:21 -05:00
Jonathan Peppers 3489d963a4
[android] guard against accidental \**\* wildcards (#49)
Context: https://github.com/xamarin/xamarin-android/pull/7837
Context: https://github.com/xamarin/Xamarin.Legacy.Sdk/pull/46

I ended up making this change in xamarin-android to avoid a potential
issue in all .NET projects, so bringing it here as well.

In cases where the `android` workload is not installed,
Xamarin.Legacy.Sdk can accidentally wildcard your entire disk:

    MSBUILD : warning MSB5029: The value “\**\.*\**” of the “Exclude” attribute in element <ItemGroup> in file “/Users/moljac/.nuget/packages/xamarin.legacy.sdk/0.2.0-alpha2/Sdk/AutoImport.Android.props (26,61)” is a wildcard that results in enumerating all files on the drive, which was likely not intended. Check that referenced properties are always defined.

Add checks that `$(MonoAndroidAssetsPrefix)` and
`$(MonoAndroidResourcePrefix)` are not blank.
2023-03-06 09:04:16 -06:00
Jonathan Peppers 3408f14e31 Bump to 0.2.0-alpha3 2023-01-19 12:51:43 -06:00
Filip Navara c36b1c233d
Include Xamarin.iOS/Mac facade directories (#47)
Fixes compilation against assemblies that have references to netstandard.dll, such as Xamarin.Forms.

* Add sample that references Xamarin.Forms

* Build HelloForms for simulator, disable code signing

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
2023-01-19 12:49:32 -06:00
Jonathan Peppers 4bb84af160
[build] bump to .NET 7 (#48)
* To fix `HelloMac.csproj`, temporarily make it a class library.
2023-01-18 21:34:43 -06:00
Jonathan Peppers f7d6122706
Use latest .NET & workloads (#44)
* Update README.md
* Update to .NET 6.0.400 SDK (implicitly updates workloads)
* Update `boots` to be able to get newest Xamarin builds
* Delete `Directory.Build.props`
2022-09-27 22:37:09 -05:00
Jonathan Peppers 39e597ecf4
Add support for .NET 6 & 7 Android workloads (#41)
Context: https://github.com/xamarin/xamarin-android/pull/7261#discussion_r954477870

To make .NET 6 builds work from a .NET 7 SDK, we are changing:

    Microsoft.Android.Sdk

To:

    Microsoft.Android.Sdk.net6
    Microsoft.Android.Sdk.net7

To deal with this in Xamarin.Legacy.Sdk, by default it will check for:

    <!--
      if we are not .NET 7 use .NET 6, so legacy or net6.0 will import
      !$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0'))
    -->
    <Import Sdk="Microsoft.Android.Sdk.net6" ... />
    <!--
      import .NET 7 if we are .NET 7
      $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0'))
    -->
    <Import Sdk="Microsoft.Android.Sdk.net7" ... />

To get the old behavior, you can set:

    <UseMicrosoftAndroidSdk>true</UseMicrosoftAndroidSdk>

Or to explicitly select, you can set one of:

    <UseMicrosoftAndroidSdkNet6>true</UseMicrosoftAndroidSdkNet6>
    <UseMicrosoftAndroidSdkNet7>true</UseMicrosoftAndroidSdkNet7>

In a future change, we can make .NET 7 the default, but likely only
after it is released GA.
2022-08-25 09:50:23 -05:00
Jonathan Peppers c3e324c774 Bump to 0.2.0-alpha2 2022-08-25 08:50:41 -05:00
Jonathan Peppers ce48ad6d67
[Android] add support for AutoImport.props across .NET versions (#38)
Context: https://github.com/xamarin/xamarin-android/pull/7023

In order to support `AutoImport.props` across multiple versions of the
Android workload in .NET 6 and .NET 7, we have to condition
`AutoImport.props` behind:

    Condition=" '$(TargetPlatformIdentifier)' == 'android' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) ..."
    Condition=" '$(TargetPlatformIdentifier)' == 'android' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) ..."

This breaks `Xamarin.Legacy.Sdk`, as a `monoandroid12` application
would have `$(TargetFrameworkVersion)` set to `v12.0`.

The only sensible way to workaround this is to provide an Android
`AutoImport.props` in Xamarin.Legacy.Sdk. We need to do this, because
xamarin/AndroidX builds using Xamarin.Legacy.Sdk.

TBD what happens for iOS and macOS, as they have not implemented the
`Condition` in `AutoImport.props` yet in the xamarin-macios repo.
2022-05-25 16:13:13 -05:00
Jonathan Peppers 6e63264699 Bump to 0.2.0-alpha1 2022-05-25 16:07:24 -05:00
Jonathan Peppers db02b9db20
Bump to the .NET 6.0.300 SDK (#39)
* fix missing NuGet source by creating `bin/Debug`
* Default `$(NoNFloatUsing)` to true for legacy Xamarin.iOS/Mac targets
* Bump to macios-12, so we get the newer Xcode
2022-05-25 16:05:02 -05:00
Jonathan Peppers 6573159716
[build] remove workaround for .NET 6 preview 7 (#36)
`$(DisableImplicitNamespaceImports)` is no longer needed.
2021-12-13 20:01:29 -06:00
Jonathan Peppers 9ca1f5150c Bump to 0.1.2-alpha6 2021-11-30 11:14:05 -06:00
mfkl 478d4862bc
Bump to .NET 6 stable (#32)
Fixes: https://github.com/xamarin/Xamarin.Legacy.Sdk/issues/33

* Bump to windows-2022 image

Context: https://docs.microsoft.com/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml

* Update Github actions
  * Install .NET 6 GA
  * Xcode 13.1 is default now: https://github.com/actions/virtual-environments/issues/4355

* Use nuget.org instead of dotnet6 feed

* Update HelloMac.csproj

$(SupportedOSPlatformVersion) should be 10.14

* VS 2022 paths

* [ios] patch $(MessagingBuildClientAssemblyFile)

This solves an assembly-load error at build time.

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
2021-11-30 11:12:44 -06:00
Jonathan Peppers 4ba5930273 Bump to 0.1.1-alpha5
Bumping from 0.1.0 to 0.1.1 version, because macOS support was added.
2021-09-21 08:44:58 -05:00
Filip Navara 7bc810cd36
Add macOS support (#20)
* Switch to Xcode 13 beta

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
2021-09-21 08:41:45 -05:00
Jonathan Peppers 9d30bb80f0
Bump to .NET 6 RC 1 (#30)
* We can use `boots --preview Xamarin.Android`
* Select JDK 11
2021-09-20 09:32:24 -05:00
Jonathan Peppers 534fbe2605
Setup Github Actions (#29)
Doing this because macOS 11 Big Sur is available now:

https://github.blog/changelog/2021-08-16-github-actions-macos-11-big-sur-is-generally-available-on-github-hosted-runners/

Remove `mac` job from AzDO. We can rely on Github Actions for macOS CI.
2021-08-21 18:39:12 -05:00
Jonathan Peppers ba6d6ad675
Fixes to support C# 10 global using (#28)
We are defining global usings in the mobile workloads
`AutoImports.props` such as:

    <ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <Using Include="Android.App" />
      <Using Include="Android.Widget" />
      <Using Include="Android.OS.Bundle" Alias="Bundle" />
    </ItemGroup>

So we should simply define `$(TargetPlatformIdentifier)` and this will
work for iOS and Android.

I found the import here actually never worked:

    <Import Condition=" '$(TargetFrameworkIdentifier)' == 'MonoAndroid' " Sdk="Microsoft.Android.Sdk" Project="AutoImport.props" />

`$(TargetFrameworkIdentifier)` is always blank. The reason it worked
at all, was because Xamarin.Legacy.Sdk defines:

    <EnableDefaultAndroidItems Condition=" '$(EnableDefaultAndroidItems)' == '' ">true</EnableDefaultAndroidItems>

So let's add this to the iOS side.
2021-08-19 09:26:39 -05:00
Jonathan Peppers a354f5b2ff
Bump to .NET 6 Preview 7 (#27)
* Fixes CI
* Set `$(DisableImplicitNamespaceImports)` to true, to workaround issues in P7
2021-08-18 20:29:53 -05:00
Jonathan Peppers e018e63299 Bump to 0.1.0-alpha4 2021-08-18 15:03:40 -05:00
Jonathan Peppers ed849228ed [build] fix 0.1.0-alpha3 in global.json
a7370d64 broke the build, this should fix.
2021-07-26 16:37:57 -05:00
Jonathan Peppers a7370d6407 Bump $(PackageVersion) to 0.1.0-alpha3 2021-07-26 15:50:14 -05:00
Jonathan Peppers 38b76e44cb
Set $(LangVersion) to latest to more closely match .NET 6 (#24) 2021-07-26 15:49:15 -05:00
Jonathan Peppers 89d2d2d1fc
[build] provision Xamarin.Android from .NET 6 release branch (#25) 2021-07-26 15:48:46 -05:00
Jonathan Peppers f78e04e916
Bump to .NET 6 Preview 5 (#23)
* Install `--preview Xamarin.Android`
2021-06-30 16:21:57 -05:00
Jonathan Peppers 1b0b091652
[build] don't run signing stage on PRs (#21)
This was useful initially to "test sign" PRs, but probably don't need this running on PRs anymore.
2021-06-26 22:15:40 -05:00
Jonathan Peppers 467d661ae9
[azdo] add job using MSBuild from VS (#18)
This verifies we can build with .NET Framework MSBuild from Visual Studio.

This would only work in VS 2019 16.10 and higher.
2021-06-11 13:32:00 -05:00
Jonathan Peppers 0d302c9fbe
Bump all the things (#19)
* Bump to boots 1.0.4.624
* Bump to .NET 6.0.100-preview.4.21255.9
* Use VS 16.10 GA of Xamarin.Android
* Set `$JI_JAVA_HOME` on macOS
2021-06-04 14:56:55 -05:00
Jonathan Peppers 2838d9ef92
Bump to boots 1.0.4.600-preview1 (#17)
Also use `dotnet tool update`, in case boots was already installed.
2021-02-20 13:42:00 -06:00
Jonathan Peppers 3ee6ea59a4
[azdo] fix signing tasks (#16)
It appears that the .yaml template I use for signing expects at least
a `SignList.xml` now:

    Get-Content : Cannot find path 'C:\A\1\_temp\artifact-signing\unsigned\nuget-unsigned\SignList.xml' because it does not exist.

This repo is unique because there are not actually any `.dll` files to
sign. The NuGet package is only `.targets` files.

For now, I've added a `SignList.xml` with no items. If I ever add a
`.dll` file one day, I'll have an example to follow.
2021-02-18 15:40:57 -06:00
Jonathan Peppers 7d73ae0f42
Bump to .NET 6.0.100-preview.1.21103.13 (#14)
Context: https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-1/
Context: https://github.com/dotnet/net6-mobile-samples/releases/tag/6.0.1xx-preview1

Use the builds that shipped in .NET 6 Preview 1

Also updated the `README.md` a bit.
2021-02-18 14:50:53 -06:00
Jonathan Peppers 92bc42d06c
[nuget] should specify $(PackageType) of MSBuildSdk (#15)
Context: https://docs.microsoft.com/nuget/create-packages/set-package-type
Context: 7bf8b6484b/Tools/MSBuild.Packaging.targets (L4)

Xamarin.Legacy.Sdk needs to specify it's NuGet package type.
2021-02-18 14:50:04 -06:00
Jonathan Peppers 9428620338
[nuget.config] remove public nuget.org feed (#13)
Context: https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610
Context: https://azure.microsoft.com/en-us/resources/3-ways-to-mitigate-risk-using-private-package-feeds/
Context: https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/12676/ncident-help-for-Substitution-attack-risk-from-multiple-package-feeds

There is a Package Substitution Attack inherent in NuGet, whereby
if multiple package sources provide packages with the same name,
it is indeterminate which package source will provide the package.

To fix this repo, we don't actually need `nuget.org` at all.
2021-02-09 13:59:59 -06:00
Jonathan Peppers 25b01897dd Update README.md 2021-02-09 08:56:06 -06:00
Jonathan Peppers ad79e7ec8f
Better clarify the purpose of this package (#12)
Fixes: https://github.com/xamarin/Xamarin.Legacy.Sdk/issues/10
2021-02-08 11:53:11 -06:00
Jonathan Peppers c2377f0eab
Bump to .NET 6.0.100-preview.1.21081.5 (#11)
* Microsoft.NET.Workload.Android 11.0.200.72
* Microsoft.NET.Workload.iOS 14.3.100.1050
2021-02-05 12:08:48 -06:00
Jonathan Peppers b67ab019b5 Bump version to 0.1.0-alpha2 2021-02-03 16:55:02 -06:00
Jonathan Peppers 5d9facb215
[windows] fix for when $(VsInstallRoot) is missing a trailing slash (#9)
Usage of Xamarin.Legacy.Sdk on xamarin-android's CI fails with:

    error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project.

Reviewing the build logs, `Xamarin.Android.CSharp.targets` fails to be
imported at all due to:

    _LegacyExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2019\EnterpriseMSBuild

It appears that if either `%VSINSTALLDIR%` or `$(VsInstallRoot)` were
missing a trailing slash, then `$(_LegacyExtensionsPath)` would be
incorrect.

First I added a new `samples/tests` folder, to start throwing in
one-off projects as pseudo-unit tests. Or maybe integration tests is a
better term? `dotnet build samples.sln` should be the equivalent of
running tests in this repo.

Next, I moved the `$(VsInstallRoot)` logic to its own
`Xamarin.VsInstallRoot.targets` file to be shared between iOS and
Android.

Lastly, I added the appropriate `EnsureTrailingSlash()` call:

https://docs.microsoft.com/visualstudio/msbuild/property-functions#msbuild-ensuretrailingslash
2021-02-03 15:00:42 -06:00
Jonathan Peppers 43391b2665 Bump to Xamarin.Android 11.2.99.50
The main reason for this: .NET 6 packages are now signed.
2021-01-27 15:49:56 -06:00
Jonathan Peppers c1e68cc8e6 [docs] Add more explanation/information 2021-01-27 15:49:56 -06:00
Jonathan Peppers c5c445c5c6 Move global.json and nuget.config to samples dir
We don't need to change these settings repository-wide. They can be
set for only the `samples` directory.

`Xamarin.Legacy.Sdk` itself can be built without any fancy
configuration.
2021-01-27 15:49:56 -06:00
Jonathan Peppers 430aa94a67
Bump to .NET 6.0.100-alpha.1.21064.27 (#7)
* .NET 6.0.100-alpha.1.21064.27
* Xamarin.Android 11.2.99.43
* Microsoft.Android.Sdk 11.0.200.43

`samples.sln` should be able to build on Mac now.
2021-01-22 14:25:25 -06:00
Jonathan Peppers 6a1c5962cb
[build] sign Xamarin.Legacy.Sdk.nupkg (#5)
Based on: https://github.com/xamarin/Xamarin.Android.FSharp.ResourceProvider/pull/8

* Bump to Microsoft.NET.Workload.Android-11.0.200-ci.master.40 for consistency
2021-01-21 16:26:44 -06:00
Jonathan Peppers 71800e2555
[build] proper NuGet package settings (#6)
Updated README
2021-01-21 16:07:55 -06:00
Jonathan Peppers f38b8b149c
[samples] C# class to verify Java binding (#4)
If the C# bindings aren't generated, the build would fail with:

    Foo.cs(6,33): error CS0246: The type or namespace name 'GoogleGson' could not be found
    (are you missing a using directive or an assembly reference?)

Other changes:

* Bump to Xamarin.Android 11.2.99.40
2021-01-21 13:26:03 -06:00
Jonathan Peppers 5d5f8dfeee
Fixes for Java binding projects (#3)
* Tweak `JavaBinding.csproj` so it emits no warnings. We might
  eventually be able to set `$(TreatWarningsAsErrors)` for samples.
* Move the `_FixResolveAssemblyReference` MSBuild target to a common
  `Xamarin.Hacks.targets`. This fixes missing assembly references for
  `MonoAndroid` TFs.

After doing this, `JavaBinding.csproj` is building correctly with no
warnings.
2021-01-21 10:01:14 -06:00
Jonathan Peppers def9cb5092 Don't override $(MSBuildExtensionsPath)
`$(MSBuildExtensionsPath)` is a special property that can fallback to multiple locations.

Let's not actually attempt to set `$(MSBuildExtensionsPath)`, and instead use our own property.
2021-01-20 16:21:40 -06:00