[msbuild] Install a `deniedAssembliesList.txt` to support denied ... (#5358)
[mono.git] / mcs / tools / xbuild / Makefile
index 13c2a2de0e84dbb7495864c6c4e716768b75d700..20268929bff93d35118ce83778a464fe510710cc 100644 (file)
@@ -14,23 +14,30 @@ include ../../build/executable.make
 XBUILD_DIR=.
 include $(XBUILD_DIR)/xbuild_test.make
 
-ifeq (4.0, $(FRAMEWORK_VERSION))
-install-local: xbuild-net4-fail
-else
 install-local: install-extras
-endif
+
+PORTABLE_TARGETS_SRC:=data/Portable/Targets
+PCL5_FX_SRC:=data/Portable/Frameworks/v5.0
+DENIED_ASSEMBLY_LIST_SRC=data/deniedAssembliesList.txt
 
 NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
+PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
 VS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/VisualStudio
 PORTABLE_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/Portable
 NUGET_BUILDTASKS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/NuGet
 
 ifeq (14.0, $(XBUILD_VERSION))
-install-extras: install-bin-data install-frameworks install-pcl-targets install-web-targets install-nuget-buildtasks-targets
+install-extras: install-versioned-files install-global-files
 else
-install-extras: install-bin-data install-frameworks install-pcl-targets install-web-targets
+install-extras: install-versioned-files
 endif
 
+#install files into xbuild's versioned locations
+install-versioned-files: install-bin-data install-nuget-imports
+
+#install files that are only installed once across all xbuild versions
+install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets install-msbuild-specific-files
+
 install-bin-data:
        $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
        $(INSTALL_DATA) data/xbuild.rsp $(DESTDIR)$(XBUILD_BIN_DIR)
@@ -67,51 +74,63 @@ install-frameworks:
        $(INSTALL_DATA) frameworks/net_4.6.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6/RedistList/FrameworkList.xml
        $(MKINSTALLDIRS) $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.1/RedistList
        $(INSTALL_DATA) frameworks/net_4.6.1.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.1/RedistList/FrameworkList.xml
+       $(MKINSTALLDIRS) $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.2/RedistList
+       $(INSTALL_DATA) frameworks/net_4.6.2.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.2/RedistList/FrameworkList.xml
+       $(MKINSTALLDIRS) $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.7/RedistList
+       $(INSTALL_DATA) frameworks/net_4.7.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.7/RedistList/FrameworkList.xml
 
 install-pcl-targets:
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.VisualBasic.targets
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.VisualBasic.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.VisualBasic.targets
+       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
+
+       for VERSION in v4.0 v4.5 v4.6 v5.0; do \
+               $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.Common.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.CSharp.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.VisualBasic.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.VisualBasic.targets; \
+       done
 
 install-web-targets:
-       $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v9.0/WebApplications
-       $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v9.0/WebApplications
-       $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v10.0/WebApplications
-       $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v10.0/WebApplications
-       $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v11.0/WebApplications
-       $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v11.0/WebApplications
-       $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v12.0/WebApplications
-       $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v12.0/WebApplications
-       $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
-       $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
+       for VERSION in v9.0 v10.0 v11.0 v12.0 v14.0 v15.0; do \
+               $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/$$VERSION/WebApplications; \
+               $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/$$VERSION/WebApplications; \
+       done
 
 NUGET_BUILDTASKS_REPO_DIR=$(topdir)/../external/nuget-buildtasks
 
-ifeq (14.0, $(XBUILD_VERSION))
-install-nuget-buildtasks-targets:
+install-nuget-targets:
        $(MKINSTALLDIRS) $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
-       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
-       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
        $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
        $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.props $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+
+install-nuget-imports:
+ifeq (14.0, $(XBUILD_VERSION))
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
        $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
        $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
 endif
 
+# The .NETPortable,Version=v5.0 framework contains no assemblies, and essentially just fills the requirement
+# for a framework moniker. When using it, assemblies are provided by NuGet packages such as .NETStandard.Library
+install-pcl5-framework:
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/RedistList
+       $(INSTALL_DATA) $(PCL5_FX_SRC)/FrameworkList.xml $(DESTDIR)$(PCL5_FX_DIR)/RedistList/FrameworkList.xml
+
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/.NET Framework 4.6.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/.NET Framework 4.6.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
+
+install-msbuild-specific-files:
+       $(MKINSTALLDIRS) $(DESTDIR)$(mono_libdir)/mono/xbuild
+       $(INSTALL_DATA) $(DENIED_ASSEMBLY_LIST_SRC) $(DESTDIR)$(mono_libdir)/mono/xbuild
+
 EXTRA_DISTFILES = \
        data/xbuild.rsp \
        data/xbuild.exe.config.in \
+       data/xbuild.exe.config_test.in \
        data/Microsoft.Build.xsd \
        data/2.0/Microsoft.Common.tasks \
        data/3.5/Microsoft.Common.tasks \
@@ -132,6 +151,25 @@ EXTRA_DISTFILES = \
        data/Microsoft.VisualBasic.targets \
        data/MSBuild/Microsoft.Build.CommonTypes.xsd \
        data/MSBuild/Microsoft.Build.Core.xsd \
+       data/Portable/Targets/Microsoft.Portable.Core.props \
+       data/Portable/Targets/Microsoft.Portable.Core.targets \
+       data/Portable/Targets/v4.0/Microsoft.Portable.Common.targets \
+       data/Portable/Targets/v4.0/Microsoft.Portable.CSharp.targets \
+       data/Portable/Targets/v4.0/Microsoft.Portable.VisualBasic.targets \
+       data/Portable/Targets/v4.5/Microsoft.Portable.Common.targets \
+       data/Portable/Targets/v4.5/Microsoft.Portable.CSharp.targets \
+       data/Portable/Targets/v4.5/Microsoft.Portable.VisualBasic.targets \
+       data/Portable/Targets/v4.6/Microsoft.Portable.Common.targets \
+       data/Portable/Targets/v4.6/Microsoft.Portable.CSharp.targets \
+       data/Portable/Targets/v4.6/Microsoft.Portable.VisualBasic.targets \
+       data/Portable/Targets/v5.0/Microsoft.Portable.Common.targets \
+       data/Portable/Targets/v5.0/Microsoft.Portable.CSharp.targets \
+       data/Portable/Targets/v5.0/Microsoft.Portable.VisualBasic.targets \
+       "data/Portable/Frameworks/v5.0/.NET Framework 4.6.xml" \
+       "data/Portable/Frameworks/v5.0/ASP.NET Core 1.0.xml" \
+       "data/Portable/Frameworks/v5.0/FrameworkList.xml" \
+       "data/Portable/Frameworks/v5.0/Windows Universal 10.0.xml" \
+       data/deniedAssembliesList.txt \
        frameworks/net_2.0.xml \
        frameworks/net_3.0.xml \
        frameworks/net_3.5.xml \
@@ -142,14 +180,9 @@ EXTRA_DISTFILES = \
        frameworks/net_4.5.2.xml \
        frameworks/net_4.6.xml \
        frameworks/net_4.6.1.xml \
-       targets/Microsoft.Portable.CSharp_4.0.targets \
-       targets/Microsoft.Portable.CSharp_4.5.targets \
-       targets/Microsoft.Portable.VisualBasic_4.0.targets \
-       targets/Microsoft.Portable.VisualBasic_4.5.targets \
-       targets/Microsoft.Portable.Common.targets \
-       targets/Microsoft.Portable.Core.targets \
-       targets/Microsoft.Portable.Core.props \
-       targets/Microsoft.WebApplication.targets \
+       frameworks/net_4.6.2.xml \
+       frameworks/net_4.7.xml \
+       targets/Microsoft.WebApplication.targets        \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props       \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets      \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets \