Skip to content

Commit 4bbb7d4

Browse files
committed
Add publish axmol build system package support
1 parent a6cd62c commit 4bbb7d4

File tree

4 files changed

+51
-37
lines changed

4 files changed

+51
-37
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ jobs:
7474
with:
7575
tag_name: ${{ steps.make_pkg.outputs.release_tag }}
7676
name: ${{ steps.make_pkg.outputs.release_tag }}
77-
files: ${{ steps.make_pkg.outputs.release_pkg }}
77+
files: |
78+
${{ steps.make_pkg.outputs.release_pkg }}
79+
${{ steps.make_pkg.outputs.bs_release_pkg }}
7880
body_path: ${{ steps.make_pkg.outputs.release_note }}
7981
prerelease: ${{ steps.make_pkg.outputs.prerelease }}
8082
target_commitish: ${{ github.event.inputs.commitish }}

1k/manifest.ps1

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,28 @@
77
# 3.30.0: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9478
88
#
99

10-
# add or overwrite tool version like follow
11-
if ($Global:is_axmol_app -or $Global:is_axmol_engine) {
12-
# load cross platform build.profiles
13-
$build_profiles_file = Join-Path $PSScriptRoot 'build.profiles'
14-
$build_profiles = ConvertFrom-Props (Get-Content $build_profiles_file)
15-
16-
$manifest['axslcc'] = $build_profiles['axslcc']
17-
$manifest['nuget'] = $build_profiles['nuget']
18-
$manifest['emsdk'] = $build_profiles['emsdk']
19-
$manifest['jdk'] = $build_profiles['jdk']
20-
21-
$manifest['ninja'] = $build_profiles['ninja']
10+
# load cross platform build.profiles
11+
$build_profiles_file = Join-Path $PSScriptRoot 'build.profiles'
12+
$build_profiles = ConvertFrom-Props (Get-Content $build_profiles_file)
2213

23-
$manifest['ndk'] = $build_profiles['ndk']
24-
$manifest['cmake'] = $build_profiles['cmake']
14+
$manifest['emsdk'] = $build_profiles['emsdk']
15+
$manifest['jdk'] = $build_profiles['jdk']
16+
$manifest['ninja'] = $build_profiles['ninja']
17+
$manifest['ndk'] = $build_profiles['ndk']
18+
$manifest['cmake'] = $build_profiles['cmake']
19+
$manifest['vs'] = $build_profiles['vs']
20+
$manifest['llvm'] = $build_profiles['llvm']
2521

26-
$manifest['vs'] = $build_profiles['vs']
27-
$manifest['llvm'] = $build_profiles['llvm']
22+
# android sdk tools
23+
$android_sdk_tools['build-tools'] = $build_profiles['build-tools']
24+
$android_sdk_tools['platforms'] = "android-$($build_profiles['target_sdk'])"
2825

29-
# android sdk tools
30-
$android_sdk_tools['build-tools'] = $build_profiles['build-tools']
31-
$android_sdk_tools['platforms'] = "android-$($build_profiles['target_sdk'])"
26+
$Global:build_profiles = $build_profiles
3227

33-
$Global:build_profiles = $build_profiles
34-
35-
$Global:download_path = $1k.realpath("$PSScriptRoot/../cache")
36-
} else {
37-
$Global:build_profiles = @{}
28+
$Global:download_path = $1k.realpath("$PSScriptRoot/../cache")
29+
30+
# add or overwrite tool version like follow
31+
if ($Global:is_axmol_app -or $Global:is_axmol_engine) {
32+
$manifest['axslcc'] = $build_profiles['axslcc']
33+
$manifest['nuget'] = $build_profiles['nuget']
3834
}

setup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ echo > /dev/null <<"out-null"
2525
$myRoot = $PSScriptRoot
2626
$AX_ROOT = $myRoot
2727
28-
$Global:is_axmol_app = $true
28+
$Global:is_axmol_engine = Test-Path $(Join-Path $AX_ROOT 'core/axmol.cpp')
2929
3030
function println($message) { Write-Host "axmol: $message" }
3131

tools/ci/publish.ps1

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,33 @@ $excludes = @(
5757
'tmp'
5858
'temp'
5959
'tools/external'
60+
'tools/bindings-generator/clang/prebuilt'
6061
'axmol-*.zip'
6162
'out'
6263
'*/_x/*'
6364
)
6465

6566
$pkg_file_name = "axmol-$version.zip"
6667
$pkg_file_path = $(Join-Path $AX_ROOT $pkg_file_name)
67-
68-
Write-Host "Creating package $pkg_file_path ..."
69-
70-
$compress_args = @{
68+
$main_pkg_compress_args = @{
7169
Path = $AX_ROOT
72-
CompressionLevel = 'Optimal'
70+
CompressionLevel = 'SmallestSize'
7371
DestinationPath = $pkg_file_path
7472
RelativeBasePath = $AX_ROOT
7573
Exclude = $excludes
7674
Prefix = "axmol-$version"
7775
}
7876

79-
# Compress-Archive @compress -PassThru
77+
$bs_pkg_file_name = "axmol-bs-$version.zip"
78+
$bs_pkg_file_path = $(Join-Path $AX_ROOT $bs_pkg_file_name)
79+
$bs_pkg_compress_args = @{
80+
Path = @("$AX_ROOT/1k", "$AX_ROOT/setup.ps1", "$AX_ROOT/core/axmolver.h.in", "$AX_ROOT/tools/cmdline")
81+
CompressionLevel = 'Optimal'
82+
DestinationPath = $bs_pkg_file_path
83+
RelativeBasePath = $AX_ROOT
84+
Exclude = $excludes
85+
Prefix = "axmol-bs-$version"
86+
}
8087

8188
function Compress-ArchiveEx() {
8289
param(
@@ -224,6 +231,7 @@ public class UnixFileStream : FileStream
224231
'Optimal' = [System.IO.Compression.CompressionLevel]::Optimal
225232
'Fastest' = [System.IO.Compression.CompressionLevel]::Fastest
226233
'NoCompression' = [System.IO.Compression.CompressionLevel]::NoCompression
234+
'SmallestSize' = [System.IO.Compression.CompressionLevel]::SmallestSize
227235
}[$CompressionLevel]
228236

229237
[array]$Excludes = $Exclude
@@ -341,21 +349,29 @@ else {
341349
$release_note = Join-Path $AX_ROOT "release_note_draft.txt"
342350
}
343351

352+
# save release note
344353
New-Item -Path $release_note -ItemType File -Value $release_note_content -Force
345354

346-
# Compress-Archive @compress_args
347-
$total = Compress-ArchiveEx @compress_args -Force
355+
# create axmol build system package
356+
Write-Host "Creating build system package $bs_pkg_file_path ..."
357+
$total= Compress-ArchiveEx @bs_pkg_compress_args -Force
358+
$bs_md5_digest = (Get-FileHash $bs_pkg_file_path -Algorithm MD5).Hash
359+
Write-Host "Create build system package $bs_pkg_file_path done, ${total} files found, MD5: $bs_md5_digest"
348360

361+
# create main package
362+
Write-Host "Creating main package $pkg_file_path ..."
363+
$total = Compress-ArchiveEx @main_pkg_compress_args -Force
349364
$md5_digest = (Get-FileHash $pkg_file_path -Algorithm MD5).Hash
350-
351-
Write-Host "Create package $pkg_file_path done, ${total} files found, MD5: $md5_digest"
365+
Write-Host "Create main package $pkg_file_path done, ${total} files found, MD5: $md5_digest"
352366

353367
Pop-Location
354368

369+
[System.IO.File]::AppendAllText($release_note, "## MD5 Hash of the release artifacts`n - ``${pkg_file_name}``: $md5_digest`n - ``${bs_pkg_file_name}``: $bs_md5_digest")
370+
355371
if ($env:GITHUB_ACTIONS -eq 'true') {
356-
[System.IO.File]::AppendAllText($release_note, "## MD5 Hash of the release artifacts`n - ``${pkg_file_name}``: $md5_digest")
357372
echo "release_tag=v$version" >> ${env:GITHUB_OUTPUT}
358373
echo "release_pkg=$pkg_file_name" >> ${env:GITHUB_OUTPUT}
374+
echo "bs_release_pkg=$bs_pkg_file_name" >> ${env:GITHUB_OUTPUT}
359375
echo "release_note=$release_note" >> ${env:GITHUB_OUTPUT}
360376
echo "prerelease=$prerelease" >> ${env:GITHUB_OUTPUT}
361377
}

0 commit comments

Comments
 (0)