{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/dart-build-config-dart-build-json/latest.json",
  "title": "build.yaml files",
  "description": "Configuration for Dart's build system",
  "x-lintel": {
    "source": "https://www.schemastore.org/dart-build.json",
    "sourceSha256": "2dfe622a59d55e2d55233a0cf32f76a03e6aeb45e370c538f4da20b7fd30f0e1"
  },
  "$ref": "#/$defs/buildConfig",
  "$defs": {
    "_listOfGlobs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "buildConfig": {
      "type": "object",
      "properties": {
        "targets": {
          "type": "object",
          "propertyNames": {
            "$ref": "#/$defs/targetKey"
          },
          "additionalProperties": {
            "$ref": "#/$defs/buildTarget"
          }
        },
        "builders": {
          "type": "object",
          "propertyNames": {
            "$ref": "#/$defs/builderKey"
          },
          "additionalProperties": {
            "$ref": "#/$defs/builderDefinition"
          }
        },
        "post_process_builders": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/postProcessBuilderDefinition"
          }
        },
        "global_options": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/globalBuilderOptions"
          }
        },
        "additional_public_assets": {
          "$ref": "#/$defs/_listOfGlobs"
        }
      },
      "additionalProperties": false
    },
    "buildTarget": {
      "type": "object",
      "properties": {
        "auto_apply_builders": {
          "type": "boolean",
          "default": true
        },
        "builders": {
          "type": "object",
          "propertyNames": {
            "$ref": "#/$defs/builderKey"
          },
          "additionalProperties": {
            "$ref": "#/$defs/targetBuilderConfig"
          }
        },
        "dependencies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/targetKey"
          }
        },
        "sources": {
          "$ref": "#/$defs/inputSet"
        }
      },
      "additionalProperties": false
    },
    "builderDefinition": {
      "type": "object",
      "properties": {
        "builder_factories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "import": {
          "type": "string"
        },
        "build_extensions": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "auto_apply": {
          "$ref": "#/$defs/autoApply",
          "default": "none"
        },
        "required_inputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "runs_before": {
          "$ref": "#/$defs/runsBefore"
        },
        "applies_builders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/builderKey"
          }
        },
        "is_optional": {
          "type": "boolean",
          "default": false
        },
        "build_to": {
          "$ref": "#/$defs/buildTo",
          "default": "cache"
        },
        "defaults": {
          "$ref": "#/$defs/targetBuilderConfigDefaults"
        },
        "target": {
          "type": "string",
          "title": "The name of the dart_library target that contains the import",
          "deprecated": true,
          "deprecationMessage": "May be null or unreliable and should not be used."
        }
      },
      "additionalProperties": false
    },
    "postProcessBuilderDefinition": {
      "type": "object",
      "properties": {
        "builder_factory": {
          "type": "string"
        },
        "import": {
          "type": "string"
        },
        "input_extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "defaults": {
          "$ref": "#/$defs/targetBuilderConfigDefaults"
        }
      },
      "additionalProperties": false
    },
    "inputSet": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "include": {
              "$ref": "#/$defs/_listOfGlobs"
            },
            "exclude": {
              "$ref": "#/$defs/_listOfGlobs"
            }
          },
          "additionalProperties": false
        },
        {
          "$comment": "Use List<String> directly, inferred to mean include.",
          "$ref": "#/$defs/_listOfGlobs"
        }
      ]
    },
    "targetBuilderConfig": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "generate_for": {
          "$ref": "#/$defs/inputSet"
        },
        "options": {
          "$ref": "#/$defs/builderOptions"
        },
        "dev_options": {
          "$ref": "#/$defs/builderOptions"
        },
        "release_options": {
          "$ref": "#/$defs/builderOptions"
        }
      },
      "additionalProperties": false
    },
    "targetBuilderConfigDefaults": {
      "type": "object",
      "properties": {
        "generate_for": {
          "$ref": "#/$defs/inputSet"
        },
        "options": {
          "$ref": "#/$defs/builderOptions"
        },
        "dev_options": {
          "$ref": "#/$defs/builderOptions"
        },
        "release_options": {
          "$ref": "#/$defs/builderOptions"
        }
      },
      "additionalProperties": false
    },
    "globalBuilderOptions": {
      "type": "object",
      "properties": {
        "options": {
          "$ref": "#/$defs/builderOptions"
        },
        "dev_options": {
          "$ref": "#/$defs/builderOptions"
        },
        "release_options": {
          "$ref": "#/$defs/builderOptions"
        },
        "runs_before": {
          "$ref": "#/$defs/runsBefore"
        }
      },
      "additionalProperties": false
    },
    "builderOptions": {
      "type": "object",
      "title": "Options to apply to a builder",
      "description": "An arbitrary Map<String, dynamic> of configuration options exposed by the individual builders. See the documentation for the builder you are configuring for guidance.",
      "additionalProperties": true
    },
    "autoApply": {
      "type": "string",
      "description": "On which packages the builder is applied by default",
      "enum": [
        "none",
        "dependents",
        "all_packages",
        "root_package"
      ]
    },
    "buildTo": {
      "type": "string",
      "description": "Whether the outputs should be stored in a hidden cache or in the source directory.",
      "enum": [
        "cache",
        "source"
      ]
    },
    "targetKey": {
      "type": "string",
      "title": "An identifier for a target",
      "description": "A target key has two parts, a package and a name. They are separated by a colon.",
      "pattern": "^(?:\\w+:)?\\w+|\\$default$"
    },
    "builderKey": {
      "type": "string",
      "title": "An identifier for a builder",
      "description": "To construct a key, you join the package name and the builder name with a colon.",
      "pattern": "^(?:\\w*:)?\\w+$"
    },
    "runsBefore": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/builderKey"
      }
    }
  }
}
