Skip to content

Commit 7f3d9ac

Browse files
authored
Use the precompiled dartdoc with pana in the pub_worker. (dart-lang#9176)
1 parent 7bda867 commit 7f3d9ac

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
44
## Next Release (replace with git tag when deployed)
55
* Bump runtimeVersion to `2026.01.20`.
66
* Upgraded pana to `0.23.8`.
7+
* Note: workers use AOT compiled `dartdoc` and `pub_worker`.
78

89
## `20260115t114900-all`
910
* Bump runtimeVersion to `2026.01.13`.

Dockerfile.worker

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ ENV FLUTTER_ROOT="/home/worker/flutter/stable"
4545
ENV PATH="/home/worker/bin:/home/worker/dart/stable/bin:${PATH}"
4646

4747
# Setup dartdoc
48-
RUN tool/setup-dartdoc.sh /home/worker/bin/dartdoc 9.0.1
48+
ENV DARTDOC_DIR=/home/worker/dartdoc
49+
RUN tool/setup-dartdoc.sh "${DARTDOC_DIR}" 9.0.1
50+
ENV DARTDOC_BINARY="${DARTDOC_DIR}/build/dartdoc"
51+
ENV DARTDOC_RESOURCES_DIR="${DARTDOC_DIR}/lib/resources"
4952

5053
# Install dependencies for pub_worker
5154
WORKDIR /home/worker/pub-dev/pkg/pub_worker

app/test/shared/versions_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ and do not format to also bump the runtimeVersion.''',
159159
final content = await File('../Dockerfile.worker').readAsString();
160160
expect(
161161
content,
162-
contains(
163-
'RUN tool/setup-dartdoc.sh /home/worker/bin/dartdoc $dartdocVersion\n',
164-
),
162+
contains('RUN tool/setup-dartdoc.sh "\${DARTDOC_DIR}" $dartdocVersion\n'),
165163
);
166164
});
167165

pkg/pub_worker/bin/pub_worker_subprocess.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ Future<void> main(List<String> args) async {
9898
final pkgDir = Directory(p.join(pkgDownloadDir.path, '$package-$version'));
9999
final detected = await _detectSdks(pkgDir.path);
100100

101+
final dartdocBinary = Platform.environment['DARTDOC_BINARY'];
102+
final dartdocResourcesDir = Platform.environment['DARTDOC_RESOURCES_DIR'];
103+
final dartdocCommand = (dartdocBinary != null && dartdocResourcesDir != null)
104+
? <String>[dartdocBinary, '--resources-dir', dartdocResourcesDir]
105+
: null;
106+
101107
final toolEnv = await ToolEnvironment.create(
102108
dartSdkConfig: SdkConfig(
103109
rootPath: detected.dartSdkPath,
@@ -108,6 +114,7 @@ Future<void> main(List<String> args) async {
108114
configHomePath: _configHomePath('flutter', detected.configKind),
109115
),
110116
pubCacheDir: pubCache,
117+
dartdocCommand: dartdocCommand,
111118
dartdocVersion: _dartdocVersion,
112119
);
113120

tool/setup-dartdoc.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
set -e
77

8-
TARGET_PATH=$1
8+
TARGET_DIR=$1
99
DARTDOC_VERSION=$2
1010

1111
# Create a temporary directory
@@ -20,5 +20,7 @@ trap 'rm -rf "$WORK_DIR"' EXIT
2020
dart pub unpack "dartdoc:${DARTDOC_VERSION}" --output=${WORK_DIR}
2121

2222
# Compile executable
23-
cd "${WORK_DIR}/dartdoc-${DARTDOC_VERSION}"
24-
dart compile exe -o "${TARGET_PATH}" bin/dartdoc.dart
23+
mv "${WORK_DIR}/dartdoc-${DARTDOC_VERSION}" "${TARGET_DIR}"
24+
cd "${TARGET_DIR}"
25+
mkdir build
26+
dart compile exe -o build/dartdoc bin/dartdoc.dart

0 commit comments

Comments
 (0)