Skip to content

Commit c825212

Browse files
committed
Merge remote-tracking branch 'upstream/master' into changemergesdialog
* upstream/master: Fixes StringIndexOutOfBoundsException when cutting text (#5776) Bump org.beryx.jlink from 2.16.4 to 2.17.0 (#5782) Bump byte-buddy-parent from 1.10.5 to 1.10.6 (#5783) Fix line endings. Try to use implicit shell to enable variable correctly be set Fix branch name detection Update script to absolute path and new username Revert "Disable non-working cleanup_pr workflow" Switch to rsync (#5778) Fix Medline tests (#5774) Normalize line ending in test file (#5775) Fix Springer fetcher tests (#5773) Fix code style (#5772)
2 parents 22b0939 + cd6f656 commit c825212

File tree

12 files changed

+239
-157
lines changed

12 files changed

+239
-157
lines changed

.github/workflows/cleanup_pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Cleanup after PR
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Extract branch name
14+
id: extract_branch
15+
run: |
16+
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
17+
- name: Delete folder on builds.jabref.org
18+
uses: appleboy/[email protected]
19+
with:
20+
script: rm -rf /var/www/builds.jabref.org/www/${{ steps.extract_branch.outputs.branch }}
21+
host: builds.jabref.org
22+
port: 9922
23+
username: jrrsync
24+
key: ${{ secrets.buildJabRefPrivateKey }}

.github/workflows/deployment.yml

Lines changed: 145 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ name: Deployment
33
on: [push]
44

55
jobs:
6-
deploy:
6+
build:
77
strategy:
8-
fail-fast: false
8+
fail-fast: true
99
matrix:
1010
os: [ubuntu-latest, windows-latest, macOS-latest]
1111
include:
1212
- os: ubuntu-latest
1313
displayName: linux
1414
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_linux-x64_bin.tar.gz
1515
jdk14Path: /jdk-14
16-
archivePortable: tar -czf build/distribution/JabRef-portable_linux.tar.gz -C build/distribution JabRef && rm -R build/distribution/JabRef
16+
archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
1717
- os: windows-latest
1818
displayName: windows
1919
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_windows-x64_bin.zip
@@ -23,104 +23,150 @@ jobs:
2323
displayName: macOS
2424
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_osx-x64_bin.tar.gz
2525
jdk14Path: /jdk-14.jdk/Contents/Home
26-
archivePortable: tar -czf build/distribution/JabRef-portable_macos.tar.gz -C build/distribution JabRef.app && rm -R build/distribution/JabRef.app
26+
archivePortable: brew install pigz && tar -c -C build/distribution JabRef.app | pigz --rsyncable > build/distribution/JabRef-portable_macos.tar.gz && rm -R build/distribution/JabRef.app
2727

2828
runs-on: ${{ matrix.os }}
29-
name: Deploy on ${{ matrix.displayName }}
29+
name: Create installer and portable version for ${{ matrix.displayName }}
3030

3131
steps:
32-
- name: Checkout source
33-
uses: actions/checkout@v2-beta
34-
with:
35-
fetch-depth: 0
36-
- name: Fetch tags and master for GitVersion
37-
run: |
38-
git fetch --tags origin
39-
git rev-parse --verify master
40-
if (-not $?) {
41-
git branch --force --create-reflog master origin/master
42-
}
43-
shell: pwsh
44-
- name: Install GitVersion
45-
uses: gittools/actions/[email protected]
46-
with:
47-
versionSpec: '5.1.2'
48-
- name: Run GitVersion
49-
id: gitversion
50-
uses: gittools/actions/[email protected]
51-
- name: Set up JDK
52-
uses: actions/setup-java@v1
53-
with:
54-
java-version: 13
55-
- uses: actions/cache@v1
56-
with:
57-
path: ~/.gradle/caches
58-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
59-
restore-keys: |
60-
${{ runner.OS }}-gradle-${{ env.cache-name }}-
61-
${{ runner.OS }}-gradle-
62-
${{ runner.OS }}-
63-
- uses: actions/cache@v1
64-
name: Cache gradle wrapper
65-
with:
66-
path: ~/.gradle/wrapper
67-
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
68-
- name: Download jpackage
69-
# We need to download jpackage from https://jdk.java.net/jpackage/
70-
run: |
71-
import tarfile
72-
import zipfile
73-
import sys
74-
if sys.version_info[0] >= 3:
75-
from urllib.request import urlretrieve
76-
else:
77-
from urllib import urlretrieve
32+
- name: Checkout source
33+
uses: actions/checkout@v2-beta
34+
with:
35+
fetch-depth: 0
36+
- name: Fetch tags and master for GitVersion
37+
run: |
38+
git fetch --tags origin
39+
git rev-parse --verify master
40+
if (-not $?) {
41+
git branch --force --create-reflog master origin/master
42+
}
43+
shell: pwsh
44+
- name: Install GitVersion
45+
uses: gittools/actions/[email protected]
46+
with:
47+
versionSpec: '5.1.2'
48+
- name: Run GitVersion
49+
id: gitversion
50+
uses: gittools/actions/[email protected]
51+
- name: Set up JDK
52+
uses: actions/setup-java@v1
53+
with:
54+
java-version: 13
55+
# configuration based on https://github.com/actions/cache/blob/master/examples.md#java---gradle
56+
- uses: actions/cache@v1
57+
name: Restore gradle cache
58+
with:
59+
path: ~/.gradle/caches
60+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
61+
restore-keys: |
62+
${{ runner.OS }}-gradle-${{ env.cache-name }}-
63+
${{ runner.OS }}-gradle-
64+
${{ runner.OS }}-
65+
- uses: actions/cache@v1
66+
name: Cache gradle wrapper
67+
# cache at Mac OS X is 2 GB (too large)
68+
if: matrix.displayName == 'linux' || matrix.displayName == 'windows'
69+
with:
70+
path: ~/.gradle/wrapper
71+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
72+
- name: Download jpackage
73+
# We need to download jpackage from https://jdk.java.net/jpackage/
74+
run: |
75+
import tarfile
76+
import zipfile
77+
import sys
78+
if sys.version_info[0] >= 3:
79+
from urllib.request import urlretrieve
80+
else:
81+
from urllib import urlretrieve
7882
79-
url = "${{ matrix.jpackageDownload }}"
80-
tmpfile, headers = urlretrieve(url)
81-
if (url.endswith("tar.gz")):
82-
tar = tarfile.open(tmpfile)
83-
tar.extractall()
84-
tar.close()
85-
elif (url.endswith("zip")):
86-
zip = zipfile.ZipFile(tmpfile)
87-
zip.extractall()
88-
zip.close()
89-
shell: python
90-
- name: Build runtime image
91-
run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
92-
- name: Build installer
93-
run: |
94-
export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
95-
./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
96-
shell: bash
97-
- name: Package application image
98-
run: ${{ matrix.archivePortable }}
99-
shell: bash
100-
- name: Build and publish snap
101-
if: matrix.os == 'ubuntu-latest' && steps.gitversion.outputs.branchName == 'master'
102-
env:
103-
SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
104-
run: |
105-
mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
106-
docker run -v $(pwd):$(pwd) -t lyzardking/snapcraft-bionic sh -c "apt update -qq && cd $(pwd) && snapcraft && mv jabref*.snap build/distribution/ && snapcraft push build/distribution/jabref*.snap --release edge || true"
107-
shell: bash
108-
- name: Rename files
109-
run: |
110-
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
111-
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
112-
shell: pwsh
113-
- name: Upload to GitHub workflow artifacts store
114-
uses: actions/upload-artifact@master
115-
with:
116-
name: JabRef-${{ matrix.displayName }}
117-
path: build/distribution
118-
- name: Upload to builds.jabref.org
119-
uses: garygrossgarten/github-action-scp@release
120-
with:
121-
local: build/distribution
122-
remote: www/${{ steps.gitversion.outputs.branchName }}
123-
host: builds.jabref.org
124-
username: builds_jabref_org
125-
privateKey: ${{ secrets.buildJabRefPrivateKey }}
126-
port: 9922
83+
url = "${{ matrix.jpackageDownload }}"
84+
tmpfile, headers = urlretrieve(url)
85+
if (url.endswith("tar.gz")):
86+
tar = tarfile.open(tmpfile)
87+
tar.extractall()
88+
tar.close()
89+
elif (url.endswith("zip")):
90+
zip = zipfile.ZipFile(tmpfile)
91+
zip.extractall()
92+
zip.close()
93+
shell: python
94+
- name: Build runtime image
95+
run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
96+
- name: Build installer
97+
run: |
98+
export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
99+
./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
100+
shell: bash
101+
- name: Package application image
102+
run: ${{ matrix.archivePortable }}
103+
shell: bash
104+
- name: Build and publish snap
105+
if: matrix.displayName == 'linux' && github.ref == 'refs/heads/master'
106+
env:
107+
SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
108+
run: |
109+
mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
110+
docker run -v $(pwd):$(pwd) -t lyzardking/snapcraft-bionic sh -c "apt update -qq && cd $(pwd) && snapcraft && mv jabref*.snap build/distribution/ && snapcraft push build/distribution/jabref*.snap --release edge || true"
111+
shell: bash
112+
- name: Rename files
113+
run: |
114+
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
115+
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
116+
shell: pwsh
117+
- name: Upload to GitHub workflow artifacts store
118+
uses: actions/upload-artifact@master
119+
with:
120+
name: JabRef-${{ matrix.displayName }}
121+
path: build/distribution
122+
deploy:
123+
name: Deploy binaries on builds.jabref.org
124+
runs-on: ubuntu-latest
125+
needs: [build]
126+
steps:
127+
- name: Checkout source
128+
uses: actions/checkout@v2-beta
129+
with:
130+
fetch-depth: 0
131+
- name: Fetch tags and master for GitVersion
132+
run: |
133+
git fetch --tags origin
134+
git rev-parse --verify master
135+
if (-not $?) {
136+
git branch --force --create-reflog master origin/master
137+
}
138+
shell: pwsh
139+
- name: Install GitVersion
140+
uses: gittools/actions/[email protected]
141+
with:
142+
versionSpec: '5.1.2'
143+
- name: Run GitVersion
144+
id: gitversion
145+
uses: gittools/actions/[email protected]
146+
- name: Get linux binaries
147+
uses: actions/download-artifact@master
148+
with:
149+
name: JabRef-linux
150+
path: build/distribution
151+
- name: Get windows binaries
152+
uses: actions/download-artifact@master
153+
with:
154+
name: JabRef-windows
155+
path: build/distribution
156+
- name: Get macOS binaries
157+
uses: actions/download-artifact@master
158+
with:
159+
name: JabRef-macOS
160+
path: build/distribution/
161+
- name: Deploy to builds.jabref.org
162+
id: deploy
163+
uses: Pendect/[email protected]
164+
env:
165+
DEPLOY_KEY: ${{ secrets.buildJabRefPrivateKey }}
166+
BRANCH: ${{ steps.gitversion.outputs.branchName }}
167+
with:
168+
flags: -vaz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync"
169+
options: ''
170+
ssh_options: '-p 9922'
171+
src: 'build/distribution/'
172+
dest: [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins {
2323
id 'com.github.ben-manes.versions' version '0.27.0'
2424
id 'org.javamodularity.moduleplugin' version '1.5.0'
2525
id 'org.openjfx.javafxplugin' version '0.0.8'
26-
id 'org.beryx.jlink' version '2.16.4'
26+
id 'org.beryx.jlink' version '2.17.0'
2727

2828
// nicer test outputs during running and completion
2929
id 'com.adarshr.test-logger' version '2.0.0'
@@ -211,7 +211,7 @@ dependencies {
211211
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.2'
212212
testCompile 'org.junit.platform:junit-platform-launcher:1.5.2'
213213

214-
testCompile 'net.bytebuddy:byte-buddy-parent:1.10.5'
214+
testCompile 'net.bytebuddy:byte-buddy-parent:1.10.6'
215215
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
216216
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
217217
testCompile 'org.mockito:mockito-core:3.2.4'

src/main/java/org/jabref/JabRefGUI.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void openWindow(Stage mainStage) {
7979
mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X));
8080
mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y));
8181
}
82-
printWindowState(mainStage);
82+
debugLogWindowState(mainStage);
8383

8484
// We create a decoration pane ourselves for performance reasons
8585
// (otherwise it has to be injected later, leading to a complete redraw/relayout of the complete scene)
@@ -204,33 +204,34 @@ private void saveWindowState(Stage mainStage) {
204204
Globals.prefs.putDouble(JabRefPreferences.POS_Y, mainStage.getY());
205205
Globals.prefs.putDouble(JabRefPreferences.SIZE_X, mainStage.getWidth());
206206
Globals.prefs.putDouble(JabRefPreferences.SIZE_Y, mainStage.getHeight());
207-
printWindowState(mainStage);
207+
debugLogWindowState(mainStage);
208208
}
209209

210210
/**
211-
* outprints the Data from the Screen
212-
* (only in debug mode)
211+
* outprints the Data from the Screen (only in debug mode)
212+
*
213213
* @param mainStage
214214
*/
215-
private void printWindowState(Stage mainStage) {
216-
StringBuilder bob = new StringBuilder();
217-
bob.append("SCREEN DATA:");
218-
bob.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n");
219-
bob.append("mainStage.POS_X: " + mainStage.getX() + "\n");
220-
bob.append("mainStage.POS_Y: " + mainStage.getY() + "\n");
221-
bob.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n");
222-
bob.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n");
223-
LOGGER.debug(bob.toString());
215+
private void debugLogWindowState(Stage mainStage) {
216+
if (LOGGER.isDebugEnabled()) {
217+
StringBuilder debugLogString = new StringBuilder();
218+
debugLogString.append("SCREEN DATA:");
219+
debugLogString.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n");
220+
debugLogString.append("mainStage.POS_X: " + mainStage.getX() + "\n");
221+
debugLogString.append("mainStage.POS_Y: " + mainStage.getY() + "\n");
222+
debugLogString.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n");
223+
debugLogString.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n");
224+
LOGGER.debug(debugLogString.toString());
225+
}
224226
}
225227

226228
/**
227229
* Tests if the window coordinates are out of the mainscreen
230+
*
228231
* @return outbounds
229232
*/
230233
private boolean isWindowPositionOutOfBounds() {
231-
232-
return !Screen.getPrimary().getBounds().contains(Globals.prefs.getDouble(JabRefPreferences.POS_X) , Globals.prefs.getDouble(JabRefPreferences.POS_Y));
233-
234+
return !Screen.getPrimary().getBounds().contains(Globals.prefs.getDouble(JabRefPreferences.POS_X), Globals.prefs.getDouble(JabRefPreferences.POS_Y));
234235
}
235236

236237
private void openLastEditedDatabases() {

0 commit comments

Comments
 (0)