Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into changemergesdialog
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
Siedlerchr committed Dec 23, 2019
2 parents 22b0939 + cd6f656 commit c825212
Show file tree
Hide file tree
Showing 12 changed files with 239 additions and 157 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/cleanup_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Cleanup after PR

on:
pull_request:
types: [closed]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Extract branch name
id: extract_branch
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Delete folder on builds.jabref.org
uses: appleboy/[email protected]
with:
script: rm -rf /var/www/builds.jabref.org/www/${{ steps.extract_branch.outputs.branch }}
host: builds.jabref.org
port: 9922
username: jrrsync
key: ${{ secrets.buildJabRefPrivateKey }}
244 changes: 145 additions & 99 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: Deployment
on: [push]

jobs:
deploy:
build:
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
displayName: linux
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_linux-x64_bin.tar.gz
jdk14Path: /jdk-14
archivePortable: tar -czf build/distribution/JabRef-portable_linux.tar.gz -C build/distribution JabRef && rm -R build/distribution/JabRef
archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
- os: windows-latest
displayName: windows
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_windows-x64_bin.zip
Expand All @@ -23,104 +23,150 @@ jobs:
displayName: macOS
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_osx-x64_bin.tar.gz
jdk14Path: /jdk-14.jdk/Contents/Home
archivePortable: tar -czf build/distribution/JabRef-portable_macos.tar.gz -C build/distribution JabRef.app && rm -R build/distribution/JabRef.app
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

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

steps:
- name: Checkout source
uses: actions/checkout@v2-beta
with:
fetch-depth: 0
- name: Fetch tags and master for GitVersion
run: |
git fetch --tags origin
git rev-parse --verify master
if (-not $?) {
git branch --force --create-reflog master origin/master
}
shell: pwsh
- name: Install GitVersion
uses: gittools/actions/[email protected]
with:
versionSpec: '5.1.2'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/[email protected]
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Cache gradle wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Download jpackage
# We need to download jpackage from https://jdk.java.net/jpackage/
run: |
import tarfile
import zipfile
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
- name: Checkout source
uses: actions/checkout@v2-beta
with:
fetch-depth: 0
- name: Fetch tags and master for GitVersion
run: |
git fetch --tags origin
git rev-parse --verify master
if (-not $?) {
git branch --force --create-reflog master origin/master
}
shell: pwsh
- name: Install GitVersion
uses: gittools/actions/[email protected]
with:
versionSpec: '5.1.2'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/[email protected]
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 13
# configuration based on https://github.com/actions/cache/blob/master/examples.md#java---gradle
- uses: actions/cache@v1
name: Restore gradle cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-${{ env.cache-name }}-
${{ runner.OS }}-gradle-
${{ runner.OS }}-
- uses: actions/cache@v1
name: Cache gradle wrapper
# cache at Mac OS X is 2 GB (too large)
if: matrix.displayName == 'linux' || matrix.displayName == 'windows'
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Download jpackage
# We need to download jpackage from https://jdk.java.net/jpackage/
run: |
import tarfile
import zipfile
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
url = "${{ matrix.jpackageDownload }}"
tmpfile, headers = urlretrieve(url)
if (url.endswith("tar.gz")):
tar = tarfile.open(tmpfile)
tar.extractall()
tar.close()
elif (url.endswith("zip")):
zip = zipfile.ZipFile(tmpfile)
zip.extractall()
zip.close()
shell: python
- name: Build runtime image
run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
- name: Build installer
run: |
export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
shell: bash
- name: Package application image
run: ${{ matrix.archivePortable }}
shell: bash
- name: Build and publish snap
if: matrix.os == 'ubuntu-latest' && steps.gitversion.outputs.branchName == 'master'
env:
SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
run: |
mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
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"
shell: bash
- name: Rename files
run: |
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
shell: pwsh
- name: Upload to GitHub workflow artifacts store
uses: actions/upload-artifact@master
with:
name: JabRef-${{ matrix.displayName }}
path: build/distribution
- name: Upload to builds.jabref.org
uses: garygrossgarten/github-action-scp@release
with:
local: build/distribution
remote: www/${{ steps.gitversion.outputs.branchName }}
host: builds.jabref.org
username: builds_jabref_org
privateKey: ${{ secrets.buildJabRefPrivateKey }}
port: 9922
url = "${{ matrix.jpackageDownload }}"
tmpfile, headers = urlretrieve(url)
if (url.endswith("tar.gz")):
tar = tarfile.open(tmpfile)
tar.extractall()
tar.close()
elif (url.endswith("zip")):
zip = zipfile.ZipFile(tmpfile)
zip.extractall()
zip.close()
shell: python
- name: Build runtime image
run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
- name: Build installer
run: |
export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
shell: bash
- name: Package application image
run: ${{ matrix.archivePortable }}
shell: bash
- name: Build and publish snap
if: matrix.displayName == 'linux' && github.ref == 'refs/heads/master'
env:
SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
run: |
mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
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"
shell: bash
- name: Rename files
run: |
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
shell: pwsh
- name: Upload to GitHub workflow artifacts store
uses: actions/upload-artifact@master
with:
name: JabRef-${{ matrix.displayName }}
path: build/distribution
deploy:
name: Deploy binaries on builds.jabref.org
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout source
uses: actions/checkout@v2-beta
with:
fetch-depth: 0
- name: Fetch tags and master for GitVersion
run: |
git fetch --tags origin
git rev-parse --verify master
if (-not $?) {
git branch --force --create-reflog master origin/master
}
shell: pwsh
- name: Install GitVersion
uses: gittools/actions/[email protected]
with:
versionSpec: '5.1.2'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/[email protected]
- name: Get linux binaries
uses: actions/download-artifact@master
with:
name: JabRef-linux
path: build/distribution
- name: Get windows binaries
uses: actions/download-artifact@master
with:
name: JabRef-windows
path: build/distribution
- name: Get macOS binaries
uses: actions/download-artifact@master
with:
name: JabRef-macOS
path: build/distribution/
- name: Deploy to builds.jabref.org
id: deploy
uses: Pendect/[email protected]
env:
DEPLOY_KEY: ${{ secrets.buildJabRefPrivateKey }}
BRANCH: ${{ steps.gitversion.outputs.branchName }}
with:
flags: -vaz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync"
options: ''
ssh_options: '-p 9922'
src: 'build/distribution/'
dest: [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.27.0'
id 'org.javamodularity.moduleplugin' version '1.5.0'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.jlink' version '2.16.4'
id 'org.beryx.jlink' version '2.17.0'

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

testCompile 'net.bytebuddy:byte-buddy-parent:1.10.5'
testCompile 'net.bytebuddy:byte-buddy-parent:1.10.6'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testCompile 'org.mockito:mockito-core:3.2.4'
Expand Down
33 changes: 17 additions & 16 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void openWindow(Stage mainStage) {
mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X));
mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y));
}
printWindowState(mainStage);
debugLogWindowState(mainStage);

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

/**
* outprints the Data from the Screen
* (only in debug mode)
* outprints the Data from the Screen (only in debug mode)
*
* @param mainStage
*/
private void printWindowState(Stage mainStage) {
StringBuilder bob = new StringBuilder();
bob.append("SCREEN DATA:");
bob.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n");
bob.append("mainStage.POS_X: " + mainStage.getX() + "\n");
bob.append("mainStage.POS_Y: " + mainStage.getY() + "\n");
bob.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n");
bob.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n");
LOGGER.debug(bob.toString());
private void debugLogWindowState(Stage mainStage) {
if (LOGGER.isDebugEnabled()) {
StringBuilder debugLogString = new StringBuilder();
debugLogString.append("SCREEN DATA:");
debugLogString.append("mainStage.WINDOW_MAXIMISED: " + mainStage.isMaximized() + "\n");
debugLogString.append("mainStage.POS_X: " + mainStage.getX() + "\n");
debugLogString.append("mainStage.POS_Y: " + mainStage.getY() + "\n");
debugLogString.append("mainStage.SIZE_X: " + mainStage.getWidth() + "\n");
debugLogString.append("mainStages.SIZE_Y: " + mainStage.getHeight() + "\n");
LOGGER.debug(debugLogString.toString());
}
}

/**
* Tests if the window coordinates are out of the mainscreen
*
* @return outbounds
*/
private boolean isWindowPositionOutOfBounds() {

return !Screen.getPrimary().getBounds().contains(Globals.prefs.getDouble(JabRefPreferences.POS_X) , Globals.prefs.getDouble(JabRefPreferences.POS_Y));

return !Screen.getPrimary().getBounds().contains(Globals.prefs.getDouble(JabRefPreferences.POS_X), Globals.prefs.getDouble(JabRefPreferences.POS_Y));
}

private void openLastEditedDatabases() {
Expand Down
Loading

0 comments on commit c825212

Please sign in to comment.