Skip to content

Instantly share code, notes, and snippets.

@simolus3
Created July 15, 2020 12:00
Show Gist options
  • Save simolus3/6cf15762be25cf94c4eaccc5f21e7902 to your computer and use it in GitHub Desktop.
Save simolus3/6cf15762be25cf94c4eaccc5f21e7902 to your computer and use it in GitHub Desktop.
build.yaml schema

IntelliJ

Open a build.yaml file and click on "No JSON schema" in the bottom toolbar (at the right). Click on "New schema mapping" and fill in the options:

  • Name: build.yaml, or what you prefer
  • Schema file or URL: https://simonbinder.eu/schema.json
  • Schema version: JSON schema version 7
  • The file pattern should be build.yaml and optionally *.build.yaml

VSCode

You need to install the redhat.vscode-yaml extension.

Then, add this to your settings:

"yaml.schemas": {
  "https://simonbinder.eu/schema.json": [
    "build.yaml"
  ]
},
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "build.yaml files",
"description": "Configuration for Dart's build system",
"definitions": {
"_listOfGlobs": {
"type": "array",
"items": {
"type": "string"
}
},
"buildConfig": {
"type": "object",
"properties": {
"targets": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/buildTarget"
}
},
"builders": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/builderDefinition"
}
},
"post_process_builders": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/postProcessBuilderDefinition"
}
},
"global_options": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/globalBuilderOptions"
}
}
},
"additionalProperties": false
},
"buildTarget": {
"type": "object",
"properties": {
"auto_apply_builders": {
"type": "boolean",
"default": true
},
"builders": {
"type": "object",
"propertyNames": {
"$ref": "#/definitions/builderKey"
},
"additionalProperties": {
"$ref": "#/definitions/targetBuilderConfig"
},
"sources": {
"$ref": "#/definitions/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": "#/definitions/autoApply",
"default": "none"
},
"required_inputs": {
"type": "array",
"items": {
"type": "string"
}
},
"runs_before": {
"type": "array",
"items": {
"$ref": "#/definitions/builderKey"
}
},
"applies_builders": {
"type": "array",
"items": {
"$ref": "#/definitions/builderKey"
}
},
"is_optional": {
"type": "boolean",
"default": false
},
"build_to": {
"$ref": "#/definitions/buildTo",
"default": "cache"
},
"defaults": {
"$ref": "#/definitions/targetBuilderConfigDefaults"
},
"target": {
"type": "string",
"title": "The name of the dart_library target that contains the import",
"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": "#/definitions/targetBuilderConfigDefaults"
}
},
"additionalProperties": false
},
"inputSet": {
"oneOf": [
{
"type": "object",
"properties": {
"include": {
"$ref": "#/definitions/_listOfGlobs"
},
"exclude": {
"$ref": "#/definitions/_listOfGlobs"
}
},
"additionalProperties": false
},
{
"$comment": "Use List<String> directly, inferred to mean include.",
"$ref": "#/definitions/_listOfGlobs"
}
]
},
"targetBuilderConfig": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"generate_for": {
"$ref": "#/definitions/inputSet"
},
"options": {
"$ref": "#/definitions/builderOptions"
},
"dev_options": {
"$ref": "#/definitions/builderOptions"
},
"release_options": {
"$ref": "#/definitions/builderOptions"
}
},
"additionalProperties": false
},
"targetBuilderConfigDefaults": {
"type": "object",
"properties": {
"generate_for": {
"$ref": "#/definitions/inputSet"
},
"options": {
"$ref": "#/definitions/builderOptions"
},
"dev_options": {
"$ref": "#/definitions/builderOptions"
},
"release_options": {
"$ref": "#/definitions/builderOptions"
}
},
"additionalProperties": false
},
"globalBuilderOptions": {
"type": "object",
"properties": {
"options": {
"$ref": "#/definitions/builderOptions"
},
"dev_options": {
"$ref": "#/definitions/builderOptions"
},
"release_options": {
"$ref": "#/definitions/builderOptions"
}
},
"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.",
"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 |.",
"pattern": "^\\w*\\|\\w+$"
}
},
"$ref": "#/definitions/buildConfig"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment