Add new profile for monodroid tools (#5699)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 5 Oct 2017 00:37:24 +0000 (02:37 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2017 00:37:24 +0000 (02:37 +0200)
* Add new profile for monodroid tools

This allows the XA build to use these instead of needing to build net_4_x.
We build the assemblies against the .NET 4.6 reference assemblies.

* Skip monodroid_tools in verify (aka mcs-compileall)

Exclude it from the test_profiles since running tests makes no sense there.

Also refactor to exclude binary_reference_assemblies as well,
it was already excluded manually in mcs-compileall before.

mcs/Makefile
mcs/build/executable.make
mcs/build/library.make
mcs/build/profiles/monodroid_tools.make [new file with mode: 0644]
mcs/build/rules.make
mcs/class/Makefile
mcs/tools/Makefile
runtime/Makefile.am

index ea121b9459e3183860af3308db838a3386dc79f9..3b4fb20c46c804afd2d1a5c147405313a90c1d94 100644 (file)
@@ -7,6 +7,7 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs packages
 basic_SUBDIRS := build jay class
 build_SUBDIRS := build class class/aot-compiler tools ilasm
 monodroid_SUBDIRS := build class
+monodroid_tools_SUBDIRS := build class tools
 monotouch_SUBDIRS := build class
 monotouch_watch_SUBDIRS := build class
 monotouch_tv_SUBDIRS := build class
@@ -66,6 +67,7 @@ $(_boot_:%=profile-do--xbuild_12--%):         profile-do--xbuild_12--%:
 $(_boot_:%=profile-do--binary_reference_assemblies--%):           profile-do--binary_reference_assemblies--%:           profile-do--build--%
 $(_boot_:%=profile-do--net_4_x--%):           profile-do--net_4_x--%:           profile-do--build--%
 $(_boot_:%=profile-do--monodroid--%):         profile-do--monodroid--%:         profile-do--build--%
+$(_boot_:%=profile-do--monodroid_tools--%):         profile-do--monodroid_tools--%:         profile-do--build--%
 $(_boot_:%=profile-do--monotouch--%):         profile-do--monotouch--%:         profile-do--build--%
 $(_boot_:%=profile-do--monotouch_watch--%):   profile-do--monotouch_watch--%:   profile-do--build--%
 $(_boot_:%=profile-do--monotouch_tv--%):      profile-do--monotouch_tv--%:      profile-do--build--%
index 020609b26a4c5cf4197089ea9cca5c776e04e1b6..7ac941ca83996de7f98bc0f36cedb5ebf3568e46 100644 (file)
@@ -42,8 +42,16 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_
 
 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
 
+ifdef TARGET_NET_REFERENCE
+# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir
+LIB_REFS_MONO = $(call _FILTER_OUT,System,$(LIB_REFS))
+LIB_REFS_SYSTEM = $(filter-out $(LIB_REFS_MONO),$(LIB_REFS))
+
+MCS_REFERENCES = $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM))
+MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO))
+else
 MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS))
-MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.exe,$(EXE_REFS))
+endif
 
 ifdef KEYFILE
 LIB_MCS_FLAGS += /keyfile:$(KEYFILE)
index 3fe7d92233873d9fc9f5563722a532898f05a994..76a49a7220bc29413fa32a5c16ff2ae254d96dde 100644 (file)
 # Have to rename to handle differences between assembly/directory names
 DEP_LIBS=$(patsubst System.Xml,System.XML,$(LIB_REFS))
 
-_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x)))
-
 LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS))
 LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS))
 
+ifdef TARGET_NET_REFERENCE
+# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir
+LIB_REFS_MONO_FULL = $(call _FILTER_OUT,System,$(LIB_REFS_FULL))
+LIB_REFS_MONO_ALIAS = $(call _FILTER_OUT,System,$(LIB_REFS_ALIAS))
+
+LIB_REFS_SYSTEM_FULL = $(filter-out $(LIB_REFS_MONO_FULL),$(LIB_REFS_FULL))
+LIB_REFS_SYSTEM_ALIAS = $(filter-out $(LIB_REFS_MONO_ALIAS),$(LIB_REFS_ALIAS))
+
+LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM_FULL))
+LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/,$(LIB_REFS_SYSTEM_ALIAS)))
+
+LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO_FULL))
+LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_MONO_ALIAS)))
+else
 LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_FULL))
 LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_ALIAS)))
+endif
 
 ifdef KEYFILE
 KEYFILE_MCS_FLAGS += /keyfile:$(KEYFILE)
diff --git a/mcs/build/profiles/monodroid_tools.make b/mcs/build/profiles/monodroid_tools.make
new file mode 100644 (file)
index 0000000..27cb67b
--- /dev/null
@@ -0,0 +1,18 @@
+# -*- makefile -*-
+
+BOOTSTRAP_PROFILE = build
+
+BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC)
+MCS = $(BOOTSTRAP_MCS)
+
+profile-check:
+       @:
+
+TARGET_NET_REFERENCE = v4.6
+DEFAULT_REFERENCES = -r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/mscorlib.dll
+
+PROFILE_MCS_FLAGS = -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+
+FRAMEWORK_VERSION = 4.5
+
+NO_INSTALL = yes
index 7e1ee2124c10012f0cd1b60c8d9502eba006d407..349599433af11241e0a6c21c0d9a4a881931c5ce 100644 (file)
@@ -9,6 +9,7 @@
 
 empty :=
 space := $(empty) $(empty)
+_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x)))
 
 # given $(thisdir), we compute the path to the top directory
 #
index 1f390d66641b9f0cc09e4771156e073c4a2992a7..7d9329e02da24d8cb2f7b74cfb52d703547b4933 100644 (file)
@@ -106,6 +106,11 @@ monodroid_dirs := \
        Mono.Posix      \
        $(pcl_facade_dirs)
 
+monodroid_tools_dirs := \
+       Mono.Cecil      \
+       ICSharpCode.SharpZipLib \
+       monodoc
+
 monotouch_dirs := \
        $(mobile_common_dirs)   \
        Mono.Simd                       \
@@ -341,6 +346,7 @@ orbis_dirs := \
        $(pcl_facade_dirs)
 
 monodroid_SUBDIRS := $(monodroid_dirs)
+monodroid_tools_SUBDIRS := $(monodroid_tools_dirs)
 monotouch_SUBDIRS := $(monotouch_dirs)
 monotouch_watch_SUBDIRS := $(monotouch_watch_dirs)
 monotouch_tv_SUBDIRS    := $(monotouch_tv_dirs)
@@ -362,7 +368,7 @@ unreal_SUBDIRS := $(unreal_dirs)
 
 include ../build/rules.make
 
-SUBDIRS = $(testing_aot_full_dirs) $(testing_aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) $(unreal_dirs)
+SUBDIRS = $(testing_aot_full_dirs) $(testing_aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(monodroid_tools_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) $(unreal_dirs)
 
 DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
index ec1f2bd2d514a3108a0ac3bff2b5b6b97a0d822e..09db25649e7ecf29499cf1b077ca158f9c7954ba 100644 (file)
@@ -50,6 +50,7 @@ net_4_5_dirs := \
        linker-analyzer
 
 build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker
+monodroid_tools_SUBDIRS = cil-strip mkbundle mdoc mono-symbolicate
 net_4_5_SUBDIRS = gacutil
 net_4_x_SUBDIRS = gacutil
 net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs)
index 326158c3af8f680573cc7eed9196df4a56ce66a2..2cd119314fe8290f26f5a6eb6712b2a51f97cd6d 100644 (file)
@@ -33,7 +33,7 @@ net_profile = net_4_x
 endif
 
 if INSTALL_MONODROID
-build_profiles += monodroid
+build_profiles += monodroid monodroid_tools
 endif
 
 if INSTALL_MONOTOUCH
@@ -72,7 +72,7 @@ if INSTALL_UNREAL
 build_profiles += unreal
 endif
 
-test_profiles = $(build_profiles)
+test_profiles = $(filter-out binary_reference_assemblies monodroid_tools,$(build_profiles))
 
 if BUILD_MCS
 
@@ -142,13 +142,10 @@ endif
 
 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
-# Skip binary_reference_assemblies because they contain metadata only
 mcs-compileall: mono-wrapper etc/mono/config
        save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
        for profile in $(test_profiles); do \
-         if [ "binary_reference_assemblies" = "$$profile" ]; then \
-          continue; \
-         elif [ "xbuild_12" = "$$profile" ]; then \
+         if [ "xbuild_12" = "$$profile" ]; then \
                  MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
          elif [ "xbuild_14" = "$$profile" ]; then \
                  MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \