diff --git a/Configuration.props b/Configuration.props
index f117c7c6378..916e8e3afaa 100644
--- a/Configuration.props
+++ b/Configuration.props
@@ -12,6 +12,7 @@
Condition=" '$(DoNotLoadOSProperties)' != 'True' "
/>
+ 7.0.99
Windows
$(HostCc64)
$(HostCxx64)
diff --git a/build-tools/scripts/BuildEverything.mk b/build-tools/scripts/BuildEverything.mk
index e630e5d69d6..aebedaaa8aa 100644
--- a/build-tools/scripts/BuildEverything.mk
+++ b/build-tools/scripts/BuildEverything.mk
@@ -1,3 +1,18 @@
+PRODUCT_VERSION = $(shell $(MSBUILD) $(MSBUILD_FLAGS) /p:DoNotLoadOSProperties=True /nologo /v:minimal /t:GetProductVersion build-tools/scripts/Info.targets | tr -d '[[:space:]]')
+
+GIT_BRANCH = $(shell LANG=C git rev-parse --abbrev-ref HEAD | tr -d '[[:space:]]' | tr -C a-zA-Z0-9- _)
+GIT_COMMIT = $(shell LANG=C git log --no-color --first-parent -n1 --pretty=format:%h)
+
+# In which commit did $(PRODUCT_VERSION) change? 00000000 if uncommitted
+-commit-of-last-version-change = $(shell LANG=C git blame Configuration.props | grep '' | grep -v grep | sed 's/ .*//')
+
+# How many commits have passed since $(-commit-of-last-version-change)?
+# "0" when commit hash is invalid (e.g. 00000000)
+-num-commits-since-version-change = $(shell LANG=C git log $(-commit-of-last-version-change)..HEAD --oneline 2>/dev/null | wc -l | sed 's/ //g')
+
+ZIP_OUTPUT = oss-xamarin.android_v$(PRODUCT_VERSION).$(-num-commits-since-version-change)_$(OS)-$(OS_ARCH)_$(GIT_BRANCH)_$(GIT_COMMIT).zip
+
+
# $(ALL_API_LEVELS) and $(ALL_FRAMEWORKS) must be kept in sync w/ each other
ALL_API_LEVELS = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# this was different when API Level 21 was "L". Same could happen in the future.
@@ -58,7 +73,7 @@ FRAMEWORK_ASSEMBLIES = \
$(FRAMEWORKS:%=bin/Debug/lib/xbuild-frameworks/MonoAndroid/%/Mono.Android.dll) \
$(FRAMEWORKS:%=bin/Release/lib/xbuild-frameworks/MonoAndroid/%/Mono.Android.dll)
-leeroy jenkins: prepare $(RUNTIME_LIBRARIES) $(TASK_ASSEMBLIES) $(FRAMEWORK_ASSEMBLIES)
+leeroy jenkins: prepare $(RUNTIME_LIBRARIES) $(TASK_ASSEMBLIES) $(FRAMEWORK_ASSEMBLIES) $(ZIP_OUTPUT)
$(TASK_ASSEMBLIES): bin/%/lib/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll:
$(MSBUILD) $(MSBUILD_FLAGS) /p:Configuration=$* $(_MSBUILD_ARGS) $(SOLUTION)
@@ -71,3 +86,13 @@ $(FRAMEWORK_ASSEMBLIES):
$(RUNTIME_LIBRARIES):
$(MSBUILD) $(MSBUILD_FLAGS) /p:Configuration=Debug $(_MSBUILD_ARGS) $(SOLUTION)
$(MSBUILD) $(MSBUILD_FLAGS) /p:Configuration=Release $(_MSBUILD_ARGS) $(SOLUTION)
+
+_BUNDLE_ZIPS = $(wildcard bin/*/bundle-*.zip)
+
+package-oss-name:
+ @echo ZIP_OUTPUT=$(ZIP_OUTPUT)
+
+package-oss $(ZIP_OUTPUT):
+ if [ -d bin/Debug/bin ] ; then cp tools/scripts/xabuild bin/Debug/bin ; fi
+ if [ -d bin/Release/bin ] ; then cp tools/scripts/xabuild bin/Release/bin ; fi
+ zip -r "$(ZIP_OUTPUT)" bin $(_BUNDLE_ZIPS:%=--exclude %)
diff --git a/samples/HelloWorld/HelloWorld.csproj b/samples/HelloWorld/HelloWorld.csproj
index 29ebf50835d..b018bdcf560 100644
--- a/samples/HelloWorld/HelloWorld.csproj
+++ b/samples/HelloWorld/HelloWorld.csproj
@@ -16,7 +16,7 @@
Assets
true
-
+
$(AndroidFrameworkVersion)
diff --git a/tools/scripts/xabuild b/tools/scripts/xabuild
index 0b3578e3f51..ed8172607d2 100755
--- a/tools/scripts/xabuild
+++ b/tools/scripts/xabuild
@@ -1,26 +1,53 @@
#!/bin/bash -e
-topdir="$(cd `dirname "$0"`/../.. && pwd)"
+
+name=$(basename "$0")
if [ -z "$CONFIGURATION" ] ; then
CONFIGURATION=Debug
fi
+xabuilddir="$(cd `dirname "$0"` && pwd)"
+
+if [[ "$xabuilddir" == */tools/scripts ]] ; then
+ topdir="$xabuilddir/../../bin/$CONFIGURATION"
+ Paths_targets="$xabuilddir/../../build-tools/scripts/Paths.targets"
+elif [[ "$xabuilddir" == */bin ]] ; then
+ topdir="$xabuilddir/.."
+else
+ (>&2 echo "$name: Could not determine location to Xamarin.Android locations.")
+ exit 1
+fi
+
if [ -z "$MSBUILD" ] ; then
MSBUILD=xbuild
fi
-export TARGETS_DIR="$topdir/bin/$CONFIGURATION/lib/xbuild"
-export MSBuildExtensionsPath="$TARGETS_DIR"
-export MONO_ANDROID_PATH="$topdir/bin/$CONFIGURATION"
-export XBUILD_FRAMEWORK_FOLDERS_PATH="$topdir/bin/$CONFIGURATION/lib/xbuild-frameworks"
-ANDROID_NDK_PATH=$(xbuild /nologo /v:minimal /t:GetAndroidNdkFullPath $topdir/build-tools/scripts/Paths.targets)
-ANDROID_SDK_PATH=$(xbuild /nologo /v:minimal /t:GetAndroidSdkFullPath $topdir/build-tools/scripts/Paths.targets)
+if [ -z "$ANDROID_NDK_PATH" -a -f "$Paths_targets" ] ; then
+ ANDROID_NDK_PATH=$($MSBUILD /nologo /v:minimal /t:GetAndroidNdkFullPath "$Paths_targets")
+ ANDROID_NDK_PATH=$(echo $ANDROID_NDK_PATH | sed 's/^\w*//g')
+ export ANDROID_NDK_PATH
+fi
+
+if [ -z "$ANDROID_SDK_PATH" -a -f "$Paths_targets" ] ; then
+ ANDROID_SDK_PATH=$($MSBUILD /nologo /v:minimal /t:GetAndroidSdkFullPath "$Paths_targets")
+ ANDROID_SDK_PATH=$(echo $ANDROID_SDK_PATH | sed 's/^\w*//g')
+ export ANDROID_SDK_PATH
+fi
-ANDROID_NDK_PATH=$(echo $ANDROID_NDK_PATH | sed 's/^\w*//g')
-ANDROID_SDK_PATH=$(echo $ANDROID_SDK_PATH | sed 's/^\w*//g')
+if [ -z "$ANDROID_NDK_PATH" ] ; then
+ >&2 echo "$name: Could not determine Android NDK path. Please export the \$ANDROID_NDK_PATH environment variable."
+ exit 1
+fi
+
+if [ -z "$ANDROID_SDK_PATH" ] ; then
+ >&2 echo "$name: Could not determine Android SDK path. Please export the \$ANDROID_SDK_PATH environment variable."
+ exit 1
+fi
-export ANDROID_NDK_PATH
-export ANDROID_SDK_PATH
+export TARGETS_DIR="$topdir/lib/xbuild"
+export MSBuildExtensionsPath="$TARGETS_DIR"
+export MONO_ANDROID_PATH="$topdir"
+export XBUILD_FRAMEWORK_FOLDERS_PATH="$topdir/lib/xbuild-frameworks"
exec $MSBUILD /p:Configuration=$CONFIGURATION $MSBUILD_OPTIONS \
/p:AndroidNdkDirectory="$ANDROID_NDK_PATH" \