Skip to content

Commit 4c984e4

Browse files
committed
[native_assets_cli] JSON schemas
1 parent 9d8eefb commit 4c984e4

File tree

70 files changed

+3263
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3263
-0
lines changed

.github/workflows/hook.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# CI for the native_* packages.
2+
#
3+
# Combined into a single workflow so that deps are configured and installed once.
4+
5+
name: hook
6+
permissions: read-all
7+
8+
on:
9+
pull_request:
10+
# No `branches:` to enable stacked PRs on GitHub.
11+
paths:
12+
- ".github/workflows/hook.yaml"
13+
- "pkgs/hook/**"
14+
- "pkgs/code_assets/**"
15+
- "pkgs/data_assets/**"
16+
push:
17+
branches: [main]
18+
paths:
19+
- ".github/workflows/native.yaml"
20+
- "pkgs/hook/**"
21+
- "pkgs/code_assets/**"
22+
- "pkgs/data_assets/**"
23+
schedule:
24+
- cron: "0 0 * * 0" # weekly
25+
26+
jobs:
27+
build:
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: [ubuntu, windows]
32+
sdk: [dev]
33+
package: [hook, code_assets, data_assets]
34+
35+
runs-on: ${{ matrix.os }}-latest
36+
37+
defaults:
38+
run:
39+
working-directory: pkgs/${{ matrix.package }}
40+
41+
steps:
42+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
43+
44+
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
45+
with:
46+
sdk: ${{ matrix.sdk }}
47+
48+
- run: dart pub get
49+
50+
- run: dart analyze --fatal-infos
51+
52+
- run: dart format --output=none --set-exit-if-changed .
53+
54+
- run: dart test
55+
56+
- run: |
57+
dart tool/normalize.dart
58+
git diff --exit-code
59+
working-directory: pkgs/${{ matrix.package }}/
60+
if: ${{ matrix.package == 'hook' && matrix.sdk == 'dev' }}
61+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
include: package:dart_flutter_team_lints/analysis_options.yaml
2+
3+
analyzer:
4+
errors:
5+
todo: ignore
6+
language:
7+
strict-casts: true
8+
strict-inference: true
9+
strict-raw-types: true
10+
11+
linter:
12+
rules:
13+
- dangling_library_doc_comments
14+
- prefer_const_declarations
15+
- prefer_expression_function_bodies
16+
- prefer_final_in_for_each
17+
- prefer_final_locals

pkgs/code_assets/doc/schema/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
These schemas document the protocol for build and link hooks with code assets.
2+
3+
* If you are a hook author, you should likely be using a hook-helper-package
4+
Dart API (such as `package:native_toolchain_c`) instead of directly consuming
5+
and producing JSON.
6+
* If you are a hook-helper-package author, you should likely be using a
7+
hook-helper-package's Dart API (such as `package:native_assets_cli`) which
8+
abstracts away from syntactic changes. If you do want to directly interact
9+
with the JSON, you can find the relevant schemas in [hook/](hook/).
10+
* If you are an SDK author, you should likely be using the SDK helper package
11+
(`package:native_assets_builder`) which abstracts away from syntactic changes.
12+
If you do want to directly interact with the JSON, you can find the relevant
13+
schemas in [sdk/](sdk/).
14+
15+
These schemas are an extension of the base protocol:
16+
17+
* [`package:hook`/doc/schema](../../../hook/doc/schema/)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:hook BuildInput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/BuildInput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:hook BuildOutput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/BuildOutput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:hook LinkInput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/LinkInput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:hook LinkOutput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/LinkOutput"
7+
}
8+
]
9+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:hook shared definitions",
4+
"allOf": [
5+
{
6+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json"
7+
},
8+
{
9+
"$ref": "../shared/shared_definitions.schema.json#"
10+
}
11+
],
12+
"definitions": {
13+
"BuildInput": {
14+
"allOf": [
15+
{
16+
"$ref": "#/definitions/HookInput"
17+
},
18+
{
19+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/BuildInput"
20+
},
21+
{
22+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildInput"
23+
}
24+
]
25+
},
26+
"BuildOutput": {
27+
"allOf": [
28+
{
29+
"$ref": "#/definitions/HookOutput"
30+
},
31+
{
32+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/BuildOutput"
33+
},
34+
{
35+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildOutput"
36+
}
37+
]
38+
},
39+
"HookInput": {
40+
"allOf": [
41+
{
42+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/HookInput"
43+
},
44+
{
45+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookInput"
46+
}
47+
]
48+
},
49+
"HookOutput": {
50+
"allOf": [
51+
{
52+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/HookOutput"
53+
},
54+
{
55+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookOutput"
56+
}
57+
]
58+
},
59+
"LinkInput": {
60+
"allOf": [
61+
{
62+
"$ref": "#/definitions/HookInput"
63+
},
64+
{
65+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/LinkInput"
66+
},
67+
{
68+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkInput"
69+
}
70+
]
71+
},
72+
"LinkOutput": {
73+
"allOf": [
74+
{
75+
"$ref": "#/definitions/HookOutput"
76+
},
77+
{
78+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/LinkOutput"
79+
},
80+
{
81+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkOutput"
82+
}
83+
]
84+
}
85+
}
86+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:sdk BuildInput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/BuildInput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:sdk BuildOutput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/BuildOutput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:sdk LinkInput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/LinkInput"
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:sdk LinkOutput",
4+
"allOf": [
5+
{
6+
"$ref": "shared_definitions.schema.json#/definitions/LinkOutput"
7+
}
8+
]
9+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"$schema": "https://json-schema.org/draft-07/schema#",
3+
"title": "package:code_assets party:sdk shared definitions",
4+
"allOf": [
5+
{
6+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json"
7+
},
8+
{
9+
"$ref": "../shared/shared_definitions.schema.json#"
10+
}
11+
],
12+
"definitions": {
13+
"BuildInput": {
14+
"allOf": [
15+
{
16+
"$ref": "#/definitions/HookInput"
17+
},
18+
{
19+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/BuildInput"
20+
},
21+
{
22+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildInput"
23+
}
24+
]
25+
},
26+
"BuildOutput": {
27+
"allOf": [
28+
{
29+
"$ref": "#/definitions/HookOutput"
30+
},
31+
{
32+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/BuildOutput"
33+
},
34+
{
35+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildOutput"
36+
}
37+
]
38+
},
39+
"HookInput": {
40+
"allOf": [
41+
{
42+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/HookInput"
43+
},
44+
{
45+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookInput"
46+
}
47+
]
48+
},
49+
"HookOutput": {
50+
"allOf": [
51+
{
52+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/HookOutput"
53+
},
54+
{
55+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookOutput"
56+
}
57+
]
58+
},
59+
"LinkInput": {
60+
"allOf": [
61+
{
62+
"$ref": "#/definitions/HookInput"
63+
},
64+
{
65+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/LinkInput"
66+
},
67+
{
68+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkInput"
69+
}
70+
]
71+
},
72+
"LinkOutput": {
73+
"allOf": [
74+
{
75+
"$ref": "#/definitions/HookOutput"
76+
},
77+
{
78+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/LinkOutput"
79+
},
80+
{
81+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkOutput"
82+
}
83+
]
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)