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 #

Build trace for the host platform. If an artifact includes this in its trace, it is platform-dependent and will be rebuilt on different host platforms.

Equations
Instances For
    @[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. Returns whether info was already up-to-date.

      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
        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

              Replays the JSON log in logFile (if it exists). If the log file is malformed, logs a warning.

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

                Saves the log produce by build as JSON to logFile.

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

                  Builds 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. Build logs (if any) are saved to a .log.json file and replayed from there if the build is skipped.

                  For example, given file := "foo.c", compares depTrace with that in foo.c.trace with the hash cache in foo.c.hash and the log cache in foo.c.log.json.

                  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 (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.JobM 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