generator: Remove support for .custom files
We don't use any .custom file anymore, and nobody should. You can do the same things with partial classes, and they're much nicer.
This commit is contained in:
parent
5b22918f4f
commit
c1e9a8c613
12 changed files with 14 additions and 57 deletions
|
@ -17,7 +17,7 @@ DISTCLEANFILES = $(ASSEMBLY).config
|
|||
POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY), $(addprefix policy., $(POLICY_VERSIONS)))
|
||||
POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS)))
|
||||
|
||||
EXTRA_DIST = $(RAW_API) $(SYMBOLS) $(ASSEMBLY).config.in $(METADATA) $(customs) $(sources) $(add_dist)
|
||||
EXTRA_DIST = $(RAW_API) $(SYMBOLS) $(ASSEMBLY).config.in $(METADATA) $(sources) $(add_dist)
|
||||
|
||||
build_symbols = $(addprefix --symbols=$(srcdir)/, $(SYMBOLS))
|
||||
|
||||
|
@ -29,14 +29,13 @@ $(API): $(METADATA) $(RAW_API) $(SYMBOLS) $(top_builddir)/parser/gapi-fixup.exe
|
|||
$(RUNTIME) $(top_builddir)/parser/gapi-fixup.exe --api=$(API) --metadata=$(srcdir)/$(METADATA) $(build_symbols); \
|
||||
fi
|
||||
|
||||
build_customs = $(addprefix $(srcdir)/, $(customs))
|
||||
api_includes = $(addprefix -I:, $(INCLUDE_API))
|
||||
|
||||
generated-stamp: $(API) $(INCLUDE_API) $(top_builddir)/generator/gapi_codegen.exe $(build_customs)
|
||||
generated-stamp: $(API) $(INCLUDE_API) $(top_builddir)/generator/gapi_codegen.exe
|
||||
rm -f generated/* && \
|
||||
$(RUNTIME) $(top_builddir)/generator/gapi_codegen.exe --generate $(API) \
|
||||
$(api_includes) \
|
||||
--outdir=generated --customdir=$(srcdir) --assembly-name=$(ASSEMBLY_NAME) \
|
||||
--outdir=generated --assembly-name=$(ASSEMBLY_NAME) \
|
||||
--gluelib-name=$(pkg)sharpglue-3 --glue-filename=glue/generated.c \
|
||||
--glue-includes=$(glue_includes) \
|
||||
&& touch generated-stamp
|
||||
|
|
|
@ -72,9 +72,8 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom(sw, gen_info.CustomDir);
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
gen_info.Writer = null;
|
||||
Statistics.BoxedCount++;
|
||||
|
|
|
@ -81,7 +81,6 @@ namespace GtkSharp.Generation {
|
|||
GenMethods (gen_info, null, null);
|
||||
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom(sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
|
|
|
@ -37,7 +37,6 @@ namespace GtkSharp.Generation {
|
|||
|
||||
bool generate = false;
|
||||
string dir = "";
|
||||
string custom_dir = "";
|
||||
string assembly_name = "";
|
||||
string glue_filename = "";
|
||||
string glue_includes = "";
|
||||
|
@ -46,6 +45,10 @@ namespace GtkSharp.Generation {
|
|||
SymbolTable table = SymbolTable.Table;
|
||||
ArrayList gens = new ArrayList ();
|
||||
foreach (string arg in args) {
|
||||
if (arg.StartsWith ("--customdir=")) {
|
||||
Console.WriteLine ("Using .custom files is not supported anymore, use partial classes instead.");
|
||||
return 0;
|
||||
}
|
||||
string filename = arg;
|
||||
if (arg == "--generate") {
|
||||
generate = true;
|
||||
|
@ -60,10 +63,6 @@ namespace GtkSharp.Generation {
|
|||
generate = false;
|
||||
dir = arg.Substring (9);
|
||||
continue;
|
||||
} else if (arg.StartsWith ("--customdir=")) {
|
||||
generate = false;
|
||||
custom_dir = arg.Substring (12);
|
||||
continue;
|
||||
} else if (arg.StartsWith ("--assembly-name=")) {
|
||||
generate = false;
|
||||
assembly_name = arg.Substring (16);
|
||||
|
@ -101,7 +100,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
GenerationInfo gen_info = null;
|
||||
if (dir != "" || assembly_name != "" || glue_filename != "" || glue_includes != "" || gluelib_name != "")
|
||||
gen_info = new GenerationInfo (dir, custom_dir, assembly_name, glue_filename, glue_includes, gluelib_name);
|
||||
gen_info = new GenerationInfo (dir, assembly_name, glue_filename, glue_includes, gluelib_name);
|
||||
|
||||
foreach (IGeneratable gen in gens) {
|
||||
if (gen_info == null)
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t\t{0}Internal{1} ({2});", retval.IsVoid ? "" : "return ", this.Name, Signature.GetCallString (false));
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
// This method is to be invoked from existing VM implementations in the .customs
|
||||
// This method is to be invoked from existing VM implementations in the custom code
|
||||
sw.WriteLine ("\t\tprivate {0} Internal{1} ({2})", retval.CSType, this.Name, Signature.ToString ());
|
||||
sw.WriteLine ("\t\t{");
|
||||
}
|
||||
|
|
|
@ -94,26 +94,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
protected void AppendCustom (StreamWriter sw, string custom_dir)
|
||||
{
|
||||
AppendCustom (sw, custom_dir, Name);
|
||||
}
|
||||
|
||||
protected void AppendCustom (StreamWriter sw, string custom_dir, string type_name)
|
||||
{
|
||||
char sep = Path.DirectorySeparatorChar;
|
||||
string custom = custom_dir + sep + type_name + ".custom";
|
||||
if (File.Exists(custom)) {
|
||||
sw.WriteLine ("#region Customized extensions");
|
||||
sw.WriteLine ("#line 1 \"" + type_name + ".custom\"");
|
||||
FileStream custstream = new FileStream(custom, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(custstream);
|
||||
sw.WriteLine (sr.ReadToEnd ());
|
||||
sw.WriteLine ("#endregion");
|
||||
sr.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract string CallByName (string var);
|
||||
|
||||
public abstract string FromNative (string var);
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace GtkSharp.Generation {
|
|||
public class GenerationInfo {
|
||||
|
||||
string dir;
|
||||
string custom_dir;
|
||||
string assembly_name;
|
||||
string gluelib_name;
|
||||
bool glue_enabled;
|
||||
|
@ -41,16 +40,14 @@ namespace GtkSharp.Generation {
|
|||
string ns_name = ns.GetAttribute ("name");
|
||||
char sep = Path.DirectorySeparatorChar;
|
||||
dir = ".." + sep + ns_name.ToLower () + sep + "generated";
|
||||
custom_dir = ".." + sep + ns_name.ToLower ();
|
||||
assembly_name = ns_name.ToLower () + "-sharp";
|
||||
}
|
||||
|
||||
public GenerationInfo (string dir, string assembly_name) : this (dir, dir, assembly_name, "", "", "") {}
|
||||
public GenerationInfo (string dir, string assembly_name) : this (dir, assembly_name, "", "", "") {}
|
||||
|
||||
public GenerationInfo (string dir, string custom_dir, string assembly_name, string glue_filename, string glue_includes, string gluelib_name)
|
||||
public GenerationInfo (string dir, string assembly_name, string glue_filename, string glue_includes, string gluelib_name)
|
||||
{
|
||||
this.dir = dir;
|
||||
this.custom_dir = custom_dir;
|
||||
this.assembly_name = assembly_name;
|
||||
this.gluelib_name = gluelib_name;
|
||||
InitializeGlue (glue_filename, glue_includes, gluelib_name);
|
||||
|
@ -90,12 +87,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string CustomDir {
|
||||
get {
|
||||
return custom_dir;
|
||||
}
|
||||
}
|
||||
|
||||
public string Dir {
|
||||
get {
|
||||
return dir;
|
||||
|
|
|
@ -270,8 +270,6 @@ namespace GtkSharp.Generation {
|
|||
|
||||
sw.WriteLine ("#endregion");
|
||||
|
||||
AppendCustom (sw, gen_info.CustomDir, Name + "Adapter");
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
|
@ -320,7 +318,6 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t[GLib.Property (\"" + prop.CName + "\")]");
|
||||
prop.GenerateDecl (sw, "\t\t");
|
||||
}
|
||||
AppendCustom (sw, gen_info.CustomDir, Name + "Implementor");
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
}
|
||||
|
@ -353,8 +350,6 @@ namespace GtkSharp.Generation {
|
|||
foreach (Property prop in props.Values)
|
||||
prop.GenerateDecl (sw, "\t\t");
|
||||
|
||||
AppendCustom (sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
GenerateImplementorIface (gen_info);
|
||||
sw.WriteLine ("#endregion");
|
||||
|
|
|
@ -239,7 +239,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom (sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
|
|
|
@ -183,8 +183,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
#endif
|
||||
sw.WriteLine ("#endregion");
|
||||
|
||||
AppendCustom(sw, gen_info.CustomDir);
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
|
|
|
@ -224,8 +224,7 @@ namespace GtkSharp.Generation {
|
|||
return;
|
||||
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom(sw, gen_info.CustomDir);
|
||||
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\t}");
|
||||
}
|
||||
sw.WriteLine ("#endregion");
|
||||
AppendCustom (sw, gen_info.CustomDir);
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ("}");
|
||||
sw.Close ();
|
||||
|
|
Loading…
Add table
Reference in a new issue