Skip to content

Commit 2aca13e

Browse files
committed
fixes reference source links (#55)
1 parent 9c8781c commit 2aca13e

File tree

9 files changed

+159
-62
lines changed

9 files changed

+159
-62
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.13.2
1+
18.12.1

WORKSPACE

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ bazel_skylib_workspace()
1717

1818
http_archive(
1919
name = "build_bazel_rules_nodejs",
20-
sha256 = "0fad45a9bda7dc1990c47b002fd64f55041ea751fafc00cd34efb96107675778",
21-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.5.0/rules_nodejs-5.5.0.tar.gz"],
20+
sha256 = "5aae76dced38f784b58d9776e4ab12278bc156a9ed2b1d9fcd3e39921dc88fda",
21+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.7.1/rules_nodejs-5.7.1.tar.gz"],
2222
)
2323

2424
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
@@ -29,7 +29,7 @@ load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
2929

3030
nodejs_register_toolchains(
3131
name = "nodejs",
32-
node_version = "16.13.2",
32+
node_version = "18.12.0",
3333
)
3434

3535
load("@rules_nodejs//nodejs:yarn_repositories.bzl", "yarn_repositories")
@@ -48,15 +48,11 @@ yarn_install(
4848

4949
http_archive(
5050
name = "io_bazel_rules_sass",
51-
sha256 = "4e60e706447cdc30dfd350191911b47a2aa3b62a199c94569cc4af473270343b",
52-
strip_prefix = "rules_sass-4f21d78581b7cfe94b28f5cb8ef6d313e8879a1c",
53-
urls = ["https://github.com/bazelbuild/rules_sass/archive/4f21d78581b7cfe94b28f5cb8ef6d313e8879a1c.zip"],
51+
sha256 = "618f0b7aae019c149ac2ff4142a66c110de116fb5c173dbeccedbaee06fc5f6d",
52+
strip_prefix = "rules_sass-a2fce75bcf103750f7accbf7f966ad48bcbca2d4",
53+
urls = ["https://github.com/bazelbuild/rules_sass/archive/a2fce75bcf103750f7accbf7f966ad48bcbca2d4.zip"],
5454
)
5555

56-
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
57-
58-
rules_sass_dependencies()
59-
6056
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
6157

6258
sass_repositories()

scripts/devref_repos.json

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,79 @@
11
[
22
{
33
"name": "ecsact_runtime",
4-
"sha256": "f7b5f5cc5b70620934be48090048e9092dbc86ba4e027959d65fd1dd46c36a77",
5-
"stripPrefix": "ecsact_runtime-475cae75c657b2570b1041264670c026de412814",
6-
"url": "https://github.com/ecsact-dev/ecsact_runtime/archive/475cae75c657b2570b1041264670c026de412814.zip"
4+
"commit": "7107b13b74d5816b3ad5f1ee3ce22f810e5ac292",
5+
"sha256": "4fe1ec0f050f7aac9838d55b27a11ee3d32c5c04537a3aae6ae04c89b163e834",
6+
"stripPrefix": "ecsact_runtime-7107b13b74d5816b3ad5f1ee3ce22f810e5ac292",
7+
"url": "https://github.com/ecsact-dev/ecsact_runtime/archive/7107b13b74d5816b3ad5f1ee3ce22f810e5ac292.zip"
78
},
89
{
910
"name": "ecsact_parse",
10-
"sha256": "b3f65f9c5ec62d77647c32736738458230469cac937eab82d46a577e52b7fc2a",
11-
"stripPrefix": "ecsact_parse-45a30d62a0c53acb3a329fa9df250c20f0b384d1",
12-
"url": "https://github.com/ecsact-dev/ecsact_parse/archive/45a30d62a0c53acb3a329fa9df250c20f0b384d1.zip"
11+
"commit": "8ca05ca39247e3c365972f985d5c1b31c9404af2",
12+
"sha256": "4e7c32731e30125aff69e6f98626b58c48fc1e631bbd5f66d91ae902a4442c2a",
13+
"stripPrefix": "ecsact_parse-8ca05ca39247e3c365972f985d5c1b31c9404af2",
14+
"url": "https://github.com/ecsact-dev/ecsact_parse/archive/8ca05ca39247e3c365972f985d5c1b31c9404af2.zip"
1315
},
1416
{
1517
"name": "ecsact_interpret",
16-
"sha256": "ac3fb03b584ec226bb2d240621e7a539339fbfd6dc2131580109c35f3b11f461",
17-
"stripPrefix": "ecsact_interpret-d014d7aa30ee2a1ac5086773a6c3477451671acd",
18-
"url": "https://github.com/ecsact-dev/ecsact_interpret/archive/d014d7aa30ee2a1ac5086773a6c3477451671acd.zip"
18+
"commit": "eeb38961cfed1b896cf8c5f8e6951dc35cf63f60",
19+
"sha256": "4c5af9d580dbab235b01f02405280cc3f76ec2101b2daf2531f79f24012875bc",
20+
"stripPrefix": "ecsact_interpret-eeb38961cfed1b896cf8c5f8e6951dc35cf63f60",
21+
"url": "https://github.com/ecsact-dev/ecsact_interpret/archive/eeb38961cfed1b896cf8c5f8e6951dc35cf63f60.zip"
1922
},
2023
{
2124
"name": "ecsact_rtb",
22-
"sha256": "7ce2b63a14cf50595675b9e4c92d8296d383f1a01576db153ee8eb9da84043d4",
23-
"stripPrefix": "ecsact_rtb-0aa75a084cbb52a272beb89c408e854e90842e6a",
24-
"url": "https://github.com/ecsact-dev/ecsact_rtb/archive/0aa75a084cbb52a272beb89c408e854e90842e6a.zip"
25+
"commit": "17fd007a45cd803c86ceb093b8f637df47a5f9b9",
26+
"sha256": "aae6d74f32de8b4670ac38b9808b42d406570eca91d04e572d75523e003d23b1",
27+
"stripPrefix": "ecsact_rtb-17fd007a45cd803c86ceb093b8f637df47a5f9b9",
28+
"url": "https://github.com/ecsact-dev/ecsact_rtb/archive/17fd007a45cd803c86ceb093b8f637df47a5f9b9.zip"
2529
},
2630
{
2731
"name": "ecsact_rt_entt",
28-
"sha256": "0b4f60e4a2f92e6fd27048b6f6e703c7716c51e3d1e85f4c385fec5fdf7c6625",
29-
"stripPrefix": "ecsact_rt_entt-2d465f01a4667dccecde4286359625eb12203926",
30-
"url": "https://github.com/ecsact-dev/ecsact_rt_entt/archive/2d465f01a4667dccecde4286359625eb12203926.zip"
32+
"commit": "75629b8b6789c0946e27b7a1d510dc160bf1d0bd",
33+
"sha256": "bd42f68a883773a1621522006b8da853335489ed113fcf53695dbc6754d2ba28",
34+
"stripPrefix": "ecsact_rt_entt-75629b8b6789c0946e27b7a1d510dc160bf1d0bd",
35+
"url": "https://github.com/ecsact-dev/ecsact_rt_entt/archive/75629b8b6789c0946e27b7a1d510dc160bf1d0bd.zip"
3136
},
3237
{
3338
"name": "ecsact_si_wasm",
34-
"sha256": "50b884ff324125a682f11725bf2724604d70810d995aca2449ea19215863729c",
35-
"stripPrefix": "ecsact_si_wasm-b8d38f376a26bbfe3d41fdf9526d9d895943c93e",
36-
"url": "https://github.com/ecsact-dev/ecsact_si_wasm/archive/b8d38f376a26bbfe3d41fdf9526d9d895943c93e.zip"
39+
"commit": "ce5d36ef60d3371f0332f9c7bdcbf0973dcc6b2e",
40+
"sha256": "a176076d994db12674b2f91af4da80b981a81d0d9620e218796de4be730f7c7a",
41+
"stripPrefix": "ecsact_si_wasm-ce5d36ef60d3371f0332f9c7bdcbf0973dcc6b2e",
42+
"url": "https://github.com/ecsact-dev/ecsact_si_wasm/archive/ce5d36ef60d3371f0332f9c7bdcbf0973dcc6b2e.zip"
3743
},
3844
{
3945
"name": "ecsact_sdk",
40-
"sha256": "15046b28a8c8e8c494acfd9091575e60f2f3b9cc2bb0f37cfea725f436972242",
41-
"stripPrefix": "ecsact_sdk-db4173eac65950f8837abd1d6c0f5079622d79a4",
42-
"url": "https://github.com/ecsact-dev/ecsact_sdk/archive/db4173eac65950f8837abd1d6c0f5079622d79a4.zip"
46+
"commit": "f4e30a83f704ee567e03bf19a3b3b3840a9e6d9b",
47+
"sha256": "ff8a8d04fe3d2b68ccef93455e102fbc6ddfe3c0ea71abeab35bfd49ba283a8b",
48+
"stripPrefix": "ecsact_sdk-f4e30a83f704ee567e03bf19a3b3b3840a9e6d9b",
49+
"url": "https://github.com/ecsact-dev/ecsact_sdk/archive/f4e30a83f704ee567e03bf19a3b3b3840a9e6d9b.zip"
4350
},
4451
{
4552
"name": "ecsact_lang_cpp",
46-
"sha256": "2f9982186cb817bf44b938c26dd07cdfd136601d0578549a251de58e43c429bc",
47-
"stripPrefix": "ecsact_lang_cpp-389390edc5a2f2468ee866c7e4aea18642f9c186",
48-
"url": "https://github.com/ecsact-dev/ecsact_lang_cpp/archive/389390edc5a2f2468ee866c7e4aea18642f9c186.zip"
53+
"commit": "79a01049ce243251f095cf601738a5f41be6f0b0",
54+
"sha256": "0585f5f5c17f58223bb88cbfc24998cdeee4f5f9a8b1549ae06a9e652cb0ada0",
55+
"stripPrefix": "ecsact_lang_cpp-79a01049ce243251f095cf601738a5f41be6f0b0",
56+
"url": "https://github.com/ecsact-dev/ecsact_lang_cpp/archive/79a01049ce243251f095cf601738a5f41be6f0b0.zip"
4957
},
5058
{
5159
"name": "ecsact_lang_csharp",
52-
"sha256": "75e584f77b7c29916ce5d24dea4d2242963c61901730c36a4e52eacb13057c3e",
53-
"stripPrefix": "ecsact_lang_csharp-996166d67fe6b819a10d3c840606b0ac5d2fc1fa",
54-
"url": "https://github.com/ecsact-dev/ecsact_lang_csharp/archive/996166d67fe6b819a10d3c840606b0ac5d2fc1fa.zip"
60+
"commit": "9c16122fbbd5d145e9a574db4e8a1e9a0cac7c66",
61+
"sha256": "7dec586ceae7142f8a7116e65e885ad53cc6bdc86b9ac4c1a942dee7f993e4e1",
62+
"stripPrefix": "ecsact_lang_csharp-9c16122fbbd5d145e9a574db4e8a1e9a0cac7c66",
63+
"url": "https://github.com/ecsact-dev/ecsact_lang_csharp/archive/9c16122fbbd5d145e9a574db4e8a1e9a0cac7c66.zip"
5564
},
5665
{
5766
"name": "ecsact_lang_json",
58-
"sha256": "564ad31d40245c1284a7c62e7f8cd21418e733e587574d31ab00c65f1eee05f2",
59-
"stripPrefix": "ecsact_lang_json-c9fed64ff96195db084d7ec70b5ab11838f8aeaf",
60-
"url": "https://github.com/ecsact-dev/ecsact_lang_json/archive/c9fed64ff96195db084d7ec70b5ab11838f8aeaf.zip"
67+
"commit": "0c5dc6658ab803e9b71d1b65efc31695a44cb247",
68+
"sha256": "b670fae2d12e8dad19394b474f49efb8aa25900f52f85088ff6a54cf6de13685",
69+
"stripPrefix": "ecsact_lang_json-0c5dc6658ab803e9b71d1b65efc31695a44cb247",
70+
"url": "https://github.com/ecsact-dev/ecsact_lang_json/archive/0c5dc6658ab803e9b71d1b65efc31695a44cb247.zip"
6171
},
6272
{
6373
"name": "ecsact_unity",
64-
"sha256": "7aa51540733caccad13cf9c7439c13c251cc7e0d75b93e957bf468c1334c780d",
65-
"stripPrefix": "ecsact_unity-749b1e74fd903a86a12b38493257f90361b05170",
66-
"url": "https://github.com/ecsact-dev/ecsact_unity/archive/749b1e74fd903a86a12b38493257f90361b05170.zip"
74+
"commit": "9a38f2120f5308bf222b4b658a3cd99e2765422a",
75+
"sha256": "c818bb4ecdf97ad84402ee2910bc1bbd581899a48eb35fbae1ae3681261e5498",
76+
"stripPrefix": "ecsact_unity-9a38f2120f5308bf222b4b658a3cd99e2765422a",
77+
"url": "https://github.com/ecsact-dev/ecsact_unity/archive/9a38f2120f5308bf222b4b658a3cd99e2765422a.zip"
6778
}
6879
]

scripts/doxygen_devref.mjs

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {createWriteStream, existsSync, createReadStream} from 'fs';
1616
import {promisify} from 'util';
1717
import {execa} from 'execa';
1818
import * as crypto from 'crypto';
19+
import {spawnSync} from 'child_process';
1920

2021
const workspaceDir = process.env['BUILD_WORKSPACE_DIRECTORY'];
2122
const devRefDir = path.resolve(workspaceDir, 'src/assets/_devref');
@@ -238,6 +239,7 @@ async function writeRepoJson(repo, task) {
238239

239240
function isRepoSame(a, b) {
240241
return (
242+
a.commit === b.commit &&
241243
a.name === b.name &&
242244
a.url === b.url &&
243245
a.sha256 === b.sha256 &&
@@ -247,9 +249,12 @@ function isRepoSame(a, b) {
247249

248250
async function main() {
249251
let force = false;
252+
let update = false;
250253
for (const arg of process.argv) {
251254
if (arg === '--force') {
252255
force = true;
256+
} else if (arg === '--update') {
257+
update = true;
253258
}
254259
}
255260

@@ -269,23 +274,65 @@ async function main() {
269274
};
270275

271276
let madeChanges = false;
277+
278+
let ghAuthToken = '';
279+
if (update) {
280+
try {
281+
ghAuthToken = spawnSync('gh', ['auth', 'token']).stdout.toString();
282+
} catch (err) {
283+
console.error(
284+
'gh auth token failed. Please make sure you have the GitHub CLI installed and you are authenticated',
285+
);
286+
process.exit(1);
287+
}
288+
}
289+
272290
for (const repo of repos) {
273-
if (repo.commit) {
274-
madeChanges = true;
291+
if (update) {
292+
const {default_branch} = await (
293+
await fetch(`https://api.github.com/repos/ecsact-dev/${repo.name}`, {
294+
headers: {
295+
Authorization: `token ${ghAuthToken}`,
296+
},
297+
})
298+
).json();
299+
300+
const commitSha = await (
301+
await fetch(
302+
`https://api.github.com/repos/ecsact-dev/${repo.name}/commits/${default_branch}`,
303+
{
304+
headers: {
305+
Authorization: `token ${ghAuthToken}`,
306+
Accept: 'application/vnd.github.VERSION.sha',
307+
},
308+
},
309+
)
310+
).text();
311+
312+
if (repo.commit !== commitSha) {
313+
madeChanges = true;
314+
repo.commit = commitSha;
315+
delete repo.sha256;
316+
delete repo.url;
317+
delete repo.stripPrefix;
318+
}
319+
}
275320

321+
if (repo.commit) {
276322
if (!repo.sha256) {
323+
madeChanges = true;
277324
repo.sha256 = '';
278325
}
279326

280327
if (!repo.stripPrefix) {
328+
madeChanges = true;
281329
repo.stripPrefix = `${repo.name}-${repo.commit}`;
282330
}
283331

284332
if (!repo.url) {
333+
madeChanges = true;
285334
repo.url = `https://github.com/ecsact-dev/${repo.name}/archive/${repo.commit}.zip`;
286335
}
287-
288-
delete repo.commit;
289336
}
290337
}
291338

src/components/doxygen-member-components/doxygen-location/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ng_ts_project(
2121
deps = [
2222
"//src/components/doxygen-member-components/doxygen-container",
2323
"//src/search:doxygen-def-types",
24+
"//src/search:service",
2425
"@npm//@angular/common",
2526
"@npm//@angular/core",
2627
"@npm//@angular/router",

src/components/doxygen-member-components/doxygen-location/doxygen-location.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<span class="i24">source</span>
44
<span>{{ repo }}</span>
55
</div>
6-
<a [href]="href" target="_blank">{{ displayFilePath }}</a>
6+
<a [href]="getHref(hrefBase$ | async)" target="_blank">{{ displayFilePath }}</a>
77
</pre>

src/components/doxygen-member-components/doxygen-location/doxygen-location.component.ts

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import {
55
ChangeDetectorRef,
66
} from '@angular/core';
77
import {ActivatedRoute} from '@angular/router';
8+
import {from, map, Observable, switchMap} from 'rxjs';
89
import {DoxygenDefLocation} from '../../../search/doxygen-def-types';
10+
import {Search} from '../../../search/search.service';
911

1012
@Component({
1113
selector: 'doxygen-location',
@@ -26,17 +28,6 @@ export class DoxygenLocationComponent {
2628
return this._repo || this.route.snapshot.params.repo;
2729
}
2830

29-
get href(): string {
30-
// TODO(zaucy): Use commit from `repo.json`
31-
const commit = `main`;
32-
let href = `https://github.com/ecsact-dev/${this.repo}/blob/${commit}/`;
33-
href += this.location.file;
34-
if (!isNaN(this.location.line)) {
35-
href += `#L${this.location.line}`;
36-
}
37-
return href;
38-
}
39-
4031
get displayFilePath() {
4132
let result = this.location.file;
4233
if (!isNaN(this.location.line)) {
@@ -46,7 +37,32 @@ export class DoxygenLocationComponent {
4637
return result;
4738
}
4839

49-
constructor(private route: ActivatedRoute, cdr: ChangeDetectorRef) {
40+
readonly commit$: Observable<string>;
41+
readonly hrefBase$: Observable<string>;
42+
43+
constructor(
44+
private route: ActivatedRoute,
45+
cdr: ChangeDetectorRef,
46+
search: Search,
47+
) {
48+
this.commit$ = route.params.pipe(
49+
switchMap(() => from(search.getRepoInfo(this.repo))),
50+
map(info => info.commit),
51+
);
52+
this.hrefBase$ = this.commit$.pipe(
53+
map(
54+
commit => `https://github.com/ecsact-dev/${this.repo}/blob/${commit}/`,
55+
),
56+
);
5057
route.params.subscribe(() => cdr.markForCheck());
5158
}
59+
60+
getHref(hrefBase: string): string {
61+
if (!hrefBase) return '';
62+
hrefBase += this.location.file;
63+
if (!isNaN(this.location.line)) {
64+
hrefBase += `#L${this.location.line}`;
65+
}
66+
return hrefBase;
67+
}
5268
}

src/components/search/search.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class SearchComponent implements OnInit {
8989
}
9090

9191
onFocus() {
92+
this.search.fetchIfNeeded();
9293
this.cdr.markForCheck();
9394
}
9495

0 commit comments

Comments
 (0)