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

Building frontend activates moc #3579

Open
vporton opened this issue Feb 8, 2024 · 3 comments
Open

Building frontend activates moc #3579

vporton opened this issue Feb 8, 2024 · 3 comments
Labels
needs-triage This ticket needs investigation.

Comments

@vporton
Copy link
Contributor

vporton commented Feb 8, 2024

Something is wrong.

I see in the terminal:

$ dfx deploy frontend
...
Building frontend...

and in the same time have 100% (one core) allocated to moc process.

How is compiling with .moc related to the frontend? At least, why does this building takes enormous time?

@vporton vporton added the needs-triage This ticket needs investigation. label Feb 8, 2024
@ericswanson-dfinity
Copy link
Member

In a default project, the frontend has a dependency on the backend. The call may be to moc --print-deps while building the dependencies graph.

    "frontend": {
      "dependencies": [
        "backend"
      ],

@vporton
Copy link
Contributor Author

vporton commented Feb 15, 2024

But it seems to happen after backend canisters are already compiled! First it produces some backend warnings and only then starts time-consuming Building frontend.... That's weird.

WARN: .mops/[email protected]/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;

WARN: .mops/[email protected]/src/Principal.mo:80.20-80.32: warning [M0154], field append is deprecated:
`Array.append` copies its arguments and has linear complexity;

Executing: cargo build --target wasm32-unknown-unknown --release -p ic_eth --locked
    Finished release [optimized] target(s) in 0.20s
Building frontend...
{
  "canisters": {
    "main": {
      "main": "src/backend/main.mo",
      "type": "motoko",
      "dependencies": [
        "order",
        "payments",
        "personhood",
        "CanDBIndex",
        "NacDBIndex",
        "internet_identity",
        "ic_eth"
      ]
    },
    "order": {
      "main": "src/backend/order.mo",
      "type": "motoko"
    },
    "personhood": {
      "main": "src/backend/personhood.mo",
      "type": "motoko",
      "dependencies": ["ic_eth", "CanDBIndex"]
    },
    "frontend": {
      "frontend": {
        "entrypoint": "src/frontend/src/index.html"
      },
      "dependencies": [
        "personhood"
      ],
      "source": [
        "src/frontend/assets",
        "dist/frontend/"
      ],
      "type": "assets"
    },
    "payments": {
      "main": "src/backend/payments.mo",
      "type": "motoko",
      "dependencies": [
        "pst"
      ]
    },
    "pst": {
      "main": "src/backend/pst.mo",
      "type": "motoko"
    },
    "CanDBIndex": {
      "main": "src/storage/CanDBIndex.mo",
      "type": "motoko",
      "dependencies": ["ic_eth"]
    },
    "NacDBIndex": {
      "main": "src/storage/NacDBIndex.mo",
      "type": "motoko",
      "dependencies": ["ic_eth"]
    },
    "CanDBPartition": {
      "main": "src/storage/CanDBPartition.mo",
      "type": "motoko",
      "dependencies": ["ic_eth"]
    },
    "NacDBPartition": {
      "main": "src/storage/NacDBPartition.mo",
      "type": "motoko",
      "dependencies": ["ic_eth"]
    },
    "ic_eth": {
      "type": "rust",
      "candid": "src/ic_eth/ic_eth.did",
      "package": "ic_eth"
    },
    "internet_identity": {
      "type": "custom",
      "candid": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did",
      "wasm": "https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm.gz",
      "shrink": false,
      "remote": {
        "candid": "internet_identity.did",
        "id": {
          "ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
        }
      }
    }
  },
  "ic_eth": {
    "type": "rust",
    "candid": "src/ic_eth/ic_eth.did",
    "package": "ic_eth"
  },
  "defaults": {
    "build": {
      "args": "-fshared-code --actor-idl .dfx/local/lsp",
      "packtool": "mops sources"
    }
  },
  "output_env_file": ".env",
  "version": 1,
  "networks": {
    "local": {
      "bind": "localhost:8000",
      "type": "ephemeral"
    }
  }
}

@chenyan-dfinity
Copy link
Collaborator

Right, there is a bug in the prompt. When it shows Building frontend..., it's actually still building backend. You can reproduce this by adding a syntax error in the backend code. The syntax error will show after Building frontend....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This ticket needs investigation.
Projects
None yet
Development

No branches or pull requests

3 participants