diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 206949b..b0e7ca0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,5 +23,5 @@ jobs: uses: actions/upload-artifact@v4 with: path: | - build/distributions/* - build/reports/* + **/build/distributions/* + **/build/reports/* diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..876c922 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() +} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..e69de29 diff --git a/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/application.gradle.kts b/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/application.gradle.kts new file mode 100644 index 0000000..502754a --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/application.gradle.kts @@ -0,0 +1,12 @@ +package hu.bme.mit.ase.shingler.gradle + +import org.gradle.kotlin.dsl.application + +plugins { + id("hu.bme.mit.ase.shingler.gradle.java") + application +} + +tasks.distZip { + enabled = false +} diff --git a/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/java.gradle.kts b/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/java.gradle.kts new file mode 100644 index 0000000..05a51ea --- /dev/null +++ b/buildSrc/src/main/kotlin/hu/bme/mit/ase/shingler/gradle/java.gradle.kts @@ -0,0 +1,27 @@ +package hu.bme.mit.ase.shingler.gradle + +plugins { + java + jacoco + `java-library` +} + +java.toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) +} + +repositories { + mavenCentral() +} + +tasks { + test { + useJUnitPlatform() + testLogging.showStandardStreams = true + finalizedBy(jacocoTestReport) + } + + jacocoTestReport { + inputs.files(test.get().outputs) + } +} diff --git a/diversity/build.gradle.kts b/diversity/build.gradle.kts new file mode 100644 index 0000000..31b7ca0 --- /dev/null +++ b/diversity/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("hu.bme.mit.ase.shingler.gradle.application") +} + +application { + mainClass = "hu.bme.mit.ase.shingler.diversity.DiversityApp" +} + +dependencies { + implementation(project(":logic")) + + implementation(libs.slf4j.api) + implementation(libs.picocli) + + runtimeOnly(libs.slf4j.log4j.impl) + + testImplementation(libs.junit.jupiter.core) + + testRuntimeOnly(libs.junit.jupiter.engine) + testRuntimeOnly(libs.junit.platform.launcher) +} diff --git a/src/main/java/hu/bme/mit/ase/shingler/diversity/DiversityApp.java b/diversity/src/main/java/hu/bme/mit/ase/shingler/diversity/DiversityApp.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/diversity/DiversityApp.java rename to diversity/src/main/java/hu/bme/mit/ase/shingler/diversity/DiversityApp.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/diversity/SimpleDocumentDiversityComputor.java b/diversity/src/main/java/hu/bme/mit/ase/shingler/diversity/SimpleDocumentDiversityComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/diversity/SimpleDocumentDiversityComputor.java rename to diversity/src/main/java/hu/bme/mit/ase/shingler/diversity/SimpleDocumentDiversityComputor.java diff --git a/src/main/resources/log4j2.properties b/diversity/src/main/resources/log4j2.properties similarity index 100% rename from src/main/resources/log4j2.properties rename to diversity/src/main/resources/log4j2.properties diff --git a/src/test/java/hu/bme/mit/ase/shingler/diversity/DiversityTest.java b/diversity/src/test/java/hu/bme/mit/ase/shingler/diversity/DiversityTest.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/diversity/DiversityTest.java rename to diversity/src/test/java/hu/bme/mit/ase/shingler/diversity/DiversityTest.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ac3234..40c72fa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,2 +1,18 @@ # This file was generated by the Gradle 'init' task. # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[versions] +picoCli = "4.7.6" +slf4j = "1.7.25" +log4j = "2.23.1" +logback = "1.5.8" +jUnit = "5.10.0" + +[libraries] +picocli = { group = "info.picocli", name = "picocli", version.ref = "picoCli" } +slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } +slf4j-log4j-impl = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j" } +slf4j-logback-impl = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" } +junit-jupiter-core = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "jUnit" } +junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "jUnit" } +junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" } diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts new file mode 100644 index 0000000..b8bece7 --- /dev/null +++ b/lib/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("hu.bme.mit.ase.shingler.gradle.java") +} diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/CosineSimilarityComputor.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/CosineSimilarityComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/CosineSimilarityComputor.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/CosineSimilarityComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/DiversityListComputor.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/DiversityListComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/DiversityListComputor.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/DiversityListComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentDiversityComputor.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentDiversityComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/DocumentDiversityComputor.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentDiversityComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentSimilarityEstimator.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentSimilarityEstimator.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/DocumentSimilarityEstimator.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/DocumentSimilarityEstimator.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/OccurrenceVectorComputor.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/OccurrenceVectorComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/OccurrenceVectorComputor.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/OccurrenceVectorComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/Tokenizer.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/Tokenizer.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/Tokenizer.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/Tokenizer.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/VectorMultiplier.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/VectorMultiplier.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/VectorMultiplier.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/VectorMultiplier.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/data/OccurrenceVector.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/OccurrenceVector.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/data/OccurrenceVector.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/OccurrenceVector.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/data/Shingle.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/Shingle.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/data/Shingle.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/Shingle.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenVector.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenVector.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenVector.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenVector.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenizedDocument.java b/lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenizedDocument.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenizedDocument.java rename to lib/src/main/java/hu/bme/mit/ase/shingler/lib/data/TokenizedDocument.java diff --git a/logic/build.gradle.kts b/logic/build.gradle.kts new file mode 100644 index 0000000..8655d01 --- /dev/null +++ b/logic/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { + id("hu.bme.mit.ase.shingler.gradle.java") +} + +dependencies { + api(project(":lib")) + + implementation(libs.slf4j.api) + + runtimeOnly(libs.slf4j.log4j.impl) + + testImplementation(libs.junit.jupiter.core) + + testRuntimeOnly(libs.junit.jupiter.engine) + testRuntimeOnly(libs.junit.platform.launcher) +} diff --git a/src/main/java/hu/bme/mit/ase/shingler/logic/BaseCosineSimilarityComputor.java b/logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseCosineSimilarityComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/logic/BaseCosineSimilarityComputor.java rename to logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseCosineSimilarityComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/logic/BaseDiversityListComputor.java b/logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseDiversityListComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/logic/BaseDiversityListComputor.java rename to logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseDiversityListComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/logic/BaseOccurrenceVectorComputor.java b/logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseOccurrenceVectorComputor.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/logic/BaseOccurrenceVectorComputor.java rename to logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseOccurrenceVectorComputor.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/logic/BaseTokenizer.java b/logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseTokenizer.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/logic/BaseTokenizer.java rename to logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseTokenizer.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/logic/BaseVectorMultiplier.java b/logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseVectorMultiplier.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/logic/BaseVectorMultiplier.java rename to logic/src/main/java/hu/bme/mit/ase/shingler/logic/BaseVectorMultiplier.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/logic/TokenizerTests.java b/logic/src/test/java/hu/bme/mit/ase/shingler/logic/TokenizerTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/logic/TokenizerTests.java rename to logic/src/test/java/hu/bme/mit/ase/shingler/logic/TokenizerTests.java diff --git a/logic/src/test/resources/log4j2.properties b/logic/src/test/resources/log4j2.properties new file mode 100644 index 0000000..2817d8f --- /dev/null +++ b/logic/src/test/resources/log4j2.properties @@ -0,0 +1,8 @@ +# The root logger with appender name +rootLogger = INFO, STDOUT + +# Assign STDOUT a valid appender & define its layout +appender.console.name = STDOUT +appender.console.type = Console +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n diff --git a/settings.gradle.kts b/settings.gradle.kts index 9f06289..5878a70 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,8 +1,8 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.10/userguide/multi_project_builds.html in the Gradle documentation. - */ - rootProject.name = "Shingler" + +include( + "lib", + "logic", + "similarity", + "diversity", +) diff --git a/similarity/build.gradle.kts b/similarity/build.gradle.kts new file mode 100644 index 0000000..464d91e --- /dev/null +++ b/similarity/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("hu.bme.mit.ase.shingler.gradle.application") +} + +application { + mainClass = "hu.bme.mit.ase.shingler.similarity.SimilarityApp" +} + +dependencies { + implementation(project(":logic")) + + implementation(libs.slf4j.api) + implementation(libs.picocli) + + runtimeOnly(libs.slf4j.logback.impl) + + testImplementation(libs.junit.jupiter.core) + + testRuntimeOnly(libs.junit.jupiter.engine) + testRuntimeOnly(libs.junit.platform.launcher) +} diff --git a/src/main/java/hu/bme/mit/ase/shingler/similarity/MultiThreadedDocumentSimilarityEstimator.java b/similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/MultiThreadedDocumentSimilarityEstimator.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/similarity/MultiThreadedDocumentSimilarityEstimator.java rename to similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/MultiThreadedDocumentSimilarityEstimator.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/similarity/SimilarityApp.java b/similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/SimilarityApp.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/similarity/SimilarityApp.java rename to similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/SimilarityApp.java diff --git a/src/main/java/hu/bme/mit/ase/shingler/similarity/SingleThreadedDocumentSimilarityEstimator.java b/similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/SingleThreadedDocumentSimilarityEstimator.java similarity index 100% rename from src/main/java/hu/bme/mit/ase/shingler/similarity/SingleThreadedDocumentSimilarityEstimator.java rename to similarity/src/main/java/hu/bme/mit/ase/shingler/similarity/SingleThreadedDocumentSimilarityEstimator.java diff --git a/similarity/src/main/resources/logback.xml b/similarity/src/main/resources/logback.xml new file mode 100644 index 0000000..841f9c9 --- /dev/null +++ b/similarity/src/main/resources/logback.xml @@ -0,0 +1,11 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/BlockBoundaryTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/BlockBoundaryTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/BlockBoundaryTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/BlockBoundaryTests.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/SentenceBlockSeparatorTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SentenceBlockSeparatorTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/SentenceBlockSeparatorTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SentenceBlockSeparatorTests.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/SimpleTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SimpleTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/SimpleTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SimpleTests.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/SingleBlockTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SingleBlockTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/SingleBlockTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/SingleBlockTests.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/TestBase.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/TestBase.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/TestBase.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/TestBase.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/WordBlockSeparatorTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/WordBlockSeparatorTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/WordBlockSeparatorTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/WordBlockSeparatorTests.java diff --git a/src/test/java/hu/bme/mit/ase/shingler/similarity/WordTokenSeparatorTests.java b/similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/WordTokenSeparatorTests.java similarity index 100% rename from src/test/java/hu/bme/mit/ase/shingler/similarity/WordTokenSeparatorTests.java rename to similarity/src/test/java/hu/bme/mit/ase/shingler/similarity/WordTokenSeparatorTests.java