Skip to content
Open
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
46 changes: 23 additions & 23 deletions buidler/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package buidler
package builder

import (
"encoding/json"
Expand All @@ -23,27 +23,27 @@ type BuidlerConfig struct {
}

func (dp *DeploymentProvider) GetConfig(configName string, projectDir string) (*providers.Config, error) {
buidlerPath := filepath.Join(projectDir, configName)
builderPath := filepath.Join(projectDir, configName)
divider := getDivider()

logrus.Debugf("Trying buidler config path: %s", buidlerPath)
logrus.Debugf("Trying builder config path: %s", builderPath)

_, err := os.Stat(buidlerPath)
_, err := os.Stat(builderPath)
if os.IsNotExist(err) {
return nil, err
}
if err != nil {
return nil, fmt.Errorf("cannot find %s, tried path: %s, error: %s", configName, buidlerPath, err)
return nil, fmt.Errorf("cannot find %s, tried path: %s, error: %s", configName, builderPath, err)
}

if runtime.GOOS == "windows" {
buidlerPath = strings.ReplaceAll(buidlerPath, `\`, `\\`)
builderPath = strings.ReplaceAll(builderPath, `\`, `\\`)
}

data, err := exec.Command("node", "-e", fmt.Sprintf(`
let { BuidlerContext } = require("@nomiclabs/buidler/internal/context");
let { loadConfigAndTasks } = require("@nomiclabs/buidler/internal/core/config/config-loading");
let { loadTsNodeIfPresent } = require("@nomiclabs/buidler/internal/core/typescript-support");
let { BuidlerContext } = require("@nomiclabs/builder/internal/context");
let { loadConfigAndTasks } = require("@nomiclabs/builder/internal/core/config/config-loading");
let { loadTsNodeIfPresent } = require("@nomiclabs/builder/internal/core/typescript-support");


loadTsNodeIfPresent();
Expand Down Expand Up @@ -71,11 +71,11 @@ func (dp *DeploymentProvider) GetConfig(configName string, projectDir string) (*

console.log("%s" + jsonConfig + "%s");
process.exit(0);
`, buidlerPath, divider, divider)).CombinedOutput()
`, builderPath, divider, divider)).CombinedOutput()
if err != nil {
return nil, fmt.Errorf(
"cannot evaluate %s, tried path: %s, error: %s, output: %s",
configName, buidlerPath, err, string(data))
configName, builderPath, err, string(data))
}

configString, err := providers.ExtractConfigWithDivider(string(data), divider)
Expand All @@ -84,19 +84,19 @@ func (dp *DeploymentProvider) GetConfig(configName string, projectDir string) (*
return nil, fmt.Errorf("cannot read %s", configName)
}

var buidlerConfig BuidlerConfig
err = json.Unmarshal([]byte(configString), &buidlerConfig)
var builderConfig BuidlerConfig
err = json.Unmarshal([]byte(configString), &builderConfig)
if err != nil {
logrus.Debugf("failed unmarshaling config: %s", err)
return nil, fmt.Errorf("cannot read %s", configName)
}

buidlerConfig.ProjectDirectory = projectDir
buidlerConfig.ConfigType = configName
builderConfig.ProjectDirectory = projectDir
builderConfig.ConfigType = configName

networks := make(map[string]providers.NetworkConfig)

for key, network := range buidlerConfig.Networks {
for key, network := range builderConfig.Networks {
networkId := network.NetworkID
if val, ok := dp.NetworkIdMap[key]; ok {
networkId = val
Expand All @@ -108,13 +108,13 @@ func (dp *DeploymentProvider) GetConfig(configName string, projectDir string) (*
}

return &providers.Config{
ProjectDirectory: buidlerConfig.ProjectDirectory,
BuildDirectory: buidlerConfig.BuildDirectory,
ProjectDirectory: builderConfig.ProjectDirectory,
BuildDirectory: builderConfig.BuildDirectory,
Networks: networks,
Compilers: map[string]providers.Compiler{
"solc": buidlerConfig.Solc,
"solc": builderConfig.Solc,
},
ConfigType: buidlerConfig.ConfigType,
ConfigType: builderConfig.ConfigType,
}, nil
}

Expand All @@ -124,7 +124,7 @@ func getDivider() string {

func (dp *DeploymentProvider) MustGetConfig() (*providers.Config, error) {
projectDir, err := filepath.Abs(config.ProjectDirectory)
buidlerConfigFile := providers.BuidlerConfigFile
builderConfigFile := providers.BuidlerConfigFile

if err != nil {
return nil, userError.NewUserError(
Expand All @@ -133,13 +133,13 @@ func (dp *DeploymentProvider) MustGetConfig() (*providers.Config, error) {
)
}

buidlerConfig, err := dp.GetConfig(buidlerConfigFile, projectDir)
builderConfig, err := dp.GetConfig(builderConfigFile, projectDir)
if err != nil {
return nil, userError.NewUserError(
fmt.Errorf("unable to fetch config: %s", err),
"Couldn't read Buidler config file",
)
}

return buidlerConfig, nil
return builderConfig, nil
}
4 changes: 2 additions & 2 deletions commands/contract/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func uploadContracts(rest *rest.Rest) error {
if numberOfContractsWithANetwork == 0 {
if commands.DeploymentProvider.GetProviderName() == providers.OpenZeppelinDeploymentProvider {
pushErrors[projectSlug] = userError.NewUserError(
fmt.Errorf("no contracts with a netowrk found in build dir: %s", providerConfig.AbsoluteBuildDirectoryPath()),
fmt.Errorf("no contracts with a network found in build dir: %s", providerConfig.AbsoluteBuildDirectoryPath()),
commands.Colorizer.Sprintf("No migrated contracts detected in build directory: %s. This can happen when no contracts have been migrated yet.\n"+
"There is currently an issue with exporting networks for regular contracts.\nThe OpenZeppelin team has come up with a workaround,"+
"so make sure you run %s before running %s\n"+
Expand All @@ -129,7 +129,7 @@ func uploadContracts(rest *rest.Rest) error {
continue
}
pushErrors[projectSlug] = userError.NewUserError(
fmt.Errorf("no contracts with a netowrk found in build dir: %s", providerConfig.AbsoluteBuildDirectoryPath()),
fmt.Errorf("no contracts with a network found in build dir: %s", providerConfig.AbsoluteBuildDirectoryPath()),
commands.Colorizer.Sprintf("No migrated contracts detected in build directory: %s. This can happen when no contracts have been migrated yet.",
commands.Colorizer.Bold(commands.Colorizer.Red(providerConfig.AbsoluteBuildDirectoryPath())),
),
Expand Down
6 changes: 3 additions & 3 deletions providers/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ func (d DeploymentProviderName) String() string {
const (
TruffleDeploymentProvider DeploymentProviderName = "Truffle"
OpenZeppelinDeploymentProvider DeploymentProviderName = "OpenZeppelin"
BuidlerDeploymentProvider DeploymentProviderName = "Buidler"
BuilderDeploymentProvider DeploymentProviderName = "Builder"
HardhatDeploymentProvider DeploymentProviderName = "Hardhat"
BrownieDeploymentProvider DeploymentProviderName = "Brownie"

HardhatConfigFile = "hardhat.config.js"
HardhatConfigFileTs = "hardhat.config.ts"

BuidlerConfigFile = "buidler.config.js"
BuilderConfigFile = "buidler.config.js"

NewTruffleConfigFile = "truffle-config.js"
OldTruffleConfigFile = "truffle.js"
Expand All @@ -45,7 +45,7 @@ const (
var AllProviders = []DeploymentProviderName{
TruffleDeploymentProvider,
OpenZeppelinDeploymentProvider,
BuidlerDeploymentProvider,
BuilderDeploymentProvider,
HardhatDeploymentProvider,
BrownieConfigFile,
}
Expand Down
4 changes: 2 additions & 2 deletions rest/payloads/generated/actions/structs.conjure.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (o *BlockTrigger) UnmarshalYAML(unmarshal func(interface{}) error) error {
return safejson.Unmarshal(jsonBytes, *&o)
}

// Action invokation result.
// Action invocation result.
type Call struct {
Id string `json:"id"`
ActionId string `json:"actionId"`
Expand Down Expand Up @@ -474,7 +474,7 @@ func (o *CallStats) UnmarshalYAML(unmarshal func(interface{}) error) error {
return safejson.Unmarshal(jsonBytes, *&o)
}

// Summary of action invokation result since full call can be large. Keep this in sync with call.
// Summary of action invocation result since full call can be large. Keep this in sync with call.
type CallSummary struct {
Id string `json:"id"`
ActionId string `json:"actionId"`
Expand Down