Author: ankit
Date: 2008-01-23 19:01:40 -0500 (Wed, 23 Jan 2008)
New Revision: 93744

Modified:
   branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/ChangeLog
   
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
   
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
   
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
   
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.include
   
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template
Log:
Fix bugs #333847.
* SimpleProjectMakefileHandler.cs:
* SolutionDeployer.cs:
* templates/Makefile.am.project.template:
* templates/Makefile.include:
* templates/Makefile.noauto.project.template:
Add support for generating satellite assemblies.


Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/ChangeLog
===================================================================
--- branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/ChangeLog    
2008-01-23 23:55:23 UTC (rev 93743)
+++ branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/ChangeLog    
2008-01-24 00:01:40 UTC (rev 93744)
@@ -1,3 +1,14 @@
+2008-01-24  Ankit Jain  <[EMAIL PROTECTED]>
+       Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix bugs #333847.
+       * SimpleProjectMakefileHandler.cs:
+       * SolutionDeployer.cs:
+       * templates/Makefile.am.project.template:
+       * templates/Makefile.include:
+       * templates/Makefile.noauto.project.template:
+       Add support for generating satellite assemblies.
+
 2008-01-22  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Autotools.addin.xml: Updated add-in category and 
description.

Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
===================================================================
--- 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
      2008-01-23 23:55:23 UTC (rev 93743)
+++ 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
      2008-01-24 00:01:40 UTC (rev 93744)
@@ -128,7 +128,7 @@
                                extras = new StringBuilder ();
                                datafiles = new StringBuilder ();
 
-                               string include_custom_hooks = String.Empty;
+                               string includes = String.Empty;
                                string references, dllReferences;
                                ProcessProjectReferences (project, out 
references, out dllReferences, ctx);
 
@@ -212,7 +212,6 @@
                                        conf_vars.AppendFormat 
("top_srcdir={0}\n\n",
                                                
FileService.AbsoluteToRelativePath (project.BaseDirectory, 
ctx.TargetCombine.BaseDirectory));
 
-                                       conf_vars.AppendFormat ("include 
$(top_srcdir)/Makefile.include\n");
                                        conf_vars.AppendFormat ("include 
$(top_srcdir)/config.make\n\n");
 
                                        // Don't emit for top level project 
makefile(eg. pdn.make), as it would be
@@ -221,7 +220,8 @@
                                                string customhooks = 
Path.Combine (project.BaseDirectory, "custom-hooks.make");
                                                bool include = File.Exists 
(customhooks);
                                        
-                                               include_custom_hooks = 
String.Format ("{0}include $(srcdir)/custom-hooks.make\n\n", include ? "" : 
"#");
+                                               includes = "include 
$(top_srcdir)/Makefile.include\n";
+                                               includes += String.Format 
("{0}include $(srcdir)/custom-hooks.make\n\n", include ? "" : "#");
                                                if (include)
                                                        makefile.SetVariable 
("EXTRA_DIST", "$(srcdir)/custom-hooks.make");
                                        }
@@ -385,6 +385,9 @@
                                        conf_vars.Append ( "\nendif\n\n" );
                                }
 
+                               conf_vars.AppendFormat ("AL={0}\n", 
(dotnetProject.ClrVersion == ClrVersion.Net_2_0) ? "al2" : "al");
+                               conf_vars.AppendFormat 
("SATELLITE_ASSEMBLY_NAME={0}.resources.dll\n", dotnetProject.DefaultNamespace);
+
                                foreach (KeyValuePair<string, DeployFile> pair 
in allDeployVars) {
                                        HandleDeployFile (pair.Value, pair.Key, 
project, ctx);
 
@@ -428,15 +431,15 @@
                                
templateEngine.Variables["COPY_DEPLOY_FILES_VARS"] = 
deployFileCopyVars.ToString();
                                
templateEngine.Variables["COPY_DEPLOY_FILES_TARGETS"] = 
deployFileCopyTargets.ToString();
                                templateEngine.Variables["ALL_TARGET"] = 
(ctx.TargetCombine.BaseDirectory == project.BaseDirectory) ? "all-local" : 
"all";
-                               
templateEngine.Variables["INCLUDE_CUSTOM_HOOKS"] = include_custom_hooks;
+                               templateEngine.Variables["INCLUDES"] = includes;
 
                                templateEngine.Variables["FILES"] = 
files.ToString();
                                templateEngine.Variables["RESOURCES"] = 
res_files.ToString();
                                templateEngine.Variables["EXTRAS"] = 
extras.ToString();
                                templateEngine.Variables["DATA_FILES"] = 
datafiles.ToString();
+                               templateEngine.Variables["CLEANFILES"] = 
vars.ToString ();
 
                                if (!generateAutotools) {
-                                       templateEngine.Variables["CLEANFILES"] 
= vars.ToString ();
                                        
templateEngine.Variables["TEMPLATE_FILES_TARGETS"] = 
templateFilesTargets.ToString();
                                        
templateEngine.Variables["INSTALL_TARGET"] = installTarget.ToString();
                                        
templateEngine.Variables["UNINSTALL_TARGET"] = uninstallTarget.ToString();
@@ -738,6 +741,7 @@
                        
                        return refp;
                }
+               
        }
 }
 

Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
===================================================================
--- 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
  2008-01-23 23:55:23 UTC (rev 93743)
+++ 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs
  2008-01-24 00:01:40 UTC (rev 93744)
@@ -21,6 +21,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -483,6 +484,7 @@
                                        " -e 
\"s,@expanded_bindir@,$(bindir),\"" +
                                        " -e 
\"s,@expanded_datadir@,$(datadir),\"" +
                                        " < $2.in > $2";
+                       templateEngine.Variables["VALID_CULTURES"] = 
CultureNames;
 
                        string fileName = Path.Combine (solution_dir, 
"Makefile.include");
 
@@ -498,6 +500,20 @@
 
                        context.AddGeneratedFile (fileName);
                }
+               
+               static string cultureNames;
+               static string CultureNames {
+                       get {
+                               if (cultureNames == null) {
+                                       StringBuilder sb = new StringBuilder ();
+                                       foreach (CultureInfo ci in 
CultureInfo.GetCultures (CultureTypes.AllCultures))
+                                               sb.AppendFormat (" {0}", 
ci.Name);
+                                       cultureNames = sb.ToString ();
+                               }
+
+                               return cultureNames;
+                       }
+               }
        }
 }
 

Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
===================================================================
--- 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
       2008-01-23 23:55:23 UTC (rev 93743)
+++ 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
       2008-01-24 00:01:40 UTC (rev 93744)
@@ -16,6 +16,8 @@
 
 DLL_REFERENCES = %%DLL_REFERENCES%%
 
+CLEANFILES = %%CLEANFILES%%
+
 include $(top_srcdir)/Makefile.include
 
 %%COPY_DEPLOY_FILES_VARS%%
@@ -27,7 +29,7 @@
 $(build_resx_resources) : %.resources: %.resx
        %%RESGEN%% '$<' '$@'
 
-$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) 
$(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list)
+$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) 
$(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) 
$(build_satellite_assembly_list)
        mkdir -p $(dir $(ASSEMBLY))
        $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) 
-out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) 
$(build_resources_embed) $(build_references_ref)
 

Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.include
===================================================================
--- 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.include
   2008-01-23 23:55:23 UTC (rev 93743)
+++ 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.include
   2008-01-24 00:01:40 UTC (rev 93744)
@@ -1,3 +1,5 @@
+VALID_CULTURES = %%VALID_CULTURES%%
+
 build_sources = $(FILES) $(GENERATED_FILES)
 build_sources_embed = $(build_sources:%='$(srcdir)/%')
 
@@ -2,12 +4,20 @@
 comma__=,
-build_resx_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, 
$(firstword $(subst $(comma__), ,$(res)))),$(res),))
-build_others_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, 
$(firstword $(subst $(comma__), ,$(res)))), ,$(res)))
+get_resource_name = $(firstword $(subst $(comma__), ,$1))
+get_culture =  $(lastword $(subst ., ,$(basename $1)))
+is_cultured_resource = $(and $(word 3,$(subst ., ,$1)), $(filter 
$(VALID_CULTURES),$(lastword $(subst ., ,$(basename $1)))))
+
+build_resx_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, $(call 
get_resource_name,$(res))),$(res),))
+build_non_culture_resx_list = $(foreach res, $(build_resx_list),$(if $(call 
is_cultured_resource,$(call get_resource_name,$(res))),,$(res)))
+build_non_culture_others_list = $(foreach res, $(filter-out 
$(build_resx_list),$(RESOURCES)),$(if $(call is_cultured_resource,$(call 
get_resource_name,$(res))),,$(res)))
+build_others_list = $(build_non_culture_others_list)
 build_xamlg_list = $(filter %.xaml.g.cs, $(FILES))
 
-build_resx_files = $(foreach res, $(build_resx_list), $(firstword $(subst 
$(comma__), ,$(res))))
+# resgen all .resx resources
+build_resx_files = $(foreach res, $(build_resx_list), $(call 
get_resource_name,$(res)))
 build_resx_resources = $(build_resx_files:.resx=.resources)
-build_resx_resources_hack = $(subst .resx,.resources, $(build_resx_list))
+
+# embed resources for the main assembly
+build_resx_resources_hack = $(subst .resx,.resources, 
$(build_non_culture_resx_list))
 build_resx_resources_embed = $(build_resx_resources_hack:%='-resource:%')
-
-build_others_files = $(foreach res, $(build_others_list), $(firstword $(subst 
$(comma__), ,$(res))))
+build_others_files = $(foreach res, $(build_others_list),$(call 
get_resource_name,$(res)))
 build_others_resources = $(build_others_files)
@@ -22,8 +32,8 @@
 build_references_ref += $(foreach ref, $(DLL_REFERENCES), -r:$(ref))
 build_references_ref += $(foreach ref, $(PROJECT_REFERENCES), -r:$(ref))
 
-EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) 
$(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES)
-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources)
+EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) 
$(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(build_culture_res_files)
+CLEANFILES += $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources) 
$(build_satellite_assembly_list)
 DISTCLEANFILES = $(GENERATED_FILES) $(pc_files) $(BUILD_DIR)/*
 
 pkglib_SCRIPTS = $(ASSEMBLY)
@@ -45,8 +55,24 @@
 # if $3 is non-empty then wrapper is marked exec
 define emit-deploy-wrapper
 $($1): $2 %%CONFIG_MAKE_DEP%%
-       mkdir -p $$(dir $($1))
+       mkdir -p '$$(@D)'
        cp '$$<' '$$@'
-       test -z '$3' || chmod +x '$$@'
+       $(if $3,chmod +x '$$@')
 %%WRAPPER_SED%%
 endef
+
+# generating satellite assemblies
+
+culture_resources = $(foreach res, $(RESOURCES), $(if $(call 
is_cultured_resource,$(call get_resource_name, $(res))),$(res)))
+cultures = $(sort $(foreach res, $(culture_resources), $(call 
get_culture,$(call get_resource_name,$(res)))))
+culture_resource_dependencies = $(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): 
$(subst .resx,.resources,$2)
+culture_resource_commandlines = cmd_line_satellite_$1 += '/embed:$(subst 
.resx,.resources,$2)'
+build_satellite_assembly_list = 
$(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME))
+build_culture_res_files = $(foreach res, $(culture_resources),$(call 
get_resource_name,$(res)))
+
+$(eval $(foreach res, $(culture_resources), $(eval $(call 
culture_resource_dependencies,$(call get_culture,$(call 
get_resource_name,$(res))),$(call get_resource_name,$(res))))))
+$(eval $(foreach res, $(culture_resources), $(eval $(call 
culture_resource_commandlines,$(call get_culture,$(call 
get_resource_name,$(res))),$(res)))))
+
+$(build_satellite_assembly_list): $(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME):
+       mkdir -p '$(@D)'
+       $(AL) -out:'$@' -culture:$* -t:lib $(cmd_line_satellite_$*)

Modified: 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template
===================================================================
--- 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template
   2008-01-23 23:55:23 UTC (rev 93743)
+++ 
branches/monodevelop/main/1.0/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template
   2008-01-24 00:01:40 UTC (rev 93744)
@@ -15,12 +15,12 @@
 
 DLL_REFERENCES = %%DLL_REFERENCES%%
 
-CLEANFILES += %%CLEANFILES%%
+CLEANFILES = %%CLEANFILES%%
 
 #Targets
 %%ALL_TARGET%%: $(ASSEMBLY) %%DEPLOY_FILE_VARS%% $(top_srcdir)/config.make
 
-%%INCLUDE_CUSTOM_HOOKS%%
+%%INCLUDES%%
 
 %%COPY_DEPLOY_FILES_TARGETS%%
 %%TEMPLATE_FILES_TARGETS%%
@@ -30,7 +30,7 @@
 $(build_resx_resources) : %.resources: %.resx
        %%RESGEN%% '$<' '$@'
 %%CUSTOM_COMMAND_TARGETS%%
-$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) 
$(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list)
+$(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) 
$(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) 
$(build_satellite_assembly_list)
        make pre-all-local-hook prefix=$(prefix)
        mkdir -p $(dir $(ASSEMBLY))
        make $(CONFIG)_BeforeBuild

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to