diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3c2944a6d..315db26b9 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -201,6 +201,53 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } shell: pwsh + # Android (API 29, arm64-v8a and x86_64): the collector, the async runtime and the default + # library, cross-built with the runner's Android NDK by the same scripts a developer runs. + # tslang links for Android through the NDK too (--android-ndk-path / ANDROID_NDK_HOME). + - name: Install Ninja (Android builds) + continue-on-error: false + run: choco install ninja -y --no-progress + shell: pwsh + + - name: Build Android Collector and Async Runtime + continue-on-error: false + working-directory: ${{github.workspace}} + run: | + $ndk = if ($env:ANDROID_NDK_LATEST_HOME) { $env:ANDROID_NDK_LATEST_HOME } else { $env:ANDROID_NDK_HOME } + if (-not $ndk -or -not (Test-Path "$ndk\build\cmake\android.toolchain.cmake")) { Write-Error "no Android NDK on this runner (ANDROID_NDK_LATEST_HOME / ANDROID_NDK_HOME)"; exit 1 } + Get-Content "$ndk\source.properties" | Select-String "Pkg.Revision" + "ANDROID_NDK_HOME=$ndk" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 + $env:ANDROID_NDK_HOME = $ndk + .\scripts\build_gc_release_android.bat + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + .\scripts\build_tslang_runtime_release_android.bat + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + shell: pwsh + + - name: Build Android Default Library + continue-on-error: false + working-directory: ${{github.workspace}}/TypeScriptCompilerDefaultLib + env: + TOOL_PATH: ${{github.workspace}}/__build/tslang/msbuild/x64/release/bin + run: | + .\scripts\build_android.bat + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + shell: pwsh + + # An executable and a shared library linked for x86_64 Android with what was just built; + # test-compile-android-link skips when the libraries are missing, so require them here. + - name: Test Compiler for Android + continue-on-error: false + working-directory: ${{github.workspace}}/__build/tslang/msbuild/x64/release + env: + TSLANG_ANDROID_DEFAULT_LIB_PATH: ${{github.workspace}}/TypeScriptCompilerDefaultLib/__build/android/x86_64 + run: | + $out = ctest -C ${{ env.BUILD_TYPE }} -R "test-compile-android-" --output-on-failure 2>&1 | Out-String + $out + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + if ($out -match "Skipped") { Write-Error "the Android link test was skipped: its libraries were not found"; exit 1 } + shell: pwsh + - name: Create Zip of Windows Asset working-directory: ${{github.workspace}}/__build # Flatten the compiler/runtime binaries into the archive root, and add the @@ -214,11 +261,22 @@ jobs: # (findResourceDir's "release package" candidate), so stage that layout too - its headers # only: the official LLVM package also puts compiler-rt's libraries under # lib/clang//lib, which neither tsbindgen nor tslang uses. + # Android, per ABI (arm64-v8a, x86_64): android//defaultlib/... (--default-lib-path= + # android/) and android//lib/{libgc.a,libTypeScriptAsyncRuntime.a} (--gc-lib-path + # and --tslang-lib-path). run: | + foreach ($abi in 'arm64-v8a', 'x86_64') { + $dest = ".\android_stage\android\$abi" + New-Item -ItemType Directory -Force -Path "$dest\lib" | Out-Null + # moved, not copied: the default library's __build, packaged whole below, would carry it twice + Move-Item -Path "..\TypeScriptCompilerDefaultLib\__build\android\$abi\defaultlib" -Destination $dest -ErrorAction Stop + Copy-Item -Path "..\3rdParty\gc\android\$abi\release\lib\libgc.a", ".\tslang-runtime\release\android\$abi\libTypeScriptAsyncRuntime.a" -Destination "$dest\lib" -ErrorAction Stop + } + Remove-Item -Recurse -Force -Path "..\TypeScriptCompilerDefaultLib\__build\android" -ErrorAction Stop New-Item -ItemType Directory -Force -Path .\gcdll_stage\gcdll | Out-Null Copy-Item -Path ..\3rdParty\gcdll\x64\release\lib\gc.lib, ..\3rdParty\gcdll\x64\release\bin\gc.dll -Destination .\gcdll_stage\gcdll -ErrorAction Stop Get-ChildItem -Path ..\3rdParty\llvm\x64\release\lib\clang -Directory | ForEach-Object { $dest = ".\resourcedir_stage\lib\clang\$($_.Name)"; New-Item -ItemType Directory -Force -Path $dest | Out-Null; Copy-Item -Path (Join-Path $_.FullName "include") -Destination $dest -Recurse -ErrorAction Stop } - Get-ChildItem -Path .\tslang\msbuild\x64\release\bin\tslang.exe, .\tslang\msbuild\x64\release\bin\tsbindgen.exe, .\tslang\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\tslang\msbuild\x64\release\bin\gc.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tslang\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe, ..\TypeScriptCompilerDefaultLib\__build, .\gcdll_stage, .\resourcedir_stage | Compress-Archive -DestinationPath ..\${{ env.ASSET_NAME }}-windows-x64.zip + Get-ChildItem -Path .\tslang\msbuild\x64\release\bin\tslang.exe, .\tslang\msbuild\x64\release\bin\tsbindgen.exe, .\tslang\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\tslang\msbuild\x64\release\bin\gc.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tslang\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe, ..\TypeScriptCompilerDefaultLib\__build, .\gcdll_stage, .\resourcedir_stage, .\android_stage\android | Compress-Archive -DestinationPath ..\${{ env.ASSET_NAME }}-windows-x64.zip shell: pwsh - name: Archive Zip of Windows Asset