Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 47fac08

Browse files
Added a Guava sample project
1 parent a6ee190 commit 47fac08

File tree

9 files changed

+125
-13
lines changed

9 files changed

+125
-13
lines changed

Directory.Build.props renamed to Android/Guava/Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<!-- Uncomment if a $(PackageVersionSuffix) is ever needed -->
44
<!-- <PackageVersionSuffix>-net6preview04</PackageVersionSuffix> -->
55
<!-- <PackageVersionSuffix Condition=" '$(BUILD_BUILDID)' != '' ">$(PackageVersionSuffix).$(BUILD_BUILDID)</PackageVersionSuffix> -->
6+
<GuavaNuGetVersion>28.2.0.1$(PackageVersionSuffix)</GuavaNuGetVersion>
7+
<GuavaFailureAccessNuGetVersion>1.0.1.3$(PackageVersionSuffix)</GuavaFailureAccessNuGetVersion>
8+
<GuavaListenableFutureNuGetVersion>1.0.0.3$(PackageVersionSuffix)</GuavaListenableFutureNuGetVersion>
69
</PropertyGroup>
710
<ItemGroup>
811
<_NuGetBuildFolders Include="build\;buildTransitive\" />

Android/Guava/build.cake

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ var GUAVA_VERSION = GUAVA_VERSION_BASE + "-android";
77
var GUAVA_FAILUREACCESS_VERSION = "1.0.1";
88
var GUAVA_LISTENABLEFUTURE_VERSION = "1.0";
99

10-
var GUAVA_NUGET_VERSION = "28.2.0.0";
11-
var GUAVA_FAILUREACCESS_NUGET_VERSION = "1.0.1.2";
12-
var GUAVA_LISTENABLEFUTURE_NUGET_VERSION = "1.0.0.2";
13-
1410
var JSR305_VERSION = "3.0.2";
1511
var CHECKER_COMPAT_QUAL_VERSION = "2.5.5";
1612
var ERROR_PRONE_ANNOTATIONS_VERSION = "2.3.3";
@@ -99,11 +95,6 @@ Task ("externals")
9995
if (zipFile != null)
10096
zipFile.Close();
10197
}
102-
103-
// Update .csproj nuget versions
104-
XmlPoke("./source/Guava/Guava.csproj", "/Project/PropertyGroup/PackageVersion", GUAVA_NUGET_VERSION + "$(PackageVersionSuffix)");
105-
XmlPoke("./source/Guava.FailureAccess/Guava.FailureAccess.csproj", "/Project/PropertyGroup/PackageVersion", GUAVA_FAILUREACCESS_NUGET_VERSION + "$(PackageVersionSuffix)");
106-
XmlPoke("./source/Guava.ListenableFuture/Guava.ListenableFuture.csproj", "/Project/PropertyGroup/PackageVersion", GUAVA_LISTENABLEFUTURE_NUGET_VERSION + "$(PackageVersionSuffix)");
10798
});
10899

109100

@@ -134,7 +125,11 @@ Task("nuget")
134125
});
135126

136127
Task("samples")
137-
.IsDependentOn("nuget");
128+
.IsDependentOn("nuget")
129+
.Does (() =>
130+
{
131+
MSBuild("./samples/GuavaSample/GuavaSample.csproj", c => c.Restore = true);
132+
});
138133

139134
Task ("clean")
140135
.Does (() =>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Google.Common.Util.Concurrent;
2+
using Java.Lang;
3+
using Java.Util.Concurrent;
4+
5+
namespace GuavaSample
6+
{
7+
// Just ensure this compiles
8+
public class Future : Java.Lang.Object, IListenableFuture
9+
{
10+
public bool IsCancelled { get; set; }
11+
12+
public bool IsDone { get; set; }
13+
14+
public void AddListener(IRunnable p0, IExecutor p1)
15+
{
16+
17+
}
18+
19+
public bool Cancel(bool mayInterruptIfRunning) => true;
20+
21+
public Object Get() => null;
22+
23+
public Object Get(long timeout, TimeUnit unit) => null;
24+
}
25+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{FF3EDEBE-27B3-42E5-A713-9EA81CB5397A}</ProjectGuid>
9+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<TemplateGuid>{122416d6-6b49-4ee2-a1e8-b825f31c79fe}</TemplateGuid>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace>GuavaSample</RootNamespace>
14+
<AssemblyName>GuavaSample</AssemblyName>
15+
<FileAlignment>512</FileAlignment>
16+
<Deterministic>True</Deterministic>
17+
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
18+
<AndroidClassParser>class-parse</AndroidClassParser>
19+
<IsPackable>false</IsPackable>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<DebugSymbols>True</DebugSymbols>
23+
<DebugType>portable</DebugType>
24+
<Optimize>False</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugSymbols>True</DebugSymbols>
32+
<DebugType>portable</DebugType>
33+
<Optimize>True</Optimize>
34+
<OutputPath>bin\Release\</OutputPath>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<ErrorReport>prompt</ErrorReport>
37+
<WarningLevel>4</WarningLevel>
38+
</PropertyGroup>
39+
<ItemGroup>
40+
<Reference Include="System" />
41+
<Reference Include="System.Xml" />
42+
<Reference Include="System.Core" />
43+
<Reference Include="Mono.Android" />
44+
<Reference Include="System.Numerics" />
45+
<Reference Include="System.Numerics.Vectors" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="Future.cs" />
49+
<Compile Include="Properties\AssemblyInfo.cs" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<PackageReference Include="Xamarin.Google.Guava" Version="$(GuavaNuGetVersion)" />
53+
<PackageReference Include="Xamarin.Google.Guava.ListenableFuture" Version="$(GuavaListenableFutureNuGetVersion)" />
54+
<PackageReference Include="Xamarin.Google.Guava.FailureAccess" Version="$(GuavaFailureAccessNuGetVersion)" />
55+
</ItemGroup>
56+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
57+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("GuavaSample")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("GuavaSample")]
14+
[assembly: AssemblyCopyright("Copyright © 2018")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]

Android/Guava/samples/NuGet.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="local-output" value="../output" />
5+
</packageSources>
6+
</configuration>

Android/Guava/source/Guava.FailureAccess/Guava.FailureAccess.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Guava is a set of core libraries that includes new collection types (such as mul
2424
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=865028</PackageProjectUrl>
2525
<PackageLicenseUrl>https://go.microsoft.com/fwlink/?linkid=865030</PackageLicenseUrl>
2626
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
27-
<PackageVersion>1.0.1.2$(PackageVersionSuffix)</PackageVersion>
27+
<PackageVersion>$(GuavaFailureAccessNuGetVersion)</PackageVersion>
2828
</PropertyGroup>
2929

3030
<ItemGroup>

Android/Guava/source/Guava.ListenableFuture/Guava.ListenableFuture.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Guava is a set of core libraries that includes new collection types (such as mul
2424
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=865028</PackageProjectUrl>
2525
<PackageLicenseUrl>https://go.microsoft.com/fwlink/?linkid=865030</PackageLicenseUrl>
2626
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
27-
<PackageVersion>1.0.0.2$(PackageVersionSuffix)</PackageVersion>
27+
<PackageVersion>$(GuavaListenableFutureNuGetVersion)</PackageVersion>
2828
</PropertyGroup>
2929

3030
<ItemGroup>

Android/Guava/source/Guava/Guava.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Guava is a set of core libraries that includes new collection types (such as mul
2424
<PackageProjectUrl>https://go.microsoft.com/fwlink/?linkid=865028</PackageProjectUrl>
2525
<PackageLicenseUrl>https://go.microsoft.com/fwlink/?linkid=865030</PackageLicenseUrl>
2626
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
27-
<PackageVersion>28.2.0.0$(PackageVersionSuffix)</PackageVersion>
27+
<PackageVersion>$(GuavaNuGetVersion)</PackageVersion>
2828
</PropertyGroup>
2929

3030
<ItemGroup>

0 commit comments

Comments
 (0)