diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml deleted file mode 100644 index e1e09d60..00000000 --- a/.github/workflows/gradle-build.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Gradle Build - -on: - push: - branches: - - master - - develop - pull_request: - -jobs: - gradle: - strategy: - matrix: - os: [ - macos-latest, - windows-latest - ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-java@v3 - with: - java-version: 11 - - - uses: suisei-cn/actions-download-file@v1.3.0 - name: Download ANTLR - with: - url: "https://www.antlr.org/download/antlr-4.9.2-complete.jar" - target: . - - - uses: gradle/gradle-build-action@v2 - with: - arguments: build --info - gradle-version: 7.2 - - - name: Upload Gradle test report - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: gradle-test-report-${{ matrix.os }} - path: build/reports/tests/test/ - - - name: Print J2EO test report - run: | - cd ./src/test/resources/ - python ./test_report.py - - gradle_ubuntu: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-java@v3 - with: - java-version: 11 - - - run: | - wget https://www.antlr.org/download/antlr-4.9.2-complete.jar - - - uses: gradle/gradle-build-action@v2 - with: - arguments: build --info - gradle-version: 7.2 - - - name: Upload Gradle test report - uses: actions/upload-artifact@v3 - if: ${{ always() }} - with: - name: gradle-test-report-ubuntu-latest - path: build/reports/tests/test/ - - - name: Log coverage percentage - run: | - echo "coverage = ${{ steps.jacoco.outputs.coverage }}" - echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - directory: ./build/reports/jacoco/test/ - fail_ci_if_error: false - flags: unittests - name: codecov-umbrella - path_to_write_report: ./build/reports/codecov_report.txt - verbose: true - - - name: Print J2EO test report - run: | - cd ./src/test/resources/ - python ./test_report.py diff --git a/.gitignore b/.gitignore index 555d8112..3fad9095 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ compile_and_run_tests.bat output.eo output_eo polystat_check -*.jar /hadoop/ /output_hadoop/ /bin @@ -16,7 +15,6 @@ polystat_check .metals/ .vscode hadoop* -J2EO*.jar j2eo-data /src/main/java/org/polystat/j2eo/antlrParser/* gradlew @@ -26,4 +24,5 @@ target .classpath .project .settings/ -ktlint \ No newline at end of file +ktlint +src/**/autogenerated diff --git a/.rultor.yml b/.rultor.yml index 514d7b89..1d090e02 100644 --- a/.rultor.yml +++ b/.rultor.yml @@ -1,6 +1,5 @@ docker: - image: "iammaxim/j2eo:latest" - as_root: true + image: "yegor256/rultor-image:1.9.1" architect: - yegor256 assets: @@ -9,17 +8,30 @@ assets: secring.gpg: yegor256/polystat-secrets#secring.gpg docker-password: yegor256/polystat-secrets#docker-password install: | - cp ../gradle.properties . - wget https://www.antlr.org/download/antlr-4.9.2-complete.jar + pdd --file=/dev/null merge: script: | - gradle build --info + mvn clean install --errors -Dstyle.color=never release: script: |- [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 - gradle build fatJar publish -x test --info -Dcandidates=false -PmvnPublicationVersion=${tag} -Dsigning.secretKeyRingFile=/home/r/secring.gpg - mv "J2EO-${tag}.jar" j2eo.jar - image=yegor256/j2eo - sudo docker build "$(pwd)" --tag "${image}:${tag}" - cat ../docker-password | sudo docker login --password-stdin --username yegor256 - sudo docker push "${image}:${tag}" \ No newline at end of file + mvn versions:set "-DnewVersion=${tag}" -Dstyle.color=never + git commit -am "${tag}" + mvn clean install -Dinvoker.skip + mvn clean deploy -Ppolystat -Psonatype --errors --settings ../settings.xml -Dstyle.color=never + mkdir /tmp/polystat + cp -R src/main/eo /tmp/polystat/objects + cp -R src/test/eo /tmp/polystat/tests + branch=$(git rev-parse --abbrev-ref HEAD) + git checkout gh-pages + git reset --hard + sudo git config --global --add safe.directory "$(pwd)" + sudo /bin/bash -c "cd '$(pwd)'; git clean -fd" + rm -rf polystat + cp -R /tmp/polystat . + find polystat -name '*.eo' | xargs sed -i "s/0\.0\.0/${tag}/g" + git add polystat + find polystat -name '*.eo' > polystat.lst + git add polystat.lst + git commit -am "polystat ${tag}" + git checkout "${branch}" diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 36768506..00000000 --- a/build.gradle.kts +++ /dev/null @@ -1,384 +0,0 @@ -import org.apache.tools.ant.taskdefs.condition.Os -import org.gradle.jvm.tasks.Jar -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jlleitschuh.gradle.ktlint.reporter.ReporterType - -plugins { - java - antlr - jacoco - pmd - checkstyle - `maven-publish` - signing - id("io.spring.dependency-management") version "1.1.0" - id("org.jlleitschuh.gradle.ktlint") version "11.0.0" - // id("org.cqfn.diktat.diktat-gradle-plugin") version "1.0.2" - kotlin("jvm") version "1.7.21" - id("com.github.dawnwords.jacoco.badge") version "0.2.4" -} - -val mvnUsername: String? by project -val mvnPassword: String? by project -val mvnPublicationVersion: String? by project -val candidates: String? by project -val amount: String? by project - -group = "org.polystat" -version = mvnPublicationVersion ?: "0.6.0" - -val compileKotlin: KotlinCompile by tasks -compileKotlin.kotlinOptions { - jvmTarget = "11" -} -val compileTestKotlin: KotlinCompile by tasks -compileTestKotlin.kotlinOptions { - jvmTarget = "11" -} - -// The Java grammar source file for ANTLR -val javaParserG4FilePath = "grammar/JavaParser.g4" -val javaLexerG4FilePath = "grammar/JavaLexer.g4" - -// Where to put generated parser -val javaParserSavePath = "src/main/java/org/polystat/j2eo/antlrParser" - -val antlrJar = "antlr-4.9.2-complete.jar" - -repositories { - mavenCentral() -} - -dependencyManagement { - imports { - mavenBom("com.jcabi:parent:0.57.0") - } -} - -dependencies { - // Library for command-line arguments support - implementation("commons-cli:commons-cli:1.5.0") - // Functional stuff - implementation("io.arrow-kt:arrow-core:1.1.3") - // Kotlin logger - implementation("org.slf4j:slf4j-simple:2.0.4") - implementation("io.github.microutils:kotlin-logging-jvm:3.0.4") - - implementation("org.junit.platform:junit-platform-commons:1.9.1") - testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1") - implementation(kotlin("stdlib-jdk8")) - - // Use ANTLR for parser generation - antlr("org.antlr:antlr4:4.11.1") - - implementation("org.polystat:j2ast:0.2.0") -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - - withJavadocJar() - withSourcesJar() -} - -tasks.javadoc { - if (JavaVersion.current().isJava9Compatible) { - (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) - } -} - -val fatJar = task("fatJar", type = Jar::class) { - // baseName = "${project.name}-fat" - // manifest Main-Class attribute is optional. - // (Used only to provide default main class for executable jar) - manifest { - attributes["Main-Class"] = "org.polystat.j2eo.main.Main2" // fully qualified class name of default main class - } - // Include dependencies - from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) - with(tasks["jar"] as CopySpec) - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -tasks { - compileKotlin { - dependsOn(generateGrammarSource) - } - compileTestKotlin { - dependsOn(generateTestGrammarSource) - } - runKtlintFormatOverMainSourceSet { - dependsOn(generateGrammarSource) - } - runKtlintFormatOverTestSourceSet { - dependsOn(generateTestGrammarSource) - } - classes { - dependsOn(ktlintFormat) - } - ktlintFormat { - finalizedBy(ktlintCheck) - } - // diktatFix { - // finalizedBy(diktatCheck) - // } - pmdMain { - dependsOn(classes) - } - checkstyleMain { - dependsOn(classes) - } - pmdTest { - dependsOn(testClasses) - } - checkstyleTest { - dependsOn(testClasses) - } - jacocoTestReport { - dependsOn(test) - finalizedBy(generateJacocoBadge) - } - test { - dependsOn(pmdTest, checkstyleTest) - finalizedBy(jacocoTestReport) - } - build { - dependsOn(fatJar) - } -} - -tasks.withType(JavaCompile::class).configureEach { - options.forkOptions.jvmArgs!!.addAll( - arrayOf( - "--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" - ) - ) -} - -tasks.javadoc { - exclude("parser/**") -} - -tasks.test { - ignoreFailures = true - useJUnitPlatform() - systemProperty("candidates", candidates ?: "false") - systemProperty("amount", amount ?: "15") -} - -pmd { - isIgnoreFailures = true - isConsoleOutput = false - toolVersion = "6.40.0" - rulesMinimumPriority.set(5) - ruleSets = listOf("category/java/codestyle.xml") -} - -ktlint { - verbose.set(true) - outputToConsole.set(true) - coloredOutput.set(true) - ignoreFailures.set(false) - reporters { - reporter(ReporterType.CHECKSTYLE) - reporter(ReporterType.JSON) - reporter(ReporterType.HTML) - } - filter { - exclude("**/style-violations.kt") - } -} - -// diktat { -// reporterType = "sarif" -// ignoreFailures = true -// } - -tasks.getByName("build") { - println("Building parser with ANTLR...") - runAntlr() -} - -checkstyle { - toolVersion = "9.1" - isShowViolations = false - isIgnoreFailures = false -} - -tasks.withType().configureEach { - reports { - xml.required.set(false) - html.required.set(true) - html.stylesheet = resources.text.fromFile("config/xsl/checkstyle-simple.xsl") - } -} -tasks.withType { - /*violationRules { - rule { - limit { - minimum = BigDecimal(0.62) - } - } - }*/ - - afterEvaluate { - classDirectories.setFrom( - files( - classDirectories.files.map { - fileTree(it).apply { - exclude("parser/**") - } - } - ) - ) - } -} -tasks.withType { - afterEvaluate { - classDirectories.setFrom( - files( - classDirectories.files.map { - fileTree(it).apply { - exclude("parser/**") - } - } - ) - ) - } - reports.csv.required.set(true) -} - -tasks.jacocoTestReport { - reports { - xml.required.set(true) - } -} -jacocoBadgeGenSetting { - jacocoReportPath = "$buildDir/reports/jacoco/test/jacocoTestReport.xml" - readmePath = "$projectDir/README.md" - // since v0.2.0, percentage limitation (0-100) for different type of coverage - // limit = ['instruction': 0, 'branch': 0, 'line': 0, 'method': 0, 'class': 0] -} - -publishing { - publications { - create("mavenJava") { - groupId = "org.polystat" - artifactId = "j2eo" - version = project.version as String - from(components["java"]) - pom { - name.set("j2eo") - description.set("Java to EO transpiler.") - url.set("https://github.com/polystat/j2eo") - // properties.set(mapOf( - // "myProp" to "value", - // "prop.with.dots" to "anotherValue" - // )) - licenses { - license { - name.set("MIT") - url.set("https://github.com/polystat/polystat/blob/master/LICENSE.txt") - } - } - developers { - developer { - id.set("zouev") - name.set("Eugene Zouev") - email.set("e.zuev@innopolis.ru") - } - developer { - id.set("IamMaxim58") - name.set("Maxim Stepanov") - email.set("m.stepanov@innopolis.university") - } - developer { - id.set("Ilia_Mil") - name.set("Ilya Milyoshin") - email.set("i.mileshin@innopolis.university") - } - developer { - id.set("egorklementev") - name.set("Egor Klementev") - email.set("e.klementev@innopolis.ru") - } - } - scm { - connection.set("scm:git:git@github.com:polystat/polystat.git") - developerConnection.set("scm:git:git@github.com:polystat/polystat.git") - url.set("https://github.com/polystat/polystat") - } - } - repositories { - maven { - credentials { - println("Applying Maven credentials") - - username = mvnUsername - password = mvnPassword - } - url = uri("https://s01.oss.sonatype.org/content/repositories/releases/") - } - } - } - } -} - -signing { - setRequired({ - gradle.taskGraph.hasTask("publish") - }) - - sign(publishing.publications["mavenJava"]) -} - -tasks.getByName("signMavenJavaPublication") { - dependsOn(fatJar) -} - -/** - * Runs ANTLR using OS-specific shell command. - */ -fun runAntlr() { - val antlrArgs = mutableListOf( - "-jar", - "../$antlrJar", - javaParserG4FilePath.replace("grammar/", ""), - javaLexerG4FilePath.replace("grammar/", ""), - "-visitor", - "-o", - "../$javaParserSavePath" - ) - - try { - when { - Os.isFamily(Os.FAMILY_WINDOWS) -> - exec { - workingDir = File("grammar") - executable = "java" - args = antlrArgs - } - Os.isFamily(Os.FAMILY_MAC) -> - exec { - workingDir = File("grammar") - executable = "java" - args = antlrArgs - } - Os.isFamily(Os.FAMILY_UNIX) -> - exec { - workingDir = File("grammar") - executable = "java" - args = antlrArgs - } - else -> - throw UnsupportedOperationException( - "Your OS is not yet supported. File a GitHub or issue or " + - "provide a Pull Request with support for ANTLR execution for your OS." - ) - } - } catch (e: Exception) { - println("Couldn't run ANTLR; $e") - } -} diff --git a/build.sh b/build.sh deleted file mode 100755 index e7fb7b54..00000000 --- a/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Fail on non-zero exit codes -set -e - -echo "Building J2EO..." -# don't throw error if a dir doesn't exist -rm -rf build/libs -gradle fatJar -x test -cp build/libs/* ./ -echo "Build completed" diff --git a/grammar/README.md b/grammar/README.md deleted file mode 100644 index 78eaff5d..00000000 --- a/grammar/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# J2EO Java Parser Grammar - -This directory contains the modified version of [ANTLR community Java parser](https://github.com/antlr/grammars-v4/tree/master/java/java). - -It supports Java 17. - -## What was changed - -- @header blocks were added in accordance with J2EO source code structure. -- Scopes were named where needed for the project. - -## What is needed to migrate J2EO to the new Java version? - -The answer depends on the features introduced in newer versions. Generally, updating lexer and parser is required. Also, `TreeMappings.kt` should be updated to include introduced parser changes. If newer features should be translated to EO, translator should be updated as well (no certain information here). - -This surely requires a code modification by a person familliar with ANTLR and Kotlin, as well as understanding of Java and EO. diff --git a/pom.xml b/pom.xml index 9f720256..3a62a5d5 100644 --- a/pom.xml +++ b/pom.xml @@ -27,18 +27,23 @@ SOFTWARE. org.polystat j2eo-parent 1.0-SNAPSHOT - pom + jar j2eo + UTF-8 4.11.1 + 3.12.2 3.1.0 1.1.3 3.0.0 1.5.0 1.2.4.2 3.1.0 + 0.2.0 0.8.8 [11,) + 3.0.1 + 2.7.3 5.9.1 5.9.1 1.9.1 @@ -47,12 +52,61 @@ SOFTWARE. 3.10.1 3.19.0 2.0.4 + org.polystat.j2eo.main - + ${project.basedir}/src/main/ + ${project.basedir}/src/test/kotlin + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + org.polystat.j2eo.main.Main + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${project.basedir}/target/generated-sources/antlr4 + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M7 + org.apache.maven.plugins maven-enforcer-plugin @@ -77,6 +131,8 @@ SOFTWARE. maven-compiler-plugin ${mvn.version} + 1.8 + 1.8 @@ -127,9 +183,6 @@ SOFTWARE. ${project.basedir}/src/test/kotlin diktat-analysis.yml - - ${project.basedir}/src/test/kotlin/excluded - @@ -139,22 +192,6 @@ SOFTWARE. jacoco-maven-plugin ${jacoco.version} - - org.antlr - antlr4-maven-plugin - ${antlr.version} - - true - - - - antlr - - antlr4 - - - - org.apache.maven.plugins maven-pmd-plugin @@ -163,6 +200,23 @@ SOFTWARE. + + org.antlr + antlr4-maven-plugin + ${antlr.version} + + true + true + + + + antlr + + antlr4 + + + + org.jacoco jacoco-maven-plugin @@ -186,31 +240,6 @@ SOFTWARE. - - org.cqfn.diktat - diktat-maven-plugin - ${diktat.version} - - - diktat - none - - check - fix - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/test/kotlin - - - ${project.basedir}/src/main/kotlin/generated - - diktat-analysis.yml - - - - org.jetbrains.kotlin kotlin-maven-plugin @@ -223,7 +252,7 @@ SOFTWARE. - test-compile + kotlin-test-compile test-compile @@ -239,15 +268,11 @@ SOFTWARE. maven-checkstyle-plugin ${checkstyle.version} - checkstyle.xml + ${project.basedir}/config/checkstyle/checkstyle.xml - Java to EO Translator https://github.com/polystat/j2eo 2021 @@ -330,9 +355,10 @@ SOFTWARE. scm:git:git@github.com:polystat/j2eo.git https://github.com/polystat/j2eo - + + rultor + https://www.rultor.com/s/eo + github-pages @@ -344,10 +370,31 @@ SOFTWARE. + + com.h2database + h2 + runtime + 2.1.214 + + + org.antlr + antlr4-runtime + ${antlr.version} + + + org.polystat + j2ast + ${j2ast.version} + org.jetbrains.kotlin kotlin-stdlib + + + org.jetbrains.kotlin + kotlin-test ${kotlin.version} + test commons-cli @@ -363,7 +410,7 @@ SOFTWARE. org.slf4j slf4j-simple ${slf4j.vesion} - + test io.github.microutils @@ -374,6 +421,7 @@ SOFTWARE. org.junit.platform junit-platform-commons ${junit-platform.version} + test org.junit.jupiter @@ -387,8 +435,64 @@ SOFTWARE. ${junit-jupiter-engine.version} test + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin.version} + test + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + org.springframework.boot + spring-boot-starter-web + ${spring-framework.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-framework.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring-framework.version} + test + + + org.mockito + mockito-core + + + + + com.ninja-squad + springmockk + ${ninja-squad.version} + test + - + + + + org.jetbrains.kotlin + kotlin-stdlib-common + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.5.30 + + + diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index e4115723..00000000 --- a/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "J2EO" diff --git a/grammar/JavaLexer.g4 b/src/main/antlr4/JavaLexer.g4 similarity index 99% rename from grammar/JavaLexer.g4 rename to src/main/antlr4/JavaLexer.g4 index 34e0eacd..2cdc0e1a 100644 --- a/grammar/JavaLexer.g4 +++ b/src/main/antlr4/JavaLexer.g4 @@ -31,10 +31,6 @@ lexer grammar JavaLexer; -@header { -package org.polystat.j2eo.antlrParser; -} - // Keywords ABSTRACT: 'abstract'; diff --git a/grammar/JavaParser.g4 b/src/main/antlr4/JavaParser.g4 similarity index 99% rename from grammar/JavaParser.g4 rename to src/main/antlr4/JavaParser.g4 index 8b20a969..c8cc11ce 100644 --- a/grammar/JavaParser.g4 +++ b/src/main/antlr4/JavaParser.g4 @@ -31,10 +31,6 @@ parser grammar JavaParser; -@header { -package org.polystat.j2eo.antlrParser; -} - options { tokenVocab=JavaLexer; } compilationUnit diff --git a/src/main/java/org/polystat/j2eo/antlrParser/README.md b/src/main/java/org/polystat/j2eo/antlrParser/README.md deleted file mode 100644 index 7c9af190..00000000 --- a/src/main/java/org/polystat/j2eo/antlrParser/README.md +++ /dev/null @@ -1 +0,0 @@ -#### This folder would contain autogenerated ANTLR parser diff --git a/src/main/kotlin/org/polystat/j2eo/main/Main2.kt b/src/main/kotlin/org/polystat/j2eo/main/Main.kt similarity index 94% rename from src/main/kotlin/org/polystat/j2eo/main/Main2.kt rename to src/main/kotlin/org/polystat/j2eo/main/Main.kt index 15f5ca85..168255a2 100644 --- a/src/main/kotlin/org/polystat/j2eo/main/Main2.kt +++ b/src/main/kotlin/org/polystat/j2eo/main/Main.kt @@ -1,11 +1,23 @@ package org.polystat.j2eo.main +import JavaLexer +import JavaParser import arrow.core.Some +import java.io.File +import java.io.FileNotFoundException +import java.nio.file.Files +import java.nio.file.Paths +import kotlin.io.path.createDirectories +import kotlin.system.exitProcess import org.antlr.v4.runtime.CharStreams import org.antlr.v4.runtime.CommonTokenStream -import org.apache.commons.cli.* // ktlint-disable no-wildcard-imports -import org.polystat.j2eo.antlrParser.JavaLexer -import org.polystat.j2eo.antlrParser.JavaParser +import org.apache.commons.cli.CommandLine +import org.apache.commons.cli.CommandLineParser +import org.apache.commons.cli.DefaultParser +import org.apache.commons.cli.HelpFormatter +import org.apache.commons.cli.Option +import org.apache.commons.cli.Options +import org.apache.commons.cli.ParseException import org.polystat.j2eo.eotree.EOLicense import org.polystat.j2eo.eotree.EOMetas import org.polystat.j2eo.eotree.EOProgram @@ -18,14 +30,8 @@ import tree.Compilation.SimpleCompilationUnit import tree.Compilation.TopLevelComponents import tree.Declaration.ImportDeclarations import tree.Entity -import java.io.File -import java.io.FileNotFoundException -import java.nio.file.Files -import java.nio.file.Paths -import kotlin.io.path.createDirectories -import kotlin.system.exitProcess -object Main2 { +object Main { @Throws(FileNotFoundException::class) @JvmStatic fun main(args: Array) { diff --git a/src/main/kotlin/org/polystat/j2eo/treeMapper/TreeMappings.kt b/src/main/kotlin/org/polystat/j2eo/treeMapper/TreeMappings.kt index 24c28751..23a452b7 100644 --- a/src/main/kotlin/org/polystat/j2eo/treeMapper/TreeMappings.kt +++ b/src/main/kotlin/org/polystat/j2eo/treeMapper/TreeMappings.kt @@ -1,18 +1,208 @@ package org.polystat.j2eo.treeMapper -/* ktlint-disable no-wildcard-imports */ +import JavaParser.ABSTRACT +import JavaParser.ADD +import JavaParser.ADD_ASSIGN +import JavaParser.AND +import JavaParser.AND_ASSIGN +import JavaParser.ASSIGN +import JavaParser.ArgumentsContext +import JavaParser.ArrayAccessContext +import JavaParser.ArrayInitializerContext +import JavaParser.BANG +import JavaParser.BITAND +import JavaParser.BITOR +import JavaParser.BOOLEAN +import JavaParser.BYTE +import JavaParser.BinaryExpressionContext +import JavaParser.BlockContext +import JavaParser.BlockStatementContext +import JavaParser.CARET +import JavaParser.CHAR +import JavaParser.CastExpresionContext +import JavaParser.ClassBodyContext +import JavaParser.ClassBodyDeclarationContext +import JavaParser.ClassDeclarationContext +import JavaParser.ClassOrInterfaceModifierContext +import JavaParser.ClassOrInterfaceTypeContext +import JavaParser.CompilationUnitContext +import JavaParser.ConstructorDeclarationContext +import JavaParser.CreatorContext +import JavaParser.DEC +import JavaParser.DIV +import JavaParser.DIV_ASSIGN +import JavaParser.DOT +import JavaParser.DOUBLE +import JavaParser.EQUAL +import JavaParser.ExpressionContext +import JavaParser.FINAL +import JavaParser.FLOAT +import JavaParser.FieldDeclarationContext +import JavaParser.FormalParameterContext +import JavaParser.FormalParameterListContext +import JavaParser.FormalParametersContext +import JavaParser.GE +import JavaParser.GT +import JavaParser.INC +import JavaParser.INSTANCEOF +import JavaParser.INT +import JavaParser.IdentifierContext +import JavaParser.IdentifierExpresionContext +import JavaParser.ImportDeclarationContext +import JavaParser.InnerCreatorContext +import JavaParser.InstanceCreationContext +import JavaParser.InstanceOfExpressionContext +import JavaParser.LE +import JavaParser.LONG +import JavaParser.LSHIFT_ASSIGN +import JavaParser.LT +import JavaParser.LiteralContext +import JavaParser.LiteralExpressionContext +import JavaParser.LocalTypeDeclarationContext +import JavaParser.LocalVariableDeclarationContext +import JavaParser.MOD +import JavaParser.MOD_ASSIGN +import JavaParser.MUL +import JavaParser.MUL_ASSIGN +import JavaParser.MemberDeclarationContext +import JavaParser.MethodBodyContext +import JavaParser.MethodCallContext +import JavaParser.MethodDeclarationContext +import JavaParser.MethodInvocationContext +import JavaParser.ModifierContext +import JavaParser.NOTEQUAL +import JavaParser.OR +import JavaParser.OR_ASSIGN +import JavaParser.PRIVATE +import JavaParser.PROTECTED +import JavaParser.PUBLIC +import JavaParser.PackageDeclarationContext +import JavaParser.ParenthesizedExpressionContext +import JavaParser.PostfixExpressionContext +import JavaParser.PrefixExpressionContext +import JavaParser.PrimaryContext +import JavaParser.PrimaryExpresionContext +import JavaParser.PrimitiveTypeContext +import JavaParser.QUESTION +import JavaParser.QualifiedNameContext +import JavaParser.RSHIFT_ASSIGN +import JavaParser.ReferenceContext +import JavaParser.SHORT +import JavaParser.STATIC +import JavaParser.STRICTFP +import JavaParser.SUB +import JavaParser.SUB_ASSIGN +import JavaParser.StatementAssertContext +import JavaParser.StatementBlockLabelContext +import JavaParser.StatementBreakContext +import JavaParser.StatementContext +import JavaParser.StatementContinueContext +import JavaParser.StatementDoContext +import JavaParser.StatementExpressionContext +import JavaParser.StatementForContext +import JavaParser.StatementIdentifierLabelContext +import JavaParser.StatementIfContext +import JavaParser.StatementReturnContext +import JavaParser.StatementSemiContext +import JavaParser.StatementSwitchContext +import JavaParser.StatementSwitchExpressionContext +import JavaParser.StatementTryBlockContext +import JavaParser.StatementTryResourceSpecificationContext +import JavaParser.StatementWhileContext +import JavaParser.SuperExpressionContext +import JavaParser.SwitchBlockStatementGroupContext +import JavaParser.SwitchExpressionContext +import JavaParser.SwitchLabelContext +import JavaParser.TILDE +import JavaParser.ThisExpresionContext +import JavaParser.TypeArgumentContext +import JavaParser.TypeArgumentsContext +import JavaParser.TypeClassOrInterfaceTypeContext +import JavaParser.TypeDeclarationContext +import JavaParser.TypeListContext +import JavaParser.TypeParameterContext +import JavaParser.TypeParametersContext +import JavaParser.TypePrimitiveTypeContext +import JavaParser.TypeTypeContext +import JavaParser.TypeTypeOrVoidContext +import JavaParser.URSHIFT_ASSIGN +import JavaParser.VAR +import JavaParser.VariableDeclaratorContext +import JavaParser.VariableDeclaratorsContext +import JavaParser.VariableInitializerContext +import JavaParser.XOR_ASSIGN import lexer.Token import lexer.TokenCode import org.antlr.v4.runtime.tree.TerminalNode -import org.polystat.j2eo.antlrParser.JavaParser.* -import tree.* -import tree.Compilation.* -import tree.Declaration.* -import tree.Expression.* -import tree.Expression.Primary.* -import tree.Statement.* -import tree.Type.* -/* ktlint-disable no-wildcard-imports */ +import tree.Compilation.CompilationUnit +import tree.Compilation.Package +import tree.Compilation.SimpleCompilationUnit +import tree.Compilation.TopLevelComponent +import tree.Compilation.TopLevelComponents +import tree.CompoundName +import tree.Declaration.ClassDeclaration +import tree.Declaration.ClassInitializer +import tree.Declaration.ConstructorDeclaration +import tree.Declaration.Declaration +import tree.Declaration.Declarations +import tree.Declaration.ImportDeclaration +import tree.Declaration.ImportDeclarations +import tree.Declaration.MethodDeclaration +import tree.Declaration.NormalClassDeclaration +import tree.Declaration.ParameterDeclaration +import tree.Declaration.ParameterDeclarations +import tree.Declaration.TypeAndDeclarators +import tree.Declaration.VariableDeclaration +import tree.Declaration.VariableDeclarator +import tree.Declaration.VariableDeclarators +import tree.Dim +import tree.Dims +import tree.Expression.ArgumentList +import tree.Expression.Binary +import tree.Expression.Cast +import tree.Expression.Expression +import tree.Expression.InstanceOf +import tree.Expression.Primary.ArrayAccess +import tree.Expression.Primary.ArrayCreation +import tree.Expression.Primary.FieldAccess +import tree.Expression.Primary.InstanceCreation +import tree.Expression.Primary.InstanceCreationQualified +import tree.Expression.Primary.Literal +import tree.Expression.Primary.MethodInvocation +import tree.Expression.Primary.Parenthesized +import tree.Expression.Primary.Primary +import tree.Expression.Primary.This +import tree.Expression.SimpleReference +import tree.Expression.UnaryPostfix +import tree.Expression.UnaryPrefix +import tree.Initializer +import tree.InitializerArray +import tree.InitializerSimple +import tree.Modifiers +import tree.StandardModifiers +import tree.Statement.Assert +import tree.Statement.Block +import tree.Statement.BlockStatement +import tree.Statement.BlockStatements +import tree.Statement.Break +import tree.Statement.Continue +import tree.Statement.Do +import tree.Statement.IfThenElse +import tree.Statement.Return +import tree.Statement.Statement +import tree.Statement.StatementExpression +import tree.Statement.SwitchBlock +import tree.Statement.SwitchLabel +import tree.Statement.While +import tree.Type.PrimitiveType +import tree.Type.Type +import tree.Type.TypeArgument +import tree.Type.TypeArguments +import tree.Type.TypeList +import tree.Type.TypeName +import tree.Type.TypeParameter +import tree.Type.TypeParameterTail +import tree.Type.TypeParameters fun CompilationUnitContext.toCompilationUnit(): CompilationUnit { val imports = ArrayList(importDeclaration().map { it.toImportDeclaration() }) diff --git a/src/main/kotlin/org/polystat/j2eo/treeMapper/Visitor.kt b/src/main/kotlin/org/polystat/j2eo/treeMapper/Visitor.kt index 73baac63..5ce8e13f 100644 --- a/src/main/kotlin/org/polystat/j2eo/treeMapper/Visitor.kt +++ b/src/main/kotlin/org/polystat/j2eo/treeMapper/Visitor.kt @@ -1,8 +1,8 @@ package org.polystat.j2eo.treeMapper -import org.polystat.j2eo.antlrParser.JavaParser -import org.polystat.j2eo.antlrParser.JavaParser.CompilationUnitContext -import org.polystat.j2eo.antlrParser.JavaParserBaseVisitor +import JavaParser +import JavaParser.CompilationUnitContext +import JavaParserBaseVisitor import tree.Entity class Visitor : JavaParserBaseVisitor() { diff --git a/src/test/kotlin/common/TestJ2EORuntimeCheck.kt b/src/test/kotlin/common/TestJ2EORuntimeCheck.kt deleted file mode 100644 index 4b1e9946..00000000 --- a/src/test/kotlin/common/TestJ2EORuntimeCheck.kt +++ /dev/null @@ -1,259 +0,0 @@ -package common - -import org.antlr.v4.runtime.CharStreams -import org.antlr.v4.runtime.CommonTokenStream -import org.junit.jupiter.api.AfterAll -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.BeforeAll -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.MethodOrderer -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.TestMethodOrder -import org.junit.jupiter.api.assertTimeoutPreemptively -import org.junit.jupiter.api.parallel.Execution -import org.junit.jupiter.api.parallel.ExecutionMode -import org.polystat.j2eo.antlrParser.JavaLexer -import org.polystat.j2eo.antlrParser.JavaParser -import org.polystat.j2eo.translator.Context -import org.polystat.j2eo.translator.Translator -import org.polystat.j2eo.treeMapper.Visitor -import org.polystat.j2eo.util.logger -import tree.Compilation.CompilationUnit -import java.io.BufferedReader -import java.io.File -import java.io.InputStreamReader -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths -import java.time.Duration -import java.util.Locale -import java.util.concurrent.TimeUnit -import kotlin.collections.HashMap -import kotlin.io.path.absolutePathString -import kotlin.io.path.name -import kotlin.io.path.relativeTo - -@Execution(ExecutionMode.SAME_THREAD) -@TestMethodOrder(MethodOrderer.OrderAnnotation::class) -class TestJ2EORuntimeCheck { - @TestFactory - fun executeAndCheckEO(): Collection { - return translatedFiles - .map { file -> executeTranslatedTest(file.first.toPath(), file.second) } - .toList() - } - - companion object { - private var testFolderRoot = Paths.get("") - private var pomFilePath = Paths.get("") - private var stdlibFolderRoot = Paths.get("") - private val fileSep = File.separatorChar.toString() - private val lineSep = System.lineSeparator() // New line character - - private lateinit var traversedFiles: Sequence - private lateinit var translatedFiles: Sequence> - - @BeforeAll - @JvmStatic - fun setup() { - val candidatesProp = System.getProperty("candidates") - val testCandidates = candidatesProp == "true" - if (testCandidates) - logger.info("-- Executing candidate tests --") - var testFolderPath = listOf("src", "test", "resources").joinToString(fileSep) - testFolderPath += fileSep + if (testCandidates) "test_candidates" else "test_ready" - val stdlibFolderPath = listOf("src", "main", "eo", "org", "polystat", "stdlib").joinToString(fileSep) - val fileStd = File(stdlibFolderPath) - stdlibFolderRoot = fileStd.toPath().toAbsolutePath() - val fileTest = File(testFolderPath) - testFolderRoot = fileTest.toPath().toAbsolutePath() - - val pomPath = listOf("src", "test", "resources", "eo_execution_pom", "pom.xml").joinToString(fileSep) - pomFilePath = File(pomPath).toPath().toAbsolutePath() - - // Double check for test files (in case testing exited abruptly) - val targetFolder = File(testFolderRoot.toString() + fileSep + "target") - if (targetFolder.exists()) { - targetFolder.deleteRecursively() - } - testFolderRoot.toFile().walk() - .filter { file -> file.isFile } - .filter { file -> isEOFile(file.toPath()) }.forEach { it.delete() } - - checkTranslation() - compileEOFiles() - } - - @AfterAll - @JvmStatic - fun cleanup() { - File(testFolderRoot.toString() + fileSep + "target").deleteRecursively() - testFolderRoot.toFile().walk() - .filter { file -> file.isFile } - .filter { file -> isEOFile(file.toPath()) }.forEach { it.delete() } - } - - private fun checkTranslation() { - traversedFiles = testFolderRoot.toFile().walk() - .filter { file -> file.isFile } - .filter { file -> isReadyTest(file.toPath()) } - .filter { file -> isNotClassFile(file.toPath()) } - .filter { file -> isJavaFile(file.toPath()) } - - translatedFiles = traversedFiles - .map { file -> file to translateFile(file.toPath()) } - } - - private fun translateFile(path: Path): Boolean { - try { - assertTimeoutPreemptively( - Duration.ofSeconds(90) - ) { - val lexer = JavaLexer(CharStreams.fromFileName(path.absolutePathString())) - val parser = JavaParser(CommonTokenStream(lexer)) - val tree = parser.compilationUnit() - val eval = Visitor() - val cu = eval.visit(tree) as CompilationUnit - val genEOLangText = Translator(path.relativeTo(testFolderRoot)).translate(cu, Context(HashMap())) - val newFileName = path.fileName.name.removeSuffix(".java") + ".eo" - val newPath = File(path.parent.toString() + fileSep + newFileName).toPath() - Files.writeString(newPath, genEOLangText.generateEO(0)) - assert(true) - } - } catch (e: Exception) { - return false - } - return true - } - - private fun compileEOFiles() { - // Copy all necessary files - val pomClonePath = File(testFolderRoot.toString() + fileSep + "pom.xml").toPath() - Files.copy(pomFilePath, pomClonePath) - val stdClonePath = File(testFolderRoot.toString() + fileSep + "stdlib").toPath() - stdlibFolderRoot.toFile().copyRecursively(stdClonePath.toFile()) - - // Execute generated EO code - val isWindows = System.getProperty("os.name").lowercase(Locale.getDefault()) - .contains("windows") // Matters a lot - - // Compile EO file - val mvnCommands = if (isWindows) listOf("mvn.cmd", "clean", "compile") - else listOf("mvn", "clean", "compile") - val compileProcess = ProcessBuilder(mvnCommands) - .directory(testFolderRoot.toFile()) - .redirectErrorStream(true) - .start() - - // Receive compilation output (maybe useful) - val mvnStdInput = BufferedReader(InputStreamReader(compileProcess.inputStream)) - var m: String? - val mvnSb = StringBuilder() - while (mvnStdInput.readLine().also { m = it } != null) { - mvnSb.append(m).append(lineSep) - } - compileProcess.waitFor() - compileProcess.destroy() - logger.info(" -- EO compilation output --$lineSep$mvnSb") - - pomClonePath.toFile().delete() - stdClonePath.toFile().deleteRecursively() - } - - private fun executeTranslatedTest(path: Path, isTranslated: Boolean): DynamicTest { - return DynamicTest.dynamicTest( - path.parent.fileName.toString() + "/" + - path.fileName.toString() - ) { - if (!isTranslated) { - assert(false) - } - - assertTimeoutPreemptively(Duration.ofSeconds(15)) { - val isWindows = System.getProperty("os.name").lowercase(Locale.getDefault()) - .contains("windows") // Matters a lot - - // Execute Java - val execPbJava = ProcessBuilder( - "java", path.toAbsolutePath().toString() - ) - execPbJava.directory(testFolderRoot.toFile()) - execPbJava.redirectErrorStream(true) - val execProcessJava = execPbJava.start() - logger.info("-- Executing Java... --") - - // Receive output - val outputJava = StringBuilder() - val stdInputJava = BufferedReader(InputStreamReader(execProcessJava.inputStream)) - var s: String? - while (stdInputJava.readLine().also { s = it } != null) { - outputJava.append(s).append(lineSep) - } - execProcessJava.waitFor() - execProcessJava.destroy() - logger.info("-- Java execution output --$lineSep$outputJava") - - // Execute EO - val relPath = path.relativeTo(testFolderRoot) - val pkg = relPath.toList().dropLast(1).joinToString(".") - val execPb = ProcessBuilder( - "java", "-cp", - if (isWindows) - "\"target/classes;target/eo-runtime.jar\"" - else - "target/classes:target/eo-runtime.jar", - "org.eolang.Main", - "$pkg.main", - if (isWindows) - "%*" - else - "\"$@\"1" - ) - execPb.directory(testFolderRoot.toFile()) - execPb.redirectErrorStream(true) - val execProcess = execPb.start() - logger.info("-- Executing EO... --") - - // Receive EO execution output - val outputEO = StringBuilder() - val stdInputEO = BufferedReader(InputStreamReader(execProcess.inputStream)) - var sEO: String? - while (stdInputEO.readLine().also { sEO = it } != null) { - outputEO.append(sEO).append(lineSep) - } - if (execProcess.waitFor(5, TimeUnit.SECONDS)) { - logger.warn("-- EO process has finished. ---") - execProcess.destroy() - } else { - logger.warn("-- EO process is stuck!!! ---") - execProcess.destroyForcibly() - } - - logger.info("-- EO execution output --$lineSep$outputEO") - - Assertions.assertEquals(outputJava.toString(), outputEO.toString()) - } - } - } - - private fun isReadyTest(path: Path): Boolean { - return !path.endsWith("SampleTest.java") && !path.contains(Paths.get("target")) - } - - private fun isClassFile(path: Path): Boolean { - return path.toString().endsWith(".class") - } - - private fun isJavaFile(path: Path): Boolean { - return path.toString().endsWith(".java") - } - - private fun isNotClassFile(path: Path): Boolean { - return !isClassFile(path) - } - - private fun isEOFile(path: Path): Boolean { - return path.toString().endsWith(".eo") - } - } -} diff --git a/src/test/kotlin/common/TestJ2EOStaticCheck.kt b/src/test/kotlin/common/TestJ2EOStaticCheck.kt deleted file mode 100644 index e8dee46d..00000000 --- a/src/test/kotlin/common/TestJ2EOStaticCheck.kt +++ /dev/null @@ -1,121 +0,0 @@ -package common - -import org.antlr.v4.runtime.CharStreams -import org.antlr.v4.runtime.CommonTokenStream -import org.junit.jupiter.api.AfterAll -import org.junit.jupiter.api.BeforeAll -import org.junit.jupiter.api.DynamicTest -import org.junit.jupiter.api.MethodOrderer -import org.junit.jupiter.api.TestFactory -import org.junit.jupiter.api.TestMethodOrder -import org.junit.jupiter.api.assertTimeoutPreemptively -import org.junit.jupiter.api.parallel.Execution -import org.junit.jupiter.api.parallel.ExecutionMode -import org.polystat.j2eo.antlrParser.JavaLexer -import org.polystat.j2eo.antlrParser.JavaParser -import org.polystat.j2eo.translator.Context -import org.polystat.j2eo.translator.Translator -import org.polystat.j2eo.treeMapper.Visitor -import tree.Compilation.CompilationUnit -import java.io.File -import java.nio.file.Path -import java.nio.file.Paths -import java.time.Duration -import kotlin.io.path.absolutePathString -import kotlin.io.path.relativeTo - -@Execution(ExecutionMode.SAME_THREAD) -@TestMethodOrder(MethodOrderer.OrderAnnotation::class) -class TestJ2EOStaticCheck { - @TestFactory - fun test(): Collection { - val t = testFolderRoot.toFile().walk() - .filter { file -> file.isFile } - .filter { file -> isReadyTest(file.toPath()) } - .filter { file -> isNotClassFile(file.toPath()) } - .filter { file -> isJavaFile(file.toPath()) } - - return t.map { translateFile(it.toPath()) }.toList() - } - - companion object { - private const val translatedTestsFolderName = "translated_tests" - private const val testsFolderName = "test_candidates" - private val testFolderRoot = Paths.get("src", "test", "resources", testsFolderName) - .toAbsolutePath() - private val sep = File.separatorChar.toString() - - @BeforeAll - @JvmStatic - fun setup() { - testFolderRoot.toFile().walk() - .filter { file -> file.isFile } - .filter { file -> isReadyTest(file.toPath()) } - .filter { file -> isNotClassFile(file.toPath()) } - .filter { file -> isJavaFile(file.toPath()) } - .toList() - } - - private fun translateJavaFile(path: Path): String { - val lexer = JavaLexer(CharStreams.fromFileName(path.absolutePathString())) - val parser = JavaParser(CommonTokenStream(lexer)) - val tree = parser.compilationUnit() - val eval = Visitor() - val cu = eval.visit(tree) as CompilationUnit - val genEOLangText = Translator(path.relativeTo(testFolderRoot)).translate(cu, Context(HashMap())) - return genEOLangText.generateEO(0) - } - - private fun getEOSample(path: Path): String { - val eoPathStr = path.absolutePathString() - .replace(testsFolderName, translatedTestsFolderName) - .replace(".java", ".eo") - return CharStreams.fromFileName(eoPathStr).toString() - } - - private fun translateFile(path: Path): DynamicTest { - return DynamicTest.dynamicTest( - path.parent.fileName.toString() + sep + - path.fileName.toString() - ) { - assertTimeoutPreemptively( - Duration.ofSeconds(10) - ) { - var translatedJava = translateJavaFile(path) - var sampleJava = getEOSample(path) - - // Ignores comments in the beginning - translatedJava = translatedJava.substring(translatedJava.indexOf("+alias")) - sampleJava = sampleJava.substring(sampleJava.indexOf("+alias")) - - assert(translatedJava == sampleJava) - } - } - } - - @AfterAll - @JvmStatic - fun cleanup() { - } - - private fun isReadyTest(path: Path): Boolean { - return !path.endsWith("SampleTest.java") && !path.contains(Paths.get("target")) - } - - private fun isTest(path: Path): Boolean { - return !path.contains(Paths.get("target")) - } - - private fun isClassFile(path: Path): Boolean { - return path.toString().endsWith(".class") - } - - private fun isJavaFile(path: Path): Boolean { - return path.toString().endsWith(".java") - } - - private fun isNotClassFile(path: Path): Boolean { - return !isClassFile(path) - } - } -} diff --git a/src/test/kotlin/open_jdk/TestJ2EOonOpenJDK.kt b/src/test/kotlin/open_jdk/TestJ2EOonOpenJDK.kt index 025109de..1a914727 100644 --- a/src/test/kotlin/open_jdk/TestJ2EOonOpenJDK.kt +++ b/src/test/kotlin/open_jdk/TestJ2EOonOpenJDK.kt @@ -13,8 +13,9 @@ import org.junit.jupiter.api.TestMethodOrder import org.junit.jupiter.api.assertTimeoutPreemptively import org.junit.jupiter.api.parallel.Execution import org.junit.jupiter.api.parallel.ExecutionMode -import org.polystat.j2eo.antlrParser.JavaLexer -import org.polystat.j2eo.antlrParser.JavaParser +import JavaLexer +import JavaParser +import JavaParserBaseVisitor import org.polystat.j2eo.translator.Context import org.polystat.j2eo.translator.Translator import org.polystat.j2eo.treeMapper.Visitor diff --git a/test-hadoop.sh b/test-hadoop.sh deleted file mode 100755 index 0aaf6572..00000000 --- a/test-hadoop.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Exit on error -set -e - -echo "Building J2EO..." -gradle build -x test jar -cp build/libs/J2EO-0.6.0.jar . - -if [ ! -e "./j2eo-data/hadoop-3.2.3-src" ]; then - echo "Downloading Hadoop..." - # get hadoop from https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.2.3/hadoop-3.2.3-src.tar.gz - mkdir -p j2eo-data - wget -O j2eo-data/hadoop.tar.gz https://dlcdn.apache.org/hadoop/common/hadoop-3.2.3/hadoop-3.2.3-src.tar.gz - # unpack - tar -xf j2eo-data/hadoop.tar.gz -C j2eo-data -else - echo "Hadoop is already downloaded, skipping download..." -fi - -echo "Starting J2EO on Hadoop..." -# clean old output -rm -rf j2eo-data/hadoop-eo - -java -jar J2EO-0.6.0.jar -o j2eo-data/hadoop-eo j2eo-data/hadoop-3.2.3-src diff --git a/test-kafka.sh b/test-kafka.sh deleted file mode 100755 index e32d594d..00000000 --- a/test-kafka.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# Exit on error -set -e - -echo "Building J2EO..." -gradle build -x test jar -cp build/libs/J2EO-0.6.0.jar . - -if [ ! -e "./j2eo-data/kafka" ]; then - echo "Downloading Kafka..." - mkdir -p j2eo-data - cd j2eo-data - git clone https://github.com/apache/kafka - cd kafka - git checkout f36de0744b915335de6b636e6bd6b5f1276f34f6 - cd ../.. -else - echo "Kafka is already downloaded, skipping download..." -fi - -echo "Starting J2EO on Kafka..." -# clean old output -rm -rf j2eo-data/kafka-eo - -java -jar J2EO-0.6.0.jar -o j2eo-data/kafka-eo j2eo-data/kafka diff --git a/test_candidates.sh b/test_candidates.sh deleted file mode 100755 index e4e19da9..00000000 --- a/test_candidates.sh +++ /dev/null @@ -1,3 +0,0 @@ -#/bin/sh - -gradle test -Dcandidates=true diff --git a/test_ready.sh b/test_ready.sh deleted file mode 100644 index a7343ca9..00000000 --- a/test_ready.sh +++ /dev/null @@ -1,3 +0,0 @@ -#/bin/sh - -./gradlew test -Pcandidates=false