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

Solidity build system #5766

Merged
merged 1 commit into from
Oct 11, 2024
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
"lint:fix": "pnpm run --recursive lint:fix && pnpm prettier --write",
"prettier": "prettier *.md \"{docs,.github}/**/*.{md,yml,ts,js}\" \"scripts/**/*.js\"",
"vnext-full-check": "pnpm run --recursive --filter \"./v-next/**\" build && pnpm run --recursive --filter \"./v-next/**\" lint && pnpm run --recursive --filter \"./v-next/**\" test"
},
"dependencies": {}
}
}
100 changes: 46 additions & 54 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions scripts/check-v-next-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const fs = require("fs");
const path = require("path");

const IGNORED_PACKAGE_FOLDERS = new Set(["hardhat-build-system"]);

/**
* @typedef {Object} Package
* @property {string} name
Expand Down Expand Up @@ -56,9 +58,9 @@ function main() {
function getAllPackageJsonPaths() {
const packageNames = fs.readdirSync(path.join(__dirname, "..", "v-next"));

const packageJsons = packageNames.map((p) =>
path.join(__dirname, "..", "v-next", p, "package.json")
);
const packageJsons = packageNames
.filter((p) => !IGNORED_PACKAGE_FOLDERS.has(p))
.map((p) => path.join(__dirname, "..", "v-next", p, "package.json"));

return packageJsons;
}
Expand Down
7 changes: 7 additions & 0 deletions v-next/example-project/contracts/A.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
pragma solidity *;

import "./B.sol";

contract A is B {}
6 changes: 6 additions & 0 deletions v-next/example-project/contracts/B.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";

contract B {}
8 changes: 8 additions & 0 deletions v-next/example-project/contracts/C.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "./B.sol";

contract C {}

contract C2 {}
1 change: 1 addition & 0 deletions v-next/example-project/contracts/D.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./C.sol";
4 changes: 4 additions & 0 deletions v-next/example-project/contracts/NoImports.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.7.0;

contract NoImports {}
4 changes: 4 additions & 0 deletions v-next/example-project/contracts/UserRemappedImport.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.0;

import "remapped/Ownable.sol";
29 changes: 29 additions & 0 deletions v-next/example-project/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { viemScketchPlugin } from "./viem-scketch-plugin.js";
import hardhatNetworkHelpersPlugin from "@ignored/hardhat-vnext-network-helpers";
import hardhatEthersPlugin from "@ignored/hardhat-vnext-ethers";

util.inspect.defaultOptions.depth = null;

const exampleEmptyTask = emptyTask("empty", "An example empty task").build();

const exampleEmptySubtask = task(["empty", "task"])
Expand Down Expand Up @@ -135,6 +137,33 @@ const config: HardhatUserConfig = {
nodeTest: "test/node",
},
},
solidity: {
profiles: {
default: {
compilers: [
{
version: "0.8.22",
},
{
version: "0.7.1",
},
],
overrides: {
"foo/bar.sol": {
version: "0.8.1",
},
},
},
test: {
version: "0.8.2",
},
coverage: {
version: "0.8.2",
},
},
dependenciesToCompile: ["@openzeppelin/contracts/token/ERC20/ERC20.sol"],
remappings: ["remapped/=npm/@openzeppelin/[email protected]/access/"],
},
};

export default config;
Loading