Skip to content

Commit 8975dd6

Browse files
committed
Hook schemas WIP
1 parent 084c107 commit 8975dd6

File tree

94 files changed

+6184
-620
lines changed

Some content is hidden

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

94 files changed

+6184
-620
lines changed

.github/workflows/hook.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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/generate.dart
58+
dart tool/normalize.dart
59+
git diff --exit-code
60+
working-directory: pkgs/${{ matrix.package }}/
61+
if: ${{ matrix.package == 'hook' && matrix.sdk == 'dev' }}
62+
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/BuildInput"
6+
}
7+
],
8+
"title": "package:code_assets party:hook BuildInput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/BuildOutput"
6+
}
7+
],
8+
"title": "package:code_assets party:hook BuildOutput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/LinkInput"
6+
}
7+
],
8+
"title": "package:code_assets party:hook LinkInput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/LinkOutput"
6+
}
7+
],
8+
"title": "package:code_assets party:hook LinkOutput"
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+
"allOf": [
4+
{
5+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json"
6+
},
7+
{
8+
"$ref": "../shared/shared_definitions.schema.json#"
9+
}
10+
],
11+
"definitions": {
12+
"BuildInput": {
13+
"allOf": [
14+
{
15+
"$ref": "#/definitions/HookInput"
16+
},
17+
{
18+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/BuildInput"
19+
},
20+
{
21+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildInput"
22+
}
23+
]
24+
},
25+
"BuildOutput": {
26+
"allOf": [
27+
{
28+
"$ref": "#/definitions/HookOutput"
29+
},
30+
{
31+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/BuildOutput"
32+
},
33+
{
34+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildOutput"
35+
}
36+
]
37+
},
38+
"HookInput": {
39+
"allOf": [
40+
{
41+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/HookInput"
42+
},
43+
{
44+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookInput"
45+
}
46+
]
47+
},
48+
"HookOutput": {
49+
"allOf": [
50+
{
51+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/HookOutput"
52+
},
53+
{
54+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookOutput"
55+
}
56+
]
57+
},
58+
"LinkInput": {
59+
"allOf": [
60+
{
61+
"$ref": "#/definitions/HookInput"
62+
},
63+
{
64+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/LinkInput"
65+
},
66+
{
67+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkInput"
68+
}
69+
]
70+
},
71+
"LinkOutput": {
72+
"allOf": [
73+
{
74+
"$ref": "#/definitions/HookOutput"
75+
},
76+
{
77+
"$ref": "../../../../hook/doc/schema/hook/shared_definitions.schema.json#/definitions/LinkOutput"
78+
},
79+
{
80+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkOutput"
81+
}
82+
]
83+
}
84+
},
85+
"title": "package:code_assets party:hook shared definitions"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/BuildInput"
6+
}
7+
],
8+
"title": "package:code_assets party:sdk BuildInput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/BuildOutput"
6+
}
7+
],
8+
"title": "package:code_assets party:sdk BuildOutput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/LinkInput"
6+
}
7+
],
8+
"title": "package:code_assets party:sdk LinkInput"
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+
"allOf": [
4+
{
5+
"$ref": "shared_definitions.schema.json#/definitions/LinkOutput"
6+
}
7+
],
8+
"title": "package:code_assets party:sdk LinkOutput"
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+
"allOf": [
4+
{
5+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json"
6+
},
7+
{
8+
"$ref": "../shared/shared_definitions.schema.json#"
9+
}
10+
],
11+
"definitions": {
12+
"BuildInput": {
13+
"allOf": [
14+
{
15+
"$ref": "#/definitions/HookInput"
16+
},
17+
{
18+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/BuildInput"
19+
},
20+
{
21+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildInput"
22+
}
23+
]
24+
},
25+
"BuildOutput": {
26+
"allOf": [
27+
{
28+
"$ref": "#/definitions/HookOutput"
29+
},
30+
{
31+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/BuildOutput"
32+
},
33+
{
34+
"$ref": "../shared/shared_definitions.schema.json#/definitions/BuildOutput"
35+
}
36+
]
37+
},
38+
"HookInput": {
39+
"allOf": [
40+
{
41+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/HookInput"
42+
},
43+
{
44+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookInput"
45+
}
46+
]
47+
},
48+
"HookOutput": {
49+
"allOf": [
50+
{
51+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/HookOutput"
52+
},
53+
{
54+
"$ref": "../shared/shared_definitions.schema.json#/definitions/HookOutput"
55+
}
56+
]
57+
},
58+
"LinkInput": {
59+
"allOf": [
60+
{
61+
"$ref": "#/definitions/HookInput"
62+
},
63+
{
64+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/LinkInput"
65+
},
66+
{
67+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkInput"
68+
}
69+
]
70+
},
71+
"LinkOutput": {
72+
"allOf": [
73+
{
74+
"$ref": "#/definitions/HookOutput"
75+
},
76+
{
77+
"$ref": "../../../../hook/doc/schema/sdk/shared_definitions.schema.json#/definitions/LinkOutput"
78+
},
79+
{
80+
"$ref": "../shared/shared_definitions.schema.json#/definitions/LinkOutput"
81+
}
82+
]
83+
}
84+
},
85+
"title": "package:code_assets party:sdk shared definitions"
86+
}

0 commit comments

Comments
 (0)