Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
jetbrains_plugin/platform.zip filter=lfs diff=lfs merge=lfs -text

*.ps1 text eol=crlf
21 changes: 21 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
paths:
- "jetbrains_plugin/**"
- "scripts/**"
- ".github/workflows/pr.yml"

permissions:
Expand All @@ -25,6 +26,9 @@ jobs:
with:
persist-credentials: false

- name: Check script integration contracts
run: ./scripts/test.sh integration --dry-run

# One source of truth: the build number and the pinned archive digest
# live in jetbrains_plugin/gradle.properties, next to each other.
- name: Read the centralized verification IDE values
Expand Down Expand Up @@ -87,6 +91,23 @@ jobs:
mkdir -p plugins/zoo-code/extension
touch plugins/zoo-code/extension/.keep prodDep.txt

- name: Check missing and stale platform archive task graphs
working-directory: jetbrains_plugin
shell: bash
run: |
trap 'rm -f platform.zip' EXIT
for archive in missing stale; do
rm -f platform.zip
if [ "$archive" = stale ]; then
printf 'version https://git-lfs.github.com/spec/v1\n' > platform.zip
fi
./gradlew clean prepareSandbox --dry-run -PdebugMode=release --no-configuration-cache > "$RUNNER_TEMP/platform-graph-$archive.log"
cat "$RUNNER_TEMP/platform-graph-$archive.log"
grep -Eq '^:genPlatform SKIPPED$' "$RUNNER_TEMP/platform-graph-$archive.log"
grep -Eq '^:preparePlatform SKIPPED$' "$RUNNER_TEMP/platform-graph-$archive.log"
awk '/^:clean /{c=NR} /^:preparePlatform /{p=NR} END{exit !(c && p && c<p)}' "$RUNNER_TEMP/platform-graph-$archive.log"
done

# The connector and focus tests are pure JVM tests and the focus of
# these gates. The Gradle test task sets java.awt.headless=true, so the
# Swing-based focus regression tests initialize on the headless runner.
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,18 @@ jobs:
needs: prepare
if: needs.prepare.outputs.marketplace-published != 'true' || needs.prepare.outputs.github-released != 'true'
runs-on: ubuntu-latest
timeout-minutes: 90
environment: jetbrains-marketplace-production
permissions:
contents: write

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

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

- name: Read the VS Code platform version
id: platform-version
shell: bash
run: |
version="$(sed -n 's/^vscodeVersion=//p' jetbrains_plugin/gradle.properties)"
if [ -z "$version" ]; then
echo "vscodeVersion is missing from jetbrains_plugin/gradle.properties."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"

# platform.zip is outside build/, so the release clean preserves it.
- name: Cache the generated VS Code platform archive
uses: actions/cache@v4
with:
path: jetbrains_plugin/platform.zip
key: platform-${{ runner.os }}-${{ steps.platform-version.outputs.version }}-${{ hashFiles('jetbrains_plugin/genPlatform.gradle') }}

- name: Build the plugin from the released VS Code extension
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ deps/vsix/plugin/*
.zoo-build/
dist-with-roo/
plans/

# Generated test reports
test-results/
6 changes: 6 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ ZOO_EXTENSION_VERSION=3.78.0 ./scripts/release.sh --mode release --clean
- Optimized builds
- Production-ready artifacts
- Minimal debug information
- Packages the VS Code platform archive: when `jetbrains_plugin/platform.zip` is
missing or invalid, the build runs the `genPlatform` task, which downloads the
four VS Code distributions pinned by `vscodeVersion` in
`jetbrains_plugin/gradle.properties` and merges their node_modules. The
archive is not stored in git and the repository needs no Git LFS. The
generation needs network access to `update.code.visualstudio.com`.

### Debug Mode
- Development builds
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
- The plugin requests ConPTY explicitly through the public pty4j setter. The JetBrains registry key `terminal.use.conpty.on.windows` is no longer read.
- If the ConPTY native library fails to load, the process falls back to winpty and the session continues.
- Other process start failures propagate to the terminal error handling.

### Checkout and release builds without Git LFS

- `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.
- 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.
- `scripts/setup.sh` no longer requires or installs Git LFS.
- The pull request workflow now also runs when files under `scripts/` change.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ The installable plugin is written to the `dist/` directory. Install that ZIP thr

The setup script handles:

- Git LFS initialization
- Git submodule initialization and updates
- Dependency installation
- Patch application
Expand All @@ -136,6 +135,7 @@ The build script then:

- Downloads the latest Zoo Code extension from the VS Code Marketplace
- Builds the Extension Host runtime
- 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
- Builds the JetBrains plugin with Zoo Code integrated
- Writes a ready-to-install plugin to the `dist/` directory

Expand Down
6 changes: 5 additions & 1 deletion jetbrains_plugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

.gradle
build/

# Generated from the VS Code distributions by the genPlatform task; never
# committed. See build.gradle.kts and genPlatform.gradle.
/platform.zip
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
Expand Down Expand Up @@ -50,4 +54,4 @@ zoo-code-messages.log
prodDep.txt

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

// 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
// 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
// To support new architectures, modify according to the logic in genPlatform.gradle script
// The platform.zip archive holds the merged node_modules of the four VS Code
// distributions pinned by vscodeVersion in gradle.properties. It is not stored
// in git: genPlatform builds it, and prepareSandbox depends on that task when
// the archive is missing or invalid (for example a stale Git LFS pointer left
// by an older checkout). To support new architectures, modify genPlatform.gradle.
if (debugMode == "release") {
// Check if platform.zip file exists and is larger than 1MB, otherwise throw exception
val platformZip = File("platform.zip")
if (platformZip.exists() && platformZip.length() >= 1024 * 1024) {
// Extract platform.zip to the platform subdirectory under the project build directory
val platformDir = File("${project.buildDir}/platform")
// Resolved against the project directory: the daemon working directory
// is not the project directory.
val platformZip = project.file("platform.zip")
fun usable() = platformZip.isFile && platformZip.length() >= 1024 * 1024
val platformDir = File("${project.buildDir}/platform")
fun extractPlatform() {
check(usable()) {
"genPlatform did not produce a valid platform.zip at ${platformZip.absolutePath}. " +
"Check the genPlatform task output, network access to update.code.visualstudio.com, " +
"and vscodeVersion in gradle.properties."
}
platformDir.mkdirs()
logger.lifecycle("[prepareSandbox] Extracting platform.zip -> ${platformDir.absolutePath}")
copy {
project.copy {
from(zipTree(platformZip))
into(platformDir)
}
copyOps.add(platformZip.absolutePath to platformDir.absolutePath)
} else {
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")
}
if (!usable()) {
logger.lifecycle("[prepareSandbox] platform.zip is missing or invalid; genPlatform will generate it before the sandbox is prepared")
dependsOn(project.tasks.named("genPlatform"))
}
// Always extract during execution: clean may remove build/platform.
doFirst { extractPlatform() }
copyOps.add(platformZip.absolutePath to platformDir.absolutePath)

copyAndTrack(File(project.buildDir, "platform/platform.txt"), "${sandboxDir}/")
// Copy platform node_modules last to ensure it takes precedence over extension_host node_modules
Expand Down
10 changes: 9 additions & 1 deletion jetbrains_plugin/genPlatform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ import java.nio.file.*
import java.security.MessageDigest


// Prepare sources in an action, before Zip checks for source files.
def preparePlatform = tasks.register('preparePlatform') {
mustRunAfter(tasks.named('clean'))
doLast {
download(project)
}
}

tasks.register('genPlatform', Zip) {
download(project)
dependsOn(preparePlatform)
from(new File(project.buildDir, "genPlatform/gen"))
into("")
destinationDirectory = project.projectDir
Expand Down
3 changes: 0 additions & 3 deletions jetbrains_plugin/platform.zip

This file was deleted.

65 changes: 5 additions & 60 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ USAGE:
DESCRIPTION:
DESCRIPTION:
This script initializes the development environment by:
- Validating system requirements (including Git LFS)
- Setting up Git LFS for large file handling
- Initializing git submodules
- Installing project dependencies
- Applying necessary patches
Expand All @@ -57,8 +55,11 @@ ENVIRONMENT:
SKIP_VALIDATION Skip environment validation if set to 'true'

REQUIREMENTS:
- Git LFS must be installed for handling large files
- Run 'git lfs install' manually if setup fails
- Git, unzip and curl must be installed

NOTES:
- The release-mode platform archive is generated by the Gradle build when
needed; this script does not handle it.

EXIT CODES:
0 Success
Expand Down Expand Up @@ -133,12 +134,6 @@ validate_system_requirements() {
log_debug "Found development tool: $tool"
done

# Check for Git LFS
if ! command_exists "git-lfs"; then
die "Git LFS not found. Please install Git LFS: https://git-lfs.github.io/" 2
fi
log_debug "Found Git LFS"

# Check Git configuration
if ! git config user.name >/dev/null 2>&1; then
log_warn "Git user.name not configured. Run: git config --global user.name 'Your Name'"
Expand All @@ -163,55 +158,6 @@ validate_system_requirements() {
log_success "System requirements validated"
}

# Initialize Git LFS
setup_git_lfs() {
log_step "Setting up Git LFS..."

cd "$PROJECT_ROOT"

# Check if Git LFS is already initialized
if git lfs env >/dev/null 2>&1; then
log_debug "Git LFS environment already configured"
else
log_info "Initializing Git LFS..."
execute_cmd "git lfs install" "Git LFS installation"
fi

# Check if .gitattributes exists and has LFS entries
if [[ -f ".gitattributes" ]]; then
local lfs_files
lfs_files=$(grep -c "filter=lfs" .gitattributes 2>/dev/null || echo "0")
if [[ "$lfs_files" -gt 0 ]]; then
log_info "Found $lfs_files LFS file pattern(s) in .gitattributes"

# Pull LFS files
log_info "Pulling LFS files..."
execute_cmd "git lfs pull" "Git LFS pull"

# Verify LFS files
log_info "Verifying LFS files..."
if git lfs ls-files >/dev/null 2>&1; then
local lfs_file_count
lfs_file_count=$(git lfs ls-files | wc -l | tr -d ' ')
if [[ "$lfs_file_count" -gt 0 ]]; then
log_success "Successfully pulled $lfs_file_count LFS file(s)"
git lfs ls-files | while read -r line; do
log_debug "LFS file: $line"
done
else
log_warn "No LFS files found in repository"
fi
fi
else
log_info "No LFS file patterns found in .gitattributes"
fi
else
log_warn "No .gitattributes file found, skipping LFS file pull"
fi

log_success "Git LFS setup completed"
}

# Initialize git submodules
setup_submodules() {
if [[ "$SKIP_SUBMODULES" == "true" ]]; then
Expand Down Expand Up @@ -502,7 +448,6 @@ main() {

# Run setup steps
validate_system_requirements
setup_git_lfs
setup_submodules
install_dependencies
apply_patches
Expand Down
Loading
Loading