Skip to content

Commit e5bd9d6

Browse files
authored
fix(build): replace required Git LFS archive with automatic generation (#13)
* fix(build): replace required Git LFS archive with automatic generation * fix(build): address platform archive review findings
1 parent 208fbe8 commit e5bd9d6

13 files changed

Lines changed: 165 additions & 112 deletions

File tree

‎.gitattributes‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
jetbrains_plugin/platform.zip filter=lfs diff=lfs merge=lfs -text
2-
31
*.ps1 text eol=crlf

‎.github/workflows/pr.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- "jetbrains_plugin/**"
7+
- "scripts/**"
78
- ".github/workflows/pr.yml"
89

910
permissions:
@@ -25,6 +26,9 @@ jobs:
2526
with:
2627
persist-credentials: false
2728

29+
- name: Check script integration contracts
30+
run: ./scripts/test.sh integration --dry-run
31+
2832
# One source of truth: the build number and the pinned archive digest
2933
# live in jetbrains_plugin/gradle.properties, next to each other.
3034
- name: Read the centralized verification IDE values
@@ -87,6 +91,23 @@ jobs:
8791
mkdir -p plugins/zoo-code/extension
8892
touch plugins/zoo-code/extension/.keep prodDep.txt
8993
94+
- name: Check missing and stale platform archive task graphs
95+
working-directory: jetbrains_plugin
96+
shell: bash
97+
run: |
98+
trap 'rm -f platform.zip' EXIT
99+
for archive in missing stale; do
100+
rm -f platform.zip
101+
if [ "$archive" = stale ]; then
102+
printf 'version https://git-lfs.github.com/spec/v1\n' > platform.zip
103+
fi
104+
./gradlew clean prepareSandbox --dry-run -PdebugMode=release --no-configuration-cache > "$RUNNER_TEMP/platform-graph-$archive.log"
105+
cat "$RUNNER_TEMP/platform-graph-$archive.log"
106+
grep -Eq '^:genPlatform SKIPPED$' "$RUNNER_TEMP/platform-graph-$archive.log"
107+
grep -Eq '^:preparePlatform SKIPPED$' "$RUNNER_TEMP/platform-graph-$archive.log"
108+
awk '/^:clean /{c=NR} /^:preparePlatform /{p=NR} END{exit !(c && p && c<p)}' "$RUNNER_TEMP/platform-graph-$archive.log"
109+
done
110+
90111
# The connector and focus tests are pure JVM tests and the focus of
91112
# these gates. The Gradle test task sets java.awt.headless=true, so the
92113
# Swing-based focus regression tests initialize on the headless runner.

‎.github/workflows/release.yml‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,18 @@ jobs:
130130
needs: prepare
131131
if: needs.prepare.outputs.marketplace-published != 'true' || needs.prepare.outputs.github-released != 'true'
132132
runs-on: ubuntu-latest
133+
timeout-minutes: 90
133134
environment: jetbrains-marketplace-production
134135
permissions:
135136
contents: write
136137

137138
steps:
139+
# The repository stores no Git LFS objects: the platform archive is
140+
# generated by the build. A plain checkout keeps releases independent of
141+
# LFS object availability.
138142
- name: Check out the JetBrains plugin
139143
uses: actions/checkout@v5
140144
with:
141-
lfs: true
142145
submodules: recursive
143146
persist-credentials: false
144147

@@ -181,6 +184,24 @@ jobs:
181184
- name: Prepare the extension host source
182185
run: ./scripts/setup.sh --skip-deps --verbose
183186

187+
- name: Read the VS Code platform version
188+
id: platform-version
189+
shell: bash
190+
run: |
191+
version="$(sed -n 's/^vscodeVersion=//p' jetbrains_plugin/gradle.properties)"
192+
if [ -z "$version" ]; then
193+
echo "vscodeVersion is missing from jetbrains_plugin/gradle.properties."
194+
exit 1
195+
fi
196+
echo "version=$version" >> "$GITHUB_OUTPUT"
197+
198+
# platform.zip is outside build/, so the release clean preserves it.
199+
- name: Cache the generated VS Code platform archive
200+
uses: actions/cache@v4
201+
with:
202+
path: jetbrains_plugin/platform.zip
203+
key: platform-${{ runner.os }}-${{ steps.platform-version.outputs.version }}-${{ hashFiles('jetbrains_plugin/genPlatform.gradle') }}
204+
184205
- name: Build the plugin from the released VS Code extension
185206
env:
186207
GITHUB_TOKEN: ${{ github.token }}

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,6 @@ deps/vsix/plugin/*
6060
.zoo-build/
6161
dist-with-roo/
6262
plans/
63+
64+
# Generated test reports
65+
test-results/

‎BUILD.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ ZOO_EXTENSION_VERSION=3.78.0 ./scripts/release.sh --mode release --clean
153153
- Optimized builds
154154
- Production-ready artifacts
155155
- Minimal debug information
156+
- Packages the VS Code platform archive: when `jetbrains_plugin/platform.zip` is
157+
missing or invalid, the build runs the `genPlatform` task, which downloads the
158+
four VS Code distributions pinned by `vscodeVersion` in
159+
`jetbrains_plugin/gradle.properties` and merges their node_modules. The
160+
archive is not stored in git and the repository needs no Git LFS. The
161+
generation needs network access to `update.code.visualstudio.com`.
156162

157163
### Debug Mode
158164
- Development builds

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@
77
- The plugin requests ConPTY explicitly through the public pty4j setter. The JetBrains registry key `terminal.use.conpty.on.windows` is no longer read.
88
- If the ConPTY native library fails to load, the process falls back to winpty and the session continues.
99
- Other process start failures propagate to the terminal error handling.
10+
11+
### Checkout and release builds without Git LFS
12+
13+
- `jetbrains_plugin/platform.zip` is no longer stored in git, and `.gitattributes` no longer tracks it with Git LFS. Fresh clones, including Windows and WSL checkouts, no longer fail on a missing LFS object.
14+
- Release builds run the existing `genPlatform` task when the archive is missing or invalid and package the generated archive. A stale Git LFS pointer left by an older checkout also triggers regeneration.
15+
- `scripts/setup.sh` no longer requires or installs Git LFS.
16+
- The pull request workflow now also runs when files under `scripts/` change.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ The installable plugin is written to the `dist/` directory. Install that ZIP thr
126126

127127
The setup script handles:
128128

129-
- Git LFS initialization
130129
- Git submodule initialization and updates
131130
- Dependency installation
132131
- Patch application
@@ -136,6 +135,7 @@ The build script then:
136135

137136
- Downloads the latest Zoo Code extension from the VS Code Marketplace
138137
- Builds the Extension Host runtime
138+
- Generates the VS Code platform archive (`platform.zip`) when a release build needs it and no valid archive is present; the archive is not stored in git and the repository requires no Git LFS
139139
- Builds the JetBrains plugin with Zoo Code integrated
140140
- Writes a ready-to-install plugin to the `dist/` directory
141141

‎jetbrains_plugin/.gitignore‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
.gradle
66
build/
7+
8+
# Generated from the VS Code distributions by the genPlatform task; never
9+
# committed. See build.gradle.kts and genPlatform.gradle.
10+
/platform.zip
711
!gradle/wrapper/gradle-wrapper.jar
812
!**/src/main/**/build/
913
!**/src/test/**/build/
@@ -50,4 +54,4 @@ zoo-code-messages.log
5054
prodDep.txt
5155

5256
### Backup files ###
53-
*.bak
57+
*.bak

‎jetbrains_plugin/build.gradle.kts‎

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ val verificationJavaLauncher = javaToolchains.launcherFor {
4747
// - Typically used when running IntelliJ with an Extension Host for live debugging and hot-reloading.
4848
//
4949
// 2. "release" — Production build mode (used to generate deployment artifacts)
50-
// - Requires platform.zip to exist, which can be retrieved via git-lfs or generated with genPlatform.gradle.
50+
// - Packages platform.zip, which the genPlatform task generates from the VS Code
51+
// distributions pinned by vscodeVersion in gradle.properties. The archive is not
52+
// stored in git; when it is missing or invalid, prepareSandbox depends on
53+
// genPlatform and the archive is generated before the sandbox is prepared.
5154
// - This file includes the full runtime environment for VSCode plugins (e.g., node_modules, platform.txt).
5255
// - The zip is extracted to build/platform/, and its node_modules take precedence over other dependencies.
5356
// - Copies compiled extension_host outputs (dist, package.json, node_modules) and plugin resources.
@@ -183,25 +186,37 @@ fun Sync.prepareSandbox() {
183186
copyAndTrack("src/main/resources/themes/", "${sandboxDir}/${vsCodePluginName}/integrations/theme/default-themes/")
184187
copyAndTrack("src/main/resources/themes/", "${sandboxDir}/themes/")
185188

186-
// The platform.zip file required for release mode is associated with the code in ../base/vscode, currently using version 1.100.0. If upgrading this code later
187-
// Need to modify the vscodeVersion value in gradle.properties, then execute the task named genPlatform, which will generate a new platform.zip file for submission
188-
// To support new architectures, modify according to the logic in genPlatform.gradle script
189+
// The platform.zip archive holds the merged node_modules of the four VS Code
190+
// distributions pinned by vscodeVersion in gradle.properties. It is not stored
191+
// in git: genPlatform builds it, and prepareSandbox depends on that task when
192+
// the archive is missing or invalid (for example a stale Git LFS pointer left
193+
// by an older checkout). To support new architectures, modify genPlatform.gradle.
189194
if (debugMode == "release") {
190-
// Check if platform.zip file exists and is larger than 1MB, otherwise throw exception
191-
val platformZip = File("platform.zip")
192-
if (platformZip.exists() && platformZip.length() >= 1024 * 1024) {
193-
// Extract platform.zip to the platform subdirectory under the project build directory
194-
val platformDir = File("${project.buildDir}/platform")
195+
// Resolved against the project directory: the daemon working directory
196+
// is not the project directory.
197+
val platformZip = project.file("platform.zip")
198+
fun usable() = platformZip.isFile && platformZip.length() >= 1024 * 1024
199+
val platformDir = File("${project.buildDir}/platform")
200+
fun extractPlatform() {
201+
check(usable()) {
202+
"genPlatform did not produce a valid platform.zip at ${platformZip.absolutePath}. " +
203+
"Check the genPlatform task output, network access to update.code.visualstudio.com, " +
204+
"and vscodeVersion in gradle.properties."
205+
}
195206
platformDir.mkdirs()
196207
logger.lifecycle("[prepareSandbox] Extracting platform.zip -> ${platformDir.absolutePath}")
197-
copy {
208+
project.copy {
198209
from(zipTree(platformZip))
199210
into(platformDir)
200211
}
201-
copyOps.add(platformZip.absolutePath to platformDir.absolutePath)
202-
} else {
203-
throw IllegalStateException("platform.zip file does not exist or is smaller than 1MB. This file is supported through git lfs and needs to be obtained through git lfs")
204212
}
213+
if (!usable()) {
214+
logger.lifecycle("[prepareSandbox] platform.zip is missing or invalid; genPlatform will generate it before the sandbox is prepared")
215+
dependsOn(project.tasks.named("genPlatform"))
216+
}
217+
// Always extract during execution: clean may remove build/platform.
218+
doFirst { extractPlatform() }
219+
copyOps.add(platformZip.absolutePath to platformDir.absolutePath)
205220

206221
copyAndTrack(File(project.buildDir, "platform/platform.txt"), "${sandboxDir}/")
207222
// Copy platform node_modules last to ensure it takes precedence over extension_host node_modules

‎jetbrains_plugin/genPlatform.gradle‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ import java.nio.file.*
66
import java.security.MessageDigest
77

88

9+
// Prepare sources in an action, before Zip checks for source files.
10+
def preparePlatform = tasks.register('preparePlatform') {
11+
mustRunAfter(tasks.named('clean'))
12+
doLast {
13+
download(project)
14+
}
15+
}
16+
917
tasks.register('genPlatform', Zip) {
10-
download(project)
18+
dependsOn(preparePlatform)
1119
from(new File(project.buildDir, "genPlatform/gen"))
1220
into("")
1321
destinationDirectory = project.projectDir

0 commit comments

Comments
 (0)