Skip to content

Commit

Permalink
Switch to new lockfile generation script. (pantsbuild#18754)
Browse files Browse the repository at this point in the history
- Delete the old one.
- Delete the unnecessary wrapper script.
- Add a new wrapper script for the special case of pex changes,
  merely as a convenience so we don't forget to update Lambdex.

This enforces the full separation between generating the Pants
default-python lockfile, which you now do with a direct Pants
generate-lockfiles invocation like any other repo,
vs generating the built-in lockfiles that we ship with Pants.
  • Loading branch information
benjyw authored Apr 18, 2023
1 parent fa8c1ce commit 717adfe
Show file tree
Hide file tree
Showing 50 changed files with 66 additions and 330 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/python/flake8.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This lockfile was autogenerated by Pants. To regenerate, run:
//
// build-support/bin/generate_all_lockfiles.sh
// ./pants generate-lockfiles --resolve=flake8
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/python/mypy.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This lockfile was autogenerated by Pants. To regenerate, run:
//
// build-support/bin/generate_all_lockfiles.sh
// ./pants generate-lockfiles --resolve=mypy
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/python/pytest.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This lockfile was autogenerated by Pants. To regenerate, run:
//
// build-support/bin/generate_all_lockfiles.sh
// ./pants generate-lockfiles --resolve=pytest
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/python/user_reqs.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This lockfile was autogenerated by Pants. To regenerate, run:
//
// build-support/bin/generate_all_lockfiles.sh
// ./pants generate-lockfiles --resolve=python-default
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
Expand Down
253 changes: 0 additions & 253 deletions build-support/bin/_generate_all_lockfiles_helper.py

This file was deleted.

25 changes: 0 additions & 25 deletions build-support/bin/generate_all_lockfiles.sh

This file was deleted.

7 changes: 3 additions & 4 deletions build-support/bin/generate_builtin_lockfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from pants.backend.tools.yamllint.subsystem import Yamllint
from pants.base.build_environment import get_buildroot
from pants.jvm.resolve.jvm_tool import JvmToolBase
from pants.jvm.shading.jarjar import JarJar
from pants.util.contextutil import temporary_dir
from pants.util.dirutil import touch

Expand Down Expand Up @@ -141,9 +142,10 @@ class JvmTool(Tool[JvmToolBase]):
GoogleJavaFormatSubsystem, "pants.backend.experimental.java.lint.google_java_format"
),
JvmTool(JUnit, "pants.backend.experimental.java"),
JvmTool(JarJar, "pants.backend.experimental.java"),
JvmTool(JavaProtobufGrpcSubsystem, "pants.backend.experimental.codegen.protobuf.java"),
JvmTool(KtlintSubsystem, "pants.backend.experimental.kotlin.lint.ktlint"),
JvmTool(ScalaPBSubsystem, "pants.backend.experimental.codegen.protobuf.scala"),
JvmTool(JavaProtobufGrpcSubsystem, "pants.backend.experimental.codegen.protobuf.java"),
JvmTool(ScalafmtSubsystem, "pants.backend.experimental.scala.lint.scalafmt"),
JvmTool(Scalatest, "pants.backend.experimental.scala"),
JvmTool(ScroogeSubsystem, "pants.backend.experimental.codegen.thrift.scrooge.scala"),
Expand Down Expand Up @@ -226,9 +228,6 @@ def req_file(_tool: PythonTool) -> str:
"--backend-packages=pants.backend.python",
"--python-pip-version=23.0.1",
f"--python-interpreter-constraints=['{default_python_interpreter_constraints}']",
# `generate_all_lockfiles.sh` will have overridden this option to solve the chicken
# and egg problem from https://github.com/pantsbuild/pants/issues/12457. We must
# restore it here so that the lockfile gets generated properly.
"--python-enable-resolves",
# Unset any existing resolve names in the Pants repo, and set to just our temporary ones.
f"--python-resolves={resolves}",
Expand Down
16 changes: 16 additions & 0 deletions build-support/bin/generate_pex_lockfiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

set -euo pipefail

# A convenience script so we don't forget to update Lambdex when we update Pex.

REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT" || exit 1

# shellcheck source=build-support/common.sh
source "${REPO_ROOT}/build-support/common.sh"

./pants generate-lockfiles --resolve=python-default
./pants run build-support/bin/generate_builtin_lockfiles.py -- lambdex
3 changes: 1 addition & 2 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ venv_use_symlinks = true

[python]
# N.B.: When adjusting this to support new Python versions, you must update the Pants
# `python_distrobution` targets, currently:
# `python_distribution` targets, currently:
# + src/python/pants:pants-packaged
# + src/python/pants/testutil:testutil_wheel
# And update the PythonBuildStandalone version/URL:
Expand Down Expand Up @@ -225,7 +225,6 @@ interpreter_constraints = [">=3.7,<3.10"]
template_by_globs = "@build-support/preambles/config.yaml"

[generate-lockfiles]
custom_command = "build-support/bin/generate_all_lockfiles.sh"
diff = true

[jvm]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This lockfile was autogenerated by Pants. To regenerate, run:
//
// build-support/bin/generate_all_lockfiles.sh
// ./pants run build-support/bin/generate_builtin_lockfiles.py"
//
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
// {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This lockfile was autogenerated by Pants. To regenerate, run:
#
# ./pants generate-lockfiles
# ./pants run build-support/bin/generate_builtin_lockfiles.py
#
# --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
# {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This lockfile was autogenerated by Pants. To regenerate, run:
#
# ./pants generate-lockfiles
# ./pants run build-support/bin/generate_builtin_lockfiles.py
#
# --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
# {
Expand Down
Loading

0 comments on commit 717adfe

Please sign in to comment.