vala r959 - in trunk: . compiler vala vapigen
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r959 - in trunk: . compiler vala vapigen
- Date: Sun, 3 Feb 2008 21:47:02 +0000 (GMT)
Author: juergbi
Date: Sun Feb 3 21:47:02 2008
New Revision: 959
URL: http://svn.gnome.org/viewvc/vala?rev=959&view=rev
Log:
2008-02-03 Juerg Billeter <j bitron ch>
* vala/Makefile.am, vala/valacodecontext.vala,
compiler/valacompiler.vala, vapigen/valavapigen.vala: move
get_package_path method to libvala
Modified:
trunk/ChangeLog
trunk/compiler/valacompiler.vala
trunk/vala/Makefile.am
trunk/vala/valacodecontext.vala
trunk/vapigen/valavapigen.vala
Modified: trunk/compiler/valacompiler.vala
==============================================================================
--- trunk/compiler/valacompiler.vala (original)
+++ trunk/compiler/valacompiler.vala Sun Feb 3 21:47:02 2008
@@ -93,43 +93,13 @@
}
}
- private string get_package_path (string! pkg) {
- string basename = "%s.vapi".printf (pkg);
-
- if (vapi_directories != null) {
- foreach (string vapidir in vapi_directories) {
- var filename = Path.build_filename (vapidir, basename);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
- }
- }
-
- string filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
-
- filename = Path.build_filename ("/usr/local/share/vala/vapi", basename);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
-
- filename = Path.build_filename ("/usr/share/vala/vapi", basename);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
-
- return null;
- }
-
private bool add_package (CodeContext! context, string! pkg) {
if (context.has_package (pkg)) {
// ignore multiple occurences of the same package
return true;
}
- var package_path = get_package_path (pkg);
+ var package_path = context.get_package_path (pkg, vapi_directories);
if (package_path == null) {
return false;
Modified: trunk/vala/Makefile.am
==============================================================================
--- trunk/vala/Makefile.am (original)
+++ trunk/vala/Makefile.am Sun Feb 3 21:47:02 2008
@@ -3,6 +3,8 @@
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GLIB_CFLAGS) \
+ -include config.h \
+ -DPACKAGE_DATADIR=\"$(pkgdatadir)\" \
$(NULL)
BUILT_SOURCES = parser.h vala.vala.stamp
@@ -149,7 +151,7 @@
$(NULL)
vala.vapi vala.vala.stamp: $(libvalacore_la_VALASOURCES)
- $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --basedir $(top_srcdir) --library vala $^
+ $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --pkg config --basedir $(top_srcdir) --library vala $^
touch $@
libvalacore_la_LIBADD = \
Modified: trunk/vala/valacodecontext.vala
==============================================================================
--- trunk/vala/valacodecontext.vala (original)
+++ trunk/vala/valacodecontext.vala Sun Feb 3 21:47:02 2008
@@ -385,6 +385,36 @@
}
}
+ public string get_package_path (string! pkg, string[] vapi_directories) {
+ string basename = "%s.vapi".printf (pkg);
+
+ if (vapi_directories != null) {
+ foreach (string vapidir in vapi_directories) {
+ var filename = Path.build_filename (vapidir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+ }
+
+ string filename = Path.build_filename (Config.PACKAGE_DATADIR, "vapi", basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+
+ filename = Path.build_filename ("/usr/local/share/vala/vapi", basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+
+ filename = Path.build_filename ("/usr/share/vala/vapi", basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+
+ return null;
+ }
+
public Namespace! create_namespace (string name, SourceReference source_reference = null) {
var node = new Namespace (name, source_reference);
node.code_binding = codegen.create_namespace_binding (node);
Modified: trunk/vapigen/valavapigen.vala
==============================================================================
--- trunk/vapigen/valavapigen.vala (original)
+++ trunk/vapigen/valavapigen.vala Sun Feb 3 21:47:02 2008
@@ -59,44 +59,21 @@
return 1;
}
}
-
- private string get_package_path (string! pkg) {
- var basename = "%s.vapi".printf (pkg);
-
- if (vapi_directories != null) {
- foreach (string vapidir in vapi_directories) {
- var filename = Path.build_filename (vapidir, basename, null);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
- }
- }
-
- var filename = Path.build_filename ("/usr/local/share/vala/vapi", basename, null);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
-
- filename = Path.build_filename ("/usr/share/vala/vapi", basename, null);
- if (FileUtils.test (filename, FileTest.EXISTS)) {
- return filename;
- }
-
- return null;
- }
-
+
private bool add_package (string! pkg) {
if (context.has_package (pkg)) {
// ignore multiple occurences of the same package
return true;
}
- var package_path = get_package_path (pkg);
+ var package_path = context.get_package_path (pkg, vapi_directories);
if (package_path == null) {
return false;
}
+ context.add_package (pkg);
+
context.add_source_file (new SourceFile (context, package_path, true));
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]