Skip to content

Commit

Permalink
chore(gradle): Modernize gradle
Browse files Browse the repository at this point in the history
Move some subprojects to kotlin script.
  • Loading branch information
rahulsom committed Nov 26, 2022
1 parent c66125f commit 1ef8995
Show file tree
Hide file tree
Showing 26 changed files with 428 additions and 411 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.caching=true
kotlin.daemon.jvmargs=-Xmx1024m
28 changes: 0 additions & 28 deletions grooves-api/build.gradle

This file was deleted.

31 changes: 31 additions & 0 deletions grooves-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
id("org.jlleitschuh.gradle.ktlint")
id("com.github.rahulsom.waena.published")
}

apply {
from("$rootDir/gradle/jacoco.gradle")
}

description = "APIs that help in computation of Grooves based Snapshots"

dependencies {
api(project(":grooves-types"))

implementation("io.reactivex.rxjava2:rxjava:2.2.21")
implementation("org.slf4j:slf4j-api:2.0.4")

compileOnly("org.codehaus.groovy:groovy:3.0.13")
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("org.projectlombok:lombok:1.18.24")

annotationProcessor("org.projectlombok:lombok:1.18.24")
}

tasks.withType<Javadoc>().configureEach {
options {
(this as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
}
50 changes: 17 additions & 33 deletions grooves-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id("dev.jacomet.logging-capabilities") version "0.+"
id("io.freefair.aspectj.post-compile-weaving") version "6.5.1"
id("com.github.rahulsom.waena.published")
`java-library`
id("java-library")
}

loggingCapabilities {
Expand All @@ -14,45 +14,29 @@ loggingCapabilities {
description = "Simpler implementation of Grooves"

dependencies {
configureLombok()
configureKotlin()
configureJUnit()
configureLogging()

implementation("org.aspectj:aspectjrt:1.9.9.1")
}

tasks.withType<Test> {
useJUnitPlatform()

// Configure Slf4j Simple Logger
systemProperty("org.slf4j.simpleLogger.log.com.github.rahulsom.grooves", "DEBUG")
}

fun DependencyHandlerScope.configureLogging() {
compileOnly("org.projectlombok:lombok:1.18.24")
testCompileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
testAnnotationProcessor("org.projectlombok:lombok:1.18.24")
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation(platform("org.junit:junit-bom:5.+"))
testImplementation("org.assertj:assertj-core:3.23.1")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation("org.slf4j:slf4j-api:2.0.4")
testRuntimeOnly("org.slf4j:slf4j-simple:2.0.5")
testRuntimeOnly("org.apache.logging.log4j:log4j-core:2.19.0")
testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.19.0")
testRuntimeOnly("ch.qos.logback:logback-classic:1.4.5")
}

fun DependencyHandlerScope.configureJUnit() {
testImplementation(platform("org.junit:junit-bom:5.+"))
testImplementation("org.assertj:assertj-core:3.23.1")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation("org.aspectj:aspectjrt:1.9.9.1")
}

fun DependencyHandlerScope.configureKotlin() {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
tasks.withType<Test> {
useJUnitPlatform()

fun DependencyHandlerScope.configureLombok() {
compileOnly("org.projectlombok:lombok:1.18.24")
testCompileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
testAnnotationProcessor("org.projectlombok:lombok:1.18.24")
// Configure Slf4j Simple Logger
systemProperty("org.slf4j.simpleLogger.log.com.github.rahulsom.grooves", "DEBUG")
}
54 changes: 0 additions & 54 deletions grooves-diagrams/build.gradle

This file was deleted.

51 changes: 51 additions & 0 deletions grooves-diagrams/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import io.miret.etienne.gradle.sass.CompileSass

plugins {
id("java-library")
id("groovy")
id("org.jetbrains.kotlin.jvm")
id("org.jlleitschuh.gradle.ktlint")
id("com.github.rahulsom.waena.published")
id("io.miret.etienne.sass").version("1.4.1")
}

apply {
from("$rootDir/gradle/jacoco.gradle")
}

description = "Asciidoctor Extension to generate Event Sourcing Diagrams like those on https://rahulsom.github.io/grooves"

repositories {
google()
}

dependencies {
implementation("com.github.rahulsom:svg-builder:0.4.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

implementation("commons-beanutils:commons-beanutils:1.9.4")
implementation("org.asciidoctor:asciidoctorj:2.5.7")
implementation("org.slf4j:slf4j-api:2.0.4")

implementation("javax.xml.bind:jaxb-api:2.3.1")

testImplementation("org.spockframework:spock-core:2.1-groovy-3.0")
}

tasks.withType<CompileSass> {
setSourceDir(project.file("$projectDir/src/main/resources"))
outputDir = project.file("$buildDir/generated/css")
}

sourceSets {
main {
resources.srcDirs("$buildDir/generated/css")
}
}

tasks.getByName("processResources").dependsOn("compileSass")
tasks.getByName("sourceJar").dependsOn("compileSass")

tasks.withType<Test> {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EventsBlock(name: String) :

val input = reader.readLines().joinToString("\n")

var filename = (attributes ?: emptyMap()).get("2") as String? ?: md5(input)
var filename = (attributes ?: emptyMap()).get("2") as String? ?: hash(input)
filename = if (filename.endsWith(".svg")) filename else "$filename.svg"

SvgBuilder(input).write(File(outDir, filename))
Expand All @@ -35,10 +35,10 @@ class EventsBlock(name: String) :
return createBlock(parent, "image", input, newAttributes, attributes?.mapKeys { it })
}

private fun md5(input: String) =
MessageDigest.getInstance("MD5").let { md5 ->
md5.update(input.toByteArray())
val hash = BigInteger(1, md5.digest())
hash.toString(16)
private fun hash(input: String) =
MessageDigest.getInstance("SHA256").let { messageDigest ->
messageDigest.update(input.toByteArray())
val hash = BigInteger(1, messageDigest.digest())
hash.toString(16).substring(0, 15)
}
}
69 changes: 0 additions & 69 deletions grooves-docs/build.gradle

This file was deleted.

Loading

0 comments on commit 1ef8995

Please sign in to comment.