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

go/tools: add gopackagesdriver #2858

Merged
merged 41 commits into from Jun 28, 2021
Merged

go/tools: add gopackagesdriver #2858

merged 41 commits into from Jun 28, 2021

Commits on Apr 3, 2021

  1. go/tools: add gopackagesdriver

    This commit introduces the GOPACKAGESDRIVER for rules_go
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 3, 2021
    Configuration menu
    Copy the full SHA
    a67afe0 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: Go <= 1.16 compatibility

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 3, 2021
    Configuration menu
    Copy the full SHA
    bdd0556 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2021

  1. go/tools/gopackagesdriver: don't use compiled Go files

    Those files are generated and will end up in the temporary mod cache,
    which isn't available later on.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    76e6753 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: explicitely ignore the C package

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    5a53ae2 View commit details
    Browse the repository at this point in the history
  3. go/tools/packagesdriver: fetch package name from the sources

    This handles some edges cases in which the import path last part is not
    the package name.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    d2b527a View commit details
    Browse the repository at this point in the history
  4. go/tools/gopackagesdriver: ensure bazel doesn't print out output files

    It's no use, and it can be a significant amount of files, so disable it.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    ce61882 View commit details
    Browse the repository at this point in the history
  5. go/tools/gopackagesdriver: don't index by package ID or files

    The indexing by ID was never used except for iterating on all packages.
    The file index isn't used either since the whole graph is dumped anyway.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    b08da87 View commit details
    Browse the repository at this point in the history
  6. go/tools/builders/stdliblist: ensure CC is absolute

    Needed when in a CGo environment for go list to work
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    5dd1e0e View commit details
    Browse the repository at this point in the history
  7. go/tools/gopackagedriver: fetch stdlib info from inner most target

    Fetch the stdlib JSON from the deepest target, and cascade it upward
    so that transitions are applied properly. Also, this enables applying
    the aspect to a target that depends on a go_binary, such as a cc_binary
    with proper transition applied.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    168e90d View commit details
    Browse the repository at this point in the history
  8. go/tools/gopackagesdriver: move bazel UI related flags to the bazel type

    This is more correct.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 4, 2021
    Configuration menu
    Copy the full SHA
    331470a View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2021

  1. go/tools/gopackagesdriver: add keep_going when building

    This ensures that all possible packages are built
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    29d0b78 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: remove dependecy on x/tools/packages

    The key types have to be copied and paster so might has well remove the
    dependency altogether.
    
    In the process, rework how the LoadMode is passed.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    529b5ab View commit details
    Browse the repository at this point in the history
  3. Buildifier pass

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    a0eeeec View commit details
    Browse the repository at this point in the history
  4. go/tools/gopackagesdriver: use BUILD_WORKSPACE_DIRECTORY for workspace

    Since the packages driver is meant to be run via `bazel run`, it's
    simpler to leverage BUILD_WORKSPACE_DIRECTORY. It's one less parameter.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    79f0cb8 View commit details
    Browse the repository at this point in the history
  5. go/tools/gopackagesdriver: simplify bazel bin lookup

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    8f76121 View commit details
    Browse the repository at this point in the history
  6. go/tools/gopackagesdriver: simplify BEP JSON file handling

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    1203bea View commit details
    Browse the repository at this point in the history
  7. go/tools/gopackagesdriver: explicit errors

    Will be easier when debugging.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    2657063 View commit details
    Browse the repository at this point in the history
  8. go/tools/gopackagesdriver: check for stdlibjson before returning it

    Sometimes if the aspects explores nodes that won't have go_ rules,
    there is no inner stdlib_json to fetch.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    859a3b1 View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2021

  1. go/tools/gopackagesdriver: fix wrong error format

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    2190ab6 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: try to speed up bazel queries

    Use special flags in order to speed up the bazel query
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    d69fad2 View commit details
    Browse the repository at this point in the history
  3. go/tools/gopackagesdriver: add missing error check

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    4719e91 View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2021

  1. go/tools/gopackagesdriver: fix typos in comments

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    07ad711 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: unquote imports with strconv.Unquote

    Cleaner than triming.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 7, 2021
    Configuration menu
    Copy the full SHA
    b3af1b1 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2021

  1. Configuration menu
    Copy the full SHA
    079bb2a View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: remove unrelated comment

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 8, 2021
    Configuration menu
    Copy the full SHA
    070b4c3 View commit details
    Browse the repository at this point in the history
  3. go/tools/packagesdriver: split targets with fields

    Empty string becomes handled, and multiple spaces too.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 8, 2021
    Configuration menu
    Copy the full SHA
    69fef40 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2021

  1. go/tools/gopackagesdriver: rename x as export_file

    Clearer that way
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    fb2df68 View commit details
    Browse the repository at this point in the history
  2. go/tools/gopackagesdriver: make GoStdLib._list_json private

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    0d01dc3 View commit details
    Browse the repository at this point in the history
  3. go/tools/gopackagesdriver: don't reallocate absolute paths slice

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    c36a5eb View commit details
    Browse the repository at this point in the history
  4. go/tools/gopackagesdriver: packageToPackage -> flatPackageForStd

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    2773277 View commit details
    Browse the repository at this point in the history
  5. go/tools/builders: fix stdliblist comment

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    5923382 View commit details
    Browse the repository at this point in the history
  6. go/tools/builder: add GOMODCACHE to stdliblist builder

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    b962df0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    98338cc View commit details
    Browse the repository at this point in the history
  8. go/tools/gopackagesdriver: rename to new gazelle convention

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    bcd9713 View commit details
    Browse the repository at this point in the history
  9. go/tools/gopackagesdriver: add file headers

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    b81ac13 View commit details
    Browse the repository at this point in the history
  10. go/tools/gopackagesdriver: cleaner iteration on optional fields

    Cleaner than hasattr
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    ae8788f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    5b80ccd View commit details
    Browse the repository at this point in the history
  12. go/tools/gopackagesdriver: remove == false expressions

    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    34ee2be View commit details
    Browse the repository at this point in the history
  13. go/tools/gopackagesdriver: don't panic when an error is returned

    simply print it and exit(1)
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    dfe668a View commit details
    Browse the repository at this point in the history
  14. go/tools/gopackagesdriver: properly compute roots using a pattern mat…

    …cher
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    81166a8 View commit details
    Browse the repository at this point in the history
  15. go/tools/gopackagesdriver: walk packages from root

    Since root packages are now properly computed, walk the package graph
    from them.
    
    This saves on JSON payload size a bit.
    
    Signed-off-by: Steeve Morin <[email protected]>
    steeve committed Apr 17, 2021
    Configuration menu
    Copy the full SHA
    32aba61 View commit details
    Browse the repository at this point in the history