github.com/alex123012/deckhouse-controller-tools@v0.0.0-20230510090815-d594daf1af8c/pkg/genall/doc.go (about)

     1  /*
     2  Copyright 2019 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Package genall defines entrypoints for generation tools to hook into and
    18  // share the same set of parsing, typechecking, and marker information.
    19  //
    20  // # Generators
    21  //
    22  // Each Generator knows how to register its markers into a central Registry,
    23  // and then how to generate output using a Collector and some root packages.
    24  // Each generator can be considered to be the output type of a marker, for easy
    25  // command line parsing.
    26  //
    27  // # Output and Input
    28  //
    29  // Generators output artifacts via an OutputRule.  OutputRules know how to
    30  // write output for different package-associated (code) files, as well as
    31  // config files.  Each OutputRule should also be considered to be the output
    32  // type as a marker, for easy command-line parsing.
    33  //
    34  // OutputRules groups together an OutputRule per generator, plus a default
    35  // output rule for any not explicitly specified.
    36  //
    37  // OutputRules are defined for stdout, file writing, and sending to /dev/null
    38  // (useful for doing "type-checking" without actually saving the results).
    39  //
    40  // InputRule defines custom input loading, but its shared across all
    41  // Generators.  There's currently only a filesystem implementation.
    42  //
    43  // # Runtime and Context
    44  //
    45  // Runtime maps together Generators, and constructs "contexts" which provide
    46  // the common collector and roots, plus the output rule for that generator, and
    47  // a handle for reading files (like boilerplate headers).
    48  //
    49  // It will run all associated generators, printing errors and automatically
    50  // skipping type-checking errors (since those are commonly caused by the
    51  // partial type-checking of loader.TypeChecker).
    52  //
    53  // # Options
    54  //
    55  // The FromOptions (and associated helpers) function makes it easy to use generators
    56  // and output rules as markers that can be parsed from the command line, producing
    57  // a registry from command line args.
    58  package genall