net_ure/CustomTarget_net_oootypes.mk   |   35 ++----
 net_ure/CustomTarget_net_uretypes.mk   |   34 ++---
 net_ure/DotnetLibrary_net_basetypes.mk |   22 +--
 net_ure/DotnetLibrary_net_oootypes.mk  |   19 +--
 net_ure/DotnetLibrary_net_uretypes.mk  |   19 +--
 solenv/gbuild/DotnetLibrary.mk         |  190 ++++++++++++---------------------
 solenv/gbuild/TargetLocations.mk       |    4 
 7 files changed, 126 insertions(+), 197 deletions(-)

New commits:
commit 2ddeef9ff5facd3551039504badd31d5cac7f2eb
Author:     RMZeroFour <[email protected]>
AuthorDate: Mon Jul 8 21:23:42 2024 +0530
Commit:     Hossein <[email protected]>
CommitDate: Sat Aug 3 11:08:57 2024 +0200

    .NET Bindings: Improve DotnetLibrary gbuild class
    
    This commit rewrites the DotnetLibrary gbuild class to build a .NET
    library. Logic for handling various .NET languages is now consolidated,
    while earlier there were separate functions for each language. Usage
    has been made much more similar to the Jar gbuild class.
    
    The CustomTargets used to build net_uretypes and net_oootypes have
    also been reworked, and a function has been added to DotnetLibrary
    to consume sources generated by a custom target, for cleaner usage.
    
    Change-Id: Ie494b2547d30c43f9bb0aedeac4d140f1f3a830b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170168
    Tested-by: Jenkins
    Reviewed-by: Hossein <[email protected]>

diff --git a/net_ure/CustomTarget_net_oootypes.mk 
b/net_ure/CustomTarget_net_oootypes.mk
index b8a007c05db0..d03f4eba1e4a 100644
--- a/net_ure/CustomTarget_net_oootypes.mk
+++ b/net_ure/CustomTarget_net_oootypes.mk
@@ -6,14 +6,13 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-$(eval $(call gb_CustomTarget_CustomTarget,net_oootypes))
+$(eval $(call gb_CustomTarget_CustomTarget,net_ure/net_oootypes))
 
-net_ure_DIR := $(gb_CustomTarget_workdir)/net_ure
 net_oootypes_DIR := $(gb_CustomTarget_workdir)/net_ure/net_oootypes
 
-$(call gb_CustomTarget_get_target,net_oootypes) : 
$(net_ure_DIR)/net_oootypes.done
+$(call gb_CustomTarget_get_target,net_ure/net_oootypes) : 
$(net_oootypes_DIR)/done
 
-$(net_ure_DIR)/net_oootypes.done : \
+$(net_oootypes_DIR)/done : \
                $(call gb_UnoApi_get_target,offapi) \
                $(call gb_UnoApi_get_target,udkapi) \
                $(call gb_Executable_get_target,netmaker) \
@@ -21,20 +20,18 @@ $(net_ure_DIR)/net_oootypes.done : \
                | $(net_oootypes_DIR)/.dir
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),NET,4)
        $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),NET)
-       $(call gb_Helper_abbreviate_dirs, \
-       rm -r $(net_oootypes_DIR) && \
-       $(call gb_Helper_execute,netmaker -v -O $(net_oootypes_DIR) \
-               -X $(call gb_UnoApi_get_target,udkapi) \
-               $(call gb_UnoApi_get_target,offapi) > [email protected] 2>&1 || \
-               (echo \
-                       && cat [email protected] \
-                       && echo \
-                       && echo "net_oootypes failed to generate. To retry, 
use:" \
-                       && echo "    make CustomTarget_net_oootypes" \
-                       && echo "cd into the net_ure/ directory to run make 
faster" \
-                       && echo \
-                       && false)) && \
-       touch $@)
+
+       $(call gb_Helper_abbreviate_dirs,\
+               $(call gb_Helper_print_on_error,\
+                       $(call gb_Helper_execute,\
+                               netmaker \
+                                       -v \
+                                       -O $(net_oootypes_DIR) \
+                                       -X $(call gb_UnoApi_get_target,udkapi) \
+                                       $(call gb_UnoApi_get_target,offapi)) \
+                       $(file >$@,),\
+                       $(net_oootypes_DIR)/log))
+
        $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),NET)
 
-# vim: set noet sw=4 ts=4:
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/net_ure/CustomTarget_net_uretypes.mk 
b/net_ure/CustomTarget_net_uretypes.mk
index 419f71ac4420..7118e6801910 100644
--- a/net_ure/CustomTarget_net_uretypes.mk
+++ b/net_ure/CustomTarget_net_uretypes.mk
@@ -6,34 +6,30 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-$(eval $(call gb_CustomTarget_CustomTarget,net_uretypes))
+$(eval $(call gb_CustomTarget_CustomTarget,net_ure/net_uretypes))
 
-net_ure_DIR := $(gb_CustomTarget_workdir)/net_ure
 net_uretypes_DIR := $(gb_CustomTarget_workdir)/net_ure/net_uretypes
 
-$(call gb_CustomTarget_get_target,net_uretypes) : 
$(net_ure_DIR)/net_uretypes.done
+$(call gb_CustomTarget_get_target,net_ure/net_uretypes) : 
$(net_uretypes_DIR)/done
 
-$(net_ure_DIR)/net_uretypes.done : \
+$(net_uretypes_DIR)/done : \
                $(call gb_UnoApi_get_target,udkapi) \
                $(call gb_Executable_get_target,netmaker) \
                $(call gb_Executable_get_runtime_dependencies,netmaker) \
                | $(net_uretypes_DIR)/.dir
        $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),NET,4)
        $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),NET)
-       $(call gb_Helper_abbreviate_dirs, \
-       rm -r $(net_uretypes_DIR) && \
-       $(call gb_Helper_execute,netmaker -v -O $(net_uretypes_DIR) \
-               $(call gb_UnoApi_get_target,udkapi) > [email protected] 2>&1 || \
-               (echo \
-                       && cat [email protected] \
-                       && echo \
-                       && echo "net_uretypes failed to generate. To retry, 
use:" \
-                       && echo "    make CustomTarget_net_uretypes" \
-                       && echo "cd into the net_ure/ directory to run make 
faster" \
-                       && echo \
-                       && false)) && \
-       touch $@)
-       $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),NET)
 
+       $(call gb_Helper_abbreviate_dirs,\
+               $(call gb_Helper_print_on_error,\
+                       $(call gb_Helper_execute,\
+                               netmaker \
+                                       -v \
+                                       -O $(net_uretypes_DIR) \
+                                       $(call gb_UnoApi_get_target,udkapi)) \
+                       $(file >$@,),\
+                       $(net_uretypes_DIR)/log))
+
+       $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),NET)
 
-# vim: set noet sw=4 ts=4:
+# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/net_ure/DotnetLibrary_net_basetypes.mk 
b/net_ure/DotnetLibrary_net_basetypes.mk
index b6a847838344..77a8134bd180 100644
--- a/net_ure/DotnetLibrary_net_basetypes.mk
+++ b/net_ure/DotnetLibrary_net_basetypes.mk
@@ -6,23 +6,21 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-$(eval $(call gb_DotnetLibrary_CsLibrary,net_basetypes))
+$(eval $(call 
gb_DotnetLibrary_DotnetLibrary,net_basetypes,$(gb_DotnetLibrary_CS)))
 
 $(eval $(call gb_DotnetLibrary_add_sources,net_basetypes,\
-    $(SRCDIR)/net_ure/source/basetypes, \
-        Any.cs \
-        BoundAttribute.cs \
-        Exception.cs \
-        IQueryInterface.cs \
-        RaisesAttribute.cs \
-        UnoGeneratedAttribute.cs \
+       net_ure/source/basetypes/Any \
+       net_ure/source/basetypes/BoundAttribute \
+       net_ure/source/basetypes/Exception \
+       net_ure/source/basetypes/IQueryInterface \
+       net_ure/source/basetypes/RaisesAttribute \
+       net_ure/source/basetypes/UnoGeneratedAttribute \
 ))
 
 $(eval $(call gb_DotnetLibrary_add_properties,net_basetypes,\
-    <AssemblyName>net_basetypes</AssemblyName> \
-    <Version>0.1.0</Version> \
-    <Company>LibreOffice</Company> \
-    <Description>Base datatypes for the .NET language UNO 
binding.</Description> \
+       <Version>0.1.0</Version> \
+       <Company>LibreOffice</Company> \
+       <Description>Base datatypes for the .NET language UNO 
binding.</Description> \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/net_ure/DotnetLibrary_net_oootypes.mk 
b/net_ure/DotnetLibrary_net_oootypes.mk
index b21f1bb92945..b12a32f50ed2 100644
--- a/net_ure/DotnetLibrary_net_oootypes.mk
+++ b/net_ure/DotnetLibrary_net_oootypes.mk
@@ -6,23 +6,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-$(eval $(call gb_DotnetLibrary_CsLibrary,net_oootypes))
+$(eval $(call 
gb_DotnetLibrary_DotnetLibrary,net_oootypes,$(gb_DotnetLibrary_CS)))
 
-$(call gb_DotnetLibrary_get_target,net_oootypes) : \
-    $(call gb_CustomTarget_get_target,net_oootypes)
+$(eval $(call 
gb_DotnetLibrary_use_customtarget,net_oootypes,net_ure/net_oootypes))
 
-$(eval $(call gb_DotnetLibrary_add_generated_sources,net_oootypes,\
-    $(gb_CustomTarget_workdir)/net_ure/net_oootypes, \
-        **/*.cs \
-))
-
-$(eval $(call gb_DotnetLibrary_link_cs_library,net_oootypes,net_uretypes))
+$(eval $(call gb_DotnetLibrary_link_library,net_oootypes,net_uretypes))
 
 $(eval $(call gb_DotnetLibrary_add_properties,net_oootypes,\
-    <AssemblyName>net_oootypes</AssemblyName> \
-    <Version>0.1.0</Version> \
-    <Company>LibreOffice</Company> \
-    <Description>LibreOffice datatypes for the .NET language UNO 
binding.</Description> \
+       <Version>0.1.0</Version> \
+       <Company>LibreOffice</Company> \
+       <Description>LibreOffice datatypes for the .NET language UNO 
binding.</Description> \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/net_ure/DotnetLibrary_net_uretypes.mk 
b/net_ure/DotnetLibrary_net_uretypes.mk
index 747e4574ecb9..a796032d8e55 100644
--- a/net_ure/DotnetLibrary_net_uretypes.mk
+++ b/net_ure/DotnetLibrary_net_uretypes.mk
@@ -6,23 +6,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-$(eval $(call gb_DotnetLibrary_CsLibrary,net_uretypes))
+$(eval $(call 
gb_DotnetLibrary_DotnetLibrary,net_uretypes,$(gb_DotnetLibrary_CS)))
 
-$(call gb_DotnetLibrary_get_target,net_uretypes) : \
-    $(call gb_CustomTarget_get_target,net_uretypes)
+$(eval $(call 
gb_DotnetLibrary_use_customtarget,net_uretypes,net_ure/net_uretypes))
 
-$(eval $(call gb_DotnetLibrary_add_generated_sources,net_uretypes,\
-    $(gb_CustomTarget_workdir)/net_ure/net_uretypes, \
-        **/*.cs \
-))
-
-$(eval $(call gb_DotnetLibrary_link_cs_library,net_uretypes,net_basetypes))
+$(eval $(call gb_DotnetLibrary_link_library,net_uretypes,net_basetypes))
 
 $(eval $(call gb_DotnetLibrary_add_properties,net_uretypes,\
-    <AssemblyName>net_uretypes</AssemblyName> \
-    <Version>0.1.0</Version> \
-    <Company>LibreOffice</Company> \
-    <Description>UNO runtime datatypes for the .NET language UNO 
binding.</Description> \
+       <Version>0.1.0</Version> \
+       <Company>LibreOffice</Company> \
+       <Description>UNO runtime datatypes for the .NET language UNO 
binding.</Description> \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/DotnetLibrary.mk b/solenv/gbuild/DotnetLibrary.mk
index 61a52545e03c..c0967168e92b 100644
--- a/solenv/gbuild/DotnetLibrary.mk
+++ b/solenv/gbuild/DotnetLibrary.mk
@@ -13,95 +13,73 @@
 
 ####### Constant Strings #########
 
-gb_DotnetLibrary__CONFIG_RELEASE := -c Release
-gb_DotnetLibrary__CONFIG_DEBUG := -c Debug
+gb_DotnetLibrary_CS := cs
+gb_DotnetLibrary_FS := fs
+gb_DotnetLibrary_VB := vb
 
-####### Helper Functions #########
+####### Build and Clean Targets #########
 
-define gb_DotnetLibrary__get_build_config
-$(if $(or \
-               $(filter TRUE,$(strip $(debug))), \
-               $(filter TRUE,$(strip $(ENABLE_DBGUTIL))) \
-       ), \
-       $(gb_DotnetLibrary__CONFIG_DEBUG), \
-       $(gb_DotnetLibrary__CONFIG_RELEASE))
+# Template for a target to generate the project file for a DotnetLibrary
+define gb_DotnetLibrary__project_target
+$$(gb_DotnetLibrary_$(1)_project) :
+       $$(shell mkdir -p $$(dir $$@))
+       $$(file  >$$@,<Project Sdk="Microsoft.NET.Sdk">)
+       $$(file >>$$@,<PropertyGroup>)
+       $$(file >>$$@,$$(DOTNET_PROPERTY_ELEMENTS))
+       $$(file >>$$@,</PropertyGroup>)
+       $$(file >>$$@,<ItemGroup>)
+       $$(file >>$$@,$$(DOTNET_ITEM_ELEMENTS))
+       $$(file >>$$@,</ItemGroup>)
+       $$(file >>$$@,</Project>)
 
 endef
 
-define gb_DotnetLibrary__escape_quotes
-$(strip $(subst ",\",$(1)))
+# Template for a target to build a DotnetLibrary
+define gb_DotnetLibrary__build_target
+$$(call gb_DotnetLibrary_get_target,$(1)) : $$(gb_DotnetLibrary_$(1)_project)
+       $$(call gb_Output_announce,$(1),$(true),NET,4)
+       $$(call gb_Trace_StartRange,$(1),NET)
+       $$(call gb_Helper_abbreviate_dirs,\
+               $$(call gb_Helper_print_on_error,\
+                       "$$(DOTNET)" build $$< $$(DOTNET_BUILD_FLAGS) -o $$(dir 
$$@),\
+                       $$(gb_DotnetLibrary_workdir)/$(1)/log))
+       $$(call gb_Trace_EndRange,$(1),NET)
 
 endef
 
-####### Build and Clean Targets #########
-
-.PHONY : $(call gb_DotnetLibrary_get_clean_target,%)
-$(call gb_DotnetLibrary_get_clean_target,%) :
-       $(call gb_Output_announce,$*,$(false),NET,4)
-       $(call gb_Helper_abbreviate_dirs,\
-               rm -rf $(call gb_DotnetLibrary_get_target,$*))
-
-$(call gb_DotnetLibrary_get_target,%) :
-       $(call gb_Output_announce,$*,$(true),NET,4)
-       $(call gb_Trace_StartRange,$*,NET)
-       $(call gb_Helper_abbreviate_dirs,\
-               mkdir -p $(call gb_DotnetLibrary_get_workdir,$*) && \
-               P=$(DOTNET_PROJECT_FILE) && \
-               echo "<Project Sdk=\"Microsoft.NET.Sdk\">" > $$P && \
-               echo "<PropertyGroup>" >> $$P && \
-               echo "$(DOTNET_PROPERTY_ELEMENTS)" >> $$P && \
-               echo "</PropertyGroup>" >> $$P && \
-               echo "<ItemGroup>" >> $$P && \
-               echo "$(DOTNET_ITEM_ELEMENTS)" >> $$P && \
-               echo "</ItemGroup>" >> $$P && \
-               echo "</Project>" >> $$P && \
-               "$(DOTNET)" build $$P $(DOTNET_BUILD_FLAGS) \
-                       -o $(call gb_DotnetLibrary_get_workdir,$*) \
-                       > [email protected] 2>&1 || \
-                       (echo \
-                               && cat [email protected] \
-                               && echo \
-                               && echo "A library failed to build. To retry 
the build, use:" \
-                               && echo "    make DotnetLibrary_$*" \
-                               && echo "cd into the module directory to run 
the build faster" \
-                               && echo \
-                               && false) && \
-               touch $@)
-       $(call gb_Trace_EndRange,$*,NET)
-
-####### Library Target Constructors #########
-
-define gb_DotnetLibrary__common_ctor
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_BUILD_FLAGS := $(strip 
$(call gb_DotnetLibrary__get_build_config))
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_PROPERTY_ELEMENTS := 
<TargetFramework>netstandard20</TargetFramework>
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_ITEM_ELEMENTS :=
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_PROJECT_FILE := $(call 
gb_DotnetLibrary_get_workdir,$(1))/$(1).$(2)
-
-$(eval $(call gb_Module_register_target, \
-       $(call gb_DotnetLibrary_get_target,$(1)), \
-       $(call gb_DotnetLibrary_get_clean_target,$(1))))
-$(call gb_Helper_make_userfriendly_targets,$(1),DotnetLibrary)
+# Template for a target to clean a DotnetLibrary
+define gb_DotnetLibrary__clean_target
+$$(call gb_DotnetLibrary_get_clean_target,$(1)) :
+       $$(call gb_Output_announce,$(1),$(false),NET,4)
+       $$(call gb_Helper_abbreviate_dirs,\
+               rm -rf $$(gb_DotnetLibrary_$(1)_project) $$(call 
gb_DotnetLibrary_get_target,$(1)))
 
 endef
 
-# Generates one csproj file from given inputs and builds it
-# call gb_DotnetLibrary_CsLibrary,targetname
-define gb_DotnetLibrary_CsLibrary
-$(call gb_DotnetLibrary__common_ctor,$(1),csproj)
+####### Library Target Constructor #########
 
-endef
+# Generates one project file for the given language, instantiating 
+# the project file, build and clean targets from above templates
+# call gb_DotnetLibrary_DotnetLibrary,targetname,language
+define gb_DotnetLibrary_DotnetLibrary
+gb_DotnetLibrary_$(1)_language := $(2)
+gb_DotnetLibrary_$(1)_project := $(gb_DotnetLibrary_workdir)/$(1)/$(1).$(2)proj
 
-# Generates one fsproj file from given inputs and builds it
-# call gb_DotnetLibrary_FsLibrary,targetname
-define gb_DotnetLibrary_FsLibrary
-$(call gb_DotnetLibrary__common_ctor,$(1),fsproj)
+$$(gb_DotnetLibrary_$(1)_project) : DOTNET_PROPERTY_ELEMENTS := 
<TargetFramework>netstandard2.0</TargetFramework> 
+$$(gb_DotnetLibrary_$(1)_project) : DOTNET_PROPERTY_ELEMENTS += 
<AssemblyName>$(1)</AssemblyName>
+$$(gb_DotnetLibrary_$(1)_project) : DOTNET_ITEM_ELEMENTS :=
+$$(eval $$(call gb_DotnetLibrary__project_target,$(1)))
 
-endef
+$$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_BUILD_FLAGS := $(if 
$(ENABLE_DEBUG),-c Debug,-c Release)
+$$(eval $$(call gb_DotnetLibrary__build_target,$(1)))
 
-# Generates one vbproj file from given inputs and builds it
-# call gb_DotnetLibrary_VbLibrary,targetname
-define gb_DotnetLibrary_VbLibrary
-$(call gb_DotnetLibrary__common_ctor,$(1),vbproj)
+.PHONY : $$(call gb_DotnetLibrary_get_clean_target,$(1))
+$$(eval $$(call gb_DotnetLibrary__clean_target,$(1)))
+
+$$(eval $$(call gb_Module_register_target, \
+       $(call gb_DotnetLibrary_get_target,$(1)), \
+       $(call gb_DotnetLibrary_get_clean_target,$(1))))
+$(call gb_Helper_make_userfriendly_targets,$(1),DotnetLibrary)
 
 endef
 
@@ -117,77 +95,51 @@ endef
 # Add <PropertyGroup> elements to the project file
 # call gb_DotnetLibrary_add_properties,target,properties
 define gb_DotnetLibrary_add_properties
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_PROPERTY_ELEMENTS += $(strip 
$(call gb_DotnetLibrary__escape_quotes,$(2)))
+$(gb_DotnetLibrary_$(1)_project) : DOTNET_PROPERTY_ELEMENTS += $(2)
 
 endef
 
 # Add <ItemGroup> elements to the project file
 # call gb_DotnetLibrary_add_items,target,items
 define gb_DotnetLibrary_add_items
-$(call gb_DotnetLibrary_get_target,$(1)) : DOTNET_ITEM_ELEMENTS += $(strip 
$(call gb_DotnetLibrary__escape_quotes,$(2)))
+$(gb_DotnetLibrary_$(1)_project) : DOTNET_ITEM_ELEMENTS += $(2)
 
 endef
 
 # Add one source file to the project file
 # This adds it to the project, and makes it a build dependency
 # so the library is rebuilt if the source changes
-# call gb_DotnetLibrary_add_source,target,basedir,source
+# call gb_DotnetLibrary_add_source,target,source
 define gb_DotnetLibrary_add_source
-$(call gb_DotnetLibrary_get_target,$(1)) : $(strip $(2))/$(strip $(3))
-$(call gb_DotnetLibrary_add_items,$(1),<Compile Include="$(strip $(2))/$(strip 
$(3))"/>)
+$(gb_DotnetLibrary_$(1)_project) : 
$(SRCDIR)/$(2).$(gb_DotnetLibrary_$(1)_language)
+$(call gb_DotnetLibrary_add_items,$(1),<Compile 
Include="$(SRCDIR)/$(2).$(gb_DotnetLibrary_$(1)_language)"/>)
 
 endef
 
 # Add source files to the project file
 # This adds them to the project, and makes it them build dependency
 # so the library is rebuilt if the sources change
-# call gb_DotnetLibrary_add_sources,target,basedir,sources
+# call gb_DotnetLibrary_add_sources,target,sources
 define gb_DotnetLibrary_add_sources
-$(foreach source,$(3),$(call gb_DotnetLibrary_add_source,$(1),$(2),$(source)))
-
-endef
-
-# Add one generated source file to the project file,
-# This is not marked as makefile build dependency,
-# so the library is NOT rebuilt if this source changes
-# Useful for things like source globs supported by .net projects
-# call gb_DotnetLibrary_add_generated_source,target,basedir,source
-define gb_DotnetLibrary_add_generated_source
-$(call gb_DotnetLibrary_add_items,$(1),<Compile Include="$(strip $(2))/$(strip 
$(3))"/>)
-
-endef
-
-# Add generated source files to the project file,
-# These are not marked as makefile build dependencies,
-# so the library is NOT rebuilt if these sources change
-# Useful for things like source globs supported by .net projects
-# call gb_DotnetLibrary_add_generated_sources,target,basedir,sources
-define gb_DotnetLibrary_add_generated_sources
-$(foreach source,$(3),$(call 
gb_DotnetLibrary_add_generated_source,$(1),$(2),$(source)))
-
-endef
-
-# Link to a DotnetLibrary_CsLibrary target
-# call gb_DotnetLibrary_link_cs_library,target,library
-define gb_DotnetLibrary_link_cs_library
-$(call gb_DotnetLibrary_get_target,$(1)) : $(call 
gb_DotnetLibrary_get_target,$(strip $(2)))
-$(call gb_DotnetLibrary_add_items,$(1),<ProjectReference Include="$(call 
gb_DotnetLibrary_get_workdir,$(strip $(2)))/$(strip $(2)).csproj"/>)
+$(foreach source,$(2),$(call gb_DotnetLibrary_add_source,$(1),$(source)))
 
 endef
 
-# Link to a DotnetLibrary_FsLibrary target
-# call gb_DotnetLibrary_link_fs_library,target,library
-define gb_DotnetLibrary_link_fs_library
-$(call gb_DotnetLibrary_get_target,$(1)) : $(call 
gb_DotnetLibrary_get_target,$(strip $(2)))
-$(call gb_DotnetLibrary_add_items,$(1),<ProjectReference Include="$(call 
gb_DotnetLibrary_get_workdir,$(strip $(2)))/$(strip $(2)).fsproj"/>)
+# Add source files generated by the given CustomTarget.
+# This adds the CustomTarget as a build dependency
+# so if the CustomTarget is rebuilt, this library is too.
+# call gb_DotnetLibrary_use_customtarget,target,customtarget
+define gb_DotnetLibrary_use_customtarget
+$(gb_DotnetLibrary_$(1)_project) : $(call gb_CustomTarget_get_target,$(2))
+$(call gb_DotnetLibrary_add_items,$(1),<Compile 
Include="$(gb_CustomTarget_workdir)/$(2)/**/*.$(gb_DotnetLibrary_$(1)_language)"/>)
 
 endef
 
-# Link to a DotnetLibrary_VbLibrary target
-# call gb_DotnetLibrary_link_vb_library,target,library
-define gb_DotnetLibrary_link_vb_library
-$(call gb_DotnetLibrary_get_target,$(1)) : $(call 
gb_DotnetLibrary_get_target,$(strip $(2)))
-$(call gb_DotnetLibrary_add_items,$(1),<ProjectReference Include="$(call 
gb_DotnetLibrary_get_workdir,$(strip $(2)))/$(strip $(2)).vbproj"/>)
+# Link to another DotnetLibrary target
+# call gb_DotnetLibrary_link_library,target,library
+define gb_DotnetLibrary_link_library
+$(gb_DotnetLibrary_$(1)_project) : $(call gb_DotnetLibrary_get_target,$(2))
+$(call gb_DotnetLibrary_add_items,$(1),<ProjectReference 
Include="$(gb_DotnetLibrary_$(2)_project)"/>)
 
 endef
 
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index ad0e26a75969..edfd2459cd62 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -63,8 +63,8 @@ gb_DescriptionTranslateTarget_get_target = 
$(WORKDIR)/DescriptionTranslateTarget
 gb_Dictionary_get_target = $(WORKDIR)/Dictionary/$(1).done
 gb_CxxObject_get_target = $(WORKDIR)/CxxObject/$(1).o
 gb_CxxObject_get_dwo_target = $(WORKDIR)/CxxObject/$(1).dwo
-gb_DotnetLibrary_get_target = $(WORKDIR)/DotnetLibrary/$(1).done
-gb_DotnetLibrary_get_workdir = $(WORKDIR)/DotnetLibrary/$(1)
+gb_DotnetLibrary_get_target = $(WORKDIR)/DotnetLibrary/$(1)/$(1).dll
+gb_DotnetLibrary_workdir = $(WORKDIR)/DotnetLibrary
 gb_GenCxxObject_get_target = $(WORKDIR)/GenCxxObject/$(1).o
 gb_GenCxxObject_get_dwo_target = $(WORKDIR)/GenCxxObject/$(1).dwo
 gb_GenAsmObject_get_target = $(WORKDIR)/GenAsmObject/$(1).o

Reply via email to