class BndGenerator extends Generator {

    public BndGenerator(SourceRoot sourceRoot) {
        super(sourceRoot);
    }

    @Override
    public void generate() throws IOException {<FILL_FUNCTION_BODY>}

    private String concatPackageName(String packageName, String packageList, String lineSeparator) {
        return (packageList == null ?
                ("\\" + lineSeparator) :
                (packageList + ", \\" + lineSeparator)) + "    " + packageName;
    }

    private static String getPackageName(Path root, Path path) {
        return root.relativize(path.getParent()).toString().replace(File.separatorChar, '.');
    }
}

        Log.info("Running %s", () -> getClass().getSimpleName());
        Path root = sourceRoot.getRoot();
        Path projectRoot = root.getParent().getParent().getParent();
        String lineSeparator = System.getProperty("line.separator");
        try (Stream<Path> stream = Files.walk(root)) {
            String packagesList = stream
                    .filter(Files::isRegularFile)
                    .map(path -> getPackageName(root, path))
                    .distinct()
                    .sorted()
                    .reduce(null, (packageList, packageName) ->
                        concatPackageName(packageName, packageList, lineSeparator));
            Path output = projectRoot.resolve("bnd.bnd");
            try(Writer writer = Files.newBufferedWriter(output)) {
                Path templateFile = projectRoot.resolve("bnd.bnd.template");
                String template = new String(Files.readAllBytes(templateFile), StandardCharsets.UTF_8);
                writer.write(template.replace("{exportedPackages}", packagesList));
            }
            Log.info("Written " + output);
        }
    
<methods>public abstract void generate() throws java.lang.Exception<variables>protected final non-sealed com.github.javaparser.utils.SourceRoot sourceRoot