def javac()

in script/common.py [0:0]


def javac(sources, target, classpath = [], modulepath = [], add_modules = [], release = '11', opts = []):
  classes = {path.stem: path.stat().st_mtime for path in pathlib.Path(target).rglob('*.class') if '$' not in path.stem}
  newer = lambda path: path.stem not in classes or path.stat().st_mtime > classes.get(path.stem)
  new_sources = [path for path in sources if newer(pathlib.Path(path))]
  if new_sources:
    print('Compiling', len(new_sources), 'java files to', target)
    check_call([
      'javac',
      '-encoding', 'UTF8',
      '--release', release] + opts + [
      # '-J--illegal-access=permit',
      # '-Xlint:deprecation',
      # '-Xlint:unchecked',
      '--class-path', classpath_separator.join(classpath + [target])] +
      (['--module-path', classpath_separator.join(modulepath)] if modulepath else []) +
      (['--add-modules', ','.join(add_modules)] if add_modules else []) +
      ['-d', target] + new_sources)