diff --git a/BUILD b/BUILD index b2f1df9..d00f48b 100644 --- a/BUILD +++ b/BUILD @@ -1 +1 @@ -python_requirements() +python_requirements(name="reqs") diff --git a/README.org b/README.org index 4ad9bfb..d652092 100644 --- a/README.org +++ b/README.org @@ -3,7 +3,7 @@ #+EMAIL: engineering@sendwave.com #+DESCRIPTION: Node Plugin Documentation -* Version 1.1.3 +* Version 1.2.0 This package contains a plugin for the [[https://www.pantsbuild.org/][pants build system]] to run npm based scripts from pants build targets @@ -15,6 +15,11 @@ installed. It also requires the [[https://github.com/compyman/pants-docker][pant =npm_package= may be included as dependencies to docker images +Legacy versions have support for earlier versions of pantsbuild: + +- 1.0.x, 1.1.x: pantsbuild 2.9 +- 0.0.1: pantsbuild 2.4 + * Installation To use this plugin in your existing pants project add it to the @@ -103,6 +108,10 @@ have reproducable builds, you may generate one by running: #+END_SRC * Changelog +* 1.2.0 +TBD ++ [Breaking] Upgrade to pants 2.13 and drop support for earlier versions ++ Remove dependency on sendwave-pants-docker in favor of the built-in Docker backend ** 1.1.3 2022-05-31 + Bug fix: prevent crash if use_nvm is enabled but nvm is not in use. diff --git a/constraints.txt b/constraints.txt index 4bf246a..dc6e7c6 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1,4 +1,4 @@ -# Generated by build-support/generate_constraints.sh on Wed Mar 2 17:15:47 CST 2022 +# Generated by build-support/generate_constraints.sh on Fri Sep 16 13:37:01 CDT 2022 ansicolors==1.1.8 attrs==21.4.0 certifi==2021.10.8 @@ -9,18 +9,18 @@ idna==3.3 ijson==3.1.4 iniconfig==1.1.1 packaging==21.3 -pantsbuild.pants==2.9.1rc0 -pantsbuild.pants.testutil==2.9.1rc0 -pex==2.1.65 -pip==22.0.3 +pantsbuild.pants==2.13.0 +pantsbuild.pants.testutil==2.13.0 +pex==2.1.102 +pip==22.2.2 pluggy==1.0.0 psutil==5.9.0 py==1.11.0 pyparsing==3.0.7 pytest==6.2.5 +python-lsp-jsonrpc==1.0.0 PyYAML==6.0 requests==2.27.1 -sendwave-pants-docker==1.0 setproctitle==1.2.2 setuptools==56.0.0 six==1.16.0 @@ -29,4 +29,5 @@ types-PyYAML==6.0.3 types-setuptools==57.4.7 types-toml==0.10.3 typing_extensions==4.0.1 +ujson==5.5.0 urllib3==1.26.8 diff --git a/pants.ci.toml b/pants.ci.toml index 96e3101..644fe84 100644 --- a/pants.ci.toml +++ b/pants.ci.toml @@ -3,12 +3,5 @@ dynamic_ui = false # Ensure colors are used (if your CI provider supports it). colors = true -[python] -# Limit the maximum number of concurrent jobs used to resolve third -# party dependencies. The max level of parallelism will be -# `process_execution_local_parallelism x resolver_jobs`, but -# often you will have one resolve process at a time. -resolver_jobs = 2 - [pytest] args = ["-vv"] diff --git a/pants.toml b/pants.toml index 9b6ead3..e4ecbea 100644 --- a/pants.toml +++ b/pants.toml @@ -1,10 +1,7 @@ [GLOBAL] -pants_version="2.9.0" +pants_version="2.13.0" pythonpath = ["%(buildroot)s/pants_plugins"] -plugins = [ - "sendwave-pants-docker~=1.0.0", -] backend_packages = [ "pants.backend.plugin_development", @@ -12,8 +9,8 @@ backend_packages = [ "pants.backend.python.lint.docformatter", "pants.backend.python.lint.black", "pants.backend.python.lint.isort" , + "pants.backend.docker", "sendwave.pants_node", - "sendwave.pants_docker" ] [source] root_patterns = ["/pants_plugins", "/test_webpack"] @@ -28,5 +25,5 @@ interpreter_constraints = [">=3.9"] enabled = true repo_id = "BB6CBFC17A66FAB02E3FA88C13113D25" -[sendwave-docker] -report_progress = true \ No newline at end of file +[docker] +build_verbose = true diff --git a/pants_plugins/sendwave/pants_node/BUILD b/pants_plugins/sendwave/pants_node/BUILD index e4ea8c9..ef6ec7c 100644 --- a/pants_plugins/sendwave/pants_node/BUILD +++ b/pants_plugins/sendwave/pants_node/BUILD @@ -1,6 +1,6 @@ python_sources( name="pants_node_library", - dependencies=["pants_plugins:pants", "//:sendwave-pants-docker"], + dependencies=["pants_plugins:pants"], ) python_distribution( diff --git a/pants_plugins/sendwave/pants_node/package.py b/pants_plugins/sendwave/pants_node/package.py index 86be4b9..f95464e 100644 --- a/pants_plugins/sendwave/pants_node/package.py +++ b/pants_plugins/sendwave/pants_node/package.py @@ -14,18 +14,16 @@ from pants.core.goals.package import (BuiltPackage, BuiltPackageArtifact, PackageFieldSet) from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest +from pants.core.util_rules.system_binaries import BinaryPathRequest, BinaryPaths from pants.engine.environment import Environment, EnvironmentRequest from pants.engine.fs import (AddPrefix, CreateDigest, Digest, DigestEntries, FileEntry, MergeDigests, RemovePrefix, Snapshot) -from pants.engine.process import (BinaryPathRequest, BinaryPaths, Process, - ProcessResult) +from pants.engine.process import Process, ProcessResult from pants.engine.rules import Get, collect_rules, rule from pants.engine.target import (Address, TransitiveTargets, TransitiveTargetsRequest) from pants.engine.unions import UnionRule from pants.source.source_root import SourceRootsRequest, SourceRootsResult -from sendwave.pants_docker.docker_component import (DockerComponent, - DockerComponentFieldSet) from sendwave.pants_node.subsystems import NodeSubsystem from .target import NodeLibrarySourcesField, NodeProjectFieldSet @@ -252,21 +250,9 @@ async def node_project_package(field_set: NodeProjectFieldSet) -> BuiltPackage: ) -@rule -async def node_project_docker(field_set: NodeProjectFieldSet) -> DockerComponent: - """Build a node_package target into a DockerComponent. - - This allows files generated by the node process to be included in - the docker image. - """ - package = await Get(Digest, NodeProjectFieldSet, field_set) - return DockerComponent(sources=package, commands=[]) - - def rules(): """Return the pants rules for this module.""" return [ UnionRule(PackageFieldSet, NodeProjectFieldSet), - UnionRule(DockerComponentFieldSet, NodeProjectFieldSet), *collect_rules(), ] diff --git a/pants_plugins/sendwave/pants_node/subsystems.py b/pants_plugins/sendwave/pants_node/subsystems.py index 59cfc00..2f9855a 100644 --- a/pants_plugins/sendwave/pants_node/subsystems.py +++ b/pants_plugins/sendwave/pants_node/subsystems.py @@ -1,6 +1,7 @@ """Sendwave pants-node Options.""" from pants.engine.rules import SubsystemRule +from pants.option.option_types import StrListOption, BoolOption from pants.option.subsystem import Subsystem @@ -24,24 +25,17 @@ class NodeSubsystem(Subsystem): options_scope = "node" help = "Node Options." - @classmethod - def register_options(cls, register): - """Register Sendwave pants-node options.""" - super().register_options(register) - register( - "--search-paths", - type=list, - member_type=str, - default=["/bin", "/usr/bin/"], - help="Directories in which to search for node binaries.'", - ) - register( - "--use-nvm", - type=bool, - default=True, - help="If true, the value of $NVM_BIN will be " - "appended to the front of the search path.", - ) + search_paths = StrListOption( + "--search-paths", + default=["/bin", "/usr/bin/"], + help="Directories in which to search for node binaries.'", + ) + use_nvm = BoolOption( + "--use-nvm", + default=True, + help="If true, the value of $NVM_BIN will be " + "appended to the front of the search path.", + ) def rules(): diff --git a/requirements.txt b/requirements.txt index b9066d3..e69de29 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +0,0 @@ -sendwave-pants-docker~=1.0.1 diff --git a/test_webpack/BUILD b/test_webpack/BUILD index d0bc927..7aa0257 100644 --- a/test_webpack/BUILD +++ b/test_webpack/BUILD @@ -7,9 +7,12 @@ node_package( artifact_paths=["public/bundle"] ) -docker( - name="docker_with_weback_bundle", - base_image="python:3.9.1-slim-buster", - command=["/bin/bash",], - dependencies=[":test_bundle",] +docker_image( + name="docker_with_webpack_bundle", + instructions=[ + "FROM python:3.9.1-slim-buster", + "COPY public /public", + "CMD /bin/bash", + ], + dependencies=[":test_bundle",] )