Improve isolated site dist[skip appveyor]

This commit is contained in:
halx99 2023-09-11 20:43:27 +08:00
parent 5bf03c47ac
commit d2a8fa00cd
3 changed files with 85 additions and 31 deletions

6
docs/_headers Normal file
View File

@ -0,0 +1,6 @@
/*
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
/**/*
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

47
docs/isolated.html Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Axmol Engine | A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)</title>
<meta name="generator" content="Jekyll v3.9.3" />
<meta property="og:title" content="Axmol Engine" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="The axmol home page" />
<meta property="og:description" content="The axmol home page" />
<link rel="canonical" href="https://axmolengine.github.io/" />
<meta property="og:url" content="https://axmolengine.github.io/" />
<meta property="og:site_name" content="axmolengine.github.io" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Axmol Engine" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","description":"The axmol home page","headline":"Axmol Engine","name":"axmolengine.github.io","url":"https://axmolengine.github.io/"}</script>
<!-- End Jekyll SEO tag -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- start custom head snippets, customize with your own _includes/head-custom.html file -->
<!-- Setup Google Analytics -->
<!-- You can set your favicon here -->
<!-- link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" -->
<!-- end custom head snippets -->
</head>
<body>
<h2>Axmol WebAssembly preview</h2>
<ul>
<li><a href="https://axmol.netlify.app/wasm/cpp_tests/cpp_tests.html">cpp_tests</a></li>
<li><a href="https://axmol.netlify.app/wasm/fairygui_tests/fairygui_tests.html">fairygui_tests</a></li>
<li><a href="https://axmol.netlify.app/wasm/HelloLua/HelloLua.html">HelloLua</a></li>
</ul>
</body>
</html>

View File

@ -129,43 +129,19 @@ mkdirs "$site_dist/assets/css"
Copy-Item './style.css' "$site_dist/assets/css/style.css"
Copy-Item './index.html' "$site_dist/index.html"
foreach($item in $verMap.GetEnumerator()) {
$ver = $item.Key
$html_out = Join-Path $site_dist "manual/$ver"
mkdirs $html_out
$release_tag = $item.Value
if ($ver -eq 'latest') {
git checkout dev
$release_tag = query_axmol_latest
} elseif($ver -eq '1.0') {
git checkout '1.x' # 1.x branch now for v1.0
} else {
git checkout $release_tag
}
configure_file './Doxyfile.in' './Doxyfile' @{'@VERSION@'=$release_tag; '@HTML_OUTPUT@' = "manual/$ver"}
Write-Host "Generating docs for $ver ..." -NoNewline
doxygen "./Doxyfile" # 1>$null 2>$null
Write-Host "done"
Copy-Item './hacks.js' $html_out
Copy-Item './doc_style.css' "$html_out/stylesheet.css"
configure_file './menu_version.js.in' "$html_out/menu_version.js" @{'@VERLIST@' = $strVerList; '@VERSION@' = $ver}
}
# deploy wasm demos to site_dist2
download_zip_expand 'https://ci.appveyor.com/api/projects/halx99/axmol/artifacts/build_wasm.zip?branch=dev' $(Join-Path $AX_ROOT 'tmp/build_wasm.zip')
$wasm_dist2 = Join-Path $site_src 'dist2/wasm/'
# build site2(isolated) wasm demos preview with pthread support
$site_dist2 = Join-Path $site_src 'dist'
$wasm_dist2 = Join-Path $site_dist2 'dist2/wasm/'
mkdirs $wasm_dist2
Copy-Item $(Join-Path $site_src 'isolated.html') $(Join-Path $site_dist2 'isolated.html')
Copy-Item $(Join-Path $site_src '_headers') $site_dist2
function copy_tree_if($source, $dest) {
if (Test-Path $source) {
Copy-Item $source $dest -Container -Recurse
}
}
download_zip_expand 'https://ci.appveyor.com/api/projects/halx99/axmol/artifacts/build_wasm.zip?branch=dev' $(Join-Path $AX_ROOT 'tmp/build_wasm.zip')
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/cpp_tests') $wasm_dist2
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/fairygui_tests') $wasm_dist2
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/HelloLua') $wasm_dist2
@ -192,7 +168,32 @@ $redirect_content = @'
</body>
</html>
'@ -f 'https://axmol.netlify.app/wasm/cpp_tests/cpp_tests'
Set-Content -Path $fake_cpp_tests_html -Value $redirect_content
# build manuals
foreach($item in $verMap.GetEnumerator()) {
$ver = $item.Key
$html_out = Join-Path $site_dist "manual/$ver"
mkdirs $html_out
$release_tag = $item.Value
if ($ver -eq 'latest') {
git checkout dev
$release_tag = query_axmol_latest
} elseif($ver -eq '1.0') {
git checkout '1.x' # 1.x branch now for v1.0
} else {
git checkout $release_tag
}
configure_file './Doxyfile.in' './Doxyfile' @{'@VERSION@'=$release_tag; '@HTML_OUTPUT@' = "manual/$ver"}
Write-Host "Generating docs for $ver ..." -NoNewline
doxygen "./Doxyfile" # 1>$null 2>$null
Write-Host "done"
Copy-Item './hacks.js' $html_out
Copy-Item './doc_style.css' "$html_out/stylesheet.css"
configure_file './menu_version.js.in' "$html_out/menu_version.js" @{'@VERLIST@' = $strVerList; '@VERSION@' = $ver}
}
Set-Location $store_cwd