java-gobject-introspection r128 - in trunk/src/org/gnome/gir: compiler repository
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r128 - in trunk/src/org/gnome/gir: compiler repository
- Date: Mon, 17 Nov 2008 02:05:07 +0000 (UTC)
Author: walters
Date: Mon Nov 17 02:05:07 2008
New Revision: 128
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=128&view=rev
Log:
Don't rely on Repository.getDefault() or the g_irepository_unload_all patch
Instead we now use multiple Repository instances.
Modified:
trunk/src/org/gnome/gir/compiler/ClassCompilation.java
trunk/src/org/gnome/gir/compiler/CodeFactory.java
trunk/src/org/gnome/gir/compiler/GlobalsCompilation.java
trunk/src/org/gnome/gir/compiler/InnerClassCompilation.java
trunk/src/org/gnome/gir/compiler/StubClassCompilation.java
trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
trunk/src/org/gnome/gir/repository/Repository.java
Modified: trunk/src/org/gnome/gir/compiler/ClassCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/ClassCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/ClassCompilation.java Mon Nov 17 02:05:07 2008
@@ -22,9 +22,9 @@
MethodVisitor clinit;
private ClassWriter realWriter;
boolean closed = false;
- public ClassCompilation(String namespace, String baseName) {
+ public ClassCompilation(String namespace, String version, String baseName) {
this.namespace = namespace;
- this.nsversion = Repository.getDefault().getNamespaceVersion(namespace);
+ this.nsversion = version;
this.baseName = baseName;
this.internalName = GType.getInternalName(namespace, baseName);
this.realWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
Modified: trunk/src/org/gnome/gir/compiler/CodeFactory.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/CodeFactory.java (original)
+++ trunk/src/org/gnome/gir/compiler/CodeFactory.java Mon Nov 17 02:05:07 2008
@@ -142,18 +142,20 @@
}
- public StubClassCompilation getCompilation(String namespace, String name) {
+ public StubClassCompilation getCompilation(String namespace, String version, String name) {
String peerInternalName = GType.getInternalName(namespace, name);
StubClassCompilation ret = writers.get(peerInternalName);
if (ret == null) {
- ret = new StubClassCompilation(namespace, name);
+ ret = new StubClassCompilation(namespace, version, name);
writers.put(peerInternalName, ret);
}
return ret;
}
public StubClassCompilation getCompilation(BaseInfo info) {
- return getCompilation(info.getNamespace(), info.getName());
+ String namespace = info.getNamespace();
+ String version = repo.getNamespaceVersion(namespace);
+ return getCompilation(info.getNamespace(), version, info.getName());
}
public String getGlobalsName(String namespace) {
@@ -1845,7 +1847,7 @@
String globalName = namespace + "Globals";
String peerInternalName = GType.getInternalName(namespace, globalName);
- GlobalsCompilation global = new GlobalsCompilation(namespace, globalName);
+ GlobalsCompilation global = new GlobalsCompilation(namespace, version, globalName);
writers.put(peerInternalName, global);
globals.put(namespace, global);
global.writer.visit(V1_6, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, global.internalName, null, "java/lang/Object", null);
@@ -1933,7 +1935,7 @@
}
public static File compile(String namespace, String version) throws GErrorException, IOException {
- Repository repo = Repository.getDefault();
+ Repository repo = new Repository();
File destFile = null;
repo.require(namespace, version);
@@ -1942,7 +1944,7 @@
long typelibLastModified = typelibPath.lastModified();
if (destFile == null) {
- destFile = getJarPath(namespace);
+ destFile = getJarPath(repo, namespace);
if (destFile == null)
return null;
logger.info("Will install to: " + destFile);
@@ -1962,8 +1964,6 @@
return null;
}
- repo.unloadAll();
-
Set<String> classNames = new HashSet<String>();
ZipOutputStream zo = new ZipOutputStream(new FileOutputStream(destFile));
for (ClassCompilation stub : stubs) {
@@ -2029,12 +2029,12 @@
logger.info(String.format("Verified %d classes", nClasses));
}
- public static File getJarPath(String namespace) {
- String path = Repository.getDefault().getTypelibPath(namespace);
+ public static File getJarPath(Repository repo, String namespace) {
+ String path = repo.getTypelibPath(namespace);
if (path == null)
return null;
File typelibPath = new File(path);
- String version = Repository.getDefault().getNamespaceVersion(namespace);
+ String version = repo.getNamespaceVersion(namespace);
return new File(typelibPath.getParent(), String.format("%s-%s.jar", namespace, version));
}
Modified: trunk/src/org/gnome/gir/compiler/GlobalsCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/GlobalsCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/GlobalsCompilation.java Mon Nov 17 02:05:07 2008
@@ -14,8 +14,8 @@
public final class GlobalsCompilation extends StubClassCompilation {
Map<String,String> interfaceTypes = new HashMap<String,String>();
public InnerClassCompilation constants;
- public GlobalsCompilation(String namespace, String name) {
- super(namespace, name);
+ public GlobalsCompilation(String namespace, String version, String name) {
+ super(namespace, version, name);
}
public InnerClassCompilation getConstants() {
Modified: trunk/src/org/gnome/gir/compiler/InnerClassCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/InnerClassCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/InnerClassCompilation.java Mon Nov 17 02:05:07 2008
@@ -4,7 +4,7 @@
package org.gnome.gir.compiler;
class InnerClassCompilation extends ClassCompilation {
- public InnerClassCompilation(String namespace, String baseName) {
- super(namespace, baseName);
+ public InnerClassCompilation(String namespace, String version, String baseName) {
+ super(namespace, version, baseName);
}
}
\ No newline at end of file
Modified: trunk/src/org/gnome/gir/compiler/StubClassCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/StubClassCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/StubClassCompilation.java Mon Nov 17 02:05:07 2008
@@ -13,9 +13,9 @@
String publicName;
- public StubClassCompilation(String namespace,
+ public StubClassCompilation(String namespace, String version,
String name) {
- super(namespace, name);
+ super(namespace, version, name);
this.innerClasses = new HashSet<InnerClassCompilation>();
this.baseName = name.substring(0, 1).toUpperCase() + name.substring(1);
this.publicName = GType.getPublicNameMapped(namespace, name);
@@ -23,13 +23,13 @@
public ClassCompilation newInner() {
int size = innerClasses.size();
- InnerClassCompilation cw = new InnerClassCompilation(namespace, baseName + "$" + size+1);
+ InnerClassCompilation cw = new InnerClassCompilation(namespace, nsversion, baseName + "$" + size+1);
innerClasses.add(cw);
return cw;
}
public InnerClassCompilation newInner(String name) {
- InnerClassCompilation cw = new InnerClassCompilation(namespace, baseName + "$" + name);
+ InnerClassCompilation cw = new InnerClassCompilation(namespace, nsversion, baseName + "$" + name);
innerClasses.add(cw);
return cw;
}
Modified: trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java (original)
+++ trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java Mon Nov 17 02:05:07 2008
@@ -44,7 +44,7 @@
}
});
- GType g_irepostiory_get_type();
+ GType g_irepository_get_type();
Pointer g_irepository_get_default();
void g_irepository_prepend_search_path(String path);
int g_irepository_get_n_infos(Repository repo, String namespace);
@@ -58,7 +58,6 @@
BaseInfo g_irepository_get_info(Repository repo, String namespace, int idx);
String g_irepository_get_shared_library(Repository repository, String namespace);
String g_irepository_get_typelib_path(Repository repository, String namespace);
- void g_irepository_unload_all(Repository repo);
void g_base_info_ref(BaseInfo info);
void g_base_info_unref(BaseInfo info);
Modified: trunk/src/org/gnome/gir/repository/Repository.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/Repository.java (original)
+++ trunk/src/org/gnome/gir/repository/Repository.java Mon Nov 17 02:05:07 2008
@@ -91,7 +91,7 @@
Repository.class, false, false);
}
- public void unloadAll() {
- GIntrospectionAPI.gi.g_irepository_unload_all(this);
+ public Repository() {
+ super(GIntrospectionAPI.gi.g_irepository_get_type(), new Object[] {});
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]