Skip to content

Commit

Permalink
Add export of com.sun.javafx.event to org.jabref (#11195)
Browse files Browse the repository at this point in the history
* Add export of com.sun.javafx.event to org.jabref

* Works

* Remove other statements

* Add comment

* Remove unneeded exports

* Add some "--opens", too

* Blindly add --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module

* Remove some controlsfx

* Add missing ,

* Try Corretto

* Try to pass build arguments

* Port

* Try " at other place

* Try other way

* Add hint

* Update build.gradle

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
  • Loading branch information
koppor and calixtus authored Apr 15, 2024
1 parent bda81a4 commit a30704f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ jobs:
--icon src/main/resources/icons/jabref.icns \
--resource-dir buildres/mac \
--file-associations buildres/mac/bibtexAssociations.properties \
--jlink-options --bind-services
--jlink-options --bind-services \
--java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module \
--java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module
- name: Build pkg (macOS)
if: (steps.checksecrets.outputs.secretspresent == 'YES')
shell: bash
Expand All @@ -150,7 +155,12 @@ jobs:
--icon src/main/resources/icons/jabref.icns \
--resource-dir buildres/mac \
--file-associations buildres/mac/bibtexAssociations.properties \
--jlink-options --bind-services
--jlink-options --bind-services \
--java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module \
--java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module
- name: Rename files with arm64 suffix as well
if: (steps.checksecrets.outputs.secretspresent == 'YES')
shell: bash
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ jobs:
--icon src/main/resources/icons/jabref.icns \
--resource-dir buildres/mac \
--file-associations buildres/mac/bibtexAssociations.properties \
--jlink-options --bind-services
--jlink-options --bind-services \
--java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module \
--java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module
- name: Build pkg (macOS)
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
shell: bash
Expand All @@ -162,7 +167,12 @@ jobs:
--icon src/main/resources/icons/jabref.icns \
--resource-dir buildres/mac \
--file-associations buildres/mac/bibtexAssociations.properties \
--jlink-options --bind-services
--jlink-options --bind-services \
--java-options --add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module \
--java-options --add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module \
--java-options --add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module
- name: Build runtime image and installer (linux, Windows)
if: (matrix.os != 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
shell: bash
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Fixed

- We fixed an issue where entry type with duplicate fields prevented opening existing libraries with custom entry types [#11127](https://github.com/JabRef/jabref/issues/11127)
- We fixed crash on opening the entry editor when auto completion is enabled. [#11188](https://github.com/JabRef/jabref/issues/11188)
- We fixed the usage of the key binding for "Clear search" (default: <kbd>Escape</kbd>). [#10764](https://github.com/JabRef/jabref/issues/10764).

### Removed
Expand Down
30 changes: 25 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ java {
application {
mainClass.set('org.jabref.Launcher')
mainModule.set('org.jabref')

applicationDefaultJvmArgs = [
// On a change here, also adapt
// 1. "run > moduleOptions"
// 2. "deployment.yml" (macOS part)
// 3. "deployment-arm64.yml"

// Fix for https://github.com/JabRef/jabref/issues/11188
'--add-exports=javafx.base/com.sun.javafx.event=org.jabref.merged.module',
'--add-exports=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module',

// Fix for https://github.com/JabRef/jabref/issues/11198
'--add-opens=javafx.graphics/javafx.scene=org.jabref.merged.module',
'--add-opens=javafx.controls/javafx.scene.control=org.jabref.merged.module',
'--add-opens=javafx.controls/com.sun.javafx.scene.control=org.jabref.merged.module'
]
}

// Workaround for https://github.com/openjfx/javafx-gradle-plugin/issues/89
Expand Down Expand Up @@ -399,14 +415,20 @@ compileJava {
}
}

// Configures "application > run" task
run {
// TODO: Remove access to internal api
moduleOptions {
// On a change here, also adapt "application > applicationDefaultJvmArgs"
addExports = [
'javafx.base/com.sun.javafx.event' : 'org.jabref.merged.module',
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin' : 'org.jabref',

// Not sure why we need to restate the controlfx exports
// We need to restate the ControlsFX exports, because we get following error otherwise:
// java.lang.IllegalAccessError:
// class org.controlsfx.control.textfield.AutoCompletionBinding (in module org.controlsfx.controls)
// cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base) because
// module javafx.base does not export com.sun.javafx.event to module org.controlsfx.controls
// Taken from here: https://github.com/controlsfx/controlsfx/blob/9.0.0/build.gradle#L1
'javafx.graphics/com.sun.javafx.scene' : 'org.controlsfx.controls',
'javafx.graphics/com.sun.javafx.scene.traversal' : 'org.controlsfx.controls',
Expand All @@ -422,7 +444,6 @@ run {

addOpens = [
'javafx.controls/javafx.scene.control' : 'org.jabref',
'org.controlsfx.controls/org.controlsfx.control.textfield' : 'org.jabref',
'javafx.controls/com.sun.javafx.scene.control' : 'org.jabref',

'javafx.controls/javafx.scene.control.skin' : 'org.controlsfx.controls',
Expand All @@ -443,8 +464,7 @@ javadoc {
version = false
author = false
addMultilineStringsOption("-add-exports").setValue([
'javafx.controls/com.sun.javafx.scene.control=org.jabref',
'org.controlsfx.controls/impl.org.controlsfx.skin=org.jabref'
'javafx.controls/com.sun.javafx.scene.control=org.jabref'
])
}
}
Expand Down

0 comments on commit a30704f

Please sign in to comment.