Documentation

Lake.Build.Common

Common Build Tools #

This file defines general utilities that abstract common build functionality and provides some common concrete build functions.

General Utilities #

@[specialize #[]]
def Lake.BuildTrace.checkUpToDate {ι : Type u_1} [Lake.CheckExists ι] [Lake.GetMTime ι] (info : ι) (depTrace : Lake.BuildTrace) (traceFile : Lake.FilePath) :

Check if the info is up-to-date by comparing depTrace with traceFile.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[inline]
    def Lake.buildUnlessUpToDate {ι : Type u_1} [Lake.CheckExists ι] [Lake.GetMTime ι] (info : ι) (depTrace : Lake.BuildTrace) (traceFile : Lake.FilePath) (build : Lake.JobM PUnit) :

    Build info unless it already exists and depTrace matches that of the traceFile. If rebuilt, save the new depTrace to the tracefile.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Fetch the trace of a file that may have its hash already cached in a .hash file.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Compute the hash of a file and save it to a .hash file.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Build file using build unless it already exists and depTrace matches the trace stored in the .trace file. If built, save the new depTrace and cache file's hash in a .hash file. Otherwise, try to fetch the hash from the .hash file using fetchFileTrace.

          By example, for file := "foo.c", compare depTrace with that in foo.c.trace and cache the hash using foo.c.hash.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[inline]

            Build file using build after dep completes if the dependency's trace (and/or extraDepTrace) has changed.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[inline]

              Build file using build after deps have built if any of their traces change.

              Equations
              Instances For
                @[inline]

                Build file using build after deps have built if any of their traces change.

                Equations
                Instances For

                  Common Builds #

                  A build job for file that is expected to already exist (e.g., a source file).

                  Equations
                  Instances For
                    @[inline]
                    def Lake.buildO (name : String) (oFile : Lake.FilePath) (srcJob : Lake.BuildJob Lake.FilePath) (weakArgs : optParam (Array String) #[]) (traceArgs : optParam (Array String) #[]) (compiler : optParam Lake.FilePath { toString := "cc" }) (extraDepTrace : optParam (Lake.BuildM Lake.BuildTrace) (pure Lake.BuildTrace.nil)) :

                    Build an object file from a source file job using compiler. The invocation is:

                    compiler -c -o oFile srcFile weakArgs... traceArgs...
                    

                    The traceArgs are included as part of the dependency trace hash, whereas the weakArgs are not. Thus, system-dependent options like -I or -L should be weakArgs to avoid build artifact incompatibility between systems (i.e., a change in the file path should not cause a rebuild).

                    You can add more components to the trace via extraDepTrace, which will be computed in the resulting BuildJob before building.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[inline]

                      Build an object file from a source fie job (i.e, a lean -c output) using leanc.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Build a static library from object file jobs using the ar packaged with Lean.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Build a shared library by linking the results of linkJobs using leanc.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Build an executable by linking the results of linkJobs using leanc.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Build a shared library from a static library using leanc.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Construct a Dynlib object for a shared library target.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For