comparison mx/mx_graal.py @ 13319:30e57b49fdb1

Include annotation processor meta-info in Truffle JAR.
author Chris Seaton <chris.seaton@oracle.com>
date Fri, 13 Dec 2013 13:54:13 +0000
parents d8692e751c65
children 093353894575
comparison
equal deleted inserted replaced
13308:d3b3c6e17d40 13319:30e57b49fdb1
1348 1348
1349 def trufflejar(args=None): 1349 def trufflejar(args=None):
1350 """make truffle.jar""" 1350 """make truffle.jar"""
1351 # We use the DSL processor as the starting point for the classpath - this 1351 # We use the DSL processor as the starting point for the classpath - this
1352 # therefore includes the DSL processor, the DSL and the API. 1352 # therefore includes the DSL processor, the DSL and the API.
1353 packagejar(mx.classpath("com.oracle.truffle.dsl.processor").split(os.pathsep), "truffle.jar", None) 1353 packagejar(mx.classpath("com.oracle.truffle.dsl.processor").split(os.pathsep), "truffle.jar", None, "com.oracle.truffle.dsl.processor.TruffleProcessor")
1354 1354
1355 def isGraalEnabled(vm): 1355 def isGraalEnabled(vm):
1356 return vm != 'original' and not vm.endswith('nograal') 1356 return vm != 'original' and not vm.endswith('nograal')
1357 1357
1358 def site(args): 1358 def site(args):
1442 global _vm_prefix 1442 global _vm_prefix
1443 _vm_prefix = opts.vm_prefix 1443 _vm_prefix = opts.vm_prefix
1444 1444
1445 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks) 1445 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks)
1446 1446
1447 def packagejar(classpath, outputFile, mainClass): 1447 def packagejar(classpath, outputFile, mainClass, annotationProcessor=None):
1448 prefix = '' if mx.get_os() != 'windows' else '\\??\\' # long file name hack 1448 prefix = '' if mx.get_os() != 'windows' else '\\??\\' # long file name hack
1449 print "creating", outputFile 1449 print "creating", outputFile
1450 filecount, totalsize = 0, 0 1450 filecount, totalsize = 0, 0
1451 with zipfile.ZipFile(outputFile, 'w', zipfile.ZIP_DEFLATED) as zf: 1451 with zipfile.ZipFile(outputFile, 'w', zipfile.ZIP_DEFLATED) as zf:
1452 manifest = "Manifest-Version: 1.0\n" 1452 manifest = "Manifest-Version: 1.0\n"
1453 if mainClass != None: 1453 if mainClass != None:
1454 manifest += "Main-Class: %s\n\n" % (mainClass) 1454 manifest += "Main-Class: %s\n\n" % (mainClass)
1455 zf.writestr("META-INF/MANIFEST.MF", manifest) 1455 zf.writestr("META-INF/MANIFEST.MF", manifest)
1456 if annotationProcessor != None:
1457 zf.writestr("META-INF/services/javax.annotation.processing.Processor", annotationProcessor)
1456 for cp in classpath: 1458 for cp in classpath:
1457 print "+", cp 1459 print "+", cp
1458 if cp.endswith(".jar"): 1460 if cp.endswith(".jar"):
1459 with zipfile.ZipFile(cp, 'r') as jar: 1461 with zipfile.ZipFile(cp, 'r') as jar:
1460 for arcname in jar.namelist(): 1462 for arcname in jar.namelist():