Skip to content

Commit 2cb5e56

Browse files
kopporsubhramit
andauthored
Add gg.cmd run-pr xyz (#115)
Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
1 parent 33e2e8b commit 2cb5e56

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

_posts/2025-05-31-run-pr.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: How to try out any JabRef pull request
3+
---
4+
5+
JabRef gets many contributions by external contributors in the form of [pull requests](https://github.com/jabref/jabref/pulls).
6+
Want to try out the feature or fix?
7+
You can now do so in a few simple steps, and give early feedback!
8+
9+
For instance, to try out the "[initial implementation of walkthrough](https://github.com/JabRef/jabref/pull/13182)", one needs to execute following command:
10+
11+
- Windows: `.\gg.cmd just run-pr 13182`
12+
- macOS/Linux: `sh ./gg.cmd just run-pr 13182`
13+
14+
## Preparation
15+
16+
To make this work, one needs to have [`gg.cmd`](https://github.com/eirikb/gg#ggcmd) available in JabRef's source directory.
17+
18+
This can be achieved by using `gg.cmd`, `JBang`, and scripts offered by JabRef:
19+
20+
1. [Download `gg.cmd`](https://github.com/eirikb/gg/releases/latest/download/gg.cmd)
21+
2. Instruct `JBang` to trust JabRef: Execute `.\gg.cmd jbang trust add https://github.com/JabRef/jabref/`.\
22+
![gg initialization](../img/gg-init-1.png)\
23+
![gg initialization](../img/gg-init-2.png)
24+
3. Clone JabRef into a folder.
25+
By default, a system-wide available temporary folder is used.
26+
(In "Advanced Hints" below, we mention steps on how to use a specific folder.)
27+
Execute `.\gg.cmd jbang https://github.com/JabRef/jabref/blob/main/.jbang/CloneJabRef.java`.\
28+
![gg-jabref-clone](../img/gg-jabref-clone.png)
29+
4. After it finishes, it will output the directory:
30+
31+
```text
32+
JabRef code available at: C:\Users\WDAGUtilityAccount\AppData\Local\Temp\jabref
33+
```
34+
35+
5. Go to the directory: `cd C:\Users\WDAGUtilityAccount\AppData\Local\Temp\jabref` (Note - replace "`WDAGUtilityAccount`" with your username).
36+
6. Move `gg.cmd` to here: `move C:\Users\WDAGUtilityAccount\Downloads\gg.cmd .`. (Note - replace "`WDAGUtilityAccount`" with your username. The path also needs to be changed if you have downloaded `gg.cmd` anywhere else.)
37+
7. Now you can run a PR using `.\gg.cmd just run-pr 13182` (replace `13182` with the PR number of whichever PR you want to try out). Initially, this might take several minutes, as the build environment has to be initialized and JabRef is built completely from scratch. In subsequent runs, the process is much faster.
38+
39+
## Advanced Hints
40+
41+
### Using another directory
42+
43+
In step 3, a temporary folder was used.
44+
You can also use a different directory.
45+
For example, following command clones into a directory `jabref` located in the current folder:
46+
47+
```cmd
48+
.\gg.cmd jbang https://github.com/JabRef/jabref/blob/main/.jbang/CloneJabRef.java jabref
49+
```
50+
51+
In general, any (non-existing) directory can be used.
52+
To clone into `c:\git-repositories\jabref`, use following command:
53+
54+
```cmd
55+
.\gg.cmd jbang https://github.com/JabRef/jabref/blob/main/.jbang/CloneJabRef.java c:\git-repositories\jabref
56+
```
57+
58+
### Linux and macOS
59+
60+
For Linux and macOS, use `sh ./gg.cmd` instead of `.\gg.cmd`.
61+
62+
### Running `JabKit`
63+
64+
You can run other parts of JabRef. For instance for `JabKit`:
65+
66+
```cmd
67+
.\gg.cmd just run-jabkit --help
68+
```
69+
70+
### Using a Windows Sandbox
71+
72+
[Windows Sandbox](https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/) is a nice feature to run a clean Windows system and have it deleted after use.
73+
74+
There is [CustomSandbox](https://github.com/oOblik/CustomSandbox) with a nice Terminal-based UI to configure the Sandbox.
75+
We modified it to include `gg.cmd`.
76+
To use, follow these steps:
77+
78+
1. Download <https://github.com/koppor/CustomSandbox/archive/refs/heads/main.zip>
79+
2. Extract it.
80+
3. Start "PowerShell".
81+
4. `cd` into the directory where you extraced it.
82+
5. Start the script: `.\CustomSandbox.ps1`.
83+
6. In the first screen, enable `[x] Networking` and `[x] Save Configuration`.
84+
7. In the second screen, enable `[x] [Chocolatey] Microsoft VC++ Redist for VS 2015-2022`, because this is required for JabRef's AI functionality. It will also enable some other packages required for installation.
85+
8. Also enable `[x] Download gg.cmd`.
86+
9. After pressing <kbd>Enter</kbd>, dependencies will be downloaded.
87+
10. Afterwards, one has to press <kbd>Enter</kbd> again to launch the sandbox.
88+
11. There, the chosen dependencies will be installed.
89+
12. Now, you can start PowerShell and continue with step 2 from above to instruct `JBang` to trust JabRef's code.
90+
91+
As usual, the first run takes a long time, because it will download all required files.
92+
The second run will be faster, because the files are cached.
93+
94+
## Special Thanks
95+
96+
- [`gg.cmd`](https://github.com/eirikb/gg#ggcmd) for automatic downloading and execution of required tooling.
97+
- [`JBang`](https://www.jbang.dev/) for enabling easy execution of `.java` files.
98+
- [Eclipse JGit](https://projects.eclipse.org/projects/technology.jgit) for making `git` available as pure Java library.
99+
100+
## More Information
101+
102+
More information is available in our [contributing guide](https://docs.jabref.org/contributing#i-would-like-to-try-out-a-feature-introduced-at-pull-request).

img/gg-init-1.png

14.9 KB
Loading

img/gg-init-2.png

20.5 KB
Loading

img/gg-jabref-clone.png

43.1 KB
Loading

0 commit comments

Comments
 (0)