示例#1
0
    def _compile_helper(self):
        # HACK: compile the Java helper classes.  Should eventually
        # use rte.py
        thisdir = py.magic.autopath().dirpath()
        rootdir = thisdir.join('src')
        srcdir = rootdir.join('pypy')
        javafiles = srcdir.listdir('*.java')
        classfiles = srcdir.listdir('*.class')
        jnajar = rootdir.join('jna.jar')

        recompile = True
        if len(classfiles) == len(javafiles):
            last_modified_java = max([java.mtime() for java in javafiles])
            last_modified_class = max([cls.mtime() for cls in classfiles])
            if last_modified_java < last_modified_class:
                recompile = False

        if recompile:
            log.red('Compiling java classes')
            javasrcs = [str(jf) for jf in javafiles]
            self._invoke([
                getoption('javac'), '-nowarn', '-d',
                str(rootdir), '-classpath',
                str(jnajar)
            ] + javasrcs, True)

        # copy .class files to classdir
        for classfile in srcdir.listdir('*.class'):
            classfile.copy(self.classdir.join('pypy'))
示例#2
0
    def _compile_helper(self):
        # HACK: compile the Java helper classes.  Should eventually
        # use rte.py
        javafiles = self.srcdir.listdir('*.java')
        classfiles = self.srcdir.listdir('*.class')
        
        recompile = True
        if len(classfiles) == len(javafiles):
           last_modified_java = max([java.mtime() for java in javafiles])
           last_modified_class = max([cls.mtime() for cls in classfiles])
           if last_modified_java < last_modified_class:
               recompile = False

        if recompile:
           log.red('Compiling java classes')               
           javasrcs = [str(jf) for jf in javafiles]
           self._invoke([getoption('javac'),
                         '-nowarn',
                         '-d', str(self.rootdir),
                         '-classpath', str(self.jnajar)
                         ] + javasrcs,
                        True)

        # copy .class files to classdir
        for classfile in self.srcdir.listdir('*.class'):
           classfile.copy(self.classdir.join('pypy'))
示例#3
0
文件: genjvm.py 项目: enyst/plexnet
 def _compile_helper(self):
     # HACK: compile the Java helper classes.  Should eventually
     # use rte.py
     if JvmGeneratedSource._cached == self.classdir:
        return
     log.red('Compiling java classes')
     javafiles = self.srcdir.listdir('*.java')
     javasrcs = [str(jf) for jf in javafiles]
     self._invoke([getoption('javac'),
                   '-nowarn',
                   '-d', str(self.classdir),
                   '-classpath', str(self.jnajar),
                   ] + javasrcs,
                  True)
     # NOTE if you are trying to add more caching: some .java files
     # compile to several .class files of various names.
     JvmGeneratedSource._cached = self.classdir
示例#4
0
 def _compile_helper(self):
     # HACK: compile the Java helper classes.  Should eventually
     # use rte.py
     if JvmGeneratedSource._cached == self.classdir:
         return
     log.red('Compiling java classes')
     javafiles = self.srcdir.listdir('*.java')
     javasrcs = [str(jf) for jf in javafiles]
     self._invoke([
         getoption('javac'),
         '-nowarn',
         '-d',
         str(self.classdir),
         '-classpath',
         str(self.jnajar),
     ] + javasrcs, True)
     # NOTE if you are trying to add more caching: some .java files
     # compile to several .class files of various names.
     JvmGeneratedSource._cached = self.classdir