Skip to content

Commit

Permalink
master: split build command to avoid breakage
Browse files Browse the repository at this point in the history
I’m not entirely sure why, but build fails when building all the
packages together:

    cargo build -p neard -p genesis-populate -p restaked \
                -p near-test-contracts --features adversarial \
                --features nightly_protocol,nightly_protocol_features
    […]
    error[E0063]: missing field `evm_chain_id` in initializer of `ApplyState`
       --> test-utils/testlib/src/user/runtime_user.rs:131:9
        |
    131 |         ApplyState {
        |         ^^^^^^^^^^ missing `evm_chain_id`

    error[E0063]: missing field `evm_chain_id` in initializer of `ViewApplyState`
       --> test-utils/testlib/src/user/runtime_user.rs:246:26
        |
    246 |         let view_state = ViewApplyState {
        |                          ^^^^^^^^^^^^^^ missing `evm_chain_id`

    error: aborting due to 2 previous errors

However, things work fine if `neard` is built separately from the
other packages.  It has to do with `protocol_feature_evm` which is not
enabled in `testlib` when necessary.  Whatever the case may be, split
the build into two commands.

Fixes: #3
  • Loading branch information
mina86 committed Jul 25, 2021
1 parent ab6aa7d commit 76bcae5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions workers/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,25 @@ def cp(*, dst: Path, srcs: typing.Sequence[Path], create_dir: bool=False):
def build_target(spec: BuildSpec, runner: utils.Runner) -> bool:
print('Building {}target'.format('expensive ' if spec.is_expensive else ''))

def cargo(*cmd):
cmd = ['cargo', *cmd, *spec.features]
def cargo(*cmd, add_features=True):
cmd = ['cargo', *cmd]
if add_features:
cmd.extend(spec.features)
if spec.is_release:
cmd.append('--release')
return runner(cmd, cwd=Path('nearcore'))

ok = True
ok = ok and cargo('build', '-p', 'neard', '-p', 'genesis-populate',
'-p', 'restaked', '-p', 'near-test-contracts',
'--features', 'adversarial')
ok = ok and cargo('build', '-p', 'neard', '--features', 'adversarial')
ok = ok and cargo('build', '-p', 'genesis-populate', '-p', 'restaked',
'-p', 'near-test-contracts', add_features=False)
if spec.is_expensive:
# It reads better when the command arguments are aligned so allow long
# lines. pylint: disable=line-too-long
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '--workspace', '--features=expensive_tests')
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '-p', 'near-client', '-p', 'near-chunks', '-p', 'neard', '-p', 'near-chain', '--features=expensive_tests')
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '--workspace', '-p', 'nearcore', '--features=expensive_tests')
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '--workspace', '--features=expensive_tests')
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '-p', 'near-client', '-p', 'neard', '-p', 'near-chain', '--features=expensive_tests')
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '-p', 'near-chunks', '--features=expensive_tests', add_features=False)
ok = ok and cargo('test', '--no-run', '--target-dir', 'target_expensive', '--workspace', '-p', 'nearcore', '--features=expensive_tests')

return ok

Expand Down

0 comments on commit 76bcae5

Please sign in to comment.