Skip to content

Commit

Permalink
Merge pull request #5766 from NomicFoundation/solidity-build-system
Browse files Browse the repository at this point in the history
Solidity build system
  • Loading branch information
kanej authored Oct 11, 2024
2 parents b2e9b3d + 18ddcf7 commit ef2a5de
Show file tree
Hide file tree
Showing 113 changed files with 7,633 additions and 428 deletions.
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/contracts@5.0.2/access/"],
},
};

export default config;
Loading

0 comments on commit ef2a5de

Please sign in to comment.