Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OS ?= $(shell uname)

V ?= 0
CONFIGURATION = Debug

ifeq ($(OS),Darwin)
Expand Down Expand Up @@ -39,7 +40,6 @@ PTESTS = \
ATESTS = \
bin/Test$(CONFIGURATION)/Android.Interop-Tests.dll

XBUILD = xbuild $(if $(V),/v:diag,)
NUNIT_CONSOLE = packages/NUnit.Runners.2.6.3/tools/nunit-console.exe

BUILD_PROPS = bin/Build$(CONFIGURATION)/JdkInfo.props bin/Build$(CONFIGURATION)/MonoInfo.props
Expand All @@ -57,12 +57,13 @@ prepare-external: $(PACKAGES) $(NUNIT_CONSOLE)
git submodule update --init --recursive

clean:
-$(XBUILD) /t:Clean
-$(MSBUILD) $(MSBUILD_FLAGS) /t:Clean
-rm -Rf bin/$(CONFIGURATION) bin/Build$(CONFIGURATION) bin/Test$(CONFIGURATION) bin/XAIntegration$(CONFIGURATION)
-rm src/Java.Runtime.Environment/Java.Runtime.Environment.dll.config

include build-tools/scripts/mono.mk
include build-tools/scripts/jdk.mk
include build-tools/scripts/msbuild.mk

$(PACKAGES) $(NUNIT_CONSOLE):
nuget restore
Expand Down Expand Up @@ -97,7 +98,7 @@ endif
# Usage: $(call TestAssemblyTemplate,assembly-basename)
define TestAssemblyTemplate
bin/Test$$(CONFIGURATION)/$(1)-Tests.dll: $(wildcard src/$(1)/*/*.cs src/$(1)/Test*/*/*.cs)
$$(XBUILD)
$$(MSBUILD) $$(MSBUILD_FLAGS)
touch $$@
endef # TestAssemblyTemplate

Expand All @@ -107,15 +108,15 @@ $(eval $(call TestAssemblyTemplate,Java.Interop.Export))
$(eval $(call TestAssemblyTemplate,Java.Interop.Tools.JavaCallableWrappers))

bin/Test$(CONFIGURATION)/Java.Interop-PerformanceTests.dll: $(wildcard tests/Java.Interop-PerformanceTests/*.cs) bin/Test$(CONFIGURATION)/$(NATIVE_TIMING_LIB)
$(XBUILD)
$(MSBUILD) $(MSBUILD_FLAGS)
touch $@

bin/Test$(CONFIGURATION)/Android.Interop-Tests.dll: $(wildcard src/Android.Interop/*/*.cs src/Android.Interop/Tests/*/*.cs)
$(XBUILD)
$(MSBUILD) $(MSBUILD_FLAGS)
touch $@

bin/$(XA_CONFIGURATION)/Java.Interop.dll: $(wildcard src/Java.Interop/*/*.cs) src/Java.Interop/Java.Interop.csproj
$(XBUILD) /p:Configuration=$(XA_CONFIGURATION) $(if $(SNK),"/p:AssemblyOriginatorKeyFile=$(SNK)",)
$(MSBUILD) $(if $(V),/v:diag,) /p:Configuration=$(XA_CONFIGURATION) $(if $(SNK),"/p:AssemblyOriginatorKeyFile=$(SNK)",)

CSHARP_REFS = \
bin/$(CONFIGURATION)/Java.Interop.dll \
Expand Down Expand Up @@ -150,7 +151,7 @@ bin/Test$(CONFIGURATION)/$(JAVA_INTEROP_LIB): bin/$(CONFIGURATION)/$(JAVA_INTERO
cp $< $@

run-android: $(ATESTS)
(cd src/Android.Interop/Tests; $(XBUILD) '/t:Install;RunTests' $(if $(FIXTURE),/p:TestFixture=$(FIXTURE)))
(cd src/Android.Interop/Tests; $(MSBUILD) $(MSBUILD_FLAGS) '/t:Install;RunTests' $(if $(FIXTURE),/p:TestFixture=$(FIXTURE)))

run-test-jnimarshal: bin/Test$(CONFIGURATION)/Java.Interop.Export-Tests.dll bin/Test$(CONFIGURATION)/$(JAVA_INTEROP_LIB)
MONO_TRACE_LISTENER=Console.Out \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ on the command line or by specifying MSBuild properties to control behavior.
The following **make**(1) variables may be specified:

* `$(CONFIGURATION)`: The product configuration to build, and corresponds
to the `$(Configuration)` MSBuild property when running `$(XBUILD)`.
to the `$(Configuration)` MSBuild property when running `$(MSBUILD)`.
Valid values are `Debug` and `Release`. Default value is `Debug`.
* `$(RUNTIME)`: The managed runtime to use to execute utilities, tests.
Default value is `mono64` if present in `$PATH`, otherwise `mono`.
Expand All @@ -85,9 +85,9 @@ The following **make**(1) variables may be specified:

make run-tests TESTS=bin/Debug/Java.Interop.Dynamic-Tests.dll

* `$(V)`: If set to a non-empty string, adds `/v:diag` to `$(XBUILD)`
* `$(V)`: If set to a non-empty string, adds `/v:diag` to `$(MSBUILD_FLAGS)`
invocations.
* `$(XBUILD)`: The MSBuild build tool to execute for builds.
* `$(MSBUILD)`: The MSBuild build tool to execute for builds.
Default value is `xbuild`.


Expand Down
9 changes: 9 additions & 0 deletions build-tools/scripts/mono.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# $(OS): Optional; **uname**(1) value of the host operating system
# $(CONFIGURATION): Build configuration name, e.g. Debug or Release
# $(V): Output verbosity. If != 0, then `MONO_OPTIONS` is exported with --debug.
#
# Outputs:
#
Expand All @@ -27,6 +28,14 @@
OS ?= $(shell uname)
RUNTIME := $(shell if [ -f "`which mono64`" ] ; then echo mono64 ; else echo mono; fi) --debug=casts

ifneq ($(V),0)
MONO_OPTIONS += --debug
endif # $(V) != 0

ifneq ($(MONO_OPTIONS),)
export MONO_OPTIONS
endif # $(MONO_OPTIONS) != ''

ifeq ($(OS),Darwin)
JI_MONO_FRAMEWORK_PATH = /Library/Frameworks/Mono.framework/Libraries/libmonosgen-2.0.1.dylib
JI_MONO_INCLUDE_PATHS = /Library/Frameworks/Mono.framework/Headers/mono-2.0
Expand Down
29 changes: 29 additions & 0 deletions build-tools/scripts/msbuild.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# MSBuild Abstraction.
#
# Makefile targets which need to invoke MSBuild should use `$(MSBUILD)`,
# not some specific MSBuild program such as `xbuild` or `msbuild`.
#
# Typical use will also include `$(MSBUILD_FLAGS)`, which provides the
# Configuration and logging verbosity, as per $(CONFIGURATION) and $(V):
#
# $(MSBUILD) $(MSBUILD_FLAGS) path/to/Project.csproj
#
# Inputs:
#
# $(CONFIGURATION): Build configuration name, e.g. Debug or Release
# $(MSBUILD): The MSBuild program to use.
# $(MSBUILD_ARGS): Extra arguments to pass to $(MSBUILD); embedded into $(MSBUILD_FLAGS)
# $(V): Build verbosity
#
# Outputs:
#
# $(MSBUILD): The MSBuild program to use. Defaults to `xbuild` unless overridden.
# $(MSBUILD_FLAGS): Additional MSBuild flags; contains $(CONFIGURATION), $(V), $(MSBUILD_ARGS).

MSBUILD = xbuild
MSBUILD_FLAGS = /p:Configuration=$(CONFIGURATION) $(MSBUILD_ARGS)

ifneq ($(V),0)
MSBUILD_FLAGS += /v:d
endif # $(V) != 0
5 changes: 3 additions & 2 deletions src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<PropertyGroup>
<CecilDirectory>$(MSBuildThisFileDirectory)\..\..\external\cecil</CecilDirectory>
<CecilPreparedFlag>prepared.flag</CecilPreparedFlag>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(MSBuildThisFileDirectory)\..\..\bin\$(Configuration)</OutputPath>
<CecilOutputPath>$([System.IO.Path]::GetFullPath ('$(OutputPath)'))</CecilOutputPath>
<OutputPath Condition=" '$(OutputPath)' == '' ">..\..\bin\$(Configuration)</OutputPath>
<CecilOutputPath>$([System.IO.Path]::Combine ($(MSBuildThisFileDirectory), $(OutputPath)))</CecilOutputPath>
<CecilOutputPath>$([System.IO.Path]::GetFullPath ($(CecilOutputPath)))</CecilOutputPath>
<CecilAssemblies>$(OutputPath)\Xamarin.Android.Cecil.dll;$(OutputPath)\Xamarin.Android.Cecil.Mdb.dll</CecilAssemblies>
</PropertyGroup>
<Target Name="PrepareCecil"
Expand Down
2 changes: 1 addition & 1 deletion src/java-interop/java-interop.mdproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
Inputs="@(Compile)"
Outputs="@(MacLibLipo)">
<PropertyGroup>
<_FixedDefines>$(DefineSymbols.Replace(' ', ';'))</_FixedDefines>
<_FixedDefines>$(DefineSymbols.Split(' '))</_FixedDefines>
</PropertyGroup>
<ItemGroup>
<_Defines Include="$(_FixedDefines)" />
Expand Down
3 changes: 2 additions & 1 deletion tests/invocation-overhead/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ clean:

include ../../build-tools/scripts/mono.mk
include ../../build-tools/scripts/jdk.mk
include ../../build-tools/scripts/msbuild.mk

$(JNIENV_GEN):
(cd ../../build-tools/jnienv-gen ; xbuild /p:Configuration=$(CONFIGURATION))
(cd ../../build-tools/jnienv-gen ; $(MSBUILD) $(MSBUILD_FLAGS) )

HANDLE_FEATURES = \
-d:FEATURE_JNIENVIRONMENT_JI_INTPTRS \
Expand Down