diff --git a/core/tests/ts-integration/scripts/build.ts b/core/tests/ts-integration/scripts/build.ts index 881478002ac..2816c529c06 100644 --- a/core/tests/ts-integration/scripts/build.ts +++ b/core/tests/ts-integration/scripts/build.ts @@ -1,10 +1,13 @@ import path from 'path'; import { exec } from 'child_process'; -import { needsRecompilation, setCompilationTime, isFolderEmpty } from './utils'; - -const CONTRACTS_DIR = 'contracts'; -const OUTPUT_DIR = 'artifacts-zk'; -const TIMESTAMP_FILE = 'last_compilation.timestamp'; // File to store the last compilation time +import { + needsRecompilation, + setCompilationTime, + isFolderEmpty, + CONTRACTS_DIR, + OUTPUT_DIR, + TIMESTAMP_FILE +} from './utils'; async function main() { const timestampFilePath = path.join(process.cwd(), TIMESTAMP_FILE); diff --git a/core/tests/ts-integration/scripts/compile-yul.ts b/core/tests/ts-integration/scripts/compile-yul.ts index ff83e733a4b..863aa71f381 100644 --- a/core/tests/ts-integration/scripts/compile-yul.ts +++ b/core/tests/ts-integration/scripts/compile-yul.ts @@ -5,12 +5,10 @@ import { exec as _exec, spawn as _spawn } from 'child_process'; import { getZksolcUrl, saltFromUrl } from '@matterlabs/hardhat-zksync-solc'; import { getCompilersDir } from 'hardhat/internal/util/global-dir'; import path from 'path'; -import { needsRecompilation, setCompilationTime } from './utils'; +import { needsRecompilation, setCompilationTime, CONTRACTS_DIR, TIMESTAMP_FILE_YUL } from './utils'; -const CONTRACTS_DIR = 'contracts'; const COMPILER_VERSION = '1.3.21'; const IS_COMPILER_PRE_RELEASE = false; -const TIMESTAMP_FILE = 'last_compilation_yul.timestamp'; // File to store the last compilation time async function compilerLocation(): Promise { const compilersCache = await getCompilersDir(); @@ -87,7 +85,7 @@ class CompilerPaths { } async function main() { - const timestampFilePath = path.join(process.cwd(), TIMESTAMP_FILE); + const timestampFilePath = path.join(process.cwd(), TIMESTAMP_FILE_YUL); const folderToCheck = path.join(process.cwd(), CONTRACTS_DIR); if (needsRecompilation(folderToCheck, timestampFilePath)) { diff --git a/core/tests/ts-integration/scripts/utils.ts b/core/tests/ts-integration/scripts/utils.ts index c285d34a528..3fe13f248f8 100644 --- a/core/tests/ts-integration/scripts/utils.ts +++ b/core/tests/ts-integration/scripts/utils.ts @@ -3,6 +3,11 @@ import * as fsPr from 'fs/promises'; import path from 'path'; import { exec } from 'child_process'; +const CONTRACTS_DIR = 'contracts'; +const OUTPUT_DIR = 'artifacts-zk'; +const TIMESTAMP_FILE = 'last_compilation.timestamp'; // File to store the last compilation time +const TIMESTAMP_FILE_YUL = 'last_compilation_yul.timestamp'; // File to store the last compilation time + // Get the latest file modification time in the watched folder function getLatestModificationTime(folder: string): Date | null { const files = fs.readdirSync(folder); @@ -78,3 +83,5 @@ export async function isFolderEmpty(folderPath: string): Promise { return true; // Return true if an error, as folder doesn't exist. } } + +export { CONTRACTS_DIR, OUTPUT_DIR, TIMESTAMP_FILE, TIMESTAMP_FILE_YUL }; diff --git a/etc/contracts-test-data/scripts/build.ts b/etc/contracts-test-data/scripts/build.ts index 505f9477063..19453939350 100644 --- a/etc/contracts-test-data/scripts/build.ts +++ b/etc/contracts-test-data/scripts/build.ts @@ -1,11 +1,14 @@ import path from 'path'; -import { needsRecompilation, setCompilationTime, isFolderEmpty } from './utils'; +import { + needsRecompilation, + setCompilationTime, + isFolderEmpty, + CONTRACTS_DIR, + OUTPUT_DIR, + TIMESTAMP_FILE +} from './utils'; import { exec } from 'child_process'; -const CONTRACTS_DIR = 'contracts'; -const OUTPUT_DIR = 'artifacts-zk'; -const TIMESTAMP_FILE = 'last_compilation.timestamp'; // File to store the last compilation time - async function main() { const timestampFilePath = path.join(process.cwd(), TIMESTAMP_FILE); const folderToCheck = path.join(process.cwd(), CONTRACTS_DIR); diff --git a/etc/contracts-test-data/scripts/utils.ts b/etc/contracts-test-data/scripts/utils.ts index c285d34a528..cde756391a1 100644 --- a/etc/contracts-test-data/scripts/utils.ts +++ b/etc/contracts-test-data/scripts/utils.ts @@ -3,6 +3,10 @@ import * as fsPr from 'fs/promises'; import path from 'path'; import { exec } from 'child_process'; +const CONTRACTS_DIR = 'contracts'; +const OUTPUT_DIR = 'artifacts-zk'; +const TIMESTAMP_FILE = 'last_compilation.timestamp'; // File to store the last compilation time + // Get the latest file modification time in the watched folder function getLatestModificationTime(folder: string): Date | null { const files = fs.readdirSync(folder); @@ -78,3 +82,5 @@ export async function isFolderEmpty(folderPath: string): Promise { return true; // Return true if an error, as folder doesn't exist. } } + +export { CONTRACTS_DIR, OUTPUT_DIR, TIMESTAMP_FILE };