modules/annotation-processor/src/main/java/org/ballerinalang/natives/annotation/processor/NativeBallerinaFileBuilder.java
public void build() {
        // writes natives.bal files for all native Java constructs.
        nativePackages.forEach((k, v) -> {
            String directory = Arrays.asList(k.split("\\.")).stream().collect(Collectors.joining(File.separator));
            try {
                Files.createDirectories(Paths.get(targetDirectory, directory));
                try (BufferedWriter writer =
                        Files.newBufferedWriter(Paths.get(targetDirectory, directory, "natives.bal"))) {
                    writer.write(v.toString());
                }
            } catch (IOException e) {
                ERROR.println("couldn't create native files for [directory] " + directory + ". cause: " + e);
            }
        });

        // writes all native code defined in Ballerina also to the same targetDirectory
        try {
            Path source = Paths.get(balSourceDir);
            Path target = Paths.get(targetDirectory);
            Files.walkFileTree(source, new BallerinaFileVisitor(source, target));
        } catch (IOException e) {
            ERROR.println("failed to move native ballerina files. cause: " + e);
        }
    }
/**
     * Create directories for native packages and write natives.bal files.
     */
Create directories for native packages and write natives.bal files.
Create directories for native packages and write natives . bal files .
public void build() {
        nativePackages.forEach((k, v) -> {
            String directory = Arrays.asList(k.split("\\.")).stream().collect(Collectors.joining(File.separator));
            try {
                Files.createDirectories(Paths.get(targetDirectory, directory));
                try (BufferedWriter writer =
                        Files.newBufferedWriter(Paths.get(targetDirectory, directory, "natives.bal"))) {
                    writer.write(v.toString());
                }
            } catch (IOException e) {
                ERROR.println("couldn't create native files for [directory] " + directory + ". cause: " + e);
            }
        });
        try {
            Path source = Paths.get(balSourceDir);
            Path target = Paths.get(targetDirectory);
            Files.walkFileTree(source, new BallerinaFileVisitor(source, target));
        } catch (IOException e) {
            ERROR.println("failed to move native ballerina files. cause: " + e);
        }
    }
public void build ( ) { nativePackages . forEach ( ( k , v ) -> { String directory = Arrays . asList ( k . split ( "\\." ) ) . stream ( ) . collect ( Collectors . joining ( File . separator ) ) ; try { Files . createDirectories ( Paths . get ( targetDirectory , directory ) ) ; try ( BufferedWriter writer = Files . newBufferedWriter ( Paths . get ( targetDirectory , directory , "natives.bal" ) ) ) { writer . write ( v . toString ( ) ) ; } } catch ( IOException e ) { ERROR . println ( "couldn't create native files for [directory] " + directory + ". cause: " + e ) ; } } ) ; try { Path source = Paths . get ( balSourceDir ) ; Path target = Paths . get ( targetDirectory ) ; Files . walkFileTree ( source , new BallerinaFileVisitor ( source , target ) ) ; } catch ( IOException e ) { ERROR . println ( "failed to move native ballerina files. cause: " + e ) ; } }
Create directories for native packages and write natives.bal files.
Create directories for native packages and write natives . bal files .
// writes natives.bal files for all native Java constructs. // writes all native code defined in Ballerina also to the same targetDirectory