Skip to content
Draft
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
78 changes: 78 additions & 0 deletions bucket/tla-toolbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"version": "1.7.4",
"description": "An IDE for Leslie Lamport's TLA+ (Temporal Logic of Actions) language and its tools",
"homepage": "https://lamport.azurewebsites.net/tla/toolbox.html",
"license": "MIT",
"notes": "Specify full path for the spec inputfile when running `tlc`.",
"suggest": {
"pretty printer": [
"miktex",
"latex"
]
},
"url": "https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/TLAToolbox-1.7.4-win32.win32.x86_64.zip",
"hash": "sha1:10b011fa0b31bc58d771f6b4cd9dd30b446d6d9d",
"extract_dir": "toolbox",
"pre_install": [
"$JDKDIR = Get-ChildItem -Attributes directory -Filter \"plugins/*openjdk*\" $dir |",
" Resolve-Path -Relative -RelativeBasePath $dir",
Comment thread
goyalyashpal marked this conversation as resolved.
"@(",
" \"@pushd `\"$dir`\"\"",
" '@set TOOLS_JAR=.\\tla2tools.jar'",
" \"@set THISJAVA=`\"${JDKDIR}\\jre\\bin\\java`\"\"",
" '@%THISJAVA% -cp %TOOLS_JAR% %*'",
" '@popd'",
Comment on lines +20 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Consider avoiding directory changes in the wrapper script to improve usability.

The @pushd/@popd pattern changes the working directory to the install directory, which breaks relative paths from the user's perspective. This is why line 6 notes that users must "specify full path for the spec inputfile when running tlc".

A better design would use absolute paths for the Java executable and JAR file without changing directories, allowing users to work with relative paths naturally.

🔎 Alternative implementation without directory changes
 "@(",
-"  \"@pushd `\"$dir`\"\"",
-"  '@set TOOLS_JAR=.\\tla2tools.jar'",
+"  \"@set TOOLS_JAR=`\"$dir\\tla2tools.jar`\"\"",
 "  \"@set THISJAVA=`\"${JDKDIR}\\jre\\bin\\java`\"\"",
 "  '@%THISJAVA% -cp %TOOLS_JAR%  %*'",
-"  '@popd'",
 ")  | Set-Content \"$dir\\tla2tools.cmd\" -Encoding ASCII",

Note: This still depends on fixing $JDKDIR (lines 17-18), but once that's corrected to produce an absolute path like $dir\plugins\jdk.openjdk..., this approach would:

  1. Use absolute paths for both THISJAVA and TOOLS_JAR
  2. Preserve the user's working directory
  3. Allow users to work with relative paths for their spec files
  4. Make the note on line 6 unnecessary

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In bucket/tla-toolbox.json around lines 20 to 24, the wrapper script uses
@pushd/@popd which changes the process working directory and forces users to
supply absolute paths; remove the directory change and instead compute absolute
paths for THISJAVA and TOOLS_JAR from the installer $dir (ensure $JDKDIR is
resolved to an absolute path under $dir\plugins\...), then invoke the Java
executable with an absolute path and -cp to the absolute JAR while leaving the
current working directory untouched so users can supply relative spec paths;
also remove or update the note about requiring full paths.

") | Set-Content \"$dir\\tla2tools.cmd\" -Encoding ASCII",
"Write-Output \"`nChecking if class-modules exist for use with 'tla2tools':\"",
"@( 'tlc2.TLC', 'tlc2.REPL', 'pcal.trans', 'tla2tex.TLA', 'tla2sany.SANY' )",
" | ForEach-Object -PipelineVariable modulename { $_ }",
" | ForEach-Object { ($_ -replace '\\.', '/') + '.class' }",
" | Resolve-Path -Relative -RelativeBasePath \"$dir/plugins/*tlatools*/\"",
Comment thread
goyalyashpal marked this conversation as resolved.
" | ForEach-Object { \"`t* $modulename -> $_\" }"
],
"bin": [
"toolbox.exe",
"tla2tools.cmd",
[
"tla2tools.cmd",
"tlc",
"tlc2.TLC"
],
[
"tla2tools.cmd",
"pcal-trans",
"pcal.trans"
],
[
"tla2tools.cmd",
"tla2sany",
"tla2sany.SANY"
],
[
"tla2tools.cmd",
"tla2tex",
"tla2tex.TLA"
]
],
"shortcuts": [
[
"toolbox.exe",
"TLA+ Toolbox"
]
],
"persist": "configuration",
"checkver": {
"github": "https://github.com/tlaplus/tlaplus"
},
"autoupdate": {
"url": "https://github.com/tlaplus/tlaplus/releases/download/v$version/TLAToolbox-$version-win32.win32.x86_64.zip",
"hash": {
"url": "https://api.github.com/repos/tlaplus/tlaplus/releases/tags/v$version",
"regex": "$sha1\\|$basename"
}
Comment thread
goyalyashpal marked this conversation as resolved.
},
"##": [
"PowerShell's Quoting_Rules (*install fields): https://technet.microsoft.com/en-us/library/hh847740.aspx",
"https://github.com/tlaplus/tlaplus/blob/c8a59811fc90755b8f32f242f48ceca50c9a404b/README.md?plain=1#L16-L30"
]
}
40 changes: 0 additions & 40 deletions bucket/tlaplus-toolbox.json

This file was deleted.