Skip to content

Commit

Permalink
Merge pull request #64 from 422404/feature/convention-plugin
Browse files Browse the repository at this point in the history
Use a convention plugin to avoid redundant project configurations
  • Loading branch information
422404 committed Apr 9, 2023
2 parents 232b352 + 855da4e commit bccf9c5
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 237 deletions.
50 changes: 3 additions & 47 deletions actorsystem-impl/build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,10 @@
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.adarshr.test-logger'
id 'jacoco'
id 'actorlang.kotlin-conventions'
}

group = 'org.actorlang'
version = '1.1.1-SNAPSHOT'
archivesBaseName = 'org.actorlang.actorsystem-impl'

repositories {
mavenCentral()
}

jacoco {
toolVersion = '0.8.8'
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
}
version = parent.version
archivesBaseName = "${parent.group}.actorsystem-impl"

dependencies {
implementation project(":actorsystem-servicecontract")

// Tests
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "io.github.microutils:kotlin-logging-jvm:3.0.4"
runtimeOnly "org.slf4j:slf4j-simple:2.0.3"
}

test {
useJUnitPlatform()
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
50 changes: 3 additions & 47 deletions actorsystem-servicecontract/build.gradle
Original file line number Diff line number Diff line change
@@ -1,50 +1,6 @@
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.adarshr.test-logger'
id 'jacoco'
id 'actorlang.kotlin-conventions'
}

group = 'org.actorlang'
version = '1.1.1-SNAPSHOT'
archivesBaseName = 'org.actorlang.actorsystem-servicecontract'

repositories {
mavenCentral()
}

jacoco {
toolVersion = '0.8.8'
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
}

dependencies {
// Tests
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

test {
useJUnitPlatform()
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
version = parent.version
archivesBaseName = "${parent.group}.actorsystem-servicecontract"
52 changes: 4 additions & 48 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,64 +1,20 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.7.20'
id 'application'
id 'org.jlleitschuh.gradle.ktlint' version '10.0.0'
id 'com.adarshr.test-logger' version '3.0.0'
id 'jacoco'
id 'actorlang.kotlin-conventions'
}

group = 'org.actorlang'
version = '1.1.1-SNAPSHOT'
archivesBaseName = 'org.actorlang.cli'

repositories {
mavenCentral()
}
archivesBaseName = "${group}.cli"

application {
mainClass.set('org.actorlang.cli.MainKt')
applicationName = 'actorlang'
}

jacoco {
toolVersion = '0.8.8'
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
}

dependencies {
implementation project(":actorsystem-servicecontract")
implementation project(":actorsystem-impl")
implementation project(":parser")
implementation project(":interpreter")
implementation project(":actorsystem-impl")
implementation project(":actorsystem-servicecontract")

// Tests
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

implementation "io.github.microutils:kotlin-logging-jvm:3.0.4"
runtimeOnly "org.slf4j:slf4j-simple:2.0.3"
}

test {
useJUnitPlatform()
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.20'
implementation 'org.jlleitschuh.gradle.ktlint:org.jlleitschuh.gradle.ktlint.gradle.plugin:10.0.0'
implementation 'com.adarshr.test-logger:com.adarshr.test-logger.gradle.plugin:3.0.0'
}
41 changes: 41 additions & 0 deletions buildSrc/src/main/groovy/actorlang.kotlin-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// https://discuss.gradle.org/t/applying-a-plugin-version-inside-a-convention-plugin/42160/2
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.adarshr.test-logger'
id 'jacoco'
}

repositories {
mavenCentral()
}

jacoco {
toolVersion = '0.8.8'
}

dependencies {
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

implementation "io.github.microutils:kotlin-logging-jvm:3.0.4"
runtimeOnly "org.slf4j:slf4j-simple:2.0.3"
}

tasks.named('test', Test) {
useJUnitPlatform()
}

tasks.named('compileKotlin') {
kotlinOptions.jvmTarget = '1.8'
}

tasks.named('compileTestKotlin') {
kotlinOptions.jvmTarget = '1.8'
}
7 changes: 2 additions & 5 deletions code-coverage-report/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ repositories {
}

dependencies {
jacocoAggregation project(':parser')
jacocoAggregation project(':actorsystem-servicecontract')
jacocoAggregation project(':actorsystem-impl')
jacocoAggregation project(':interpreter')
}

Expand All @@ -23,14 +20,14 @@ reporting {
}

tasks.named('check') {
dependsOn tasks.named('testCodeCoverageReport', JacocoReport)
finalizedBy tasks.named('testCodeCoverageReport')
}

testCodeCoverageReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
// We exclude the parser Java generated sources
// We exclude the parser generated sources
"org/actorlang/antlr/gen/*"
])
}))
Expand Down
49 changes: 3 additions & 46 deletions interpreter/build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,12 @@
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.adarshr.test-logger'
id 'jacoco'
id 'actorlang.kotlin-conventions'
}

group = 'org.actorlang'
version = '1.1.1-SNAPSHOT'
archivesBaseName = 'org.actorlang.interpreter'

repositories {
mavenCentral()
}

jacoco {
toolVersion = '0.8.8'
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
}
version = parent.version
archivesBaseName = "${parent.group}.interpreter"

dependencies {
implementation project(":actorsystem-servicecontract")
implementation project(":actorsystem-impl")
implementation project(":parser")

// Tests
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "io.github.microutils:kotlin-logging-jvm:3.0.4"
runtimeOnly "org.slf4j:slf4j-simple:2.0.3"
}

test {
useJUnitPlatform()
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
58 changes: 14 additions & 44 deletions parser/build.gradle
Original file line number Diff line number Diff line change
@@ -1,62 +1,32 @@
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'antlr'
id 'org.jlleitschuh.gradle.ktlint'
id 'com.adarshr.test-logger'
id 'jacoco'
id 'actorlang.kotlin-conventions'
}

group = 'org.actorlang'
version = '1.1.1-SNAPSHOT'
archivesBaseName = 'org.actorlang.parser'
version = parent.version
archivesBaseName = "${parent.group}.parser"

repositories {
mavenCentral()
}

jacoco {
toolVersion = '0.8.8'
dependencies {
antlr 'org.antlr:antlr4:4.9'
}

generateGrammarSource {
tasks.named('generateGrammarSource', AntlrTask) {
arguments += ["-visitor", "-long-messages"]
outputDirectory = file("src/main/java/")
}

jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
}

dependencies {
antlr 'org.antlr:antlr4:4.9'

// Tests
testImplementation "org.mockito:mockito-core:3.+"
testImplementation 'org.mockito:mockito-inline:3.11.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}

test {
useJUnitPlatform()
tasks.named('compileKotlin') {
dependsOn tasks.named('generateGrammarSource')
}

compileKotlin {
kotlinOptions.jvmTarget = '1.8'
dependsOn generateGrammarSource
tasks.named('compileTestKotlin') {
dependsOn tasks.named('generateTestGrammarSource')
}

compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
tasks.named('runKtlintCheckOverMainSourceSet') {
dependsOn tasks.named('generateGrammarSource')
}

runKtlintCheckOverMainSourceSet {
dependsOn generateGrammarSource
tasks.named('runKtlintCheckOverTestSourceSet') {
dependsOn tasks.named('generateTestGrammarSource')
}

0 comments on commit bccf9c5

Please sign in to comment.