Skip to content

Commit 8989841

Browse files
authored
harfbuzz-subset use prebuilt nuget package (#28)
1. afs.core: use nuget package instead of prebuilt cache, move build-harfbuzz-subset scripts to https://github.com/MIRIMIRIM/build-harfbuzz/tree/master 2. HarfBuzzBinding: add readme and bump to 0.1.0 3. Update github actions
1 parent 0dd9430 commit 8989841

11 files changed

Lines changed: 71 additions & 249 deletions

File tree

.github/workflows/afs-cmd-ci.yml

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,25 @@ on:
1919

2020
jobs:
2121
build:
22-
name: build-${{ matrix.target }}-${{ matrix.arch }}
23-
runs-on: ${{ matrix.os }}
22+
name: build-${{ matrix.config.target }}-${{ matrix.arch }}
23+
runs-on: ${{ matrix.config.os }}
2424
env:
25-
identifier: ${{ matrix.target }}-${{ matrix.arch }}
25+
identifier: ${{ matrix.config.target }}-${{ matrix.arch }}
2626
strategy:
2727
matrix:
2828
harfbuzz_ver: ['10.1.0']
29-
target: [win, linux-musl, osx]
30-
arch: [x64, arm64]
31-
include:
29+
dotnet_version: ['9.x']
30+
config:
3231
- os: windows-latest
3332
target: win
33+
framework: net9.0
3434
- os: windows-latest
3535
target: linux-musl
36+
framework: net8.0 # need zig fix? https://github.com/ziglang/zig/pull/20081
3637
- os: macos-latest
3738
target: osx
38-
dotnet_version: ['9.x']
39+
framework: net9.0
40+
arch: [x64, arm64]
3941

4042
steps:
4143

@@ -47,10 +49,8 @@ jobs:
4749
- name: Checkout
4850
uses: actions/checkout@v4
4951

50-
# - name: Update submodule
51-
# run: git submodule update --init --recursive
52-
5352
- name: Test
53+
if: matrix.config.target != 'osx'
5454
run: |
5555
dotnet --version
5656
cd ./AssFontSubset.CoreTests
@@ -59,47 +59,21 @@ jobs:
5959
cd ..
6060
6161
- name: Setup Zig Compiler (target linux)
62-
if: matrix.target == 'linux-musl'
62+
if: matrix.config.target == 'linux-musl'
6363
uses: mlugg/setup-zig@v1
6464
with:
6565
version: "master"
6666

6767
- name: Add llvm-objcopy (target linux)
68-
if: matrix.target == 'linux-musl'
68+
if: matrix.config.target == 'linux-musl'
6969
run: |
70-
Invoke-WebRequest -Uri https://github.com/MIRIMIRIM/FontFlat/releases/download/harfbuzz-libs/llvm-objcopy.exe -OutFile ./AssFontSubset.Console/llvm-objcopy.exe
71-
72-
- name: Use prebuilt harfbuzz subset
73-
uses: actions/cache/restore@v4
74-
with:
75-
path: ./HarfBuzzBinding/target
76-
key: hb-subset-${{ matrix.harfbuzz_ver }}-${{ env.identifier }}-static
77-
fail-on-cache-miss: true
70+
Invoke-WebRequest -Uri https://github.com/MIRIMIRIM/build-harfbuzz/releases/download/utils/llvm-objcopy.exe -OutFile ./AssFontSubset.Console/llvm-objcopy.exe
7871
7972
- name: Change to afs.cmd and Publish
80-
if: matrix.target != 'linux-musl'
8173
run: |
82-
mkdir native
83-
mv ./HarfBuzzBinding/target/* ./native/
84-
8574
cd ./AssFontSubset.Console
8675
dotnet restore
87-
dotnet publish -c Release -r ${{ env.identifier }} -f net9.0
88-
89-
cd ..
90-
91-
# need zig fix? https://github.com/ziglang/zig/pull/20081
92-
- name: Change to afs.cmd and Publish (target linux)
93-
if: matrix.target == 'linux-musl'
94-
run: |
95-
mkdir native
96-
mv ./HarfBuzzBinding/target/* ./native/
97-
98-
cd ./AssFontSubset.Console
99-
dotnet restore
100-
dotnet publish -c Release -r ${{ env.identifier }} -f net8.0
101-
102-
cd ..
76+
dotnet publish -c Release -r ${{ env.identifier }} -f ${{ matrix.config.framework }}
10377
10478
- name: Set short version
10579
shell: bash
@@ -108,25 +82,13 @@ jobs:
10882
echo "VERSION=$ver_short" >> $GITHUB_ENV
10983
11084
- name: Upload exe files
111-
if: matrix.target != 'linux-musl'
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: AssFontSubset.Console_g${{ env.VERSION }}_${{ env.identifier }}
115-
path: |
116-
AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/
117-
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.pdb
118-
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dbg
119-
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dwarf
120-
!AssFontSubset.Console/bin/Release/net9.0/${{ env.identifier }}/publish/*.dsym
121-
122-
- name: Upload exe files
123-
if: matrix.target == 'linux-musl'
12485
uses: actions/upload-artifact@v4
12586
with:
12687
name: AssFontSubset.Console_g${{ env.VERSION }}_${{ env.identifier }}
12788
path: |
128-
AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/
129-
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.pdb
130-
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dbg
131-
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dwarf
132-
!AssFontSubset.Console/bin/Release/net8.0/${{ env.identifier }}/publish/*.dsym
89+
AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/
90+
!AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.a
91+
!AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.pdb
92+
!AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dbg
93+
!AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dwarf
94+
!AssFontSubset.Console/bin/Release/${{ matrix.config.framework }}/${{ env.identifier }}/publish/*.dSYM

.github/workflows/build-harfbuzz-subset.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

AssFontSubset.Console/AssFontSubset.Console.csproj

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,12 @@
1717
</ItemGroup>
1818

1919
<Import Project="..\build\global.props" />
20-
21-
<Target Name="CopyNativeFiles" AfterTargets="Build" Condition=" '$(Configuration)' == 'Debug' and $([MSBuild]::IsOSPlatform('Windows')) ">
22-
<Copy SourceFiles="..\native\harfbuzz.dll" DestinationFolder="$(OutputPath)" />
23-
<Copy SourceFiles="..\native\harfbuzz-subset.dll" DestinationFolder="$(OutputPath)" />
24-
<Copy SourceFiles="..\native\harfbuzz.pdb" DestinationFolder="$(OutputPath)" />
25-
<Copy SourceFiles="..\native\harfbuzz-subset.pdb" DestinationFolder="$(OutputPath)" />
26-
</Target>
27-
28-
<ItemGroup>
20+
21+
<ItemGroup Condition="'$(Configuration)' == 'Release'">
2922
<DirectPInvoke Include="harfbuzz" />
30-
<NativeLibrary Include="../native/libharfbuzz.a" />
23+
<NativeLibrary Include="$(OutputPath)libharfbuzz.a" />
3124
<DirectPInvoke Include="harfbuzz-subset" />
32-
<NativeLibrary Include="../native/libharfbuzz-subset.a" />
25+
<NativeLibrary Include="$(OutputPath)libharfbuzz-subset.a" />
3326
</ItemGroup>
3427

3528
</Project>

HarfBuzzBinding/HarfBuzzBinding.csproj

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,41 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
6-
<Version>0.0.1</Version>
6+
<Version>0.1.0</Version>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
</PropertyGroup>
1111

12+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
13+
<PackageSuffix>Win</PackageSuffix>
14+
</PropertyGroup>
15+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
16+
<PackageSuffix>Linux</PackageSuffix>
17+
</PropertyGroup>
18+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
19+
<PackageSuffix>Mac</PackageSuffix>
20+
</PropertyGroup>
21+
22+
<PropertyGroup Condition=" $(RuntimeIdentifier.StartsWith('win')) ">
23+
<PackageSuffix>Win</PackageSuffix>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" $(RuntimeIdentifier.StartsWith('linux')) ">
26+
<PackageSuffix>Linux</PackageSuffix>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" $(RuntimeIdentifier.StartsWith('osx')) ">
29+
<PackageSuffix>Mac</PackageSuffix>
30+
</PropertyGroup>
31+
32+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
33+
<NativeLibraryType>Shared</NativeLibraryType>
34+
</PropertyGroup>
35+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
36+
<NativeLibraryType>Static</NativeLibraryType>
37+
</PropertyGroup>
38+
39+
<ItemGroup>
40+
<PackageReference Include="MIR.NativeLib.Harfbuzz.$(NativeLibraryType).$(PackageSuffix)" Version="10.1.0.0" />
41+
</ItemGroup>
42+
1243
</Project>

HarfBuzzBinding/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# HarfBuzzBinding
2+
3+
This is a binding library for HarfBuzz, primarily targeting the use of `harfbuzz-subset`.
4+
5+
The dependent native libraries are provided by `MIR.NativeLib.Harfbuzz.*`, shared libraries are used for debugging, and static libraries are employed for release builds, so you can only `PublishAot` when publish release. The version of `MIR.NativeLib.Harfbuzz.*` is harfbuzz version + package patch version. Currently, it only supports the following RIDs:
6+
7+
- Windows:
8+
- win-x64
9+
- win-arm64
10+
- Linux:
11+
- linux-musl-x64
12+
- linux-musl-arm64
13+
- Mac:
14+
- osx-x64
15+
- osx-arm64

HarfBuzzBinding/scripts/linux-musl-arm64.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

HarfBuzzBinding/scripts/linux-musl-x64.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

HarfBuzzBinding/scripts/osx-x64.ini

Lines changed: 0 additions & 13 deletions
This file was deleted.

HarfBuzzBinding/scripts/project.ini

Lines changed: 0 additions & 16 deletions
This file was deleted.

HarfBuzzBinding/scripts/win-arm64.ini

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)