Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to pre-generated bindings, add feature for generating at compile-time #21

Merged
merged 30 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4b47823
Change to pre-generated bindings, use feature for compile-time generated
pheki Oct 29, 2023
1e4bfa2
Fix clippy lints
pheki Oct 29, 2023
a2e0a8a
Ignore bindgen feature on docs.rs
pheki Oct 29, 2023
2f173ec
Update generate-bindings.yml
pheki Oct 29, 2023
f5a17cc
Update build.yml
pheki Oct 29, 2023
71e15a7
Fix clippy and missing-libs
pheki Oct 29, 2023
0ad21e9
Update docs
pheki Oct 29, 2023
0076583
Add rust-toolchain.toml with nightly as the default
pheki Oct 29, 2023
46d27f2
Update CHANGELOG.md
pheki Oct 29, 2023
3e2b869
Add rustfmt component to update-bindings
pheki Oct 30, 2023
947d621
Fix workflow file reference
pheki Oct 30, 2023
2b26429
Run bindgen from crate root on update-bindings CI
pheki Nov 17, 2023
f408d3f
Add CI job to check bindings
pheki Nov 17, 2023
b9137d2
On the CI to update bindings, get the submodule hash after updating
pheki Nov 17, 2023
13b6ee7
Bind is_build_rs to a variable to make function argument clearer
pheki Dec 21, 2023
b19bd19
Rename sort keys to precedence and ident
pheki Dec 21, 2023
36cc067
When formatting fails, warn if running from build.rs, panic otherwise
pheki Dec 21, 2023
e68444b
Use CargoCallbacks instead of our own ParseCallbacks implementation
pheki Dec 22, 2023
8810181
Gate env_logger under "log-build" feature
zetanumbers Jan 2, 2024
b263a26
Use "build-util" profile for vitasdk-build-util
zetanumbers Jan 2, 2024
1e91b1d
`cargo update`
zetanumbers Jan 2, 2024
85d3fbc
Watch DOCS_RS environment variable change
zetanumbers Jan 2, 2024
26469cb
Add all-stubs feature
zetanumbers Jan 2, 2024
68ba290
rename all_stubs field for serde
zetanumbers Jan 2, 2024
171bcb9
Revert adding redundant --missing-features check
zetanumbers Jan 2, 2024
c3b824f
Group foreign items by feature and refactor
pheki Dec 22, 2023
be2761d
Use doc_auto_cfg instead of doc_cfg
pheki Jan 5, 2024
8d66111
Link on same foreign mods as external definitions and sort by feature
pheki Jan 6, 2024
d458151
Sort `impl` blocks by rendering the type using quote
pheki Jan 6, 2024
13843a2
Add note to README.md and comments to workflows about LLVM version used
pheki Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 52 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
workflow_dispatch:

env:
# If you update LLVM_VERSION, remember to also update `update-bindings.yml`
# and `README.md`
LLVM_VERSION: "16"

jobs:
Expand All @@ -31,8 +33,6 @@ jobs:
sha: ${{ github.sha }}

- uses: actions/checkout@v3
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
Expand All @@ -41,21 +41,6 @@ jobs:
key: ${{ runner.os }}-vitasdk
fail-on-cache-miss: true

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
${{ runner.temp }}/llvm
key: llvm

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ env.LLVM_VERSION }}
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Cache dependencies
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -134,8 +119,6 @@ jobs:
sha: ${{ github.sha }}

- uses: actions/checkout@v3
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
Expand All @@ -144,21 +127,6 @@ jobs:
key: ${{ runner.os }}-vitasdk
fail-on-cache-miss: true

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
${{ runner.temp }}/llvm
key: llvm

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ env.LLVM_VERSION }}
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand Down Expand Up @@ -234,7 +202,6 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
with:
Expand Down Expand Up @@ -278,26 +245,24 @@ jobs:
context: Check missing libs
sha: ${{ github.sha }}

doc:
name: Doc
# Checks if there's no diff when regenerating bindings
check-bindings:
name: Check bindings
runs-on: ubuntu-latest
needs: install-vitasdk
timeout-minutes: 30
env:
RUSTDOCFLAGS: -D warnings
timeout-minutes: 10
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Doc
context: Check bindings
sha: ${{ github.sha }}

- uses: actions/checkout@v3
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
with:
Expand All @@ -320,6 +285,51 @@ jobs:
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Regenerate bindings
env:
VITASDK: /opt/vitasdk
# From clang-sys
LIBCLANG_PATH: ${{ runner.temp }}/llvm/lib
LLVM_CONFIG_PATH: ${{ runner.temp }}/llvm/bin/llvm-config
run: |
cargo run --profile build-util -p vitasdk-sys-build-util -- bindgen

- name: Check diff
run: |
git add . && git diff --quiet && git diff --cached --quiet

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Check bindings
sha: ${{ github.sha }}

doc:
name: Doc
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RUSTDOCFLAGS: -D warnings
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Doc
sha: ${{ github.sha }}

- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
Expand All @@ -330,13 +340,6 @@ jobs:
- name: Run cargo doc
run: DOCS_RS=1 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --target armv7-sony-vita-newlibeabihf -Z build-std

- name: Upload docs
uses: actions/upload-artifact@v3
with:
name: docs
path: target/armv7-sony-vita-newlibeabihf/doc
if-no-files-found: error

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
Expand Down
57 changes: 51 additions & 6 deletions .github/workflows/update-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ on:

env:
PR_BRANCH: update-bindings
# If you update LLVM_VERSION, remember to also update `build.yml` and
# `README.md`
LLVM_VERSION: "16"

jobs:
install-vitasdk:
uses: ./.github/workflows/setup-vitasdk.yml
with:
path: /opt/vitasdk

update:
name: Update
update-and-regenrate:
name: Update and regenerate
runs-on: ubuntu-latest
needs: install-vitasdk
steps:
Expand All @@ -30,21 +33,63 @@ jobs:
key: ${{ runner.os }}-vitasdk
fail-on-cache-miss: true

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
${{ runner.temp }}/llvm
key: llvm

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ env.LLVM_VERSION }}
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Cache build-util dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-util-${{ hashFiles('Cargo.lock') }}

- name: Update vita-headers
run: |
echo "VITA_HEADERS_HASH=$(git submodule status | grep vita-headers | cut -d ' ' -f 2)" >> $GITHUB_ENV
git submodule update --recursive --remote vita-headers
echo "VITA_HEADERS_HASH=$(git submodule status | grep vita-headers | cut -d ' ' -f 2)" >> $GITHUB_ENV

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
profile: minimal
override: true

- name: Regenerate bindings
env:
VITASDK: /opt/vitasdk
# From clang-sys
LIBCLANG_PATH: ${{ runner.temp }}/llvm/lib
LLVM_CONFIG_PATH: ${{ runner.temp }}/llvm/bin/llvm-config
run: |
cargo run --profile build-util -p vitasdk-sys-build-util -- bindgen

- name: Commit and create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@v5
with:
title: Update vita-headers
body: Created by the action at [/.workflows/update-bindings.yml](../tree/main/.workflows/update-bindings.yml)
title: Update vita-headers bindings
body: Created by the action at [.github/workflows/update-bindings.yml](../tree/main/.github/workflows/update-bindings.yml)
branch: ${{ env.PR_BRANCH }}
delete-branch: true
commit-message: Update vita-headers to ${{ env.VITA_HEADERS_HASH }}
assignees: pheki
assignees: pheki,ZetaNumbers
committer: Aphek <bilkow@tutanota.com>
author: Aphek <bilkow@tutanota.com>

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

The format is based on [Common Changelog](https://common-changelog.org/) and [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [0.3.3] - Unreleased

### Changed

- Bindings are now pre-generated by default, meaning that LLVM / Clang is no longer requried to be installed.
- There's a new `bindgen` feature which makes the crate generate bindings at compile-time by using headers at `$VITASDK` instead of using pre-generated bindings.

## [0.3.2] - 2023-10-06

### Fixed
Expand Down
Loading
Loading