Skip to content

Support incremental builds #1180

@deemp

Description

@deemp

Superseded by purescript/purescript#3995

Related to #700

Problem

Hi! spago seems to ignore already compiled files.

Steps to reproduce

  1. Clone this repo at master or at a commit, e.g. bbe37b6.

  2. Remove the output directory.

  3. Run spago build.

    • you may see logs like this:
    Reading Spago workspace configuration...
    
    ✅ Selecting 6 packages to build:
        docs-search-client-halogen
        docs-search-common
        docs-search-index
        spago
        spago-bin
        spago-core
    
    Downloading dependencies...
    Building...
    [  11 of 1014] Compiling Record.Unsafe
    [  10 of 1014] Compiling Spago.Command.Script
    [   9 of 1014] Compiling Web.DOM.Internal.Types
    [   3 of 1014] Compiling Spago.Generated.BuildInfo
    [   7 of 1014] Compiling Type.Function
    [   2 of 1014] Compiling Type.Row
    [   1 of 1014] Compiling Unsafe.Coerce
    [   6 of 1014] Compiling Web.Event.Internal.Types
    [   4 of 1014] Compiling Type.Proxy
    [   8 of 1014] Compiling Type.Equality
    [   5 of 1014] Compiling Spago.Texts
    [  12 of 1014] Compiling Partial
    ...
  4. Interrupt the build (Ctrl+C in my case) before it finishes.

  5. Check the output directory (part of the logs is omitted).

    tree output
    output
    |-- Control.Semigroupoid
    |   |-- corefn.json
    |   |-- docs.json
    |   |-- externs.cbor
    |   |-- index.js
    |   `-- index.js.map
    |-- Data.ArrayBuffer.Types
    |   |-- corefn.json
    |   |-- docs.json
    |   |-- externs.cbor
    |   |-- index.js
    |   `-- index.js.map
    |-- Data.Boolean
    |   |-- corefn.json
    |   |-- docs.json
    |   |-- externs.cbor
    |   |-- index.js
    |   `-- index.js.map
    
    ...
    
    23 directories, 116 files
  6. Record the statistics on output/Control.Semigroupoid/index.js.

    $ stat output/Control.Semigroupoid/index.js
    Access: 2024-01-25 01:19:46.011057433 +0300
    Modify: 2024-01-25 01:32:12.667933173 +0300
    Change: 2024-01-25 01:32:12.667933173 +0300
    Birth: 2024-01-25 01:19:46.011057433 +0300
  7. Run spago build again.

    Reading Spago workspace configuration...
    
    ✅ Selecting 6 packages to build:
        docs-search-client-halogen
        docs-search-common
        docs-search-index
        spago
        spago-bin
        spago-core
    
    Downloading dependencies...
    Building...
    [   3 of 1014] Compiling Web.DOM.Internal.Types
    [   8 of 1014] Compiling Type.Function
    [   7 of 1014] Compiling Type.Proxy
    [   1 of 1014] Compiling Type.Equality
    [   5 of 1014] Compiling Type.Row
    [   6 of 1014] Compiling Web.Event.Internal.Types
    [   2 of 1014] Compiling Spago.Texts
    [   4 of 1014] Compiling Unsafe.Coerce
    [   9 of 1014] Compiling Spago.Generated.BuildInfo
    [  10 of 1014] Compiling Spago.Command.Script
    [  11 of 1014] Compiling Record.Unsafe
    [  12 of 1014] Compiling Partial
    [  13 of 1014] Compiling JS.Fetch.Referrer
    [  14 of 1014] Compiling Data.Void
    [  15 of 1014] Compiling Data.Unit
    [  16 of 1014] Compiling Data.Traversable.Accum
    [  17 of 1014] Compiling Data.String.Unsafe
    [  18 of 1014] Compiling Data.NaturalTransformation
    [  19 of 1014] Compiling Data.Int.Bits
    [  20 of 1014] Compiling Data.Boolean
    [  21 of 1014] Compiling Data.ArrayBuffer.Types
    [  22 of 1014] Compiling Control.Semigroupoid
  8. Interrupt the build.

  9. Record the statistics on output/Control.Semigroupoid/index.js.

    Access: 2024-01-25 01:19:46.011057433 +0300
    Modify: 2024-01-25 01:35:40.739062556 +0300
    Change: 2024-01-25 01:35:40.739062556 +0300
    Birth: 2024-01-25 01:19:46.011057433 +0300

Expected result

  • No built file is modified during a new build
  • spago build-s less files (now it's 1014) on subsequent runs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions