+2007-08-08 Jürg Billeter <j@bitron.ch>
+
+ * vala/valacodecontext.vala, gobject/valaccodecompiler.vala,
+ compiler/valacompiler.vala: support passing C source files to the
+ command line, patch by Nicolas Trangez
+
2007-08-08 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* vapi/gtk+-2.0.vala: fix the signatures of some TreeModel
foreach (string source in sources) {
if (FileUtils.test (source, FileTest.EXISTS)) {
- context.add_source_file (new SourceFile (context, source));
+ if (source.has_suffix (".vala")) {
+ context.add_source_file (new SourceFile (context, source));
+ } else if (source.has_suffix (".c")) {
+ context.add_c_source_file (source);
+ } else {
+ Report.error (null, "%s is not a supported source file type. Only .vala and .c files are supported.".printf (source));
+ }
} else {
Report.error (null, "%s not found".printf (source));
}
return 1;
}
- foreach (string source in sources) {
- if (!source.has_suffix (".vala")) {
- stderr.printf ("Only .vala source files supported.\n");
- return 1;
- }
- }
-
var compiler = new Compiler ();
return compiler.run ();
}
cmdline += " " + Shell.quote (file.get_csource_filename ());
}
}
+ var c_source_files = context.get_c_source_files ();
+ foreach (string file in c_source_files) {
+ cmdline += " " + Shell.quote (file);
+ }
try {
Process.spawn_command_line_sync (cmdline, null, null, out exit_status);
public Method module_init_method { get; set; }
private Gee.List<SourceFile> source_files = new ArrayList<SourceFile> ();
+ private Gee.List<string> c_source_files = new ArrayList<string> ();
private Namespace! _root = new Namespace (null);
private Gee.List<SourceFileCycle> cycles = new ArrayList<SourceFileCycle> ();
public Collection<SourceFile> get_source_files () {
return new ReadOnlyCollection<SourceFile> (source_files);
}
+
+ /**
+ * Returns a copy of the list of C source files.
+ *
+ * @return list of C source files
+ */
+ public Collection<string> get_c_source_files () {
+ return new ReadOnlyCollection<string> (c_source_files);
+ }
/**
* Adds the specified file to the list of source files.
}
/**
+ * Adds the specified file to the list of C source files.
+ *
+ * @param file a C source file
+ */
+ public void add_c_source_file (string! file) {
+ c_source_files.add (file);
+ }
+
+ /**
* Returns a copy of the list of used packages.
*
* @return list of used packages