Skip to content

Commit

Permalink
Update to sdk-style csproj and netstandard2.0. (#78)
Browse files Browse the repository at this point in the history
Update `Xamarin.Android.Tools.AndroidSdk` to use sdk-style projects
and target frameworks `netstandard2.0` and `net461`.

Update `Xamarin.Android.Tools.AndroidSdk-Tests` to use sdk-style projects.

Move `Xamarin.Android.Tools.AndroidSdk-Tests` into a `tests` directory
to avoid sdk-style globbing.

Use MSBuild properties for NuGet packages instead of .nuspec.

Update `MicroBuild.Core` to `Microsoft.VisualStudioEng.MicroBuild.Core`.

  * Not sure what this does but [the docs][0] said the old one was
    deprecated and pointed to the new one which supports
    `netstandard2.0`.

[0]: https://www.nuget.org/packages/MicroBuild.Core
  • Loading branch information
jpobst authored and jonpryor committed Jan 28, 2020
1 parent 9f4ed4b commit bfb66f3
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 192 deletions.
2 changes: 1 addition & 1 deletion Xamarin.Android.Tools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.AndroidSdk", "src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj", "{E34BCFA0-CAA4-412C-AA1C-75DB8D67D157}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.AndroidSdk-Tests", "src\Xamarin.Android.Tools.AndroidSdk\Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj", "{1E5501E8-49C1-4659-838D-CC9720C5208F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.AndroidSdk-Tests", "tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj", "{1E5501E8-49C1-4659-838D-CC9720C5208F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
31 changes: 20 additions & 11 deletions azure-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,60 @@
name: Xamarin.Android.Tools $(Rev:r)

jobs:
- job: windows
displayName: windows
pool: Hosted VS2017
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
versionSpec: '5.4.x'
- task: NuGetCommand@2
displayName: 'NuGet restore'
displayName: 'NuGet Restore'
inputs:
restoreSolution: Xamarin.Android.Tools.sln
- task: MSBuild@1
displayName: 'Build solution Xamarin.Android.Tools.sln'
inputs:
solution: Xamarin.Android.Tools.sln
- task: VSTest@2
displayName: 'VsTest - NUnit3'
displayName: 'Run Tests'
inputs:
testAssemblyVer2: 'bin\TestDebug\*-Tests.dll'
pathtoCustomTestAdapters: 'packages\NUnit3TestAdapter.3.13.0\build\net35'
- powershell: |
$hashOfLastVersionChange = & "git" "log" "--follow" "-1" "--pretty=%H" "nuget.version"
$commitsSinceVersionChange = & "git" "rev-list" "--count" "$hashOfLastVersionChange..HEAD"
$majorMinor = Get-Content "nuget.version"
$version = "$majorMinor.$commitsSinceVersionChange"
Write-Host "##vso[task.setvariable variable=xat.nuget.version]$version"
- task: NuGetCommand@2
displayName: NuGet pack
- task: MSBuild@1
displayName: 'Build NuGet'
inputs:
command: custom
arguments: pack src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj -Version $(xat.nuget.version) -OutputDirectory $(Build.ArtifactStagingDirectory)
solution: 'src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj'
msbuildArguments: '/t:pack /p:Version=$(xat.nuget.version) /p:OutputPath=$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: upload artifacts
displayName: Upload Artifacts
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
- job: mac
displayName: mac
pool: Hosted macOS
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
versionSpec: '5.4.x'
- task: NuGetCommand@2
displayName: 'NuGet restore'
displayName: 'NuGet Restore'
inputs:
restoreSolution: Xamarin.Android.Tools.sln
restoreDirectory: 'packages'
- task: MSBuild@1
displayName: 'Build solution Xamarin.Android.Tools.sln'
inputs:
solution: Xamarin.Android.Tools.sln
- script: mono packages/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe bin/TestDebug/Xamarin.Android.Tools.AndroidSdk-Tests.dll
displayName: Run NUnit Tests
- script: mono packages/nunit.consolerunner/3.9.0/tools/nunit3-console.exe bin/TestDebug/Xamarin.Android.Tools.AndroidSdk-Tests.dll
displayName: Run Tests
- task: PublishTestResults@2
condition: always()
inputs:
Expand Down
15 changes: 0 additions & 15 deletions src/Xamarin.Android.Tools.AndroidSdk/Properties/AssemblyInfo.cs

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions src/Xamarin.Android.Tools.AndroidSdk/Tests/packages.config

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,70 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{e34bcfa0-caa4-412c-aa1c-75db8d67d157}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Android.Tools</RootNamespace>
<AssemblyName>Xamarin.Android.Tools.AndroidSdk</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<Title>Xamarin.Android.Tools</Title>
<Authors>Xamarin</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/xamarin/xamarin-android-tools</PackageProjectUrl>
<Description>Xamarin tools for interacting with the Android SDK.</Description>
<Copyright>Copyright © Xamarin 2011-2016</Copyright>
<PackageTags>Xamarin;Xamarin.Android</PackageTags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MicroBuild.Core">
<Version>0.3.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="0.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<FilesToSign Include="$(OutDir)\Xamarin.Android.Tools.AndroidSdk.dll">
<Authenticode>Microsoft400</Authenticode>
</FilesToSign>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AndroidTargetArch.cs" />
<Compile Include="OS.cs" />
<Compile Include="AndroidVersion.cs" />
<Compile Include="AndroidVersions.cs" />
<Compile Include="AndroidSdkInfo.cs" />
<Compile Include="JdkInfo.cs" />
<Compile Include="Sdks\AndroidSdkBase.cs" />
<Compile Include="Sdks\AndroidSdkUnix.cs" />
<Compile Include="Sdks\AndroidSdkWindows.cs" />
<Compile Include="ProcessUtils.cs" />
<Compile Include="AndroidAppManifest.cs" />
<Compile Include="FileUtil.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Sdks\" />
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\bin\TestDebug</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\bin\TestRelease</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.11.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Resources\manifest-simplewidget.xml">
<LogicalName>manifest-simplewidget.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj" />
</ItemGroup>

</Project>

0 comments on commit bfb66f3

Please sign in to comment.