3 # Copyright (c) 2013-2014. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
10 Tool to generate the simgrid.jar
19 dists = ['https://ci.inria.fr/simgrid/job/SimGrid-Multi/build_mode=Debug,label=%s/lastSuccessfulBuild/artifact/build/SimGrid-3.11/simgrid.jar' % dist
20 for dist in ["small-debian-32", "small-debian-64", "small-freebsd-64-clang"]]
22 'https://ci.inria.fr/simgrid/job/Simgrid-Mult-Win7/build_mode=Debug,label=windows-64/lastSuccessfulBuild/artifact/build/simgrid.jar')
27 def __init__(self, filename='simgrid.jar'):
28 self.zipfile = zipfile.ZipFile(filename, 'w')
30 self.git_version = None
32 def addJar(self, filename):
33 with zipfile.ZipFile(filename) as zf:
37 for z in zf.infolist():
38 path = filter(None, z.filename.split('/'))
39 if len(path) == 3 and path[0] == 'NATIVE':
40 platform, arch = path[1:3]
41 elif z.filename == 'META-INF/MANIFEST.MF':
42 zf.read('META-INF/MANIFEST.MF')
43 git_version = re.findall(
44 r"Implementation-Version: \"(.*?)\"", zf.read('META-INF/MANIFEST.MF'))
46 assert platform is not None and git_version is not None, "Jar file not valid (%s, %s)" % (
47 platform, git_version)
48 print "Adding: %s %s" % (platform, arch)
49 if self.git_version is None:
50 self.git_version = git_version
51 elif self.git_version != git_version:
52 print "WARNING: Assembling jar of various commits (%s vs %s)" % (self.git_version, git_version)
54 for info in zf.infolist():
55 if info.filename not in self.done:
56 self.done.add(info.filename)
57 self.zipfile.writestr(info, zf.read(info.filename))
59 def addByUrl(self, url):
60 data = urllib2.urlopen(url)
61 f = tempfile.NamedTemporaryFile(delete=False)
70 if __name__ == "__main__":
74 for a in sys.argv[1:]: