diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2956839129..177cfc7f63 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,10 +3,9 @@ "sonarsource.sonarlint-vscode", "ms-vscode.cpptools", "ms-vscode.cmake-tools", - "orta.vscode-jest", - "esbenp.prettier-vscode", - "dbaeumer.vscode-eslint", + "oxc.oxc-vscode", "redhat.java", + "vitest.explorer", "vscjava.vscode-gradle", "vscjava.vscode-java-debug" ] diff --git a/Clava-JS/CxxTestSources/test1/lib.cpp b/Clava-JS/CxxTestSources/test1/lib.cpp deleted file mode 100644 index 0792bc4a1f..0000000000 --- a/Clava-JS/CxxTestSources/test1/lib.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "lib.h" -#include - -void foo() { printf("Hello, world!"); } \ No newline at end of file diff --git a/Clava-JS/CxxTestSources/test1/lib.h b/Clava-JS/CxxTestSources/test1/lib.h deleted file mode 100644 index 21eac780fc..0000000000 --- a/Clava-JS/CxxTestSources/test1/lib.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LIB_H__ -#define __LIB_H__ - -void foo(); - -#endif // __LIB_H__ diff --git a/Clava-JS/CxxTestSources/test1/main.cpp b/Clava-JS/CxxTestSources/test1/main.cpp deleted file mode 100644 index 7556e5638d..0000000000 --- a/Clava-JS/CxxTestSources/test1/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "lib.h" - -#pragma clava foo -int main(int argc, char *argv[]) { - foo(); - return 0; -} \ No newline at end of file diff --git a/Clava-JS/README.md b/Clava-JS/README.md index 0182411ffa..67af82eb1d 100644 --- a/Clava-JS/README.md +++ b/Clava-JS/README.md @@ -35,20 +35,12 @@ Starting from the `workspace` directory, execute the following commands to build ```bash npm install +gradle -p clava/ClavaWeaver installDist npm run build -w lara-framework/Lara-JS npm run build -w clava/Clava-JS -npm install -cd clava/ClavaWeaver -gradle installDist -cd ../.. ``` -Finally, copy the JARs in the folder `./clava/ClavaWeaver/build/install/ClavaWeaver/lib` into a new folder called java-binaries in `./clava/Clava-JS`: - -```bash -mkdir clava/Clava-JS/java-binaries -cp -r ./clava/ClavaWeaver/build/install/ClavaWeaver/lib ./clava/Clava-JS/java-binaries -``` +The `installDist` task synchronizes the complete ClavaWeaver distribution into `./clava/Clava-JS/java-binaries`. The generated directory is refreshed automatically, including when `installDist` is invoked directly, so do not copy or edit its contents manually. Local `npm pack` and `npm publish` also validate that `java-binaries` is a real, populated directory before creating a package. Install the package globally: diff --git a/Clava-JS/api/Issues.test.ts b/Clava-JS/api/Issues.test.ts index 165a255610..d6e3a89fdb 100644 --- a/Clava-JS/api/Issues.test.ts +++ b/Clava-JS/api/Issues.test.ts @@ -1,7 +1,7 @@ import { registerSourceCode, registerSourceCodes, -} from "@specs-feup/lara/jest/jestHelpers.ts"; +} from "@specs-feup/lara/vitest/weaverTestHelpers.ts"; import Query from "@specs-feup/lara/api/weaver/Query.ts"; import { FunctionJp } from "./Joinpoints.ts"; import ClavaJoinPoints from "./clava/ClavaJoinPoints.ts"; diff --git a/Clava-JS/api/LegacyIntegrationTests - C.test.ts b/Clava-JS/api/LegacyIntegrationTests - C.test.ts index 819f278223..ec85066b3a 100644 --- a/Clava-JS/api/LegacyIntegrationTests - C.test.ts +++ b/Clava-JS/api/LegacyIntegrationTests - C.test.ts @@ -1,12 +1,14 @@ -import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.ts"; +import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.ts"; -import ClavaJavaTypes from "./clava/ClavaJavaTypes.ts"; +import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; import path from "path"; +import { ClavaLegacyTester } from "../vitest/ClavaLegacyTester.ts"; +import ClavaJavaTypes from "./clava/ClavaJavaTypes.ts"; const isWindows = process.platform === "win32"; const isMacOS = process.platform === "darwin"; -/* eslint-disable jest/expect-expect */ +/* oxlint-disable vitest/expect-expect */ describe("CTest", () => { function newTester() { return new ClavaLegacyTester( @@ -17,6 +19,11 @@ describe("CTest", () => { .setSrcPackage("c/src"); } + afterEach(() => { + PrintOnce.messagesSet.clear(); + IdGenerator.idCounter.clear(); + }); + // TODO: Temporarily disabled, Jenkins fails with "Cannot inherit from final class" it("Loop", async () => { await newTester().test("Loop.js", "loop.c"); @@ -101,7 +108,7 @@ describe("CTest", () => { await newTester() .checkExpectedOutput(false) .test("InlineNasLu.js", "inline_nas_lu.c"); - }); + }, 10_000); it("InlineNasFt", async () => { await newTester() @@ -340,7 +347,7 @@ describe("CApiTest", () => { } await tester.test("InlinerTest.js", "inliner.c"); - }); + }, 15_000); it("StatementDecomposer", async () => { await newTester().test( diff --git a/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts b/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts index c0bef9b83d..8fd880d59b 100644 --- a/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts +++ b/Clava-JS/api/LegacyIntegrationTests - CXX.test.ts @@ -1,12 +1,14 @@ -import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.ts"; -import ClavaJavaTypes from "./clava/ClavaJavaTypes.ts"; import JavaInterop from "@specs-feup/lara/api/lara/JavaInterop.ts"; +import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; +import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; import path from "path"; +import { ClavaLegacyTester } from "../vitest/ClavaLegacyTester.ts"; +import ClavaJavaTypes from "./clava/ClavaJavaTypes.ts"; const isWindows = process.platform === "win32"; const isMacOS = process.platform === "darwin"; -/* eslint-disable jest/expect-expect */ +/* oxlint-disable vitest/expect-expect */ describe("CxxTest", () => { function newTester() { return new ClavaLegacyTester( @@ -17,6 +19,11 @@ describe("CxxTest", () => { .setSrcPackage("cpp/src"); } + afterEach(() => { + PrintOnce.messagesSet.clear(); + IdGenerator.idCounter.clear(); + }); + it("Statement", async () => { await newTester().test("Statement.js", "statement.cpp"); }); diff --git a/Clava-JS/api/LegacyIntegrationTests - Issues.test.ts b/Clava-JS/api/LegacyIntegrationTests - Issues.test.ts index e73847c701..c4782a44ec 100644 --- a/Clava-JS/api/LegacyIntegrationTests - Issues.test.ts +++ b/Clava-JS/api/LegacyIntegrationTests - Issues.test.ts @@ -1,8 +1,8 @@ -import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.ts"; +import { ClavaLegacyTester } from "../vitest/ClavaLegacyTester.ts"; import ClavaJavaTypes from "./clava/ClavaJavaTypes.ts"; import path from "path"; -/* eslint-disable jest/expect-expect */ +/* oxlint-disable vitest/expect-expect */ describe("IssuesTest", () => { function newTester() { return new ClavaLegacyTester( diff --git a/Clava-JS/api/Query.test.ts b/Clava-JS/api/Query.test.ts index ca2fba6d11..f937f5a1fb 100644 --- a/Clava-JS/api/Query.test.ts +++ b/Clava-JS/api/Query.test.ts @@ -1,4 +1,4 @@ -import { registerSourceCode } from "@specs-feup/lara/jest/jestHelpers.ts"; +import { registerSourceCode } from "@specs-feup/lara/vitest/weaverTestHelpers.ts"; import Query from "@specs-feup/lara/api/weaver/Query.ts"; import { FunctionJp, Loop } from "./Joinpoints.ts"; diff --git a/Clava-JS/api/clava/ClavaJavaTypes.ts b/Clava-JS/api/clava/ClavaJavaTypes.ts index 3f3d47692d..e617cf3b43 100644 --- a/Clava-JS/api/clava/ClavaJavaTypes.ts +++ b/Clava-JS/api/clava/ClavaJavaTypes.ts @@ -2,9 +2,9 @@ import JavaTypes, { type JavaClasses, } from "@specs-feup/lara/api/lara/util/JavaTypes.ts"; -// eslint-disable-next-line @typescript-eslint/no-namespace +// oxlint-disable-next-line typescript/no-namespace export namespace ClavaJavaClasses { - /* eslint-disable @typescript-eslint/no-empty-object-type */ + /* oxlint-disable typescript/no-empty-object-type */ export interface ClavaNodes extends JavaClasses.JavaClass {} export interface ClavaNode extends JavaClasses.JavaClass {} export interface CxxJoinpoints extends JavaClasses.JavaClass {} @@ -19,7 +19,7 @@ export namespace ClavaJavaClasses { export interface CxxWeaverOption extends JavaClasses.JavaClass {} export interface ClavaOptions extends JavaClasses.JavaClass {} export interface CodeParser extends JavaClasses.JavaClass {} - /* eslint-enable @typescript-eslint/no-empty-object-type */ + /* oxlint-enable typescript/no-empty-object-type */ } /** diff --git a/Clava-JS/api/clava/ClavaJoinPoints.test.ts b/Clava-JS/api/clava/ClavaJoinPoints.test.ts index 53cf209c38..ae34056103 100644 --- a/Clava-JS/api/clava/ClavaJoinPoints.test.ts +++ b/Clava-JS/api/clava/ClavaJoinPoints.test.ts @@ -1,4 +1,4 @@ -import { registerSourceCode } from "@specs-feup/lara/jest/jestHelpers.ts"; +import { registerSourceCode } from "@specs-feup/lara/vitest/weaverTestHelpers.ts"; import Query from "@specs-feup/lara/api/weaver/Query.ts"; import { ExprStmt } from "../Joinpoints.ts"; import ClavaJoinPoints from "./ClavaJoinPoints.ts"; diff --git a/Clava-JS/api/jest.config.ts b/Clava-JS/api/jest.config.ts deleted file mode 100644 index 64b53490b5..0000000000 --- a/Clava-JS/api/jest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from "jest"; -import { weaverConfig } from "../code/WeaverConfiguration.ts"; - -export default defineConfig({ - preset: "ts-jest/presets/default-esm", - testEnvironment: "@specs-feup/lara/jest/jestEnvironment.ts", - globalSetup: "@specs-feup/lara/jest/jestGlobalSetup.ts", - globalTeardown: "@specs-feup/lara/jest/jestGlobalTeardown.ts", - setupFiles: ["@specs-feup/lara/jest/setupFiles/sharedJavaModule.ts"], - setupFilesAfterEnv: ["@specs-feup/lara/jest/setupFiles/importSideEffects.ts"], - moduleNameMapper: { - "(.+)\\.js": "$1", - }, - testEnvironmentOptions: { - weaverConfig, - }, -}); diff --git a/Clava-JS/clang-plugin-binaries/ClangASTDumper_14.0.6.so b/Clava-JS/clang-plugin-binaries/ClangASTDumper_14.0.6.so deleted file mode 100755 index d014202170..0000000000 Binary files a/Clava-JS/clang-plugin-binaries/ClangASTDumper_14.0.6.so and /dev/null differ diff --git a/Clava-JS/clang-plugin-binaries/plugin-14.so b/Clava-JS/clang-plugin-binaries/plugin-14.so deleted file mode 100755 index 577f9ac1bc..0000000000 Binary files a/Clava-JS/clang-plugin-binaries/plugin-14.so and /dev/null differ diff --git a/Clava-JS/clang-plugin-binaries/plugin-15.so b/Clava-JS/clang-plugin-binaries/plugin-15.so deleted file mode 100755 index 6b86438dd0..0000000000 Binary files a/Clava-JS/clang-plugin-binaries/plugin-15.so and /dev/null differ diff --git a/Clava-JS/clang-plugin-binaries/plugin-16.so b/Clava-JS/clang-plugin-binaries/plugin-16.so deleted file mode 100755 index a6b176b590..0000000000 Binary files a/Clava-JS/clang-plugin-binaries/plugin-16.so and /dev/null differ diff --git a/Clava-JS/clava.json b/Clava-JS/clava.json deleted file mode 100644 index 48ccc2168a..0000000000 --- a/Clava-JS/clava.json +++ /dev/null @@ -1 +0,0 @@ -{ "watch": "CxxTestSources/test1" } diff --git a/Clava-JS/code/ClangPlugin/ClangPlugin.test.ts b/Clava-JS/code/ClangPlugin/ClangPlugin.test.ts index 376983f398..cea1531967 100644 --- a/Clava-JS/code/ClangPlugin/ClangPlugin.test.ts +++ b/Clava-JS/code/ClangPlugin/ClangPlugin.test.ts @@ -1,4 +1,4 @@ -import { jest } from "@jest/globals"; +import { vi } from "vitest"; import fs from "fs"; import path from "path"; @@ -76,17 +76,17 @@ describe("ClangPlugin", () => { const actualMap = await ClangPlugin.getAvailablePlugins(); expect(actualMap).toEqual(expectedMap); - jest.restoreAllMocks(); + vi.restoreAllMocks(); }); it("should throw an error when the clang-plugin-binaries directory does not exist", async () => { - jest.spyOn(fs, "existsSync").mockClear().mockReturnValue(false); + vi.spyOn(fs, "existsSync").mockClear().mockReturnValue(false); await expect(ClangPlugin.getAvailablePlugins()).rejects.toThrow( "Could not find 'clang-plugin-binaries' directory" ); - jest.restoreAllMocks(); + vi.restoreAllMocks(); }); }); */ diff --git a/Clava-JS/code/jest.config.ts b/Clava-JS/code/jest.config.ts deleted file mode 100644 index 76873b4a20..0000000000 --- a/Clava-JS/code/jest.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from "jest"; - -export default defineConfig({ - preset: "ts-jest/presets/default-esm", - testEnvironment: "node", - moduleNameMapper: { - "(.+)\\.js": "$1", - }, -}); diff --git a/Clava-JS/eslint.config.ts b/Clava-JS/eslint.config.ts deleted file mode 100644 index 7df9bdcf0e..0000000000 --- a/Clava-JS/eslint.config.ts +++ /dev/null @@ -1,52 +0,0 @@ -import js from "@eslint/js"; -import eslintConfigPrettier from "eslint-config-prettier"; -import jest from "eslint-plugin-jest"; -import tsdoc from "eslint-plugin-tsdoc"; -import { defineConfig } from "eslint/config"; -import { dirname } from "path"; -import typescriptEslint from "typescript-eslint"; -import { fileURLToPath } from "url"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); - -export default defineConfig([ - js.configs.recommended, - eslintConfigPrettier, - ...typescriptEslint.configs.recommended, - { - plugins: { - "@typescript-eslint": typescriptEslint.plugin, - tsdoc, - }, - - languageOptions: { - parser: typescriptEslint.parser, - ecmaVersion: 5, - sourceType: "script", - - parserOptions: { - project: ["./tsconfig.json", "./tsconfig.*.json"], - tsconfigRootDir: __dirname, - }, - }, - - rules: { - "tsdoc/syntax": "warn", - }, - }, - { - ...jest.configs["flat/recommended"], - files: ["**/*.spec.ts", "**/*.test.ts"], - - plugins: { - jest, - }, - - languageOptions: { - globals: { - ...jest.environments.globals.globals, - }, - }, - }, -]); diff --git a/Clava-JS/jest.config.ts b/Clava-JS/jest.config.ts deleted file mode 100644 index cfa242603e..0000000000 --- a/Clava-JS/jest.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from "jest"; - -export default defineConfig({ - preset: "ts-jest/presets/default-esm", - testEnvironment: "node", - notify: true, - notifyMode: "always", - //verbose: true, - collectCoverage: false, - coverageDirectory: "coverage", - coverageReporters: ["text", "lcov"], - collectCoverageFrom: ["**/*[^.d].(t|j)s"], - coverageProvider: "v8", - moduleNameMapper: { - "(.+)\\.js": "$1", - }, - projects: ["api", "code"], -}); diff --git a/Clava-JS/jest/ClavaLegacyTester.ts b/Clava-JS/jest/ClavaLegacyTester.ts deleted file mode 100644 index a57c0c07e6..0000000000 --- a/Clava-JS/jest/ClavaLegacyTester.ts +++ /dev/null @@ -1,44 +0,0 @@ -import ClavaJavaTypes, { - type ClavaJavaClasses, -} from "../api/clava/ClavaJavaTypes.ts"; - -import { WeaverLegacyTester } from "@specs-feup/lara/jest/WeaverLegacyTester.ts"; - -export class ClavaLegacyTester extends WeaverLegacyTester { - protected readonly WORK_FOLDER: string = "cxx_weaver_output"; - private readonly standard: ClavaJavaClasses.Standard; - private readonly compilerFlags: string; - - public constructor( - basePackage: string, - standard: ClavaJavaClasses.Standard, - compilerFlags: string = "" - ) { - super(basePackage); - this.standard = standard; - this.compilerFlags = compilerFlags; - - this.set(ClavaJavaTypes.ClavaOptions.FLAGS, this.compilerFlags); - } - - public async test( - laraResource: string, - ...codeResources: string[] - ): Promise { - if (this.standard != null) { - this.set(ClavaJavaTypes.ClavaOptions.STANDARD, this.standard); - } - - this.set( - ClavaJavaTypes.CxxWeaverOption.CHECK_SYNTAX, - this.checkWovenCodeSyntax - ); - this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CLAVA_INFO, true); - this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CODE_GENERATION); - - // Enable parallel parsing - //this.set(ClavaJavaTypes.ParallelCodeParser.PARALLEL_PARSING); - - await super.test(laraResource, ...codeResources); - } -} diff --git a/Clava-JS/oxlint.config.ts b/Clava-JS/oxlint.config.ts new file mode 100644 index 0000000000..2f6883cbde --- /dev/null +++ b/Clava-JS/oxlint.config.ts @@ -0,0 +1,6 @@ +import config from "@specs-feup/lara/oxlint.config.ts"; +import { defineConfig } from "oxlint"; + +export default defineConfig({ + extends: [config], +}); diff --git a/Clava-JS/package.json b/Clava-JS/package.json index a19401e298..b9b559c9f9 100644 --- a/Clava-JS/package.json +++ b/Clava-JS/package.json @@ -1,6 +1,6 @@ { "name": "@specs-feup/clava", - "version": "3.5.1", + "version": "4.0.0", "description": "A C/C++ source-to-source compiler written in Typescript", "type": "module", "bin": { @@ -23,20 +23,23 @@ "code", "java-binaries", ".gitignore", - "eslint.config.ts", - "jest.config.ts", "LICENSE", + "oxlint.config.ts", "package.json", "README.md", "tsconfig.json", - "typedoc.config.js" + "typedoc.config.js", + "vitest.config.ts" ], "scripts": { "run": "node ./code/index.ts", "build": "tsc", "build:watch": "npm run build -- --watch", - "lint": "eslint --flag unstable_native_nodejs_ts_config .", - "test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --detectOpenHandles --forceExit", + "lint": "oxlint .", + "format": "oxfmt .", + "format:check": "oxfmt --check .", + "prepack": "node --input-type=module --eval \"import { validateJavaBinaries } from '@specs-feup/lara/scripts/validateJavaBinaries.js'; validateJavaBinaries();\"", + "test": "vitest run", "test:api": "npm run test -- api", "test:code": "npm run test -- code", "test:cov": "npm run test -- --coverage", @@ -62,25 +65,20 @@ }, "homepage": "https://github.com/specs-feup/clava#readme", "dependencies": { - "@specs-feup/lara": "~3.5.0", + "@specs-feup/lara": "^4.0.0", "cytoscape": "^3.33.1" }, "devDependencies": { - "@jest/globals": "^30.2.0", "@types/debug": "^4.1.12", "@types/java": "^0.9.6", - "@types/jest": "^30.0.0", - "@types/node": "^25.0.0", + "@types/node": "^24.0.0", "@types/yargs": "^17.0.35", - "cross-env": "^10.1.0", - "eslint": "^9.39.2", - "eslint-config-prettier": "^10.1.8", - "eslint-plugin-jest": "^29.12.1", + "@vitest/coverage-v8": "^4.1.10", "eslint-plugin-tsdoc": "^0.5.0", - "jest": "^30.2.0", - "node-notifier": "^10.0.1", - "ts-jest": "^29.4.6", - "typescript": "^6.0.3", - "typescript-eslint": "^8.52.0" + "oxfmt": "^0.59.0", + "oxlint": "^1.74.0", + "typescript": "^7.0.2", + "oxlint-tsgolint": "^7.0.2001", + "vitest": "^4.1.10" } } diff --git a/Clava-JS/tsconfig.json b/Clava-JS/tsconfig.json index 45c2114568..416c109338 100644 --- a/Clava-JS/tsconfig.json +++ b/Clava-JS/tsconfig.json @@ -6,7 +6,7 @@ "strict": true, "isolatedModules": true, "allowSyntheticDefaultImports": true, - "types": ["node", "jest"], + "types": ["node", "vitest/globals"], "rewriteRelativeImportExtensions": true, "erasableSyntaxOnly": true, "verbatimModuleSyntax": true diff --git a/Clava-JS/vitest.config.ts b/Clava-JS/vitest.config.ts new file mode 100644 index 0000000000..8a6562ca7c --- /dev/null +++ b/Clava-JS/vitest.config.ts @@ -0,0 +1,4 @@ +import { createWeaverVitestConfig } from "@specs-feup/lara/vitest/weaverVitestConfig.ts"; +import { weaverConfig } from "./code/WeaverConfiguration.ts"; + +export default createWeaverVitestConfig(weaverConfig); diff --git a/Clava-JS/vitest/ClavaLegacyTester.ts b/Clava-JS/vitest/ClavaLegacyTester.ts new file mode 100644 index 0000000000..3b038339e5 --- /dev/null +++ b/Clava-JS/vitest/ClavaLegacyTester.ts @@ -0,0 +1,44 @@ +import ClavaJavaTypes, { + type ClavaJavaClasses, +} from "../api/clava/ClavaJavaTypes.ts"; + +import { WeaverLegacyTester } from "@specs-feup/lara/vitest/WeaverLegacyTester.ts"; + +export class ClavaLegacyTester extends WeaverLegacyTester { + protected readonly WORK_FOLDER: string = "cxx_weaver_output"; + private readonly standard: ClavaJavaClasses.Standard; + private readonly compilerFlags: string; + + public constructor( + basePackage: string, + standard: ClavaJavaClasses.Standard, + compilerFlags: string = "", + ) { + super(basePackage); + this.standard = standard; + this.compilerFlags = compilerFlags; + + this.set(ClavaJavaTypes.ClavaOptions.FLAGS, this.compilerFlags); + } + + public async test( + laraResource: string, + ...codeResources: string[] + ): Promise { + if (this.standard != null) { + this.set(ClavaJavaTypes.ClavaOptions.STANDARD, this.standard); + } + + this.set( + ClavaJavaTypes.CxxWeaverOption.CHECK_SYNTAX, + this.checkWovenCodeSyntax, + ); + this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CLAVA_INFO, true); + this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CODE_GENERATION); + + // Enable parallel parsing + //this.set(ClavaJavaTypes.ParallelCodeParser.PARALLEL_PARSING); + + await super.test(laraResource, ...codeResources); + } +} diff --git a/ClavaWeaver/build.gradle b/ClavaWeaver/build.gradle index 1ff759a7e0..91128a6e1c 100644 --- a/ClavaWeaver/build.gradle +++ b/ClavaWeaver/build.gradle @@ -73,3 +73,36 @@ tasks.register('generateWeaver', JavaExec) { } compileJava.dependsOn generateWeaver + +def clavaWeaverInstallDir = layout.buildDirectory.dir('install/ClavaWeaver') +def clavaJsJavaBinaries = layout.projectDirectory.dir('../Clava-JS/java-binaries') + +def syncClavaJsJavaBinaries = tasks.register('syncClavaJsJavaBinaries', Sync) { + group = 'distribution' + description = 'Synchronizes the ClavaWeaver installDist output used by Clava-JS.' + dependsOn tasks.named('installDist') + from clavaWeaverInstallDir + into clavaJsJavaBinaries + + // The destination is also used by npm packaging and must not retain files + // that are no longer part of installDist. + outputs.upToDateWhen { false } + + doFirst { + def installLib = clavaWeaverInstallDir.get().dir('lib').asFile + if (!installLib.isDirectory()) { + throw new GradleException("ClavaWeaver installDist output is missing: ${installLib}") + } + + def destination = clavaJsJavaBinaries.asFile.toPath() + if (java.nio.file.Files.isSymbolicLink(destination)) { + java.nio.file.Files.delete(destination) + } else if (java.nio.file.Files.exists(destination) && !java.nio.file.Files.isDirectory(destination)) { + throw new GradleException("Clava-JS java-binaries is not a directory: ${destination}") + } + } +} + +tasks.named('installDist') { + finalizedBy syncClavaJsJavaBinaries +}