From 8844c49aaea806253eb33323b54f204b8f4fd83a Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Sat, 30 Nov 2024 11:21:12 +0100 Subject: [PATCH 1/2] add cache output --- conda_recipe_v2_schema/model.py | 16 +++++ schema.json | 102 ++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/conda_recipe_v2_schema/model.py b/conda_recipe_v2_schema/model.py index 081b824..d7af7d9 100644 --- a/conda_recipe_v2_schema/model.py +++ b/conda_recipe_v2_schema/model.py @@ -617,9 +617,25 @@ class BaseRecipe(StrictBaseModel): ) +class Cache(StrictBaseModel): + source: ConditionalList[Source] | None = Field( + None, description="The source items to be downloaded and used for the cache build and subsequent outputs." + ) + + requirements: Requirements | None = Field(None, description="The dependencies needed at cache-build time.") + + build: OutputBuild | None = Field( + None, description="Describes how the package should be build." + ) + + class ComplexRecipe(BaseRecipe): recipe: ComplexPackage | None = Field(None, description="The package version.") + cache: Cache | None = Field( + None, description="The cache build that can be used as a common build step for all output." + ) + outputs: ConditionalList[Output] = Field( ..., description="A list of outputs that are generated for this recipe." ) diff --git a/schema.json b/schema.json index e10ecd4..9a307e6 100644 --- a/schema.json +++ b/schema.json @@ -562,6 +562,96 @@ "title": "Build", "type": "object" }, + "Cache": { + "additionalProperties": false, + "properties": { + "source": { + "anyOf": [ + { + "$ref": "#/$defs/UrlSource" + }, + { + "$ref": "#/$defs/GitRev" + }, + { + "$ref": "#/$defs/GitTag" + }, + { + "$ref": "#/$defs/GitBranch" + }, + { + "$ref": "#/$defs/BaseGitSource" + }, + { + "$ref": "#/$defs/LocalSource" + }, + { + "$ref": "#/$defs/IfStatement" + }, + { + "items": { + "anyOf": [ + { + "$ref": "#/$defs/UrlSource" + }, + { + "$ref": "#/$defs/GitRev" + }, + { + "$ref": "#/$defs/GitTag" + }, + { + "$ref": "#/$defs/GitBranch" + }, + { + "$ref": "#/$defs/BaseGitSource" + }, + { + "$ref": "#/$defs/LocalSource" + }, + { + "$ref": "#/$defs/IfStatement" + } + ] + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The source items to be downloaded and used for the cache build and subsequent outputs.", + "title": "Source" + }, + "requirements": { + "anyOf": [ + { + "$ref": "#/$defs/Requirements" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The dependencies needed at cache-build time." + }, + "build": { + "anyOf": [ + { + "$ref": "#/$defs/OutputBuild" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Describes how the package should be build." + } + }, + "title": "Cache", + "type": "object" + }, "ComplexPackage": { "additionalProperties": false, "properties": { @@ -729,6 +819,18 @@ "default": null, "description": "The package version." }, + "cache": { + "anyOf": [ + { + "$ref": "#/$defs/Cache" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The cache build that can be used as a common build step for all output." + }, "outputs": { "anyOf": [ { From d227eae68f1bb98db000ff9211d438b92e85e50d Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Sat, 30 Nov 2024 15:41:25 +0100 Subject: [PATCH 2/2] fmt --- conda_recipe_v2_schema/model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conda_recipe_v2_schema/model.py b/conda_recipe_v2_schema/model.py index d7af7d9..af470b0 100644 --- a/conda_recipe_v2_schema/model.py +++ b/conda_recipe_v2_schema/model.py @@ -619,10 +619,13 @@ class BaseRecipe(StrictBaseModel): class Cache(StrictBaseModel): source: ConditionalList[Source] | None = Field( - None, description="The source items to be downloaded and used for the cache build and subsequent outputs." + None, + description="The source items to be downloaded and used for the cache build and subsequent outputs.", ) - requirements: Requirements | None = Field(None, description="The dependencies needed at cache-build time.") + requirements: Requirements | None = Field( + None, description="The dependencies needed at cache-build time." + ) build: OutputBuild | None = Field( None, description="Describes how the package should be build."