Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move shouldMergeCompilationJobs call to the build system #6416

Merged
merged 6 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/selfish-worms-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Moved the calls to shouldMergeCompilationJobs from the task actions to the build system and made its' result the default fallback to use in absence of the mergeCompilationJobs option.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
import chalk from "chalk";

import { shouldMergeCompilationJobs } from "../solidity/build-profiles.js";
import {
getArtifacts,
getBuildInfos,
Expand Down Expand Up @@ -75,9 +74,6 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
const buildOptions: BuildOptions = {
force: false,
buildProfile: hre.globalOptions.buildProfile,
mergeCompilationJobs: shouldMergeCompilationJobs(
hre.globalOptions.buildProfile,
),
quiet: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import debug from "debug";
import pMap from "p-map";

import { FileBuildResultType } from "../../../../types/solidity/build-system.js";
import { DEFAULT_BUILD_PROFILE } from "../build-profiles.js";
import {
DEFAULT_BUILD_PROFILE,
shouldMergeCompilationJobs,
} from "../build-profiles.js";

import {
getArtifactsDeclarationFile,
Expand Down Expand Up @@ -334,7 +337,10 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
subgraphsWithConfig.push([configOrError, subgraph]);
}

if (options?.mergeCompilationJobs === true) {
if (
options?.mergeCompilationJobs ??
shouldMergeCompilationJobs(buildProfileName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm my understanding. Instead of saying that invocations of the build system's build should set a bool on merging compilation jobs at each invocation site; we switch to there being a default behavior that matches the current two invocations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly! I want the shouldMergeCompilationJobs(buildProfileName) to become the default. The users of build() would still be able to set the mergeCompilationJobs bool option if they so choose.

) {
log(`Merging compilation jobs`);

const mergedSubgraphsByConfig: Map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { NewTaskActionFunction } from "../../../../types/tasks.js";

import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";

import { shouldMergeCompilationJobs } from "../build-profiles.js";
import { throwIfSolidityBuildFailed } from "../build-results.js";
import { isNpmRootPath } from "../build-system/root-paths-utils.js";

Expand Down Expand Up @@ -30,9 +29,6 @@ const compileAction: NewTaskActionFunction<CompileActionArguments> = async (
const results = await solidity.build(rootPaths, {
force,
buildProfile: globalOptions.buildProfile,
mergeCompilationJobs: shouldMergeCompilationJobs(
globalOptions.buildProfile,
),
quiet,
});

Expand Down
Loading