Skip to content

Instantly share code, notes, and snippets.

View jonpryor's full-sized avatar

Jonathan Pryor jonpryor

View GitHub Profile
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Ankit: Override these! -->
<MonoSourceFullPath>/Volumes/Seagate4TB/work/xamarin-android/external/mono</MonoSourceFullPath>
</PropertyGroup>
<ItemGroup>
<MonoTestAssembly Include="monodroid_corlib_test.dll">
<SourcePath>corlib</SourcePath>
</MonoTestAssembly>
</ItemGroup>
uname -a
Darwin casper 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
ce28d4e5bfebff5cc727d624f222db13bf03646c - Merge pull request #1907 from LuaAndC/build-pkg-ignore-some-gitkeep [2 days ago] [ (HEAD -> mxe-upstream, mxe-upstream/master)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G29
autoconf --version 2>/dev/null | head -1
autoconf (GNU Autoconf) 2.69
// array hash
class ah {
public static void main (String[] args) {
int[] a = new int []{1,2,3};
int[] b = new int []{1,2,3};
System.out.println ("a hash: " + a.hashCode());
System.out.println ("b hash: " + b.hashCode());
}
}
@jonpryor
jonpryor / MainActivity.cs
Created April 10, 2017 20:54
PCLStorage NuGet use
using System;
using Android.App;
using Android.Widget;
using Android.OS;
using System.Threading.Tasks;
using PCLStorage;
namespace FurkanErasian_PclStorage

Android NDK, SDK

Note: A xamarin-android checkout maintains its own Android NDK + SDK to ensure consistent builds and build behavior, permitting reproducible builds and providing greater flexibility around when we need to perform Android SDK + NDK updates. The Android SDK and NDK are maintained by default via two directories in your home directory:

  • $(AndroidToolchainCacheDirectory): Where downloaded files are cached. Defaults to the $HOME/android-archives directory.

Consider this scenario:

  1. You have expansion-deps.projitems which contains the @(JdkIncludePath) item group.
  2. You have expansion.props which uses @(JdkIncludePath) to generate a $(_JdkIncludePaths) property
  3. You have expansion.projitems which creates a new @(_HostRuntime) item group which uses $(JdkIncludePath) within the %(_HostRuntime.CFlags) item metadata
  4. You print out %(_HostRuntime.CFlags).

Incredibly, behavior differs between xbuild, msbuild in mono 4.6, and msbuild in mono 4.8.

diff -u MainActivity.cs.jonp-orig MainActivity.cs
--- MainActivity.cs.jonp-orig 2016-07-06 17:11:28.000000000 -0400
+++ MainActivity.cs 2016-08-01 14:45:49.000000000 -0400
@@ -3,7 +3,10 @@
using Android.OS;
using Android.Runtime;
+using Java.Interop;
+
using System;
diff --git a/build-tools/mono-runtimes/mono-runtimes.projitems b/build-tools/mono-runtimes/mono-runtimes.projitems
index ae79165..89484f8 100644
--- a/build-tools/mono-runtimes/mono-runtimes.projitems
+++ b/build-tools/mono-runtimes/mono-runtimes.projitems
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <_MonoRuntime Include="armeabi" Condition="$(AndroidSupportedTargetJitAbis.Contains (':armeabi:'))">
+ <_MonoRuntime Include="armeabi" Condition="$(AndroidSupportedTargetJitAbisForConditionalChecks.Contains (':armeabi:'))">
diff --git a/Configuration.props b/Configuration.props
index f71adb1..a71d4f3 100644
--- a/Configuration.props
+++ b/Configuration.props
@@ -11,6 +11,7 @@
<HostCc Condition=" '$(HostCc)' == '' ">cc</HostCc>
<HostCxx Condition=" '$(HostCxx)' == '' ">c++</HostCxx>
<ManagedRuntime Condition=" '$(ManagedRuntime)' == '' And '$(OS)' != 'Windows_NT' ">mono</ManagedRuntime>
+ <TargetFrameworkRootPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\lib\xbuild-frameworks</TargetFrameworkRootPath>
<HOME Condition=" '$(HOME)' == '' ">$(HOMEDRIVE)$(HOMEPATH)</HOME>
diff --git a/src/Mono.Posix/Mono.Posix.csproj b/src/Mono.Posix/Mono.Posix.csproj
index 8120cc2..5d3f73e 100644
--- a/src/Mono.Posix/Mono.Posix.csproj
+++ b/src/Mono.Posix/Mono.Posix.csproj
@@ -245,6 +245,11 @@
<Name>Mono.Android</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\Xamarin.Android.Build.Tasks\Xamarin.Android.Build.Tasks.csproj">
+ <Project>{3F1F2F50-AF1A-4A5A-BEDB-193372F068D7}</Project>