<commit_before># gradle-api-impl-separation
One approach to have clear interfaces amongst different modules, is to separate the API from the implementation for each module.
Modules are then only allowed to reference API classes of other modules.
For example: 
If `moudleB` depends on `moudleA`, then `moduleB` is only allowed to reference classes in the API part of `moduleA`.

This repository demonstrates a gradle multiproject build configuration that allows to separate API and implementation classes based on source sets and configurations.

Per module there are two source sets defined:
- main: This source set contains the implementation classes (it points to src/impl/java)
- api: This source set contains the api classes that should be exposed

```
sourceSets {
    main {
        java {
            srcDir 'src/impl/java'
        }

        resources {
            srcDir 'src/impl/resources'
        }
    }

    api {
        java {
            srcDir 'src/api/java'
        }
    }
}
```

For each source there is a corresponding configuration with a JAR artifact only containing the compiled sources from the source set.
This means that for each module a `module-api.jar` contianing only the API classes and a `module.jar` containing only the implementation classes is created.<commit_msg>Adds gradle links to README<commit_after># gradle-api-impl-separation
One approach to enforce clear interfaces between different modules, is to separate the API from the implementation and allow other modules to only depend on API artifacts.
For example: 
If `moudleB` depends on `moudleA`, then `moduleB` is only allowed to reference classes in the API part of `moduleA`.

This repository demonstrates a gradle multiproject build configuration that achieves this separation using [source sets](https://docs.gradle.org/2.14.1/dsl/org.gradle.api.tasks.SourceSet.html) and [https://docs.gradle.org/2.14.1/dsl/org.gradle.api.Project.html#org.gradle.api.Project:configurations(groovy.lang.Closure)](dependency configurations).

Per module there are two source sets defined:
- main: This source set contains the implementation classes (it points to src/impl/java)
- api: This source set contains the api classes that should be exposed

```
sourceSets {
    main {
        java {
            srcDir 'src/impl/java'
        }

        resources {
            srcDir 'src/impl/resources'
        }
    }

    api {
        java {
            srcDir 'src/api/java'
        }
    }
}
```

For each source there is a corresponding configuration with a JAR artifact only containing the compiled sources from the source set.
This means that for each module a `module-api.jar` contianing only the API classes and a `module.jar` containing only the implementation classes is created.
{'fraction_non_alphanumeric': 0.06678700361010831, 'fraction_numerical': 0.002888086642599278, 'mean_word_length': 3.2961240310077518, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3329820', 'n_tokens_mistral': 726, 'n_tokens_neox': 699, 'n_words': 324}