Compare commits

...

634 Commits

Author SHA1 Message Date
Maxim Kartashev
1bb9d4f610 JBR-4562 Generate hs_err file on SIGABRT 2022-06-10 19:06:17 +03:00
Maxim Kartashev
9be1a05027 JBR-4485 Windows: EXCEPTION_ACCESS_VIOLATION at sun.nio.fs.WindowsDirectoryStream$WindowsDirectoryIterator.readNextEntry
As a precaution, range-check the offset returned by WinAPI before
using it to read raw memory with Unsafe.
2022-06-10 16:36:46 +03:00
Vitaly Provodin
b720fa6c36 Update README.md 2022-06-10 07:11:20 +03:00
Vitaly Provodin
5c65f0b977 Update README.md 2022-06-10 07:11:19 +03:00
Maxim Kartashev
7125f84090 JBR-3323 Exclude parts of VM code from sanitizer checks
Exclude VM error-reporting code that treats memory as a raw sequence of
bytes from address sanitizer checks. This is needed to only get true
reports when running tests against the --enable-asan build.
2022-06-10 07:11:17 +03:00
Dmitry Batrak
5685b59d69 JBR-4552 Windows revert back after initial move/resize in Cygwin/X
(cherry picked from commit 6dc194e089)
2022-06-10 07:11:16 +03:00
Manuel Unterhofer
9409d3e01b FL-11598 Fix accidental reset of window configuration for custom decoration on macOS
This also aligns the handling of the style mask with how the other settings are applied: It uses a client property now. This property is now also applied directly on peer initialization so that there is no need to re-apply, and the window directly appears in the correct configuration.
2022-06-10 07:11:15 +03:00
Nikita Provotorov
48bde55e42 JBR-4394, IDEA-246833: refactoring and blocking the fix of JBR-1573 to recreate IMs and ICs during preediting.
(cherry picked from commits 7a36587db8d3d5a63c5691243cd5bf56733c06e6, 321a4a3f83)
2022-06-10 07:11:14 +03:00
Nikita Provotorov
904781572e JBR-4394, IDEA-246833: fixup of JBR-2444.
(cherry picked from commit ef262dc8bb)
2022-06-10 07:11:13 +03:00
Dmitry Batrak
698ad98bac JBR-4537 Popup windows shown for a background window cause app icon to blink in taskbar on KDE 2022-06-10 07:11:12 +03:00
Dmitry Batrak
955eb6acbc JBR-4535 Popup windows disappear on mouse hover when 'Focus strictly under mouse' policy is used in KDE 2022-06-10 07:11:11 +03:00
Vitaly Provodin
b2bde73a4e JBR-4520 set file permissions after signing 2022-06-10 07:11:10 +03:00
Alexey Ushakov
3d1d40b3d8 JBR-4486 AA Ovals not rendered under metal
Replaced display link with redraw() method of MTLLayer invoked in the appropriate time
2022-06-10 07:11:09 +03:00
Vitaly Provodin
98ca1d0d3e JBR-4512 windows: include pdb-files into jbrsdk 2022-06-10 07:11:08 +03:00
Vitaly Provodin
00c0c83dbb JBR-4087 add version info into the name of root directory in JBR tar.gz-distributions 2022-06-10 07:11:07 +03:00
Vitaly Provodin
c7523d7692 JBR-4511 remove --disable options from configure mac-aarch64 builds & unify configure for x64 and aarch64 2022-06-10 07:11:06 +03:00
Alexey Ushakov
32a224d58f JBR-3828 restore details for Java exceptions in crash dumps handled by ObjC
Added exception.toString() to jbr_err_* log

(cherry picked from commit 478bd6cdd7)

Added java stack of the exception to jbr_err_* log

(cherry picked from commit e97f728e93)

Also return the static string "OutOfMemoryError" in case of that
exception has been thrown in order to avoid crashing while reporting an
exception in an out-of-memory situation.
2022-06-10 07:11:05 +03:00
Maxim Kartashev
bbb0401368 JBR-1430 (8195129) Windows: use UTF16 version of Win32 API to load DLL
Also correct library name encoding in exception messages.
2022-06-10 07:11:04 +03:00
Maxim Kartashev
5f6e827e7b JBR-4064 Windows: update build scripts to produce more deterministic output
Passed the configure script options necessary to enable reproducible builds
on Windows. With this options, the resulting jars are reproducible, but
native executables and libraries aren't.
2022-06-10 07:11:03 +03:00
Vitaly Provodin
14c62d9b06 Update README.md
update the link to JBR for IDEA 2022.2
2022-06-10 07:11:02 +03:00
Vitaly Provodin
7b3d7247d9 exclude jb/java/awt/Window/ZOrderOnModalDialogActivation.java from S2 runs on Windows and Linux 2022-06-10 07:11:01 +03:00
Vitaly Provodin
75148a0725 exclude several tests from runs on machines with enabled VoiceOver 2022-06-10 07:11:00 +03:00
Vitaly Provodin
979fb980ad exclude javax/swing/plaf/nimbus/TestNimbusOverride.java on windows due to 8253184 2022-06-10 07:10:59 +03:00
Vitaly Provodin
f798a13f52 exclude java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java on linux-aarch64 only due to 8266283 2022-06-10 07:10:58 +03:00
Vladislav Rassokhin
c6ba1ab12b JBR-4451 Make bash scripts safer 2022-06-10 07:10:57 +03:00
Vitaly Provodin
6aa9552d07 JBR-4487 enable Linux 32 builds 2022-06-10 07:10:56 +03:00
Vitaly Provodin
90543ae967 JBR-4458 enable JBR17 windows 32 bit builds 2022-06-10 07:10:55 +03:00
Vitaly Provodin
28427a7938 JBR-4272 generate and save debug symbols for JBR on macos/linux 2022-06-10 07:10:53 +03:00
Vitaly Provodin
a68e65a6ad JBR-4053 integrate DCEVM patches as usual commits 2022-06-10 07:10:52 +03:00
Maxim Kartashev
bb71f1b721 JBR-4498 Update README.md for the main branch 2022-06-10 07:10:51 +03:00
Nikita Provotorov
ffca4d60ad JBR-2074 Windows 10 AArch64 support: add build and pack scripts. 2022-06-10 07:10:50 +03:00
Vladimir Kempik
651fe8cfda JBR-4452: Update crash report message with JBR youtrack link
instead of bugreport.java.com
2022-06-10 07:10:49 +03:00
Artem Bochkarev
b724595090 JBR-4473: fixed native part of SystemHotkeyReader 2022-06-10 07:10:48 +03:00
Dmitry Batrak
a570fc792a JBR-1740 Menu remains open when application loses focus
(cherry picked from commit f987d22cd2)
2022-06-10 07:10:47 +03:00
Vitaly Provodin
8c3bbfec24 exclude Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java from S2 runs due to 8286840 2022-06-10 07:10:46 +03:00
Vitaly Provodin
8c61ecaa81 exclude java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java due to 8282232 2022-06-10 07:10:45 +03:00
Maxim Kartashev
22bc91a60b JBR-4471 Linux: popup appears on wrong screen after desktop scale change
When screen scale changes, the cached screen bounds must be explicitly
updated. Call resetBoundsCache() whenever X11GraphicsDevice.scale has
changed.
2022-06-10 07:10:44 +03:00
Manuel Unterhofer
ba528b7b44 Merge fullscreen handlers for transparent title bar into existing ones 2022-06-10 07:10:43 +03:00
Manuel Unterhofer
2fd9ac69b2 FL-11420 Fix view hierarchy restoration for full-screen mode on macOS 2022-06-10 07:10:42 +03:00
Vitaly Provodin
de4bb7faa5 JBR-4437 add sources to JBRSDK distributions for Windows and Linux 2022-06-10 07:10:41 +03:00
Nikita Gubarkov
22590ac43f JBR-4364 Port macOS native file dialog patches
IDEA-146669 Enable Mac native file dialogs
IDEA-159507 Mac native dialogs: multiple open dialogs are possible
JBR-1784 File dialogs aren't themed on macOS
JBR-1752 Floating windows overlap modal dialogs
JBR-2005: don't set appearance of file chooser if OSX version < 10.14
JBR-4546 Focus is not returned back to IDE after closing "Open" dialog
2022-06-10 07:10:40 +03:00
Dmitry Batrak
c4a7a9ef66 JBR-4463 Activating app-modal dialog brings all app windows to front
(cherry picked from commit 2b05925276)
2022-06-10 07:10:39 +03:00
Maxim Kartashev
cefe3cf679 JBR-4464 Error building latest jbr-dev after JDK-8285730 2022-06-10 07:10:38 +03:00
Maxim Kartashev
63238cfac5 JBR-4118 NIO methods fail on Google Drive's virtual volume
If NtQueryDirectoryFile() failed with STATUS_INVALID_PARAMETER,
try again asking for less information with the FileDirectoryInformation
option as "information class". This option works on a mounted
Google Drive, but it doesn't provide file ids, which speed
up file listing. So it is used only as a fall-back solution.

(cherry picked from commit 82693aa985)
2022-06-10 07:10:37 +03:00
Maxim Kartashev
adf9d5fb23 JBR-3680 Cherry-pick Google's NIO patches to get faster file listing
Fix regression introduced by Google's NIO patches:
- do not attempt to get the next entry after the directory stream has
been closed already,
- fix FaultyFileSystem that is used in StreamTest.java to throw
the right exception even when getFileAttributeView() is used instead of
readAttributes(),
- removed unnecessary type cast that caused a compilation warning.

Added a test for walking a directory with a non-latin name.

(cherry picked from commit 152a4e886d)
2022-06-10 07:10:36 +03:00
Renaud Paquay
bae385dc1d JBR-3680 Improve performance of WindowsDirectoryStream
Use `NtQueryDirectoryInformation` instead of `FindFirst/FindNext` to
retrieve the list of entries of a directory.

`NtQueryDirectionInformation` has 2 main benefits over
`FindFist`/`FindNext`:

* Performance is about 40% faster

* Each retrieved entry retrieved contains a 64-bit `FileId` in addition
  to the usual attributes, ensuring that returned `java.nio.Path`
  instances hold onto a `BasicFileAttributes` instance that exposes a
  non-null `java.nio.file.attribute.BasicFileAttributes.fileKey()`.

This change also requires creating a new WindowsFileKey class, similar
to UnixFileKey class, so that
`java.nio.file.attribute.BasicFileAttributes.fileKey()` can return an
Object instance that can be used to compare files for equality.

With this change, the Windows implementation of Files.walkFileTree is
about 40% faster when the FOLLOW_LINKS option is not used, and about
2.5x faster when the FOLLOW_LINKS option is used.

When the FOLLOW_LINKS option is used, most calls to
`Files.isSameFile`, which is expensive as it requires 2 file I/O
operations, are avoided because the Path entries returned by the
new WindowsDirectoryStream implementation now contain a non-null
BasicFileAttributes.fileKey(). The remaining calls to
`Files.isSameFile` are performed when Files.walkFileTree need
to compare the initial directory with other entries.

Change-Id: Id79d89d477a6d5dcf151c63a9d6072c6f7ef43b2

(AKA JBR-3680 Cherry-pick Google's NIO patches to get faster file listing)

(cherry picked from commit 7c2d7541ba)
2022-06-10 07:10:35 +03:00
Maxim Kartashev
1992c2f9b8 JBR-3498 Windows: exception when trying to delete a directory with a trailing space
Allow Windows Path to have a trailing space despite Windows naming conventions
discouraging it. Many programs - including Explorer - successfully work
with such files or directories.
2022-06-10 07:10:34 +03:00
Dmitry Batrak
0467444b26 JBR-1518 JBR 11 does not support chain of popups on Linux
(cherry picked from commit 849356ee01)
2022-06-10 07:10:33 +03:00
Dmitry Batrak
7f09fb7a5c small corrections to README.md 2022-06-10 07:10:32 +03:00
Dmitry Batrak
938b65f80e JBR-4306 Robot doesn't work as expected in some cases on macOS
(cherry picked from commits 7d69734465, 0f33031484, 3b5ded0d02)
2022-06-10 07:10:31 +03:00
Vitaly Provodin
e79f7219f2 JBR-4437 add sources to JBRSDK distributions 2022-06-10 07:10:30 +03:00
Ryan Osial
3f6ec4af49 Cache results of font-config pattern search for reuse
(cherry picked from commit 432f637904)
(cherry picked from commit 17bc232f6f)
2022-06-10 07:10:29 +03:00
Maxim Kartashev
0b6086fd60 JBR-3948 Linux: SIGSEGV at [libawt_xawt] Java_sun_awt_X11_XInputMethod_createXICNative
The crashes begin with the call to getDefaultConfig() in
createStatusWindow() returning garbage. With 8280468 fixed, there aren't
many reasons left for it to do so; it must be that the argument to the
call (the screen number) is out of range.

This change eliminates the possibilities to get an absolutely incorrect
screen number by checking the return values of several Xlib functions,
which, when fail, will leave their outgoing arguments uninitialized.
This, in turn, can lead to reading some random memory resulting in
equally random screen number that is later being fed to
getDefaultConfig().

Although on modern systems with Xinerama there should really be no
screen other than zero, as the last resort, this number is also
range-checked in getDefaultConfig() itself.
2022-06-10 07:10:28 +03:00
Vitaly Provodin
362832aad5 JBR-4370 create a test checking all JBR artifacts exist - add exit code 2022-06-10 07:10:27 +03:00
Anton Tarasov
19ab9be3cf JBR-3906 JBR for Linux aarch64 with JCEF is missing, is there any support plan? 2022-06-10 07:10:26 +03:00
Maxim Kartashev
cf8b010b67 JBR-3862 Implement native WatchService on MacOS
The watch service is based on FSEvents API that notifies about file
system changes at a directory level. It is possible to go back to
using the old polling watch service with -Dwatch.service.polling=true.

Features include:
- support for FILE_TREE option (recursive directory watching),
- minimum necessary I/O (no filesystem access more than once
  unless needed),
- one thread ("run loop") per WatchService instance,
- changes are detected by comparing file modification times with
  millisecond precision,
- a directory tree snapshot is taken at the time of WatchKey creation
  and can take a long time (proportional to the number of files).
2022-06-10 07:10:25 +03:00
Anton Tarasov
891301f6c3 JBR-4355 javax/swing/GraphicsConfigNotifier/StalePreferredSize.java: # C [libobjc.A.dylib+0x90ff] objc_release+0x1f
(cherry picked from commit c0b2b59d4a)
2022-06-10 07:10:24 +03:00
Anton Tarasov
f3cb62b888 JBR-4389 [update_1] IDEA UI font becomes too large after disconnecting the external monitor / sleep 2022-06-10 07:10:23 +03:00
Anton Tarasov
74f8ed059e JBR-4389 IDEA UI font becomes too large after disconnecting the external monitor / sleep 2022-06-10 07:10:22 +03:00
Dmitry Batrak
93ebc37b86 remove duplicate bundled JetBrains Mono bold italic font
following JBR-4402

(cherry picked from commit b7e5d3cfcf)
2022-06-10 07:10:21 +03:00
Dmitry Batrak
9047496374 JBR-4402 The wrong text is rendered in editor 2022-06-10 07:10:20 +03:00
Artem Semenov
2a89a39404 JBR-4235 Context menu not readable after opening on Mac OS 2022-06-10 07:10:19 +03:00
Vitaly Provodin
e71966813a JBR-4297 add a regression test
(cherry picked from commit 8e94fff6aa)
2022-06-10 07:10:18 +03:00
Konstantin Bulenkov
c5797a1b1c Update JetBrains Mono font to 2.225 2022-06-10 07:10:16 +03:00
Anton Tarasov
ca2439fcc7 JBR-4362 [mac] system menu opens with duplicated items
(cherry picked from commit e32defe49d)
2022-06-10 07:10:15 +03:00
Alexey Ushakov
3d745d0fdb JBR-4363 Changes in fonts rendering between JBR11 and JBR17
Resolved merge artifact after applying IDEA-57233 fix
2022-06-10 07:10:14 +03:00
Alexey Ushakov
63199194f7 JBR-3843 IDE text is misaligned vertically when using Consolas font
Use usWinAscent/usWinDescent for metrics on Windows
2022-06-10 07:10:13 +03:00
Alexey Ushakov
30bb3256a1 JBR-1110 [JDK11] java/awt/font/Outline/OutlineInvarianceTest.java: Failed for font java.awt.Font[family=Dialog,name=MS Gothic,style=bold,size=30]
Replaced FT_LOAD_NO_HINTING mode for non AA rendering with FT_LOAD_TARGET_LIGHT

(cherry picked from commit 3368768244)
2022-06-10 07:10:12 +03:00
Alexey Ushakov
4496034a74 JBR-2000 RM 2019.3.1 font rendering regression, normal text is heavier
Added -Djava2d.font.loadFontConfig=bundled to force loading bundled font.conf

(cherry picked from commit 788e078f64)
2022-06-10 07:10:11 +03:00
Dmitry Batrak
40abd882bf JBR-4346 [Xfce] Windows are moved unexpectedly between workspaces when modal dialog is shown
(cherry picked from commits ad299f1e74, 800220af16)
2022-06-10 07:10:10 +03:00
Anton Tarasov
c1697caeda JBR-4328 remove LWCToolkit.unsafeNonblockingExecute
(cherry picked from commit 9a3f31a6c4)
2022-06-10 07:10:09 +03:00
Anton Tarasov
5954be876f JBR-4134 PyCharm is slow and unusable on MacBook Pro with M1
(cherry picked from commit 36190505f5)
2022-06-10 07:10:08 +03:00
Anton Tarasov
2435d9405f JBR-4284 Sub items of main menu options are not displayed
A regression of JBR-4208 LWCToolkit.invokeAndWait should not stuck on invocation loss

(cherry picked from commit c464e4748e)
2022-06-10 07:10:07 +03:00
Anton Tarasov
e4345dd630 JBR-4119 UI freezes at sun.lwawt.macosx.CAccessibility.getChildrenAndRoles
(cherry picked from commit 6ba79774d8)
2022-06-10 07:10:06 +03:00
Anton Tarasov
59c2ab7fad JBR-4106 PyCharm hangs with 100% CPU usage on one core 2022-06-10 07:10:05 +03:00
Alexey Ushakov
959dc494a0 JBR-3827 SIGILL at [libsystem_kernel] __kill in Java Exception at -[CDragSource convertData:]
Added check for drag source
2022-06-10 07:10:04 +03:00
Alexey Ushakov
e12a8c2f20 JBR-3366 SIGILL at [libsystem_kernel] __kill in NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition
Wrapped the native exception and added logging
2022-06-10 07:10:03 +03:00
Alexey Ushakov
d38f51fd89 JBR-3365 SIGILL at [libsystem_kernel] __kill in java.lang.RuntimeException: Failed to convert, no screen / primaryScreen
Wrapped the native exception and added logging
2022-06-10 07:10:02 +03:00
Dmitry Batrak
555562bf8a JBR-3751 Window content isn't rendered with some window managers on Linux
(cherry picked from commit 8d22e4dcb0)
2022-06-10 07:10:01 +03:00
Vitaly Provodin
734a8559f1 JBR-4188 add script comparing performance results
add exec permissions && fix misprint in checking if headers exist

move the script comparing performance results from jdk8u_test
2022-06-10 07:10:00 +03:00
Vitaly Provodin
e67bb7cbb9 JBR-4294 split desktop tests to more groups for Commit testing 2022-06-10 07:09:59 +03:00
Vladimir Kempik
24161691b8 JBR-4283: Provide native JBR builds for alpine Linux-aarch64 2022-06-10 07:09:58 +03:00
Vladimir Kempik
39be1736b2 JBR-4242:Provide native JBR builds for alpine Linux 2022-06-10 07:09:57 +03:00
Dmitry Batrak
effc5922b0 JBR-4281 Window losing focus isn't detected in some cases on macOS
(cherry picked from commit 363650bbf4)
2022-06-10 07:09:56 +03:00
greg
84f510aa9f macOS: add methods to setup transparent titlebar with custom height (#100)
* macOS: add methods to setup transparent titlebar with custom height

* make windowTransparentTitleBarHeight CPlatfromWindow property

* add windowTransparentTitleBarHeight test

* Prevent mouseUp events on the transparent header on macOS when the window is being dragged

Co-authored-by: Manuel Unterhofer <manuel.unterhofer@jetbrains.com>

Custom macOS window decorations via JBR API

squash! macOS: add methods to setup transparent titlebar with custom height (#100)

JBR-4460 Fix window drag with custom decorations on macOS
2022-06-10 07:09:55 +03:00
Denis Fokin
662b2cf3af JBR-4038 [JBR17] Force Touch events are not supported on macOS
Added missing files and handlers from JBR11
2022-06-10 07:09:54 +03:00
Alexey Ushakov
9c75c10d4f JBR-3901 jbr-dev compile problem
Added transient keyword
2022-06-10 07:09:53 +03:00
Alexander Lobas
99cbb64bd9 JBR-2893 Big Sur: Add support of opening project as tabs IDEA-257932 Big Sur: IDEA hangs after closing a project tab after exiting and entering full screen
Converted JNF to JNIUtilites

(cherry picked from commit f02e31a440)
(cherry-picked from commit a84736ebcc)
2022-06-10 07:09:52 +03:00
Dmitry Batrak
8c5d294676 JBR-3676 WINDOW_ACTIVATED/DEACTIVATED events sent to a frame when child window closes on macOS
(cherry-picked from commit 824f9ebec3)
2022-06-10 07:09:51 +03:00
Dmitry Batrak
2de62e3cb5 JBR-3611, JBR-3633, JBR-3666, JBR-3663, JBR-3671, JBR-3673, JBR-4181, JBR-4186 Interoperability with macOS desktop spaces
(cherry-picked from commits 43fdd6cd26, 75335543f2, a156c6b9bf, 9fdc75969b, 1dcc612a81, 93588d0738, 94a3885bbe, c040e05703, 67b6cd871f, 9040fd56cd)
2022-06-10 07:09:50 +03:00
Dmitry Batrak
696d00d18f refactor nativeCreateNSWindow call wrapping
as part of JBR-3017

(cherry picked from commit eeef67a335)
2022-06-10 07:09:49 +03:00
Dmitry Batrak
c1553e24c3 remove excessive wrapping with AccessController (AWTThreading does it internally now)
as part of JBR-3017

(cherry picked from commit f1dd523ba8)
2022-06-10 07:09:48 +03:00
Dmitry Batrak
068234ba4f JBR-2971 Log more information about window creation and property changes
(cherry picked from commit 9d86b4d235)
2022-06-10 07:09:47 +03:00
Dmitry Batrak
a7130da4de JBR-2533 Popup is not focused on click when switching from another application on macOS
(cherry picked from commits d9ff151211, 67b174dc8c, 72b0add80c, 21af1eba85, 2f1d317d87, 6dd334f9f0, cd863bac0d, 010f6fc951, 25e087d269, parts of 7d5ac56b6c, cd6dd5c3cf, e8bbd8ffdd)

with fix for JBR-3640 (java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java: window Open button lost focus when it should not) and JBR-3979 (Focus is not transferred to parent window)
2022-06-10 07:09:46 +03:00
Anton Tarasov
f65e14a7b8 JBR-4208 LWCToolkit.invokeAndWait should not stuck on invocation loss
including JBR-4543 (NPE: IdeEventQueue.lambda$getNextEvent$0)
2022-06-10 07:09:45 +03:00
Nikita Provotorov
e681414ab6 JBR-4271: JBR17 and dev built without --with-vendor-name parameter have invalid value of the java.vm.vendor property.
Changes the default JBR's vendor from "Oracle Corporation" to "JetBrains s.r.o.".

(cherry picked from commit 0cb7b4565c)
2022-06-10 07:09:44 +03:00
Nikita Gubarkov
d2a3872202 JBR API v0.0.3
JBR-4228 report HTMINBUTTON, HTMAXBUTTON, HTCLOSE, HTMENU, HTCAPTION targets via JBR API & handle corresponding non-client mouse events for windows with custom decoration
2022-06-10 07:09:43 +03:00
Alexey Ushakov
147ceb303d JBR-4224 java/awt/image/VolatileImage/GradientPaints.java: Number of mismatches (300000) exceeds limit (54000) with tolerance=5
Updated reg test to handle contentLost event
2022-06-10 07:09:42 +03:00
Vitaly Provodin
1e1d710eaa exclude javax/swing/border/TestTitledBorderLeak.java on windows due to 8213531 2022-06-10 07:09:41 +03:00
Ivan Lopatin
896ab23bce Scale2: exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java due to 8279190 on macosx-all 2022-06-10 07:09:40 +03:00
Nikita Provotorov
4ff2245f36 JBR-3299: The test /jb/sun/awt/macos/NationalLayoutTest/Layout_ABC.java fails on MacOS.
Fixes the Layout_*.java tests by giving them to know the <Ctrl + key> combinations can generate KEY_TYPED event.

(cherry picked from commit eae5198b20)
2022-06-10 07:09:39 +03:00
Vitaly Provodin
ea241e707d exclude java/awt/Frame/FrameSetSizeStressTest/FrameSetSizeStressTest.java on Wayland
sun/security/pkcs11/Signature/TestDSAKeyLength.java                                 8279941 linux-all
2022-06-10 07:09:38 +03:00
Alexey Ushakov
8c44f67648 JBR-4112 macOS: SIGILL at [libsystem_kernel] __kill in OOME: Java heap space at java.awt.image.DataBufferInt.<init>
Reg test update: replace management api with jfr
2022-06-10 07:09:37 +03:00
Nikita Provotorov
2c81167074 JBR-4207, IDEA-287559: IDEA incorrectly handles AltGr key modifier.
This commit reverts the fix of JDK-8041928 and disables its regression tests.

(cherry picked from commit ba5209ec06)
2022-06-10 07:09:36 +03:00
Nikita Provotorov
9332da2b84 JBR-4207, IDEA-287559: IDEA incorrectly handles AltGr key modifier.
Renames the test AltGrMustGenerateAltGrModifierTest3838.java to AltGrMustGenerateAltGrModifierTest4207.java.

(cherry picked from commit ed60a9c2bd)
2022-06-10 07:09:35 +03:00
Maxim Kartashev
e6198221f6 JBR-4173 Tier1 test failures in jdk/javadoc/doclet/testModules
Introduction of JBR API changed the order of modules appearing in Java
Doc. This commit updates the corresponding tests to match the current
output with JBR API.

(cherry picked from commit 609406c21b)
2022-06-10 07:09:34 +03:00
Nikita Gubarkov
0dfced21fb JBR-2567 Fix max file path buffer size for fontpath.c 2022-06-10 07:09:33 +03:00
Vitaly Provodin
b5084f4cae exclude sun/security/pkcs11/Signature/TestDSAKeyLength.java on Ubuntu 21.04 due to 8279941 2022-06-10 07:09:32 +03:00
Anton Tarasov
72f5dff9ed JBR-4204 provide an option to disable a11y support on macOS
(cherry picked from commit ee3c56abdc)
2022-06-10 07:09:31 +03:00
Vitaly Provodin
5eb9dee38e exclude two swing tests on Windows due to JBR-4197 2022-06-10 07:09:29 +03:00
Alexey Ushakov
8ec0b0a06e JBR-4112 macOS: SIGILL at [libsystem_kernel] __kill in OOME: Java heap space at java.awt.image.DataBufferInt.<init>
Removed double allocation of surface data
2022-06-10 07:09:28 +03:00
Alexey Ushakov
f1bbccc384 JBR-4187 java/awt/GraphicsDevice/DisplayModes/UnknownRefrshRateTest.java.UnknownRefrshRateTest fails on mac
Constrained display modes count used by the test
2022-06-10 07:09:27 +03:00
Alexey Ushakov
ea64d042d2 JBR-4177 libc++abi: terminating with uncaught exception of type NSException
Added check for AppContext
2022-06-10 07:09:26 +03:00
Alexey Ushakov
078696513e JBR-4174 java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java fails on mac aarch64
Hide cursor to fix OGL&Metal Robot issue (it reads cursor image). Added tolerance to fix Metal Robot inaccuracy.
2022-06-10 07:09:25 +03:00
Artem Semenov
3fc710c71a JBR-4167 [JCK] AccassibleJTree tests fail on Ubuntu 2022-06-10 07:09:24 +03:00
Alexey Ushakov
ec577e0b67 JBR-4164 IDEs cannot be launched via launch configuration
Moved execution of displayChanged() to EDT
2022-06-10 07:09:23 +03:00
Maxim Kartashev
560a775e1c JBR-3917 Problem using windows certificate store (trustStoreType=Windows-ROOT not recognized) 2022-06-10 07:09:22 +03:00
Maxim Kartashev
df53cec718 JBR-4145 Make builds independent from build directory
Supplied the --disable-absolute-path-in-output option to the configure script
when building JBR.
2022-06-10 07:09:21 +03:00
Vitaly Provodin
b3d15f376c JBR-4154 extract version info from sources & JBR-4099 make test-image on jbrsdk_jcef step 2022-06-10 07:09:20 +03:00
Vitaly Provodin
a2256f4c0e JBR-4169 add jdk.javadoc into JBR 2022-06-10 07:09:19 +03:00
Alexey Ushakov
7ace9fe731 JBR-4150 IDE regularly locks up at sun.lwawt.macosx.LWCToolkit.getScreenInsets
Restored caching screen insets. Added handling of dock resize.
2022-06-10 07:09:18 +03:00
Vitaly Provodin
d6a47360d6 exclude java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java on Wayland configs due to 8279256 2022-06-10 07:09:17 +03:00
Vitaly Provodin
97ccebc080 exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java on Scale2 configs due to 8279190 2022-06-10 07:09:16 +03:00
Vitaly Provodin
34aa814c19 exclude java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java due to 827361 2022-06-10 07:09:15 +03:00
Vitaly Provodin
f6b47062a7 add exclude list for Wayland failures 2022-06-10 07:09:14 +03:00
Vitaly Provodin
a00c34509a exclude javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation /JComboBoxPopupLocation.java on macOS due to 8194945 2022-06-10 07:09:13 +03:00
Vitaly Provodin
1f1dbd709d exclude sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java on windows due to 8144029 2022-06-10 07:09:12 +03:00
Maxim Kartashev
1a4efda93f JBR-3948 Linux: SIGSEGV at [libawt_xawt] Java_sun_awt_X11_XInputMethod_createXICNative
The problem: the crashes occur in createStatusWindow() when calls like
adata->AwtColorMatch() end up going to 0x0 pc or some random inaccessible
memory. The only reason for that seems to be the
getDefaultConfig(screen) returning either NULL or garbage. That, in turn, probably
happens because of the wrong screen number provided. Before JBR-3623 was
fixed, awt_numScreens could've changed between the time the screen
number was chosen and the getDefaultConfig() call. After JBR-3623 was
fixed, this change is protected with the AWT lock, which this code
holds.
The fix: obtain the screen number via the Xlib API rather than the
ad-hoc loop though the root windows and return NULL if
getDefaultConfig() doesn't return useable data.

(cherry picked from commit 3d23e8d6a5)
2022-06-10 07:09:11 +03:00
Vitaly Provodin
46e9f0b197 add exclude list for Scale2 test runs 2022-06-10 07:09:10 +03:00
Vitaly Provodin
2edb8ff96c exclude java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java due to 8134231 2022-06-10 07:09:09 +03:00
Alexey Ushakov
b026a235d4 JBR-3773 M1 java/awt/Window/WindowAppearanceTest/WindowAppearanceTest.java: : Incorrect color java.awt.Color[r=75,g=74,b=72]at (140,5)
Added more variants of colors for unfocused and focused titles
2022-06-10 07:09:08 +03:00
Artem Semenov
5e13d87301 JBR-3775 Optimize the algorithm for obtaining tree elements 2022-06-10 07:09:07 +03:00
Nikita Gubarkov
f4d9408b0f JBR API v0.0.2
Added file dialog customization via JBR API & fixed bugs in windows common item dialog
2022-06-10 07:09:06 +03:00
Vitaly Provodin
857da7157a JBR-3931 add the module jdk.unsupported.desktop into jbr
(cherry picked from commit 32def2fd42)
2022-06-10 07:09:05 +03:00
Alexey Ushakov
b64fa7d530 JBR-4111 [JBR17] Make possible to select files and directories independently
Implemented apple.awt.fileDialogForFiles property
2022-06-10 07:09:04 +03:00
Vitaly Provodin
c8e5608a32 enable fixed tests to regular runs 2022-06-10 07:09:03 +03:00
Vitaly Provodin
f0633e3697 exclude javax/swing tests on mac-aarch64 due to 8277816 2022-06-10 07:09:02 +03:00
Aleksandr Veselov
898434efa9 JBR-4107 A11y: macOS - wrong frame position if window is not on primary screen 2022-06-10 07:09:01 +03:00
Alexey Ushakov
0849d0781e JBR-4060 [JBR17+Metal] Flickering on button's shadow
Removed unnecessary global flag. Optimized mask cache texture clearing code.
2022-06-10 07:09:00 +03:00
Alexey Ushakov
62fee2d454 JBR-3954 Transparent text color rendering (needed for experimental UI)
Performed conversion from ARGB_PRE to ARGB in the grayscale text shader
2022-06-10 07:08:59 +03:00
Alexey Ushakov
dfb905ab0b JBR-3872 [JBR17+Metal] Wrong color for scrollbars and inlay hints
Corrected typo in setTxtUniforms and fixed alpha blending in frag_gmc_text shader
2022-06-10 07:08:58 +03:00
Alexey Ushakov
cd9b7c1176 JBR-3820 Gamma correction for grayscale text in Metal rendering pipeline
Implemented gamma correction using the same approach that we did for OGL grayscale text rendering (OGLTextRenderer.c)
Optimized shader performance
2022-06-10 07:08:57 +03:00
Alexey Ushakov
c289b9d389 JBR-4104 jbr-dev compilation failure
Corrected suppress warnings
2022-06-10 07:08:56 +03:00
Vitaly Provodin
5d89f7595c JBR-4067 fix misprint with applying obsolete exclude_jcef_module.patch 2022-06-10 07:08:55 +03:00
Vitaly Provodin
6f8a88c878 JBR-3756 remove JNF from mac-aarch64 binaries 2022-06-10 07:08:54 +03:00
Vitaly Provodin
f339f19a73 JBR-4082 create JBR & JBRSDK installer packages 2022-06-10 07:08:53 +03:00
Dmitry Batrak
7f7c1996be JBR-4084 Default font '. AppleSystemUIFont' does not have bold weight on Chinese characters
(cherry picked from commit 4fde082d53)
2022-06-10 07:08:52 +03:00
Maxim Kartashev
99951b99e8 JBR-3899 SIGSEGV at [libjvm] _ZN23JfrNetworkInterfaceName11on_rotationEv
Prevent JfrNetworkInterfaceName::on_rotation() to dereference a
potentially NULL pointer.

(cherry picked from commit b2a9372d70)
2022-06-10 07:08:51 +03:00
Artem Semenov
388363f11a JBR-4012 On Idea Vo often speeks selected element of tables, lists, and trees. 2022-06-10 07:08:50 +03:00
Maxim Kartashev
16d998e645 JBR-4061 Specify build user for the build 2022-06-10 07:08:49 +03:00
Maxim Kartashev
208e36c36c JBR-4063 macOS: update build scripts to produce more deterministic output
Make mkimages.sh produce more deterministic .tar.gz archives on MacOS.
NB: build notarization is not in the scope of this change.

(cherry picked from commit e1a1b6814d)
2022-06-10 07:08:48 +03:00
Maxim Kartashev
fd528e40ad JBR-4033 Linux: update build scripts to produce more deterministic output
This commits achieves almost the same build output with the same build
input on Linux. Exceptions are:
- class files timestamps differ in jrt-fs.jar (for all output),
- class files timestamps differ in all the jmod files (for
  jbrsdk...tar.gz).
NB: jbrsdk...test...tar.gz does not need to be deterministic.

This was achieved mainly by
- setting several environment variables (SOURCE_DATE_EPOCH, TZ),
- providing the necessary options to the configure script,
- setting the timestamp of all files that make up the resulting
  archive to SORUCE_DATE_EPOCH and normalizing the list of said
  files before archiving.

(cherry picked from commit ffded82734)
2022-06-10 07:08:46 +03:00
Maxim Kartashev
4a58f3502b JBR-4059 Create Dockerfile for building on AArch64 Linux 2022-06-10 07:08:45 +03:00
Dmitry Batrak
2f8ebd3370 JBR-4021 Unexpected focus event order on window showing
(cherry picked from commit 2a398ebb24)

includes fix for JBR-4131 Popup doesn't get focus if created from context menu

(cherry picked from commit 685562aafc)
2022-06-10 07:08:44 +03:00
Maxim Kartashev
c00a624543 JBR-4020 Test ObsoleteFlagErrorMessage fails after +IgnoreUnrecognizedVMOptions has become the default
(cherry picked from commit ae5963a094)
2022-06-10 07:08:43 +03:00
Maxim Kartashev
d2eac580b9 JBR-3923 Internal Error in c1_Instruction.cpp
Make C1 hotspot compiler bail out during CFG construction if there's a
cycle in the graph that isn't a natural loop and that has led to an
unexpected state of stack/locals like missing a phi function.

This is a temporary measure that lets hotspot continue working
even after encountering such bytecode patterns. The full solution
will probably involve more sophisticated CFG checks.

(cherry picked from commit aa0b61cb75)
2022-06-10 07:08:42 +03:00
Artem Semenov
41c3ed8ae0 JBR-3868 Combobox list is not voiced of VoiceOver 2022-06-10 07:08:41 +03:00
Vitaly Provodin
08043861dc exclude tests spontaneously creating windows during test execution 2022-06-10 07:08:40 +03:00
Maxim Kartashev
a826c9c40b JBR-2755 IDE UI became slow via remote X Server connection from Windows
When XGetImage() calls become slow in a remote X11 session, fake
XGetImage() with client-side XCreateImage() that is filled with some
background color. The color is chosen from several top left corner
pixels of the "slow" images obtained with XGetImage().

This feature activates in a remote X11 session only and is
controlled with -Dremote.x11.workaround={true|false|auto}.
2022-06-10 07:08:39 +03:00
Alexey Ushakov
41797e95ff JBR-3924 CMD+Tilda does not switch app windows
Introduced vm property to disable capturing of next app window shortcut
2022-06-10 07:08:38 +03:00
Nikita Gubarkov
6bc323a13d JBR-2917 Added emoji support for Windows
JBR-3951 Pass real glyph type from native code instead of guessing it by rowBytes & width
2022-06-10 07:08:37 +03:00
Pavel
1d73a09fb2 JBR-3926 make AwtComponent transparent for hit events by default
* JBR-3926 make AwtComponent transparent for hit events by default

* [WIP] pass hittest event to frame only if custom decoration is enabled and frame ready to handle it
(cherry picked from commit c0e26ff5d5)
2022-06-10 07:08:36 +03:00
Maxim Kartashev
f2467f5fbc JBR-3896 Abysmally slow input and UI performance since upgrade to IU-213.4928.7 from previous 2021.3 EAP version
The slowness was the result of XWM.getInsetsFromExtents() repeated
attempts to acquire frame extents from a property that under Sway is
simply unavailable. Each attempt added at least 20ms to every re-draw.

Prior to (repeatedly) checking for NET_FRAME_EXTENTS property of a
window, check that the property is supported by the window manager.

(cherry picked from commit b40cc1c791)
2022-06-10 07:08:35 +03:00
Anton Tarasov
e66ffd0b77 JBR-3413 use timeout in CAccessibility.invokeAndWait
(cherry picked from commit e7009db076)
2022-06-10 07:08:34 +03:00
Maxim Kartashev
e29a0fe33c JBR-3916 Deadlock in pGetBounds() on Linux
The deadlock occurred because one thread was holding the AWT lock and
waiting for boundsCacheLock in resetBoundsCache() and the other vice
versa stuck in pGetBounds() owning boundsCacheLock and waiting for the
AWT lock.

The solution is to get rid of boundsCacheLock altogether. It was
introduced in order to never return null from getBoundsCached() so that
resetBoundsCache() wouldn't interfere. But the same effect can be
achieved by simply using a local variable to hold a copy of the current
bounds. The worst case scenario now is that two threads update
boundsCached immediately one after another (if they both have observed
the null value there at about the same time), but that's harmless as
pGetBounds() grabs the AWT lock when necessary.

(cherry picked from commit dc6ad31524)
2022-06-10 07:08:33 +03:00
Vitaly Provodin
b348cb0287 JBR-3905 add incremental JBR building 2022-06-10 07:08:32 +03:00
Vitaly Provodin
c1fb0e8985 JBR-3904 fix the image directory name of macos builds 2022-06-10 07:08:31 +03:00
Dmitry Batrak
d2c10acfbe log LWCToolkit invokeAndWait requests
as part of JBR-3017, to make investigation of similar issues simpler in the future

(cherry-picked from commit a7fd723e43)
2022-06-10 07:08:30 +03:00
Alexey Ushakov
f84687c650 JRE-202 Deadlock in CGLGraphicsConfig.getCGLConfigInfo
Added processing system events while waiting for OGLRenderQueue.lock
Moved getCGLConfigInfo logic execution to AppKit thread so, awt lock is
 taken on one thread

(cherry picked from commit d1c8bf03e1bd41cb075aa73cc39558103af7fe1a)
(cherry picked from commit 6bf9f31986be64acf3755b34568802f9960a66ec)
(cherry picked from commit 4e21d67e0369bffac45662c63699b39946218a7a)
2022-06-10 07:08:29 +03:00
Alexey Ushakov
1c850591fa JRE-193 UI freeze and 12/second thread dumps
Moved CStrikeDisposer dispose code to AppKit

(cherry picked from commit 28774d6878)
2022-06-10 07:08:28 +03:00
Alexander Lobas
7b2f1e5564 JBR-3660 PhpStorm 2021.2 crashes on selecting iCloud Drive directory in Open dialog
(cherry picked from commit f5434bcaaf)
2022-06-10 07:08:27 +03:00
Alexander Lobas
ed97e68f02 JBR-3629 SIGILL at [libsystem_kernel] __kill NPE at com.intellij.openapi.options.SchemeImportUtil$1.isFileSelectable / -[CFileDialog askFilenameFilter:]
(cherry picked from commit 86c13ecaed)
2022-06-10 07:08:26 +03:00
Alexander Lobas
70aab78c54 JBR-3443 Native file dialog on OSX enable filename filter by VM option
(cherry-picked from commit f10e324538)
2022-06-10 07:08:25 +03:00
Alexander Lobas
bae444224e JBR-3442 Native file dialog on OSX (for open file) doesn't allow pasting path
(cherry-picked from commit 7d8cc524ca)
2022-06-10 07:08:24 +03:00
Maxim Kartashev
c866962598 Revert "JBR-2755 IDE UI became slow via remote X Server connection from Windows"
This reverts commit cd9138844da770ae60806fd7dbc1e85c773882a8.
2022-06-10 07:08:22 +03:00
Konstantin Aleev
e6693af78a fix memory leaks in AccessibleJTree
(cherry picked from commit 561a7b8def)
2022-06-10 07:08:21 +03:00
Maxim Kartashev
374a011ed0 JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled
The _NET_FRAME_EXTENTS property that is used to obtain the initial
insets of a dialog window does not immediately get its value and may be
returned as 0 if queried too soon after the window creation.

In order to avoid (incorrect) guessing of dialog's insets, make 3
attempts at getting the insets with a small but increasing pause
in between them.
2022-06-10 07:08:20 +03:00
Maxim Kartashev
51e9b27c02 Revert "JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled"
This reverts commit 8e7aed70976ec0f90c736d86b9cd3e9cf09ff6d4.
2022-06-10 07:08:19 +03:00
Nikita Provotorov
220a270f33 JBR-3838 AltGr on Polish keyboard triggers Ctrl+Alt shortcut.
Add regression test.

(cherry picked from commit 8df43eef4b)
2022-06-10 07:08:18 +03:00
Maxim Kartashev
505f9eb588 JBR-3835 Cropped messages in all Message Dialogs in Idea on Ubuntu 18.04.5 LTS with swing alerts enabled
The _NET_FRAME_EXTENTS property that is used to obtain the initial
insets of a dialog window does not immediately get its value and may be
returned as 0 if queried too soon after the window creation.

In order to avoid (incorrect) guessing of dialog's insets, add an
artificial delay if getInsets() is called too soon.
2022-06-10 07:08:17 +03:00
Vitaly Provodin
706ce018c2 configure BOOT_JDK to use JDK 17 2022-06-10 07:08:16 +03:00
Alexey Ushakov
2795710e38 JBR-3820 Gamma correction for grayscale text in Metal rendering pipeline
Added regression test to compare OGL and Metal text rendering
2022-06-10 07:08:15 +03:00
Artem Bochkarev
6905fda68f JBR-1762: request focus of immediate parent when dispose popup
because requesting focus for frame-parent causes to close whole popup chain

(cherry picked from commit 7a2ccfc521)

JBR-1762: fixed review comments

(cherry picked from commit 0efbe5d9b9)
2022-06-10 07:08:14 +03:00
Dmitry Batrak
657e040d27 JBR-2759 Typeahead issue on Linux
(cherry picked from commits 76bdaf1131, b20c56ff3e)
2022-06-10 07:08:13 +03:00
Artem Bochkarev
42c381e354 JBR-1762: request focus of immediate parent when dispose popup
because requesting focus for frame-parent causes to close whole popup chain

(cherry picked from commit 7a2ccfc521)

JBR-1762: fixed review comments

(cherry picked from commit 0efbe5d9b9)
2022-06-10 07:08:12 +03:00
Denis Fokin
88d6d4f012 JBR-1362 Multiple child windows opened and closed in sequence result in a focus loss
(cherry picked from commit 3c9c599a2d)
2022-06-10 07:08:11 +03:00
Nikita Gubarkov
afe67cd7ad Added JBR API 2022-06-10 07:08:10 +03:00
Maxim Kartashev
935c2cbf79 JBR-3813 Regression after fix for JBR-3688
1. Cached bounds and insets must be cloned before return because they
aren't immutable objects.
2. Fixed the deadlock in resetBoundsCache() by synchronizing on a dedicated
lock.

(cherry picked from commit cd5314db8b)
2022-06-10 07:08:09 +03:00
Renaud Paquay
0db72ab5af Add BasicWithKeyFileAttributeView interface
This new interface is similar to `BasicFileAttributeView` except it
gives implementations a hint that the fileKey() should be acquired
even at some performance cost.

`FileTreeWalker` uses this new interface to request a file key
in addition to regular file attributes so that file equality can
be efficiently performed when checking for loops during file
tree traversal.

This makes `FileTreeWalker` about 2x faster when traversing non
trivial file system trees with the FOLLOW_LINKS option.

Change-Id: I8de047c8fc241dbab9ad57c5e361118a3a94893d

(AKA JBR-3680 Cherry-pick Google's NIO patches to get faster file listing)

(cherry picked from commit 6d1c3f06c4)
2022-06-10 07:08:08 +03:00
Ivan Migalev
8fc8f5254e JBR-3785: don't touch the active keyboard layout on input method activation / deactivation.
origin PR: github.com/JetBrains/JetBrainsRuntime/pull/78.

(cherry picked from commit 2f772fd1a2)
2022-06-10 07:08:07 +03:00
Dmitry Batrak
2260309078 JBR-3779 Unexpected Alt+Tab behaviour for Java frames on Cinnamon DE
(cherry picked from commit 0bf13985d5)
2022-06-10 07:08:06 +03:00
Maxim Kartashev
b2f28db66b JBR-3688 PyCharm incredibly slow with fakexrandr
Cache screen bounds and insets and (conservatively) reset those caches
upon any possibility of a change.
This feature can be disabled with -Dx11.cache.screen.insets=false and
-Dx11.cache.screen.bounds=false.

Based on commit accef6f21e.
2022-06-10 07:08:05 +03:00
Maxim Kartashev
ec86a0e21d JBR-3772 java/beans/PropertyEditor/TestFontClass.java: access denied ("java.util.PropertyPermission" "sun.awt.x11.trace" "read")
Instead of using System.getProperty() directly, wrap the call into
GetPropertyAction and use AccessController to execute it.
2022-06-10 07:08:04 +03:00
Anton Tarasov
0900f755ec JBR-3655 [followup] jbr-dev build fails to find jcef modules on Windows 2022-06-10 07:08:03 +03:00
Dmitry Batrak
65dbc51756 JBR-3504 a11y focus is set on the wrong element when opening popups
(cherry-picked from commit a69e12e0d2)
2022-06-10 07:08:02 +03:00
Maxim Kartashev
c2849c1642 JBR-3665 Typing is slow in remote X session
Only call XGetKeyboardMapping() once for all valid codes and cache the
resulting table. Use the cache on the subsequent calls to
keycodeToKeysym().
2022-06-10 07:08:01 +03:00
Maxim Kartashev
15b7728c72 JBR-2273 JBR musl port
Detect if we're running on a musl-based system by checking for the presence
of the libgcompat.so glibc compatibility library in the process' map.
If so, java is re-started with LD_LIBRARY_PATH set to point to the right
directory with libjvm.so. This works around the problem with the musl
dynamic library loader.

(based on commit 13a904ddb5)
2022-06-10 07:08:00 +03:00
Alexey Ushakov
ed8a5bd2ce Added support for otf into the build scripts. Updated prebuild maps.
Applied code from jbr-dev
2022-06-10 07:07:59 +03:00
Konstantin Bulenkov
e5daeb5da8 bundle Inter font 2022-06-10 07:07:58 +03:00
Maxim Kartashev
0dda907a48 JBR-3664 Logging for communications with X server
Introduced logging controlled with -Dsun.awt.x11.trace.
Currently, only looks at the AWT lock and reports methods holding it
sorted by average hold time.

(based on commit 792a58ea0e)
(based on commit 770b4dc9c1)
2022-06-10 07:07:57 +03:00
Dmitry Batrak
2ae828ce4d JBR-3726 Modal windows 'disappear' on minimize in KDE
(cherry picked from commits d9baf2d9db, 9c2841028f, 5c4fd9ceaf, f0ed32fca4)
2022-06-10 07:07:56 +03:00
Maxim Kartashev
8c6ff2e592 JBR-3712 Add project creation instructions to JBR README
Also changed the version of bootstrap Java to 17.
2022-06-10 07:07:55 +03:00
Maxim Kartashev
8fe9a7e4ed JBR-3542 Fix -Xcheck:jni warnings
Fixes warnings coming from JBR-specific code in addition to those fixed
by 8269223.
2022-06-10 07:07:54 +03:00
Dmitry Batrak
185648645e JBR-3706 Toggling full screen mode for two frames doesn't work on macOS if invoked without delay
(cherry picked from commit 28cfc4815f)
2022-06-10 07:07:53 +03:00
Dmitry Batrak
94cf3791bf JBR-3686 Background window steals focus when converted to full screen on macOS
(cherry-picked from commit 07a5b9672e)
2022-06-10 07:07:52 +03:00
Dmitry Batrak
8d9be14c08 JBR-3662, JBR-3672 Focus jumps to another project tab after closing modal dialog
(cherry picked from commit bfd01081c3, 2a71dc5981)
2022-06-10 07:07:51 +03:00
Anton Tarasov
7d68576113 JBR-3655 jbr-dev build fails to find jcef modules on Windows 2022-06-10 07:07:50 +03:00
Nikita Gubarkov
4e143d9417 JBR-3648 Replace CacheCellInfo usages with MTLCacheCellInfo in metal rendering code 2022-06-10 07:07:49 +03:00
Dmitry Batrak
d6e986f719 JBR-3642 java/awt/Window/8159168/SetShapeTest.java fails on macOS-x64 & macOS-aarch64
make sure jb/java/awt/Focus/Typeahead* tests still pass

includes fixes for JBR-3786 javax/swing/plaf/aqua/CustomComboBoxFocusTest.java fails on MacOS by timeout
(cherry picked from commit f5c5388fb5)

and JBR-4113 java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java fails by time out on macOS

(cherry picked from commit d8d4c55a61)
2022-06-10 07:07:48 +03:00
Anton Tarasov
4ca54f0694 JBR-1834 [linux] runtime hidpi switch is broken
(cherry picked from commit eaa04303a7)
2022-06-10 07:07:47 +03:00
Anton Tarasov
870ec4c95e JBR-1429 Scale is huge due to GDK_SCALE
(cherry-picked from commit 1c3477df2e)
2022-06-10 07:07:46 +03:00
Anton Tarasov
1538af0bdc JBR-1365 force IDE-managed HiDPI on Linux for fractional scales
(cherry picked from commit f092ff3962)
2022-06-10 07:07:45 +03:00
Anton Tarasov
598e0a7344 Allow HiDPI mode on Linux 2022-06-10 07:07:43 +03:00
Anton Tarasov
c60e20d9a9 JRE-489 -Dswing.bufferPerWindow is fractional scale unfriendly 2022-06-10 07:07:42 +03:00
Anton Tarasov
3a9fbe7f67 JRE-310 check for Windows8.1 when enabling ui scale
Was "don't fallback on fractional scale" in JBSDK9.
2022-06-10 07:07:41 +03:00
Maxim Kartashev
4eeb9b6cd1 JBR-3645 Tool to support keeping JBR in sync with OpenJDK 2022-06-10 07:07:40 +03:00
Vitaly Provodin
b33e46e80a JBR-3639 add jbrsdk tarballs for dcevm, jcef builds 2022-06-10 07:07:39 +03:00
Vitaly Provodin
a65b2407cf JBR-3639 add jbrsdk tarballs for dcevm, jcef builds 2022-06-10 07:07:38 +03:00
Anton Tarasov
31b934a428 JBR-3627 include jmods in jbrsdk bundle for jbr-dev 2022-06-10 07:07:37 +03:00
Maxim Kartashev
aef1a8d2b2 JBR-3597 Update project README for Java 17 2022-06-10 07:07:36 +03:00
Vitaly.Provodin
f2b6fa6109 add 32-sizes for native data types
(cherry picked from commit 3a79870da8)
2022-06-10 07:07:35 +03:00
Vitaly.Provodin
7e4eb1c2f8 add dockerfile for x86
(cherry picked from commit 8fb2341ea8)
2022-06-10 07:07:34 +03:00
Nikita Gubarkov
51e6c00511 Added Clion project setup 2022-06-10 07:07:33 +03:00
Nikita Gubarkov
8ba309bfc6 Added JBR-specific .idea project files 2022-06-10 07:07:32 +03:00
Nikita Gubarkov
1c76544faf Updated IDEA project setup 2022-06-10 07:07:31 +03:00
Alexey Ushakov
e5458a8952 JBR-3344 "Exit Full Screen" action doesn't work, the only way is mouse click on window's native "green" button.
Restored JBR-1931 fix partially reverted by JBR-1718

(cherry picked from commit c0be778e20)
2022-06-10 07:07:30 +03:00
Anton Tarasov
459644090d JBR-3337 jb/java/jcef/HandleJSQueryTest3314.sh: fails on macOS-aarch64 with "JS Query was not handled in 2nd opened browser"
(cherry picked from commit 8678f41971)
2022-06-10 07:07:29 +03:00
Anton Tarasov
e219f71651 JBR-3545 Window.setMinimumSize does not respect DPI scaling
(cherry picked from commit 9b4f72ad18)
2022-06-10 07:07:28 +03:00
Denis Fokin
1a8d506967 JRE-408 JBR-3515 fix NullPointerException in MetalRootPaneUI.installWindowListeners
(cherry picked from commit 584d554af529cff445b0f09bc2d57be55e138b7a)
(cherry picked from commit 6a42bb54bd)
2022-06-10 07:07:27 +03:00
Elena Sayapina
7d90a4f81e JBR-2657 [TESTBUG] ChainOfPopupsFocusTest misbehaving on Windows
- changed open popup shortcut from Ctrl+N to Ctrl+M, so no new explorer windows appear if desktop gets focused by error
- added a click on the main test frame, so it gets focus when running from background cygwin process on Windows, otherwise it just flashes on the taskbar

(cherry picked from commit eda8e4d50e)
2022-06-10 07:07:26 +03:00
Maxim Kartashev
a85a4954d9 JBR-3590 Update JetBrains Runtime README 2022-06-10 07:07:25 +03:00
Maxim Kartashev
bb50cbdcd3 JBR-3572 Wayland: java/awt/Window/WindowTitleVisibleTest/WindowTitleVisibleTestLinuxGnome.java: title bar shown and hidden are the same.
Exclude the test when running under XWayland that doesn't implement
screen capture necessary for the test to function.
2022-06-10 07:07:24 +03:00
Denis Konoplev
4b44d3cb48 EA-252361: Check window for null
(cherry picked from commit 23a7dbd486)
2022-06-10 07:07:23 +03:00
Artem Bochkarev
863358f372 JBR-3131: support custom view for system menu items
(cherry picked from commit 78d509ac0f)
2022-06-10 07:07:22 +03:00
Artem Bochkarev
72d800e757 JBR-3127: set NSWindowAllowsImplicitFullScreen=NO
fixed JBR-3127 Modal dialogs invoked from modal or floating dialogs are opened in full screen

(cherry picked from commit 0b8ff1a7e6)

JBR-3127: add possibility to load NSJavaVirtualMachine

JavaVM framework is deprecated but this class is still checked by AppKit, see https://youtrack.jetbrains.com/issue/JBR-3127#focus=Comments-27-4684465.0-0

(cherry picked from commit be6a2c4f0c)
2022-06-10 07:07:21 +03:00
Nikita Gubarkov
c51d5953b0 JBR-3376 Added check for -1 glyph info pointer in OGLTextRenderer.c 2022-06-10 07:07:20 +03:00
Dmitry Batrak
a60c148e2e JBR-3024 Popups are shown with 1x1 size sometimes
test case only

(cherry picked part of commit ee298f5287)
2022-06-10 07:07:19 +03:00
Vitaly Provodin
975f9b0273 JBR-3314 add regression test
(cherry picked from commit c81adfed61)
2022-06-10 07:07:18 +03:00
Ivan Migalev
930482d32b JBR-3227 Reload type of required native file dialogs each time a file dialog is requested
(cherry picked from commit 26dd87ab7c)
2022-06-10 07:07:17 +03:00
Vitaly Provodin
705f759507 JBR-1505 add jdk.jcmd module into JBR
(cherry picked from commit c40b9c8b9e)
2022-06-10 07:07:16 +03:00
Ivan Migalev
05f166e0df JBR-3068 Update path selector behavior when sun.awt.windows.useCommonItemDialog is enabled
(cherry picked from commit 442bb7eecc)
2022-06-10 07:07:15 +03:00
Alexey Ushakov
3a5f170964 JBR-2996 M1 warnings: CoreText note: Client requested name “.SFCompact-Black”, it will get Times-Roman rather than the intended font
Cached system fonts family names

(cherry picked from commit 56629e4c90)
2022-06-10 07:07:14 +03:00
Alexey Ushakov
478bf5cb28 JBR-3023 Gray idea frame after project open with ide.mac.transparentTitleBarAppearance.
Initiate move/resize event on first appearance of window having FULL_WINDOW_CONTENT property set

(cherry picked from commit a6ea081ba2)
2022-06-10 07:07:13 +03:00
Dmitry Batrak
83344368b0 JBR-3017 Focus issue in presence of third-party accessibility tool
use the new invocation approach for 'makeKeyAndOrderFront' as well, as it can also cause synchronous back-calls to accessibility subsystem, and change the global call order unexpectedly

this commit fixes TypeaheadSetVisibleTest and TypeaheadToFrontTest, when they are run with AltTab active

Guard against possible deadlocks, if UI-related methods are invoked not on EDT.
Sample deadlock scenario:
* Application thread attempts to show the window, this involves calling CWrapper.NSWindow.makeKeyAndOrderFront under AWT tree lock, which blocks till 'makeKeyAndOrderFront' completes on AppKit thread
* AppKit thread, while executing 'makeKeyAndOrderFront' performs 'back-call' to CAccessibility.getFocusOwner, which waits for execution on EDT
* EDT performs some activity requiring AWT tree lock (e.g. processing of PaintEvent)

(cherry picked from commits e3aaff5db4, 09941119e1)
2022-06-10 07:07:12 +03:00
Dmitry Batrak
6191418468 JBR-3072 Deadlock on nested dialog hiding
(cherry picked from commits 99242748ee, ad1595b5c2)
2022-06-10 07:07:11 +03:00
Dmitry Batrak
ce286f597a fix occasional freezes of JBR-3017 reproducer after the fix
(cherry picked from commit 7e6db54f77)
2022-06-10 07:07:10 +03:00
Dmitry Batrak
0c91b7a128 JBR-2819 Create API to determine typographic family/subfamily for available fonts
(cherry picked from commit 89e519a4ef)
2022-06-10 07:07:09 +03:00
Nikita Gubarkov
90cbc82d09 JBR-2924 Do not try to create native italic font when we're going to make it fake italic 2022-06-10 07:07:08 +03:00
Nikita Gubarkov
d3d6f7c6b4 JBR-3982 Fixed non-antialiased text rendering on macOS
JBR-3269 Disabled subpixel antialiasing for macOS Mojave and newer
2022-06-10 07:07:07 +03:00
Dmitry Batrak
1139c6d7fc JBR-3017 Focus issue in presence of third-party accessibility tool
(cherry picked from commit 88ead5d9e3)
2022-06-10 07:07:06 +03:00
Vitaly Provodin
5b32fa5d33 JBR-1718 add a regression test
(cherry picked from commit 84ff4eab21)
2022-06-10 07:07:05 +03:00
Vitaly Provodin
370e8e01ab JBR-2957 notarize JBR and JBRSDK as APPL
(cherry picked from commit 0e7f9ce4ca)
2022-06-10 07:07:04 +03:00
Elena Sayapina
19653c85d8 JBR-2890 [TESTUPDATE] Enable jcef tests on macOS aarch64 platform
(cherry picked from commit 1714d7b627)
2022-06-10 07:07:03 +03:00
Vitaly Provodin
19f42777a9 JBR-667 add shenandoahgc feature
(cherry picked from commit e15dad04)
2022-06-10 07:07:02 +03:00
Artem Bochkarev
3d8ae3471c JBR-2562: fixed invokation of parent method
(cherry picked from commit 93cbab2f2d)

JBR-2562: suppress exceptions from [NSWindow _changeJustMain]

temporary workaround to prevent crashes

(cherry picked from commit dd055b5970)
2022-06-10 07:07:01 +03:00
Mikhail Grishchenko
6fb1c77136 JBR-2890 Disable jcef tests on 32-bit and aarch64 platforms
(cherry picked from commit d34d6528fe)
2022-06-10 07:07:00 +03:00
Alexey Ushakov
072588e9ad JBR-2879 Big Sur: Opening project in new window results in opening project in another tab
Disabled Tabbing mode for all NSWindows

(cherry picked from commit 8cb0377a31)
2022-06-10 07:06:59 +03:00
Nikita Gubarkov
eef2774847 JBR-2910 Implemented extended glyph cache for macOS
JBR-3976 Fixed text spacing & emoji scaling on macOS

JBR-3638 Adjust subpixel glyph positions for correct rounding in CStrike#getGlyphImageBounds
2022-06-10 07:06:58 +03:00
Alexey Ushakov
e59b907323 JBR-2617 Text with opacity renders black
Implemented alpha blending in grayscale text rendering (UX-1320)
Corrected bright text thickness (smooth on), bright and dark text thickness (smooth off)
Added JVM properties for fine tuning

(cherry picked from commit c30306f779)
(cherry picked from commit c95adeb8f2)
(cherry picked from commit 269c9580fb)
(cherry picked from commit 55c7be5fe9)
(cherry picked from commit e28ff71e97)
2022-06-10 07:06:57 +03:00
Alexey Ushakov
0ef549193a JBR-2521 Ugly font in all 2020.2 EAPs on macOS
Provide gamma correction for both light and dark text

(cherry picked from commit 5953202a7e)
2022-06-10 07:06:56 +03:00
Alexey Ushakov
e9aa55a765 JBR-2591 Repainting is broken (was: Icons in tree list widgets became dark)
Save current blend mode before cached grayscale rendering

(cherry picked from commit 7beb75ccec)
(cherry picked from commit ed52fde57d)
2022-06-10 07:06:55 +03:00
Alexey Ushakov
6f44831434 JBR-1986 Enabling fractional metrics causes visual artifacts in font rendering on macOS 10.14+
Disable subpixel positioning for macOS 10.13+ if legacy LCD rendering is disabled

(cherry picked from commit dbd24232e4)
2022-06-10 07:06:54 +03:00
Vitaly Provodin
5409072d0d exclude bug7154030 on macosx-aarch64 due to 8268284 2022-06-10 07:06:53 +03:00
Vitaly Provodin
05f8edd129 exclude SharedMemoryPixmapsTest on macosx-all due to 8221451 2022-06-10 07:06:52 +03:00
Vyacheslav Moklev
cbe2c46fa1 JBR-2442 fix memory leak of fileBuffer
fix was suggested by Nikita Gubarkov
2022-06-10 07:06:51 +03:00
Andrey Starovoyt
ecf5f15583 JBR-2736 provide writeObjects implementation for copying files/folders from Project Explorer to the Finder
(cherry picked from commit 33db034d49)
(cherry picked from commit d3ec3d899d)
2022-06-10 07:06:50 +03:00
Sergey Malenkov
c163116200 EA-235126 - CME: HighlightableComponent.getPreferredSize
(cherry picked from commit 523d80cafd)
2022-06-10 07:06:49 +03:00
Kirill Kirichenko
d2e961d075 JBR-2667 Post review: rename win.darkTheme.on to win.lightTheme.on and reversed the logic
(cherry picked from commit eeab5252e6)
2022-06-10 07:06:48 +03:00
Kirill Kirichenko
672f4e3c02 JBR-2667 Add new AWT desktop property for light/dark theme detection on Windows 10
(cherry picked from commit 0e4ad056dd)
2022-06-10 07:06:47 +03:00
Alexey Ushakov
a2ec7379d3 JBR-2593 Wide ligatures not rendered in Grayscale mode
Added missing flush of cached vertices

(cherry picked from commit ad409b4370)
2022-06-10 07:06:46 +03:00
Nikita Gubarkov
cd226c46ef JBR-2910 Implemented extended glyph cache for Linux 2022-06-10 07:06:45 +03:00
Nikita Gubarkov
200df1b2b9 JBR-2910 Implemented extended glyph cache for Windows 2022-06-10 07:06:44 +03:00
Nikita Gubarkov
f955704c23 JBR-2614 Fixed LCD glyph width to include both left & right padding, so that rowBytes = width * 3 2022-06-10 07:06:43 +03:00
Alexey Ushakov
ebee86ad53 JBR-2463 Font rendering problem on macOS Mojave
Use adjusted advances for glyphs

(cherry picked from commit 1af5dd4aae)
2022-06-10 07:06:42 +03:00
Denis Konoplev
ad7aaccbcb JBR-3544: Generate popup invoked instead of New in this directory 2022-06-10 07:06:41 +03:00
Vitaly Provodin
4af952c3f1 JBR-2545 Clean up the list of ignored Render tests
(cherry picked from commit f7b4c42e1d)
2022-06-10 07:06:40 +03:00
Jayathirth D V
440838821f 8241490: Add large text performance tests in RenderPerfTest
(cherry picked from commit 803ee2f2b5)
2022-06-10 07:06:39 +03:00
Alexey Ushakov
7e992f0787 8230657: Create fine grained render perf test for metal pipeline
Converted gradle JUnit test to plain java for ant and gnumake

To run the tests:
cd src/demo/share/java2d/RenderPerfTest

ant run
or
java -jar dist/RenderPerfTest.jar
or
java -jar dist/RenderPerfTest.jar testWhiteTextBubblesGray

(cherry picked from commit 356121b18f)
(cherry picked from commit 8bd8d2d132)
2022-06-10 07:06:38 +03:00
Konstantin Bulenkov
b1236c2bfa Update FiraCode to 5.2
(cherry picked from commit 71e2a8d8ad)
2022-06-10 07:06:37 +03:00
Alexey Ushakov
f2900a1f9f JBR-1929 Improve rendering of San Francisco font of macOS Catalina
Reverting gamma correction because of rendering artifacts in the light theme

This reverts commit 5016db51

(cherry picked from commit c1d644a004)
2022-06-10 07:06:36 +03:00
Alexey Ushakov
8a24f99ef5 JBR-1929 Improve rendering of San Francisco font of macOS Catalina
Added gamma correction to match grayscale rendering with subpixel one

(cherry picked from commit 5016db518a)
2022-06-10 07:06:35 +03:00
Alexey Ushakov
901ad4c77a JBR-2463 Font rendering problem on macOS Mojave
Use adjusted advances for glyphs

(cherry picked from commit 1af5dd4aae)
2022-06-10 07:06:34 +03:00
Anton Tarasov
d357f5455f revert: JBR-1434 "New file dialog" popup remains above all windows on switching application
java.awt.peer.WindowPeer.isLightweightDialog() method does not exist.

(cherry picked from commit 7d8aeaf7de)
2022-06-10 07:06:33 +03:00
Anton Tarasov
eeb17986b8 JBR-2872 improve: JBR-2866 JCEF: Markdown editor steals focus from a different frame
(cherry picked from commit bad748e3d0)
2022-06-10 07:06:32 +03:00
Anton Tarasov
df4c1c8f4d JBR-2866 JCEF: Markdown editor steals focus from a different frame 2022-06-10 07:06:31 +03:00
Anton Tarasov
2143bd54b5 JBR-2645 enable CefBrowser.close(true) in jcef reg tests
(cherry picked from commit 492c217125)
2022-06-10 07:06:30 +03:00
Anton Tarasov
da738f6b06 JBR-2259 WebSite isn't loaded with .loadUrl method if browser isn't shown in UI
(cherry picked from commit 57bbddf071)
2022-06-10 07:06:29 +03:00
Anton Tarasov
4a0ca635a7 JBR-2557 use com.jetbrains.cef.JCefAppConfig in JCEF tests
(cherry picked from commit e30a309f92)
2022-06-10 07:06:28 +03:00
Anton Tarasov
7eecab2199 JBR-2489 Git branch operations (switch to another branch, rebase) sometimes crash WebStorm 202.5428.27
(cherry picked from commit 81d2156fb1)
2022-06-10 07:06:26 +03:00
Anton Tarasov
1177c3d643 JBR-2282 [jcef] update to JCEF/80.0.4+g74f7b0c+chromium-80.0.3987.122
(cherry picked from commit a5adc725df)
2022-06-10 07:06:25 +03:00
Anton Tarasov
2f090810a7 JBR-2305 jcef: jb/java/jcef/JCEFStartupTest.java throws java.lang.ExceptionInInitializerError
(cherry picked from commit f0385f01ec)
2022-06-10 07:06:24 +03:00
Anton Tarasov
b539f53697 JBR-2306 jcef: jb/java/jcef/JCEFStartupTest.java unexpectedly exits with the exit code: 0
(cherry picked from commit ff7d7bd43c)
2022-06-10 07:06:23 +03:00
Anton Tarasov
ec7e8e9cf4 JBR-2299 [mac] jcef requests for "chromium safe storage" keychain access
(cherry picked from commit dd1334a352)
2022-06-10 07:06:22 +03:00
Anton Tarasov
eea6defb20 JBR-2222 Crash during closing IDE
(cherry picked from commit d0c367b31f)
2022-06-10 07:06:21 +03:00
Anton Tarasov
d29195ab4d JBR-2287 [jcef] add CefBrowser wrapper to jtreg tests
(cherry picked from commit fa961d1769)
2022-06-10 07:06:20 +03:00
Anton Tarasov
1c741a50c0 JBR-2169 AWTThreading: remove tracked invocation event from completion listener
(cherry picked from commit a855f3b835)
2022-06-10 07:06:19 +03:00
Anton Tarasov
7f49efcc04 JBR-2159 Native crash in thread AWT-EventQueue-0 when trying to push commit
(cherry picked from commit bba297b4a4)
2022-06-10 07:06:18 +03:00
Anton Tarasov
48125e7ca5 JBR-2148 JCEF: JBR bundle has invalid app structure
(cherry picked from commit f45f84d7ed)
2022-06-10 07:06:17 +03:00
Anton Tarasov
4855aedc2d JBR-2146 improve InvokeOnToolkitHelper to cover more generic case 2022-06-10 07:06:16 +03:00
Anton Tarasov
52691ea6ac JBR-2139 Idea freeze on dynamic plugin unloading
(cherry picked from commit e57bae4f66)
2022-06-10 07:06:15 +03:00
Anton Tarasov
e7b86e2ecf JBR-2099 jb/java/jcef/JCEFStartupTest.java fails on Windows, Linux
(cherry picked from commit 3dfb0aa16a)
2022-06-10 07:06:14 +03:00
Anton Tarasov
13cf6f38aa JBR-2093 create reg test for JCEF startup
(cherry picked from commit e8c2761f5b)
2022-06-10 07:06:13 +03:00
Anton Tarasov
d479435fc7 JBR-2082 Revealing taskbar does not work when "Automatically hide the taskbar"
(cherry picked from commit b31a41fb2f)
2022-06-10 07:06:12 +03:00
Mikhail Grishchenko
fd2662b226 JBR-2639, JBR-2412 [jcef] Tests that checks mouse events
JBR-2412 [windows] mouse listener does not work for jcef

(cherry picked from commit 66ad6472ae)
(cherry picked from commit 04246aac57)
(cherry picked from commit b7cde4fd05)
2022-06-10 07:06:11 +03:00
Mikhail Grishchenko
9604e5d170 JBR-2639 [win] jcef does not recognize vertical mouse wheel events
added regression test

(cherry picked from commit e8e4741bb0)
2022-06-10 07:06:10 +03:00
Mikhail Grishchenko
8e6826d1b9 JBR-2412 [windows] mouse listener does not work for jcef
added regression test

(cherry picked from commit d1479872f2)
2022-06-10 07:06:09 +03:00
Elena Sayapina
219ab049ed JBR-2630 Typing speed in IDE editor was dropped after switching to 11.0.8
Introduced sun.awt.osx.RobotSafeDelayMillis property to control macOS specific safe delay for Robot methods.
50 ms safe delay was initially hardcoded in 3862142d (JDK-8242174: [macos] The NestedModelessDialogTest test make the macOS unstable) which affected performance tests execution.

(cherry picked from commit 5f691bb788)
2022-06-10 07:06:08 +03:00
Mikhail Grishchenko
7e4784e113 JBR-2430 [jcef] Added Regression test
Checks that JS Query is handled in 2nd opened browser

(cherry picked from commit 404ff84565)

Refactoring + changed EDT awaiting method

(cherry picked from commit dc24658b31)
2022-06-10 07:06:07 +03:00
Vitaly Provodin
87b1ca2a26 exclude the new printer test 8262731 2022-06-10 07:06:06 +03:00
Alexey Ushakov
603c332b77 JBR-2419 Improve performance of CStrike.getNativeGlyphOutlineBounds
Do not pass the result via java object. Use more straight api.

(cherry picked from commit 9f91fe91f5)
(cherry picked from commit c0fd2daf5c)
2022-06-10 07:06:06 +03:00
Alexey Ushakov
cebef58f3e JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions
Used user home dir for jbr_err files. Removed logging with reportException method

(cherry picked from commit 2c8cdb221b)

JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions

Used process workdir for jbr_err files. Added one more logging to reportException method

(cherry picked from commit 95a47810d5)

JBR-2382 Provide detailed stack trace in crash dumps for unhandled ObjC exceptions

Generate jbr_err_pidXX.log file with detailed stack trace of the exception

(cherry picked from commit 4c42f75021)
2022-06-10 07:06:04 +03:00
Artem Bochkarev
6a5544e9a3 JBR-2253: unset LD_PRELOAD just after VM loaded
workaround for JBR-2253 Preload libjsig.so to fix JNA crashes

(cherry picked from commit 127a2deddf)
2022-06-10 07:06:04 +03:00
Kirill Kirichenko
bfc67faa18 JBR-1874 Cursor not changing from 'default' to 'text'. Additional fix after reopening.
(cherry picked from commit 5a29d4ade9)
2022-06-10 07:06:03 +03:00
Elena Sayapina
839c9dd6a5 JBR-2585 [TESTBUG] TouchScreenEvent tests affect tests simulating mouse actions
- added workaround for JBR-2585
- added README.md about manual test run
- made an update to close LinuxTouchScreenDevice properly
- added an error exit from linux shell script if sudo password is empty or chown fails

(cherry picked from commit 4deb3bbe61)
2022-06-10 07:06:02 +03:00
Denis Konoplev
46cd42e095 fixup! macOS national keyboard support
Remove unused import that broke compilation
2022-06-10 07:06:01 +03:00
Elena Sayapina
9a05519a9b IDEA-165950 [TESTUPDATE] National keyboard layouts support
Update regression test after the following commits:

02fad83c: Remove public constants from KeyEvent
f4227faf: Impossible to assign cmd+ß shortcuts
(cherry picked from commit 264802cf4b)
2022-06-10 07:06:00 +03:00
Elena Sayapina
4537c6dd19 JBR-2328 [TESTBUG] Regression test java/awt/keyboard/AllKeyCode/AllKeyCode.java is not correct
(cherry picked from commit 861f73c393)
(cherry picked from commit bfab6a9364)
(cherry picked from commit e9fa7a0882)
2022-06-10 07:05:59 +03:00
Mikhail Grishchenko
3aa37e7943 JBR-2259 WebSite isn't loaded with .loadUrl method if browser isn't shown in UI
Added reproducer

(cherry picked from commit e875bf72c9)
2022-06-10 07:05:58 +03:00
Denis Konoplev
5db49a9ea2 JBR-2490 Add option to work with Surface Pen
(cherry picked from commit 5acc7680a1)
2022-06-10 07:05:57 +03:00
Denis Konoplev
2a0a2a4137 JBR-2669: set unicode for both keyCode and extendedKeyCode
(cherry picked from commit ba3f14c83a)
2022-06-10 07:05:56 +03:00
Denis Konoplev
8ec5d1b6db JBR-2554: Proper unicode values in KeyEvent.keyCode
(cherry picked from commit 703d77a927)
2022-06-10 07:05:55 +03:00
Denis Konoplev
3edeac4c29 JBR-215: Remove SystemInfo
(cherry picked from commit 9adf77a512)
2022-06-10 07:05:54 +03:00
Denis Konoplev
f9daa9e2d8 JBR-215: Separate LatinNonAlphaNumKeycodes option
(cherry picked from commit caf366f6f3)
2022-06-10 07:05:53 +03:00
Denis Konoplev
b481334b92 JBR-215: Windows non-alphanumeric shortcuts
(cherry picked from commit 4f60efebe2)
2022-06-10 07:05:52 +03:00
Denis Konoplev
e3c9ae1ba5 JBR-2280: Fix regression. Mode compatible with old option.
(cherry picked from commit a3e3c23cb1)
2022-06-10 07:05:51 +03:00
Denis Fokin
744628c150 macOS national keyboard support 2022-06-10 07:05:50 +03:00
Sergey Malenkov
f85f106eda JBR-1929 FractionalMetricsSupport
(cherry picked from commit bbdc159762)
2022-06-10 07:05:49 +03:00
Mikhail Grishchenko
cd3edf73e8 JBR-2256 JEditorPane with test/html type and zero margins is not shown
Updated reproducer

(cherry picked from commit 529a188b8b)

JBR-2256 JEditorPane with test/html type and zero margins is not shown

Added reproducer

(cherry picked from commit 41578a40b5)
2022-06-10 07:05:48 +03:00
Mikhail Grishchenko
9e8917c837 JBR-2210 IDEA fails to start (JVM crashes) when using the -Dfile.encoding=UTF-8in IDEA's vmoptions file
Added regression test

(cherry picked from commit 4e1f5a43b3)
2022-06-10 07:05:47 +03:00
Alexey Ushakov
acfc77ea84 JBR-2210 IDEA fails to start (JVM crashes) when using the -Dfile.encoding=UTF-8in IDEA's vmoptions file
Returning devanagari subset back for ja.UTF-8 to get non-null font name from WFontConfiguration.getTextComponentFontName(). It is a regression from JDK-8208179.

(cherry picked from commit b51254a975)
2022-06-10 07:05:46 +03:00
Mikhail Grishchenko
762982d4bb JBR-1414 [Test] downscale frames to run on low-dpi screens
(cherry picked from commit b46e74fe6f)
2022-06-10 07:05:45 +03:00
Elena Sayapina
5e04c17144 JBR-1905 [TESBUG] java/awt/TextArea/DisposeTest/TestDispose.java: frame is not disposed
- java/awt/TextArea/DisposeTest/TestDispose.java, java/awt/TextField/DisposeTest/TestDispose.java: fixed test frame disposal
- java/awt/Frame/DisposeStressTest/DisposeStressTest.java: decreased test timeout from 2h to 10 min, added minor diagnostic logging

(cherry picked from commit 7f025f4e16)
(cherry picked from commit dda7f3d871)
(cherry picked from commit bc09aadadb)
2022-06-10 07:05:44 +03:00
Alexey Ushakov
054b66c3a4 JBR-2135 Use CoreText api to select the font with the most recent version
Added a property to force loading bundled fonts: -Djava2d.font.noVersionCheck=true

(cherry picked from commit cbb148dff4)
2022-06-10 07:05:43 +03:00
Alexey Ushakov
b6ba70fd19 JBR-2137 JetBrainsMono fonts update to v1.0.3
(cherry picked from commit a6e441828a)
2022-06-10 07:05:42 +03:00
Mikhail Grishchenko
b46cf26224 JBR-1414: Added regression test for dnd with HiDPI scaling
(cherry picked from commit 1f4ab12fbb)
2022-06-10 07:05:41 +03:00
Elena Sayapina
b1b0996a78 JBR-2041 [TEST] Added new regression test (Touchscreen devices support)
(cherry picked from commit 2d587b3728)
(cherry picked from commit 92606f2c7f)
(cherry picked from commit 05af375909)
(cherry picked from commit 0f895bf1b2)
(cherry picked from commit 08aa0852b7)
2022-06-10 07:05:40 +03:00
Konstantin Bulenkov
ca4ba9405a Update JetBrains Mono to 1.0.2
(cherry picked from commit 6f4a13e46f)
2022-06-10 07:05:39 +03:00
Ivan Migalev
b25954e459 Extract the DWM colorization parameters from registry (JBR-2070)
(cherry picked from commit 0330cab60b)
2022-06-10 07:05:38 +03:00
Ivan Migalev
35dcaa8c97 Refresh desktop properties on WM_DWMCOLORIZATIONCOLORCHANGED (JBR-2070)
(cherry picked from commit 06086f4a7e)
2022-06-10 07:05:37 +03:00
Ivan Migalev
66bc4c75b6 Fix a possible resource leak in ColorizationColorAffectsBorders
(cherry picked from commit 0c911b6ffe)
2022-06-10 07:05:36 +03:00
Elena Sayapina
314ff00a38 JBR-2086 JetBrainsMono fonts update to v1.0.1
(cherry picked from commit a4b373e631)
2022-06-10 07:05:35 +03:00
Konstantin Bulenkov
2008568852 JetBrains Mono 1.0
(cherry picked from commit d514f7a982)
2022-06-10 07:05:34 +03:00
Denis Konoplev
07673d89da JBR-3444: Return NullSurfaceData when gc == null
(cherry picked from commit 01ad15e61c)
2022-06-10 07:05:33 +03:00
Denis Konoplev
3c5f1a07ac JBR-1995: Last character issue with korean
Fix for JTextComponent

(cherry picked from commit a7c8b0b535)
2022-06-10 07:05:32 +03:00
Denis Konoplev
18a1762483 JBR-2891: Post PhaseEvents in the begin and end of Magnify and Rotate
(cherry picked from commit c811c295c2)
2022-06-10 07:05:31 +03:00
Denis Konoplev
18dd8d740a JBR-2444: Turn on IM workaround by default
(cherry picked from commit 15c4ce1d3e)
2022-06-10 07:05:30 +03:00
Denis Konoplev
832414bbbe Fix build: add import & fix jwhen 2022-06-10 07:05:29 +03:00
Denis Konoplev
e5f597ac5b JBR-2795: Add explicit conversion
(cherry picked from commit bf3e1c0c31)
2022-06-10 07:05:28 +03:00
Denis Konoplev
58c4b4a346 IDEA-237231: Correct signarute mask
(cherry picked from commit 6974131eec)
2022-06-10 07:05:27 +03:00
Denis Konoplev
ca3ac86e80 IDEA-237231: Possible fix for pen interraction
(cherry picked from commit 33a8c95d39)
2022-06-10 07:05:26 +03:00
Denis Konoplev
d01a408789 JBR-2347: Free memory on other exceptions, rethrow ThreadDead & log it
(cherry picked from commit 16ca839ed3)
2022-06-10 07:05:25 +03:00
Denis Konoplev
a42ca5588b JBR-2347: Don't free memory when thread is dead
(cherry picked from commit afb3303db5)
2022-06-10 07:05:24 +03:00
Denis Konoplev
feb394a9d6 JBR-2041: Project view tap fix, recovery? constants & logging
(cherry picked from commit 1e904db3b0)
2022-06-10 07:05:23 +03:00
Denis Konoplev
7405998a6b IDEA-229135: Fling animation stop on tap
(cherry picked from commit 7ce0f79561)
2022-06-10 07:05:22 +03:00
Denis Konoplev
15ff33c4c5 Windows touch screen support
(cherry picked from commit cab3f28907)
2022-06-10 07:05:21 +03:00
Denis Konoplev
960bfbfe04 Turn off multitouch
(cherry picked from commit a2576ffa9a)
2022-06-10 07:05:20 +03:00
Denis Konoplev
1221f39d17 Check XInput extension && touch inertia
(cherry picked from commit cca7fb97f4)
2022-06-10 07:05:19 +03:00
Denis Konoplev
1df230b9d3 Touch scroll handling
(cherry picked from commit 6dcec3dc31)
2022-06-10 07:05:18 +03:00
Denis Konoplev
e2b7be714f XI2 Constants
(cherry picked from commit 588cd6ee73)
2022-06-10 07:05:17 +03:00
Denis Konoplev
432d419f54 XLibWrapper XI2 functions
(cherry picked from commit d6bd1bfa2b)
2022-06-10 07:05:16 +03:00
Denis Konoplev
96fab49948 X11 native get put double
(cherry picked from commit f101bc1108)
2022-06-10 07:05:15 +03:00
Denis Konoplev
dd9f1d9406 Native data types
(cherry picked from commit 9504574dbb)
2022-06-10 07:05:14 +03:00
Denis Konoplev
1b7e07e717 XI2 headers in xlib wrapper generator
(cherry picked from commit ef108067a1)
2022-06-10 07:05:13 +03:00
Denis Konoplev
8bd9f0cd5c Revert "Turn off multitouch"
This reverts commit 90ea3bf57e4c687e9d9bf0a37f2f64c82a81f4eb.
2022-06-10 07:05:12 +03:00
Denis Konoplev
9b1c6b9321 Turn off multitouch
(cherry picked from commit a2576ffa9a)
2022-06-10 07:05:11 +03:00
Alexey Ushakov
60b32ab89f JBR-1962 Allow to change font config
Replaced several privileged blocks with just one

(cherry picked from commit faa8d3d258)
2022-06-10 07:05:10 +03:00
Vitaly Provodin
fb14ff4f49 JBR-572: Regression test on the crash caused by the fix
(cherry picked from commit 6cc380ffb5)
(cherry picked from commit 958e25ed21)
(cherry picked from commit a7de601d5f)
2022-06-10 07:05:09 +03:00
Dennis Ushakov
ef28ca8628 JBR-1863, JBR-1868 correct advances on Catalina 2022-06-10 07:05:08 +03:00
Dennis Ushakov
2c91ede60f JBR-1850: on macOS fonts should be sorted by weight to ensure proper population of the families 2022-06-10 07:05:07 +03:00
Dennis Ushakov
00c1800818 faster font family loading & lazy font family population
1. NSFont.familyName is faster than loading allFamilyNames
2. Prebuilt list of system fonts
3. Cleanup San Francisco family loading
4. Avoid calling expensive native getWidth on font when creating font family, load styles only when they would be used.
2022-06-10 07:05:06 +03:00
Dennis Ushakov
049615eaba JBR-1756 use CoreText for all font rendering on Catalina 2022-06-10 07:05:05 +03:00
Nikita Gubarkov
3e2ea2e11e JBR-410 Added emoji support for Linux 2022-06-10 07:05:04 +03:00
Alexey Ushakov
dbd864cb41 JBR-1997 JetBrainsMono fonts update to v0.22
(cherry picked from commit 41f4fddd34)
(cherry picked from commit f5302a02f4)
(cherry picked from commit 5d7fd2e1e5)
2022-06-10 07:05:03 +03:00
Anton Tarasov
993befa6e8 JRE-729 [windows] unreasonable IME activity consumes CPU 2022-06-10 07:05:02 +03:00
Dmitry Batrak
c1328b9de3 JBR-3119 Application's panel in KDE taskbar blinks when popup window is shown
this re-fixes JBR-2934 in a different way

(cherry picked from commit 63134e091b)
2022-06-10 07:05:01 +03:00
Dmitry Batrak
59d21c8d0c JBR-3038 Unexpected windows z-order change on workspace switch
(cherry picked from commit ddda860f42)
2022-06-10 07:05:00 +03:00
Dmitry Batrak
0135be47f4 JBR-3035 The Confirm Exit pop-up window remains hidden behind a window of another application
(cherry picked from commit 470c3bd1b5)
2022-06-10 07:04:59 +03:00
Dmitry Batrak
a16044df88 JBR-2934 Serious usability issue with GoLand 2020.3 caused by JBR
(cherry picked from commit 95be4351d4)
2022-06-10 07:04:58 +03:00
Dmitry Batrak
fb9ed4216d JBR-2977 Opening a recent project in a new window doesn't bring this window to the front
(cherry picked from commit 2d9fb9e7b8)
2022-06-10 07:04:57 +03:00
Dmitry Batrak
749f5c5484 JBR-2698 setAutoRequestFocus(false) breaks focus logic under i3 window manager on Linux
(cherry picked from commit ebcdeb7d80)
2022-06-10 07:04:56 +03:00
Dmitry Batrak
e783fd33cd JBR-2696 Log focus API invocations with stack traces
(cherry picked from commits 0f038754e5, a507cab6d3)
2022-06-10 07:04:55 +03:00
Dmitry Batrak
ce7ac1309e JBR-2496 Prevent JVM stealing focus from other applications on Linux (JBR-2497, JBR-2499, JBR-2503, JBR-2652)
(cherry picked from commits 87525d1d2a, 66381f0dec, 8a789e04e9, 665ebc5d47, 98a9219c23)
2022-06-10 07:04:54 +03:00
Alexey Ushakov
f988e9ff5d JBR-3509 Extend JDK-8267521 (Post JEP 411 refactoring: maximum covering > 50K) to JBR specific changes
Marked all the usages of SecurityManager related api
2022-06-10 07:04:53 +03:00
Artem Bochkarev
b33e85f789 JBR-1851: check NSArray length
and make more exception-safe
and minor optimization for logging (cache jobjects)

(cherry picked from commit 5839539379)
2022-06-10 07:04:52 +03:00
Artem Bochkarev
94ea9f9eb3 JBR-1841: allow deferred disabling of InputMethods-support
(cherry picked from commit 969255904b)
2022-06-10 07:04:51 +03:00
Artem Bochkarev
d4e8e225cc JBR-1668: add hardcoded default values for preferences node NSServicesStatus
(cherry picked from commit 8445f53d85)
2022-06-10 07:04:50 +03:00
Artem Bochkarev
e6348ae72b JBR-1515: obtain shortcut from OS to check inside AWTView.performKeyEquivalent
(cherry picked from commit 30d479fbd4)
2022-06-10 07:04:49 +03:00
Artem Bochkarev
bc9edd437d JBR-1668: add hardcoded descriptions of system actions
and minor fixes

fix memory management

(cherry picked from commit 15f7368309)
2022-06-10 07:04:48 +03:00
Elena Sayapina
bf31085172 JBR-1417 [TEST] Added new regression test (JBR 11 does not support chain of popups)
(cherry picked from commit 41e89505be)
(cherry picked from commit 9fe5c778d9)
(cherry picked from commit 6ea9530d9f)
(cherry picked from commit d757108517)
(cherry picked from commit b99c1e7b5c)
2022-06-10 07:04:47 +03:00
Alexey Ushakov
b8364c9894 JBR-1690 Bundle new fonts
Test correction
Restored RenderUtil.java
Removed obsolete golden images
(cherry picked from commits:
aa13c8b4ea
943b1472c7
cab6dd5087
7997c7a5ee
cab6dd5087
7997c7a5ee
d3731df79d)
2022-06-10 07:04:46 +03:00
Dmitry Batrak
9f24184710 IDEA-257525 Unable to show Chinese when using IDEA mac ARM version
The proposed solution is to use a 'normal' font as a base for 'San Francisco' font fallback.
Most of its fallback components/candidates (provided by the OS) are expected to be normal
fonts as well, and so the resulting coverage of Unicode character repertoire should be much better.

(cherry picked from commits 9b7113a6cf, 92b00d50b5, 53489fab27)
2022-06-10 07:04:45 +03:00
Dmitry Batrak
8a9ae26a24 JRE-469 Console with emoji output becomes slow
The fix consists of two parts:
* Making CCharToGlyphMapper remember that a particular character cannot be displayed (isn't mapped to glyph with given font). Checking this repeatedly in native code is very slow.
* Make CCompositeGlyphMapper remember the results of char-to-glyph mapping, this was missing in previous implementation. This reuses caching code in CompositeGlyphMapper, extending the range of characters for which the results are cached to include Supplementary Multilingual Plane (most emoji characters belong to it).

port commit 4e0ccde2 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 394e055ae6)

cherry picked from commit 0db7e948af
2022-06-10 07:04:44 +03:00
Dmitry Batrak
9c0ba15996 reimplement JDK-7162125 to fix JDK-8147002
port commit ba38e5c4 from JBR 9

port from JBR 11 to JBR 15(cherry picked from commit a949f9d220)

cherry-picked from commit f309844f75
2022-06-10 07:04:43 +03:00
Artem Bochkarev
eae241d085 JBR-1771: fixed compilation errors (macosx-x86_64-normal-server-fastdebug)
(cherry picked from commit 1acada7cac)
2022-06-10 07:04:42 +03:00
Artem Bochkarev
86d3853994 JBR-1668: minor fixes
fixed review comments

(cherry picked from commit 9dbcf194c9)
2022-06-10 07:04:41 +03:00
Vitaly Provodin
626a835b3c JBR-1618: fixed misprint, added saving screenshots in case of failure
(cherry picked from commit e4a3889cf0)
2022-06-10 07:04:40 +03:00
Alexey Ushakov
c40db6da0d JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Corrected lookup for bold fonts

(cherry picked from commit 114b8af38f)
2022-06-10 07:04:39 +03:00
Alexey Ushakov
30f99a3ec5 JBR-1399 Improve font discovery and loading by introducing font cache
Added unit test

(cherry picked from commit b4f5bf8bd3)
2022-06-10 07:04:38 +03:00
Elena Sayapina
dd44165022 IDEA-165950 [TEST] Added new regression test (National keyboard layouts support)
(cherry picked from commit 0900a705bc)
2022-06-10 07:04:37 +03:00
Artem Bochkarev
5c2d28d710 JBR-1668: read system keyboard shortcuts
initial support for OS X

(cherry picked from commit 6bbe7102e2)
2022-06-10 07:04:36 +03:00
Artem Bochkarev
75dc2be160 JBR-1573: restore current input context after cleanup
(cherry picked from commit b7acd7f6f6)
2022-06-10 07:04:35 +03:00
Alexey Ushakov
6810a1e792 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Restored old behaviour of registerFontsInDir as it does not affect idea bundled fonts

(cherry picked from commit cef29e8100)
2022-06-10 07:04:34 +03:00
Alexey Ushakov
349f257af8 JBR-1874 Cursor not changing from 'default' to 'text'
Prevent OS from changing cursor

(cherry picked from commit 94a4eb7002)
2022-06-10 07:04:33 +03:00
Alexey Ushakov
2784eba886 JBR-1778 Font in editor incorrect (always italics)
Added -it pattern into italic detection code
Added some more patterns to bold and italic detection code
'Anka/Coder' font support

(cherry picked from commit 5119eeee12)
(cherry picked from commit ec241e4a0a)
(cherry picked from commit 251068294e)
(cherry picked from commit 08ae9ff034)
2022-06-10 07:04:32 +03:00
Alexey Ushakov
57b36ad020 JBR-1699 Use platform font rendering for bundled fonts on MacOS
Use different family for specific font faces. Refactoring

JBR-3071 Remove naming workaround for Fira Code

(cherry picked from commits c423003bd4, aee4b48d20)
2022-06-10 07:04:31 +03:00
Alexey Ushakov
60ca34b29f JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)

(cherry picked from commit e838103a24)
2022-06-10 07:04:30 +03:00
Alexey Ushakov
11646e2970 JBR-1885 JetBrainsMono fonts update to v0.19
Updated the fonts to v0.19. Bundled italic fonts

(cherry picked from commit 7f032e3fe7)
(cherry picked from commit a7b4c9449a)
2022-06-10 07:04:29 +03:00
Alexey Ushakov
a090ef5117 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)

(cherry picked from commit e838103a24)
2022-06-10 07:04:28 +03:00
Alexey Ushakov
7853752cfd JBR-1699 Use platform font rendering for bundled fonts on MacOS
Used CFont instead of TrueTypeFont for bundled fonts on mac
Use different family for specific font faces. Refactoring

(cherry picked from commit 8c86ad3e96)
(cherry picked from commit c423003bd4)
(cherry picked from commit bcae402dc8)
2022-06-10 07:04:27 +03:00
Alexey Ushakov
266d6c9489 JBR-1690 Bundle new fonts
Update family name for JetBrainsMono-Thin

(cherry picked from commit 0d2326ff34)
(cherry picked from commit 83843f9124)
(cherry picked from commit 2a2e1cfb36)
(cherry picked from commit 76abb69262)
2022-06-10 07:04:26 +03:00
Alexey Ushakov
9bcb98c1a3 JBR-1645 javax/swing/JTextArea/TestTabSize.java: Tab width calculation wrong
Corrected idea font filter

(cherry picked from commit 62f9d1f46a)
2022-06-10 07:04:25 +03:00
Artem Bochkarev
f3f2431a30 JBR-1573: workaround for 'Sudden keyboard death on Ubuntu 18'
recreate instance of system InputMethod when starts filter all events

(cherry picked from commit 3ad94911af)

(cherry picked from commit c8533a1219)
2022-06-10 07:04:24 +03:00
Alexey Ushakov
8f96ffb39d JBR-1399 Improve font discovery and loading by introducing font cache
Bundle IDEA fonts to improve startup performance

(cherry picked from commit 350a3fdef3)
2022-06-10 07:04:23 +03:00
Artem Bochkarev
da5718d9a6 JBR-1541: activate menu in completion handler of modal dialog
(cherry picked from commit e57384c1d6)
2022-06-10 07:04:22 +03:00
Alexey Ushakov
06d88a1f43 JBR-1314 Font difference in pycharm 2019.1 on Ubuntu
Removed disabling hints on MAX_FCSIZE_LTL_DISABLED font size

(cherry picked from commit 2b99dfed40)
2022-06-10 07:04:21 +03:00
Alexey Ushakov
9734a980c0 JBR-1412 [fwp to JBR11] JBR-1393 RubyMine is hanging after log in (macOS)
Modified version of JBR8 fix

(cherry picked from commit 434166fe63)
2022-06-10 07:04:20 +03:00
Alexey Ushakov
62a6b1eaf8 JBR-1394 JBR11 does not support LCD text on Mac
Enable LCD rendering for transparent destinations

(cherry picked from commit 207c6b92ff)
2022-06-10 07:04:19 +03:00
Elena Sayapina
4e7f5b3ef1 JBR-1372: [TESTBUG] JDialog1054.java, MoveFocusShortcutTest.java regression tests need update
(cherry picked from commit a5948894bf)
2022-06-10 07:04:18 +03:00
Maxim Kartashev
f67d5d2f18 JBR-2755 IDE UI became slow via remote X Server connection from Windows
When XGetImage() calls become slow in a remote X11 session, fake
XGetImage() with client-side XCreateImage() that is filled with some
background color. The color is chosen from several top left corner
pixels of the "slow" images obtained with XGetImage().

This feature activates in a remote X11 session only and is
controlled with -Dremote.x11.workaround={true|false|auto}.
2022-06-10 07:04:17 +03:00
Vyacheslav Moklev
07460d2868 Fix const pointer after JDK-8225032 fix 2022-06-10 07:04:16 +03:00
Vyacheslav Moklev
b9296cb8a6 Fix compilation on windows platform: awt_ole.h must be included before awt.h 2022-06-10 07:04:15 +03:00
Vyacheslav Moklev
ce7baf4369 JBR-1269 Common Item Dialog does not appear on Alt+Tab or click in windows toolbar
JBR-1270 Common Item Dialog does not have an icon

Select a proper window handle
2022-06-10 07:04:14 +03:00
Vyacheslav Moklev
fdc40f59b3 JBR-1271 Wrong parent of native windows dialogs
Set a proper parent to a dialog window
2022-06-10 07:04:13 +03:00
Vyacheslav Moklev
1e0babd67b JBR-1273 Common Item Dialog does not open when wrong path to directory is passed
Handle set directory / set file properly
2022-06-10 07:04:12 +03:00
Vyacheslav Moklev
685261c788 JBR-1274 Common Item Dialog sometimes crash the process
Prevent from freeing memory with CoTaskMemFree twice
2022-06-10 07:04:11 +03:00
Vyacheslav Moklev
30777188aa JBR-1257 CommonItemDialog modal window has no owner
Fix modality for Common Item Dialog

squash! JBR-1257 CommonItemDialog modal window has no owner

JBR-2478 java/awt/Modal/FileDialog/FileDialogNonModal7Test.java: DummyButton on Dialog did not gain focus when clicked

revert part of JBR-1271, that's related to 'old' file dialogs
2022-06-10 07:04:10 +03:00
Vyacheslav Moklev
20179b74d4 JBR-1258 CommonItemDialog ignores directory to open
Fix parsing of directory path / file path
2022-06-10 07:04:09 +03:00
Vyacheslav Moklev
27b3f408c2 JRE-1216 Implement Windows native file dialogs with the new Common Item Dialog API
Add implementation of file dialogs with the new Common Items Dialog API
2022-06-10 07:04:09 +03:00
Alexey Ushakov
f2cb370f24 JBR-1144 [JDK11] [macos] Held down key is not deleted when press backspace after accent menu popup (Mojave)
Handled both Delete and ForwardDelete keys

(cherry picked from commit e3ba0bd651)
2022-06-10 07:04:08 +03:00
Alexey Ushakov
2cea674bcb JBR-1144 [JDK11] [macos] Held down key is not deleted when press backspace after accent menu popup (Mojave)
Handled backspace separately

(cherry picked from commit 81916a92af)
2022-06-10 07:04:07 +03:00
Elena Sayapina
d7275d3820 JBR-1102: [TESTBUG] java/awt/Paint/ComponentIsNotDrawnAfterRemoveAddTest/ComponentIsNotDrawnAfterRemoveAddTest.java: 'paint' method of 60 components was not called
(cherry picked from commit dc7abebe17)
(cherry picked from commit c8d631a142)
2022-06-10 07:04:06 +03:00
Elena Sayapina
e9e86436d6 JBR-998: [TEST] Added new regression test (Input freezes after MacOS key-selector on Mojave)
(cherry picked from commit 3d898a8024)
(cherry picked from commit f368f0f101)
2022-06-10 07:04:05 +03:00
Elena Sayapina
58fdec5814 JBR-318: [TEST] Added new regression test (Cmd+` doesn't work after update to JDK 152_*)
(cherry picked from commit 0be0a018b5)
(cherry picked from commit 5bb4c2a1d6)
2022-06-10 07:04:04 +03:00
Elena Sayapina
4d6bcc6961 JBR-1054: [TEST] Added new regression test (Weird non-modal dialog above modal dialog behaviour)
(cherry picked from commit b808be6a6a)
(cherry picked from commit 48b7dd874f)
2022-06-10 07:04:03 +03:00
Vitaly Provodin
05a35e7397 JRE-1117 J2DBench: introduced result reader for TC's charts (follow up)
separated printing values fo TC charts and values for comparisons

(cherry picked from commit bbdbe17e2a)
2022-06-10 07:04:02 +03:00
Vitaly Provodin
d1af4f67ff JRE-1117 J2DBench: introduced result reader for TC's charts
(cherry picked from commit 422fa59643)
2022-06-10 07:04:01 +03:00
Alexey Ushakov
8f1525f5f8 JRE-60 Editor font is distorted on Kubuntu Linux 16.04 with HiDPI
Override FC_HINT_SLIGHT only for small font sizes

(cherry picked from commit 0e1d23c807)
2022-06-10 07:04:00 +03:00
Alexey Ushakov
f66c4c33c9 JRE-471 Crash on macOS Sierra after Sleep
Replaced [NSScreen screens] 'objectAtIndex' with 'firstObject' to get nil instead of NSRangeException. Added nil checks

(cherry picked from commit d6b98511262055c01522d9ec8024253af7e91564)
(cherry picked from commit cef970e1ba)
2022-06-10 07:03:59 +03:00
Alexey Ushakov
c0be5e080f JRE-608 J2DBench metrics: up to 20x degradation
Increased rendering queue buffer up to 6.4 MB

(cherry picked from commit 9ef00f00a7fb6e14835393f8d3944157c6800727)
(cherry picked from commit 2a61e9e997a880a60c5acb361849205170501b91)
(cherry picked from commit 68ca9f00ded004c970b94bd047a04b9f09237047)
(cherry picked from commit 2fe5289178)
2022-06-10 07:03:58 +03:00
Alexey Ushakov
fc10c2197c JRE-1028 fwport(9): JRE-1008 Do not use LCD shader on macOS 10.14+ in font rendering
Disable LCD text shader on macOS 10.14+ if LCD rendering is not explicitly specified

(cherry picked from commit dffea9d701)
2022-06-10 07:03:57 +03:00
Konstantin Bulenkov
62950d9f09 update icons
(cherry picked from commit dfe387ff5037deda29d8d522cba6cc5370796ff4)
(cherry picked from commit de1e4a9d71)
2022-06-10 07:03:56 +03:00
Konstantin Bulenkov
2cc6be8cdf add workspace.xml to gitignore
(cherry picked from commit bd5b9403fdca779ecc76f0b3af2918fe772f7ed1)

(cherry picked from commit 37e7661f85)
2022-06-10 07:03:55 +03:00
Vitaly Provodin
2135bac484 Update README.md 2022-06-10 07:03:54 +03:00
Vitaly Provodin
d9fb80ac42 Regression test on https://bugs.openjdk.java.net/browse/JDK-8139176
(cherry picked from commit 6f1c0a6)
(cherry picked from commit 63130fd461)

add regression test on https://bugs.openjdk.java.net/browse/JDK-8139176

(cherry picked from commit 380c17456c)

(cherry picked from commit 6f1c0a6)
(cherry picked from commit 63130fd461)
2022-06-10 07:03:53 +03:00
Vitaly Provodin
aeab0d6bec not for upstream: added disposing frames in order to provide the test with the chance on the second run
(cherry picked from commit 8170635)
(cherry picked from commit 7fc924f065)
2022-06-10 07:03:52 +03:00
Vitaly Provodin
8973e9e2d5 JRE-9: added regression test
(cherry picked from commit 4ffb665)
(cherry picked from commit 00a29ad129)
2022-06-10 07:03:51 +03:00
Sergey Malenkov
b562f62fc4 JRE-100 Scroll with inertia (Mac os) should only work in the initial component
(cherry picked from commit e79502c708)
2022-06-10 07:03:50 +03:00
Sergey Malenkov
ed0c9e2d44 IDEA-161965 ignore dragged event that does not change mouse location Sierra is more sensit
(cherry picked from commit ef490fa465)
2022-06-10 07:03:49 +03:00
Stanislav Dombrovsky
27d45f1ad4 Fix rendering of HTML list dots + better vertical align for them.
(cherry picked from commit fa4a404533ba1ef638fe523adc74391aee8a3ebf)

(cherry picked from commit 9f079c66e9)
2022-06-10 07:03:47 +03:00
Vitaly Provodin
daaa9d06d9 configure BOOT_JDK to use JDK 16 2022-06-10 07:03:46 +03:00
Dmitry Batrak
3a421b7375 JBR-3353 Sibling popup window is shown below dialog on macOS
(cherry picked from commit 4c6f3e4510)
2022-06-10 07:03:45 +03:00
Dmitry Batrak
d6f02862f3 JBR-3339 Window requests focus on horizontal scroll (on Linux)
(cherry picked from commit 8d74e8e30b)
2022-06-10 07:03:44 +03:00
Anton Tarasov
73d303b368 JRE-166 [macOS] deadlock with JFXPanel
(cherry picked from commit a9dbb6990fac0c659297487a261ba9170e5fb3ad)

(cherry picked from commit 8a44e1bb37)
2022-06-10 07:03:43 +03:00
Alexey Ushakov
bf56ab61b7 8265445: Introduce the new client property for mac: apple.awt.windowAppearance
Implemented apple.awt.windowAppearance client property
2022-06-10 07:03:42 +03:00
Anton Tarasov
488bcf78ca JBR-3306 jbr-dev warnings: incompatible pointer to integer conversion returning 'void *' from a function with result type 'jlong' 2022-06-10 07:03:41 +03:00
Dmitry Batrak
c2f5a86fc7 JBR-2498 Fix unexpected window raising under Mutter WM
re-implement the fix, so that ChildAlwaysOnTopTest isn't failing
2022-06-10 07:03:40 +03:00
Maxim Kartashev
97368947c0 JBR-3323 Improve sanitizer-enabled builds
Improve usability of builds with --enable-asan.
Add the --enable-usan option to build with Undefined Behavior Sanitizer.
2022-06-10 07:03:39 +03:00
Alexey Ushakov
fbb96291b3 JBR-3327 [jbr-dev] Adjust mac window appearance according to AppleInterfaceStyle property
Set window appearance according to AppleInterfaceStyle default
2022-06-10 07:03:38 +03:00
Alexey Ushakov
9bb7231399 JRE-238 [736] java.awt.AWTError: access denied ("java.lang.RuntimePermission" "canInvokeInSystemThreadGroup")
Moved task execution on AppKit to the privileged block. Minor refactoring

(cherry picked from commit 5dbb88471115c9e4a536ae37d0e6794de9e5ac9c)
2022-06-10 07:03:37 +03:00
Alexey Ushakov
ac8757e155 JRE-359 CGraphicsEnvironment.getDefaultScreenDevice() returns null
Moved CG api calls to AppKit thread

(cherry picked from commit fd0210f035199e8612097a2c1d42b90cfd2111f8)
(cherry picked from commit 5e99e376d9dfe477401121878704630c3c13f9f7)

(cherry picked from commit 6d73b25130)
2022-06-10 07:03:36 +03:00
Dmitry Batrak
817a957cd4 JBR-2973 Copy/Move dialog not in the focus on drag-n-drop to Project Tool window from external application
(cherry picked from commit 20fe78b650)
2022-06-10 07:03:35 +03:00
Alexey Ushakov
2a6bb84ddd JRE-444 CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse is slow
Replaced number of CGWindowListCopyWindowInfo for each window layer with [NSWindow windowNumberAtPoint: belowWindowWithWindowNumber:]

(cherry picked from commit 2a143af4d62340acdfd9c94d876f684385febbc8)
(cherry picked from commit 6fc369e8bf)
2022-06-10 07:03:34 +03:00
Alexey Ushakov
cb1957e50a JRE-482 Java_sun_font_CStrike_getNativeGlyphOutline takes too much time in scrolling
Replaced glyph outlines with bounding boxes for glyph boundaries calculation for most common usages. Also, skipped unnecessary OGL flushes in OGL rendering queue

(cherry picked from commit c58dc052af48887338a38beb0c721eddca3af481)
(cherry picked from commit 7f6be7cfb907bbf1c3572b911df5690fa3039fde)
(cherry picked from commit c68913d82c0ba4b4c509179123f0a4bf7971f857)
(cherry picked from commit 9cfa04c93ad416a8177d9e7ca410850bd3ff880f)
(cherry picked from commit 0e930841704e4e98ecc0c888b144245e74218799)
(cherry picked from commit 8ffc190fbdb059d5a24842115c0bc3ade8b351b9)
(cherry picked from commit 0f7c26186a)
2022-06-10 07:03:33 +03:00
Alexey Ushakov
1f7da9f4b8 JBR-3316 Reimplement CThreading functionality on top of OpenJDK17 sourcebase
Adopted CThreading related code to OpenJDK17 source base

(cherry picked from commit 5dfb30ae68b2c54d58c98a9195709c031f823581)
(cherry picked from commit 94163bd69f64616836523e81567aa1141480d841)
2022-06-10 07:03:32 +03:00
Alexey Ushakov
4568648b45 JBR-3304 jbr-dev warnings: 'getPhysFontName' defined but not used [-Werror=unused-function]
Removed unused code
2022-06-10 07:03:31 +03:00
Vitaly Provodin
d44fb5a6fe exclude javax/swing/JTabbedPane/4624207/bug4624207.java failing on windows due to 8197552 2022-06-10 07:03:30 +03:00
Alexey Ushakov
ddee6dcaa3 JRE-366 Add support for Awesome WM
Added detection of Awesome WM and handled similar to Sawfish WM

(cherry picked from commit 6742077ed198975949af567e8ef543f853397351)
(cherry picked from commit 2847be73c6)
2022-06-10 07:03:29 +03:00
Alexey Ushakov
4bc691c900 JRE-353 Fedora 25 + XMonad rendering issues
Added support for Xmonad WM

(cherry picked from commit c690c3c7fdf1390e6b1a8d388ff752a09391ae3c)
(cherry picked from commit 6851dc3441)
2022-06-10 07:03:28 +03:00
Denis Konoplev
a90b176bd2 8264143: Change uint8_t to unsigned char 2022-06-10 07:03:27 +03:00
Dmitry Batrak
35ef152a49 JBR-3255 Applying 'incline' transform might change character's advance
(cherry picked from commit b37f7cfdb1)
2022-06-10 07:03:26 +03:00
Dmitry Batrak
43558eebe4 JBR-3215 'deriveFont(float)' can return a different font (not just change the size)
(cherry picked from commit 8eafcaab24)
2022-06-10 07:03:25 +03:00
Dmitry Batrak
b0882fd905 JBR-3157 Maximized window with custom decorations isn't focused on showing
(cherry picked from commit 62b04983f2)
2022-06-10 07:03:24 +03:00
Dmitry Batrak
2f112e564f make AwtListGarbageCollectionTest pass reliably
(cherry picked from commit 304eb7f919)
2022-06-10 07:03:23 +03:00
Dmitry Batrak
ce607857ac JBR-1752 Floating windows overlap modal dialogs
(cherry picked from commit 0161050077)
2022-06-10 07:03:22 +03:00
Dmitry Batrak
84d5509bcc JBR-3054 Focus is not returned to frame after closing of second-level popup on Windows
(cherry picked from commit 0c2b6e1c04)
2022-06-10 07:03:21 +03:00
Dmitry Batrak
cde67b7755 JBR-2702 Tooltips display through other applications on hover
(cherry picked from commits 11732c2469, 0ed7deabaa)
2022-06-10 07:03:20 +03:00
Dmitry Batrak
2580696244 added RobotSmokeTest
this test failing in jtreg launch most probably indicates either some problem with the environment (e.g. some windows left open from previously launched processes) or with java.awt.Robot implementation

(cherry picked from commit 1d525a2d2f)
2022-06-10 07:03:19 +03:00
Dmitry Batrak
c938dd6de3 JBR-2847 Always dispatch KEY_TYPED event to the same component as KEY_PRESSED event
also fixes JBR-2834, IDEA-254466, IDEA-254466
squashed with fixes for JBR-3291, JBR-3307, JBR-3598

(cherry picked from commits e94f6057a4, ba6b9c085e, 2ccf6b65a7, 3b0708af7d, 3674766d65)
2022-06-10 07:03:18 +03:00
Dmitry Batrak
35d42d0a81 JBR-2712 Typeahead mechanism doesn't work on Windows
(cherry picked from commits 1a9838082e, f5b6222835, acd7e3b2da, cd6dd5c3cf8556f97f3113cb7d615a92393b57bf(partially), e8bbd8ffdd90f57cd12d7d7e89188be97ee4be0b(partially), 37901295e1, cafb374afc)
2022-06-10 07:03:17 +03:00
Denis Konoplev
115e64c515 8264143: Lanai: RenderPerfTest.BgrSwBlitImage has artefacts on apple M1
Add stdint include to fix x64 build
2022-06-10 07:03:16 +03:00
Dmitry Batrak
e5381f08a3 JBR-2498 Fix unexpected window raising under Mutter WM
(cherry picked from commit 73b45fb899)
2022-06-10 07:03:15 +03:00
Dmitry Batrak
f847def5cf JBR-2248 Support text wrapping in a <pre> tag in JEditorPane
port from JBR 11 to JBR 15 (cherry picked from commit ff2e915371)

cherry picked from commit 6a30c56138
2022-06-10 07:03:14 +03:00
Dmitry Batrak
f3fadbf0c5 JBR-2234 Support CSS setting overflow-wrap:anywhere in JEditorPane
port from JBR 11 to JBR 15 (cherry picked from commits b6583d0a71, 6003abc15f)

cherry picked from commit 93ad4f06dd

also includes JBR-4006 [JCK] javax.swing.text.html.CSS$Attribute.OVERFLOW_WRAP field breaks public API
(cherry picked from commit f20a3d8679)
and JBR-4007 [JCK] javax.swing.text.GlyphView.calcBreakSpots method breaks public API
(cherry picked from commit 1002eff4f3)
2022-06-10 07:03:13 +03:00
Dmitry Batrak
476551126d JBR-2050 Issue with keycap emojis
port from JBR 11 to JBR 15 (cherry picked from commit ae91e1d7f1)

cherry picked from commit d3018a1837
2022-06-10 07:03:12 +03:00
Dmitry Batrak
dfd1241860 JBR-1987 Korean/Thai characters not printed properly in annotation tooltip (e.g. spellchecker)
This changes the fonts JDK uses for font fallback on Windows. These used to be DokChampa (for Thai) and Batang/Gulim/Gulim (for Korean).
Those fonts are not available by default on Windows 10, user needs to install supplementary font language packs to get them.
Now the following fonts will be used - Tahoma (for Thai) and Malgun Gothic (for Korean). They are available by default
on Windows 7, 8 and 10.

port from JBR 11 to JBR 15 (cherry picked from commit 850653192b)

cherry picked from commit 2bf43a57ab
2022-06-10 07:03:11 +03:00
Dmitry Batrak
946b041037 JBR-1714 Italic text is displayed using incorrect glyphs on Windows
port from JBR 11 to JBR 15 (cherry picked from commits 46e4cdfcbd, 9cc5cbc99b)

cherry picked from commit 6769b27e53
2022-06-10 07:03:10 +03:00
Dmitry Batrak
2d05c65e2e JBR-1689 Incorrect painting of long strings on linux
port from JBR 11 to JBR 15 (cherry picked from commits e12c1d6f0d, 0429e74e9d)

cherry picked from commit e43cfd198f
2022-06-10 07:03:09 +03:00
Dmitry Batrak
3ae0c7834a JBR-1248 Exception caused by broken font
port from JBR 11 to JBR 15 (cherry picked from commit 4efa7eab3e)

cherry picked from commit 6e1c514c6c
2022-06-10 07:03:08 +03:00
Dmitry Batrak
e7407cb0ae JBR-1245 [JDK 11] There are different letter spacings in some controls
port from JBR 11 to JBR 15 (cherry picked from commit a26b70568a)

cherry picked from commit e2637199e9
2022-06-10 07:03:07 +03:00
Dmitry Batrak
5642a8e4e7 JRE-927 Unexpected wrapping of bidirectional text in JEditorPane on HiDPI screens
port commit 11a5a4a2 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 65a5e450d5)

cherry picked from commit 47ff31ae82
2022-06-10 07:03:06 +03:00
Dmitry Batrak
9319ca3ce6 JRE-774 Don't paste BOM from clipboard on Mac
port commit ea9b75b3 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit c6fed2cf58)

cherry picked from commit a5e25d1ef9
2022-06-10 07:03:05 +03:00
Dmitry Batrak
694ec9246d JRE-847 Box drawing characters have different widths with Monospaced font on Windows
port commit 778cef18 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 9caaac4a5a)

cherry picked from commit eea293f4a4
2022-06-10 07:03:04 +03:00
Dmitry Batrak
9c43b11cd9 JRE-748 Strange dots with fractional metrics turned on
port commit 82e7c82d from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit e9bd5f5dad)

cherry picked from commit e0475e9ba2
2022-06-10 07:03:03 +03:00
Dmitry Batrak
dc1bb5ea19 JRE-593 Wrong italic font rendering for Source Code Pro
port commit 1f6bd200 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 32ce109355)

cherry picked from commit 087ff34c2e
2022-06-10 07:03:02 +03:00
Dmitry Batrak
e1d1a0f98b JRE-430 Font fallback sometimes doesn't work in Swing text components
port commit fc8003ad from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 5b814d6b34)

cherry picked from commits b871188f44, 0a9f16dc90, 9cc82c39d9
2022-06-10 07:03:01 +03:00
Alexey Ushakov
63004fba18 JRE-303 2017.1.1 update breaks linux fonts
Corrected rendering hints for Non-AA text rendering

(cherry picked from commit b923aa7a0729a10ea47d3438622d659fbead44c9)
(cherry picked from commit b6bdd04e41)
2022-06-10 07:03:00 +03:00
Alexey Ushakov
2351a736bd JRE-205 Font is wrong and without anti aliasing in 2017.1 EAP
Added property to disable bundled font config:
  java2d.font.loadFontConf=false
Do not load custom font.conf by default

Moved hints adjusting logic from code to bundled font.conf file
Applied correction only for regular fonts with platform sizes less than 12
Some fonts are not corrected at all: Consolas, Noto Sans Mono
Used family name instead of physical one in requests to Fontconfig
Removed redundant call to FcConfigBuildFonts
Added privileged access to the properties (JRE-235,JRE-235)

(cherry picked from commit 4d4c915047077ebd966b0e3be056566d56ba11a4)
(cherry picked from commit 9d6f325f72482405264852f3ee2636f5fedaeaf0)
(cherry picked from commit e7e3372bf8db539c0f6bc85db9f1093f8fa4c380)
(cherry picked from commit 3e724caed2f199be50d25d1ecb20b7819c86be2e)
(cherry picked from commit d372b35963c096a32331b05b257e26841ace5d94)
(cherry picked from commit 18a5f5de03eb107f89dca138a44b9aab2151235c)
(cherry picked from commit 9ba320efef0539f75aa93fd1b5dd80266c954d0a)
(cherry picked from commit b8c38f419972af61291953f7f452c1698f7a1624)
(cherry picked from commit debba0128e200be60adc9a339d5985590ef4e230)
(cherry picked from commit 2fa17b1bd7d6524e4b5fa4d0b3ce2bf02a8fcc78)
(cherry picked from commit 09b4f61db0d4f5beea0e16ce9136c99e2185c10b)
(cherry picked from commit 3b6782dd742f9c74a9535145db2f9f7ffaccf7c8)
(cherry picked from commit f1b68149528c13a22fa64468c130b1405bf3d081)
(cherry picked from commit db5cf5a2b9cb454630fb86783c2d58cd5446cba6)
(cherry picked from commit 32140948578bc3c2a0c5f8adb537660421efe5e7)
(cherry picked from commit b978e3d0b131ed642774c5a14a649e13f764c20b)

(cherry picked from commit c75c1ef8b2)

(cherry picked from commit a29f19e6a2)
2022-06-10 07:02:59 +03:00
Dmitry Batrak
d7a79ba871 an option to disable native rendering for rotated text (following JRE-19)
port commit ccc1ded6 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 72fb9ff7c4)

cherry picked from commit a5bd092449
2022-06-10 07:02:58 +03:00
Dmitry Batrak
ae1c81e579 JRE-11 Support text rendering via DirectWrite API on Windows
port commits 7b180f8d, cccbcab4 from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commit 030f15834c)

cherry picked from commit b16ee45915
2022-06-10 07:02:57 +03:00
Dmitry Batrak
b2d5467a94 IDEA-150876 OpenJDK fonts for toolwindow names look worse than Oracles's
don't apply FreeType-returned glyph advance for rotated glyphs rendered by GDI

This seems to produce a better looking text (more evenly spaced). Fractional metrics won't be respected by this code, but we can address this later if needed.

port commits c9debd5e, ed78cd00, 4c7e1619, 7aa0429c, 7bd6c17c from JBR 9

port from JBR 11 to JBR 15 (cherry picked from commits d6b588bdab, dbc15fb84e)

cherry picked from commit 2c0d6150d0
2022-06-10 07:02:56 +03:00
Vitaly Provodin
95e1215abd JRE-186 added regression test (Modal dialogs (Messages) shouldn't popup IDEA when another application is active)
(cherry picked from commit 236bd38d1b)
2022-06-10 07:02:55 +03:00
Vitaly Provodin
0ea47501fe JRE-269 added regression (JLabel doesn't scale <code>text</code> HTML fragments.)
(cherry picked from commit 1f4ad38d23)
2022-06-10 07:02:54 +03:00
Alexey Ushakov
a765541dcc JRE-307 Wrong dpi reported on Wayland
(cherry picked from commit 15693661cc)
2022-06-10 07:02:53 +03:00
Vitaly Provodin
d2cd6bebb3 JRE-392 added regression (Tip of the day is not hidden while another modal window is shown)
(cherry picked from commit c7b0ac686f)
2022-06-10 07:02:52 +03:00
Vitaly Provodin
a79cb15de0 JRE-394 added regression test (System getenv doesn't return env var set in JNI code)
(cherry picked from commit 3a7b3c67b0)
2022-06-10 07:02:51 +03:00
Vitaly Provodin
51eaa43806 JRE-401 added regression test (AppCode freezes during autocomplete and other operations)
(cherry picked from commit cb4453b1d1)
2022-06-10 07:02:50 +03:00
Vitaly Provodin
641d459d3e JRE-422 added new regression test (AWTView deliverJavaMouseEvent leaks jEvent)
(cherry picked from commit 37dc13c603)
2022-06-10 07:02:49 +03:00
Vitaly Provodin
b8edb9809d JRE-430 added new regression test (Font fallback sometimes doesn't work in Swing text components)
(cherry picked from commit d04debc847)
2022-06-10 07:02:48 +03:00
Vitaly Provodin
fc1923456c JRE-457 added new regression test (OGLTR_DisableGlyphModeState is slow)
(cherry picked from commit 3a43f4557f)
2022-06-10 07:02:47 +03:00
Vitaly Provodin
cc01c97158 JRE-458 added new regression test (Insufficient and inconsistent permissions on some files in Linux build)
(cherry picked from commit 82adbe9c25)
2022-06-10 07:02:46 +03:00
Vitaly Provodin
7dcddd5e54 JRE-467 added new regression test (Wrong rendering of variation sequences)
(cherry picked from commit 0026095202)
2022-06-10 07:02:45 +03:00
Vitaly Provodin
8712d035fd JRE-468 added new regression test (Idea freezes on project loading)
(cherry picked from commit 1ce8c3ce82)
2022-06-10 07:02:44 +03:00
Vitaly Provodin
2e54bd3aba JRE-501 added new regression test (Live resize is jerky for heavy java applications on Mac)
(cherry picked from commit c4a1277c1b)
2022-06-10 07:02:43 +03:00
Vitaly Provodin
4c6793b9bc JRE-638 added new regression test (enable unlimited cryptographic policy by default)
(cherry picked from commit 4a14c6f15a)
2022-06-10 07:02:42 +03:00
Vitaly Provodin
309d954e0f JRE-705 added new regression test (Z-order of child windows is broken on Mac OS)
(cherry picked from commit 82cd480619)
2022-06-10 07:02:41 +03:00
Vitaly Provodin
d7e33e8a08 JRE-624 CThreading isAppKit() fails to detect main app thread if it was renamed
(cherry picked from commit c8f248a936)
2022-06-10 07:02:40 +03:00
Alexey Ushakov
3ffe573dca IDEA-166173 IntelliJ freezes when returning from sleep
Fixed deadlock by removing unnecessary getScreenResolution call

(cherry picked from commit cec93cf1fd)
2022-06-10 07:02:39 +03:00
Alexey Ushakov
e1c233d397 Added missing fontconfig defines
(cherry picked from commit 2ac273a456)
2022-06-10 07:02:38 +03:00
Alexey Ushakov
f2bd316228 JRE-43 Font.getFamily() does not work in headless mode
Removed unused code

(cherry picked from commit 5b523f049e)
2022-06-10 07:02:37 +03:00
Alexey Ushakov
6d14a43f17 JRE-43 Font.getFamily() does not work in headless mode
Bundled Droid fonts to fallback in headless mode

(cherry picked from commit 5b523f049e)
2022-06-10 07:02:36 +03:00
Alexey Ushakov
2d4ce4f04a JRE-15 Greyscale text is too dark comparing with subpixel AA
Adjusted default value for greyscale text rendering in freetype

(cherry picked from commit f80497c4f0)
2022-06-10 07:02:35 +03:00
Alexey Ushakov
8189d88ab8 IDEA-155347 On Ubuntu with High DPI tooltip font is too thick when the tooltip is fading in and out
Handled missing FC_RGBA_NONE value

(cherry picked from commit 44fcbdabf8)
2022-06-10 07:02:34 +03:00
Alexey Ushakov
2c13dfce5c IDEA-149882 Issue with fonts in Ubuntu 12.04
Provided fallback to default font rendering settings if libfontconfig unable to
match font pattern

(cherry picked from commit d93a5f1598)
2022-06-10 07:02:33 +03:00
Alexey Ushakov
e67ed8a552 IDEA-151619 CLion EAP fails to start with missing symbol: FT_Library_setLcdFilter
Skip FT_Library_setLcdFilter call if the symbol is not there
Cache negative FT_Library_setLcdFilter symbol lookup result
Used RTLD_DEFAULT handler for process symbols lookup

(cherry picked from commit e6f0055704)
2022-06-10 07:02:32 +03:00
Alexey Ushakov
9994255625 JRE-29 fontconfig lib crashes CLion on OSX
Disabled fontconfig usage on OSX

(cherry picked from commit 431e14429c)
2022-06-10 07:02:31 +03:00
Vitaly Provodin
6dd69fa897 exclude tests spontaneously creating windows during test execution 2022-06-10 07:02:30 +03:00
Alexey Ushakov
1c19b8a891 JRE-48 built-in jre renders fonts abnormally heavier (normal text looks bold) than the oracle jre
Disable FT_LOAD_TARGET_LIGHT for fonts with FC_AUTOHINT=false (this target implicitly enables  FC_AUTOHINT)
Reused setupLoadRenderFlags for all rendering cases

(cherry picked from commit f3f2667a4c)
2022-06-10 07:02:29 +03:00
Alexey Ushakov
8479549b0c Added logging for freetypeScaler via env variable OPENJDK_LOG_FFS=yes
and for screen resolution in freetypeScaler

(cherry picked from commit 091d74a791)
2022-06-10 07:02:28 +03:00
Alexey Ushakov
2ccff3ac45 JRE-34 IDE Crashes During Startup
Added validation of dpi settings coming from xserver

(cherry picked from commit b1c49c3b27)
2022-06-10 07:02:27 +03:00
Anton Tarasov
b4637c4aea Add build.gradle 2022-06-10 07:02:26 +03:00
Anton Tarasov
0df607c741 JBR-2031 [mac] jcef deadlocks with a11y on start
(cherry picked from commit 4f44b37f08)
2022-06-10 07:02:25 +03:00
Alexey Ushakov
cd9879172a JRE-1083 [JDK11] Test com/sun/java/accessibility/util/8051626/Bug8051626.java fails on macOS on JB JDK11b
Wrapped SelectorPerformer invocation into privileged action

(cherry picked from commit 48e7b547ae)
2022-06-10 07:02:24 +03:00
Anton Tarasov
cca600f517 JBR-2019 provide getWindowHandle method for jcef
(cherry picked from commit 7ae706b629)
2022-06-10 07:02:23 +03:00
Anton Tarasov
611811208b Comment assertion (originally JRE-965)
The assert line crashes debug hotspot.

(cherry picked from commit a00074a86c)
2022-06-10 07:02:22 +03:00
Anton Tarasov
8907a0fbc2 JBR-1976 [jcef] need mouse-transparent window on Windows
(cherry picked from commit b60fac96b4)
2022-06-10 07:02:21 +03:00
Anton Tarasov
54ffd9ae01 JBR-1824 export NSWindow::setIgnoresMouseEvents to java internal API
(cherry picked from commit 4399dc382c)
2022-06-10 07:02:20 +03:00
Anton Tarasov
b793d5c067 JBR-1802 com/sun/java/accessibility/util/8051626/Bug8051626.java: access denied ("java.lang.RuntimePermission" "getClassLoader")
(cherry picked from commit eae772aca9)
2022-06-10 07:02:19 +03:00
Anton Tarasov
c1a1e2859b JBR-1795 Project opened from Welcome screen goes to backgound after loading
(cherry picked from commit 322526458a)
2022-06-10 07:02:18 +03:00
Anton Tarasov
266b19af8f JBR-1609 Jupyter Notebook eventually causes IDEA to become unresponsive on Mac OSX
(cherry picked from commit 8ae0be8eb6)
2022-06-10 07:02:17 +03:00
Anton Tarasov
71d032b993 JBR-1786 Weird white border for IDE window
(cherry picked from commit 4b09614a0e)
2022-06-10 07:02:16 +03:00
Vyacheslav Moklev
78aa75c2e1 JBR-1552 Invalid screen bounds in full screen mode
Check is window is not in undecorated state

(cherry picked from commit 5547701e2c)
2022-06-10 07:02:15 +03:00
Vyacheslav Moklev
03b0b45147 JBR-1509 Client area size is wrong in Borderless mode
Fix client area size

(cherry picked from commit 00d32e58dc)
2022-06-10 07:02:14 +03:00
Anton Tarasov
a3cee8d1de JBR-1770 [windows] frame does not open as maximized
(cherry picked from commit d9dfc3c6c5)
2022-06-10 07:02:13 +03:00
Anton Tarasov
72b42fb828 JBR-1693 difficult to input Japanese text with "Fast" Key Repeat
(cherry picked from commit 12de3e287e)
2022-06-10 07:02:12 +03:00
Anton Tarasov
6a36a26177 JBR-1669 IDE-managed HiDPI mode is broken
(cherry picked from commit 461b0b5cd4)
2022-06-10 07:02:11 +03:00
Anton Tarasov
05c9320869 JBR-1650 propagate custom decoration title bar height to native
(cherry picked from commit f6fc65d014)
2022-06-10 07:02:10 +03:00
Anton Tarasov
f52be59692 JBR-1629 Maximized window cut at the right and bottom
(cherry picked from commit 9e768377db)
2022-06-10 07:02:09 +03:00
Anton Tarasov
d48ba43b9f JBR-1492 Not able to start Intellij Idea 2017.2.5 with modified vmoptions
(cherry picked from commit e7ca6db66b)
2022-06-10 07:02:08 +03:00
Anton Tarasov
8e579c3b9c JBR-1427 pycharm jupyter preview stuck and no response when click on preview.
(cherry picked from commit 1746b04686)
2022-06-10 07:02:07 +03:00
Anton Tarasov
a54b4f12c8 IDEA-210154 Borderless UI: Top frame of IDEA window is blue
(cherry picked from commit 2dd4163bc4)
2022-06-10 07:02:06 +03:00
Anton Tarasov
dd9ba05115 JBR-1351 Borderless UI: Bold frame around IDEA window appears on non-HiDPI display
(cherry picked from commit 06d35de069)
2022-06-10 07:02:05 +03:00
Anton Tarasov
141565ff26 JBR-1313 wrong insets for non-resizable custom-decorated frame
(cherry picked from commit 9179718cb6)
2022-06-10 07:02:04 +03:00
Anton Tarasov
cc88055aec JBR-1293 do not modify client bounds when custom-decorated frame is set undecorated
(cherry picked from commit cb188edaab)
2022-06-10 07:02:03 +03:00
Anton Tarasov
d5f8ce53f2 JBR-1278 allow native border and shadow for custom decoration mode
(cherry picked from commit a879ad5739)
2022-06-10 07:02:02 +03:00
Anton Tarasov
4ec4325141 JRE-1232 forwardport: JRE-1228 support custom frame decoration
(cherry picked from commit d2820524a1)
2022-06-10 07:02:01 +03:00
Anton Tarasov
688b7b8ba4 JRE-1162 [jdk11] support on-the-fly DPI change on linux
(cherry picked from commit c06c4c69d3)
2022-06-10 07:02:00 +03:00
Anton Tarasov
270d420b78 JRE-1142 [jdk11] hidpi is not detected since Ubuntu 18.04
(cherry picked from commit be4f8c0d9d)
2022-06-10 07:01:59 +03:00
Anton Tarasov
4bd7f7d2a9 JRE-1111 [JDK11] java/beans/Beans/TypoInBeanDescription.java crashes at libawt_xawt.so+0x4a30d
(cherry picked from commit b89e6aed0b)
2022-06-10 07:01:58 +03:00
Anton Tarasov
616a2c9425 fix JNI_OnUnload definition
(cherry picked from the commit  3571e39071)

(cherry picked from commit 1019d8f0f2)
2022-06-10 07:01:57 +03:00
Anton Tarasov
8725f8ebf3 JRE-981 IM workaround does not work anymore
forward port of 2d7c29b in JetBrains/jdk8u_jdk

(cherry picked from commit f3ccc53e02)
2022-06-10 07:01:56 +03:00
Anton Tarasov
43e25b1eb0 JRE-938 [windows] Frame.setMaximizedBounds not hidpi-aware
(cherry picked from commit cc97899923320e1fa17f5e44975c4a0f0ba51014)
(cherry picked from commit ccfe65be7f)
2022-06-10 07:01:55 +03:00
Anton Tarasov
4f7bf69844 JRE-907 macOS: add ability to check for scaled display mode
(cherry picked from commit e496262aa1)
2022-06-10 07:01:54 +03:00
Anton Tarasov
9d8e5f61b6 JRE-934 Diff viewer errors are not visible on HiDPI Linux
(cherry picked from commit 641a09dd52)
2022-06-10 07:01:53 +03:00
Anton Tarasov
80d22dc4db [jdk9] HiDPI scale is not detected on some linux desktops
(cherry picked from commit 9279d80110)
2022-06-10 07:01:52 +03:00
Anton Tarasov
709b40faa6 JRE-681 [windows] direct drawing into frame graphics may have wrong translate
(cherry picked from commit 6ea1d45fd1)
2022-06-10 07:01:51 +03:00
Anton Tarasov
6085fa02ec Read org.gnome.desktop.interface/scaling-factor
(cherry picked from commit 277357ae73)
2022-06-10 07:01:50 +03:00
Anton Tarasov
df0e730208 Revert "8239894: Xserver crashes when the wrong high refresh rate is used"
This code is needed for "Read org.gnome.desktop.interface/scaling-factor".
Keep it until "JDK-8260270 Implement the HiDPI scale factor reading" is fixed.

This reverts commit a7c2ebc7
2022-06-10 07:01:49 +03:00
Anton Tarasov
afb42bcfa2 Do not scale base font in HiDPI mode on Linux
(cherry picked from commit 6fb2c36529)
2022-06-10 07:01:48 +03:00
Anton Tarasov
336c814bbd JRE-772 swing returns incorrect FRC when AA is off
(cherry picked from commit a161897d908aa10da6306c06452c5d6317fed2f0)
(cherry picked from commit 2bf5a7ca5c)
2022-06-10 07:01:47 +03:00
Anton Tarasov
182157fbfc JRE-681 [windows] direct drawing into frame graphics may have wrong translate
(cherry picked from commit ab6dee4c1fc453ad3cb5adb69fc243e550d184ae)

(cherry picked from commit 6ea1d45fd1)
2022-06-10 07:01:46 +03:00
Anton Tarasov
b3f78e9587 JRE-665 Navigate Class/File/Symbol, Find in Path popup windows don't pick characters from input method
(cherry picked from commit 676f305b2b3b278e305bd4d9bde4269f27b3d676)
(cherry picked from commit 6ce31e0a32)
2022-06-10 07:01:45 +03:00
Anton Tarasov
6f712b258d JRE-616 [linux] notify when dpi correction factor is applied to fonts
(cherry picked from commit f57d41f3118bfd773c99ce32d58cfae16931be6a)
(cherry picked from commit 6246abc72f)
2022-06-10 07:01:44 +03:00
Anton Tarasov
3e7fab334d JRE-612 [windows] icon in frame title is not dpi-aware
(cherry picked from commit dec04385177a2abb677add909d3b94f94c62a14e)

(cherry picked from commit 38466cbab0)
2022-06-10 07:01:43 +03:00
Anton Tarasov
dd5ccf7270 JRE-604 [fps] frame's client area is one pixel beneath frame's borders
Adopted.

(cherry picked from commit ef2870ee38)
2022-06-10 07:01:42 +03:00
Anton Tarasov
2d99bc9d42 JRE-596 [windows] popup positioning is broken with JRE-573
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit c5cc28d85d)
2022-06-10 07:01:41 +03:00
Anton Tarasov
285dc42ddb JRE-577 Goland 18 displays out of memory
(cherry picked from commit 2daaf21e420d4af15d3b1bfeb3f896074bea1e61)

(cherry picked from commit 9ea2011948)
2022-06-10 07:01:40 +03:00
Anton Tarasov
bf2ce8d5ef JRE-573 [windows] window client area bounds mismatch
Apply only WmEraseBkgnd

(cherry picked from commit afa68f7ad6440303c6417be3f675b1c4644b6014)

(cherry picked from commit 0651b45e13)
2022-06-10 07:01:39 +03:00
Anton Tarasov
f99ca88fcf JRE-382 Three AWT-tests become hanging starting since master-875
(cherry picked from commit 7d492101db8fcbb3d285fd8e9669f74b0e0fce8f)
(cherry picked from commit b965f85c1b)
2022-06-10 07:01:38 +03:00
Anton Tarasov
7d59ae043b JRE-373 [macos] nativeCreateNSWindow deadlocks with a11y
(cherry picked from commit 72c77a992bbf1b95b82ffc08cb2f4f3bc36b3657)

(cherry picked from commit aa09fa2c85)
2022-06-10 07:01:37 +03:00
Anton Tarasov
d7c19ad3b0 IDEA-172422 Popup at the wrong place on the second monitor (new hidpi)
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit 11a0911d65)
2022-06-10 07:01:37 +03:00
Anton Tarasov
8a9e173aaa JRE-309 [windows] on-screen position of a component is not pixel-perfect in user space in JRE-HiDPI mode
Adopted: moved to AwtWindow::Reshape

(cherry picked from commit 985908cf10)
2022-06-10 07:01:36 +03:00
Anton Tarasov
ed6072504b JRE-269 JLabel doesn't scale <code>text</code> HTML fragments.
(cherry picked from commit 9ef72b6c3a477e4225f9b98e30fa9190613520e4)
(cherry picked from commit c17bc728ee)
2022-06-10 07:01:35 +03:00
Anton Tarasov
88dc8e8177 JRE-225 [macos] IDEA hangs on attempt to call getDefaultScreenDevice() from EDT
(cherry picked from commit 76aba25)

(cherry picked from commit df11dcc97bb5556ac5d0299b773a512b4f0bb5bb)
(cherry picked from commit aeea6c1ca3)
2022-06-10 07:01:34 +03:00
Anton Tarasov
b74ccab753 JRE-210 JEditorPane may return wrong preferred size as it moves b/w monitors of different scale
(cherry picked from commit 6c3087e6bda32ae9b095e069d8bea614502f5c03)
(cherry picked from commit adb3a4be16)
2022-06-10 07:01:33 +03:00
Anton Tarasov
6036815340 JRE-119 [suppress updateGC() for WFileDialogPeer/WPrintDialogPeer]
updateGC() is called from WWindowPeer.<init> though it's not applicable to the named dialogs
as they don't have native AwtWindow peer required for the method.

(cherry picked from commit 72ed9f653177e273b811cfe70c2dba102a8636e4)
(cherry picked from commit cec49aaa38)
2022-06-10 07:01:32 +03:00
Anton Tarasov
c2b34cc2a0 JRE-119 [use default "sun.java2d.dpiaware=true" to be dpi-aware on Window 7]
This lets awt_Win32GraphicsEnv.cpp SetProcessDPIAwareProperty() call Win7 specific ::SetProcessDPIAware() API func.

(cherry picked from commit 5e7a766090810d839f4352d06fc2812499d766f8)
(cherry picked from commit 7d1d43bfa1)
2022-06-10 07:01:31 +03:00
Anton Tarasov
a8447a8c4b JRE-119 [Dynamically set DPI-awareness level to enable backward compatible HiDPI behavior]
Adopted: rely on java.manifest

(cherry picked from commit d00cfa4dc62a14a4cf89df9d4c4899970c9fc9e8)

Adopted

(cherry picked from commit 60be76b725)
2022-06-10 07:01:30 +03:00
Anton Tarasov
21c14abc20 JRE-119 [ask if ui scale is enabled natively]
(cherry picked from commit 801f45875fd8699edcbda5896210cec191062261)
(cherry picked from commit 20edebdefa)
2022-06-10 07:01:29 +03:00
Anton Tarasov
25de3e004a IDEA-153474 let JDK detect Xft.dpi value on non-GTK Linux DEs
Use the GTK method:

https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get

to retrieve "gtk-xft-dpi" integer property of the X settings.

Add the property to JDK's GtkEngine & gtk2-interface.
Then read the property via GtkEngine from GTK LaF when "gnome.Xft/dpi" is undefined. It's assumed GTK LaF is forcedly installed.

(cherry picked from commit e05fc391ae0a3cc389e836441f882c0cf6ab3b99)
(cherry picked from commit fd615a5b45)
2022-06-10 07:01:28 +03:00
Anton Tarasov
6c240c3df7 IDEA-148854: AppCode crashes randomly every 15 mins or so
(cherry picked from commit 02f9a5fbb4924ff67c8a04c15e490acfcc750003)
(cherry picked from commit b8f4b4a9ed)
2022-06-10 07:01:27 +03:00
Vitaly Provodin
82984bbcce updated JTreg exclude list 2022-06-10 07:01:26 +03:00
Alexey Ushakov
a3a6ce4558 IDEA-57233, IDEA-152816, IDEA-152454 Editor font antialising/appearance problems on Linux
Used desktop DPI instead of hard-coded 72
Compensated increased glyph bitmap size by adjusting font size
Added LCD filter for sub-pixel rendering
Use fontconfig library to provide right rendering options for fonts
Corrected sizes passed to fontconfig library and hinting disabling policy
Added logging and versioned fontconfig lib loading
Resolved font rendering problem in lenses
fix text rendering issues (text cutoff and incorrect rendering in editor fragment components)
FcMatchFont-type pattern substitutions shouldn't be invoked before specific font is selected - it can apply unrelated rules
port commit e21cd635 from JBR 9
partially rollback JBR-363 fix, to apply corresponding change from OpenJDK 12

(cherry picked from commit 5d704a963b)
(cherry picked from commit 3d7ac30072)
(cherry picked from commit 0456745afb)
(cherry picked from commit 3d7ac30072)
(cherry picked from commit 4c8351fecf)
(cherry picked from commit 5faebc73d5)
(cherry picked from commit d1ed8ab118)
2022-06-10 07:01:25 +03:00
Vitaly Provodin
cf9b8087b4 JBR-3401 enable macos-aarhc64 builds 2022-06-10 07:01:24 +03:00
Vitaly Provodin
270056603c JBR-3305 remove the option --disable-warnings-as-errors from configure 2022-06-10 07:01:23 +03:00
Vitaly Provodin
bbdfc24b32 JBR-3398 remove the Experimental AOT and JIT Compiler (JEP 410) 2022-06-10 07:01:22 +03:00
Alexey Ushakov
0b3366e34e JBR-2807: JDK15: update modules.list to resolve jbr build failure
removed nashorn modules
2022-06-10 07:01:21 +03:00
Vitaly Provodin
417b52dbc5 JBR-2130 remove module jdk.pack 2022-06-10 07:01:20 +03:00
Vitaly Provodin
8c2fadf774 JBR-2922 add JCEF to jbrsdk binaries
& fix a misprint in get_mods_list

JBR-2922 add JCEF to jbrsdk binaries

& fix a misprint in get_mods_list
2022-06-10 07:01:19 +03:00
Vitaly Provodin
6ef2bc47f5 JBR-2912 add JBR 15 builds with DCEVM 2022-06-10 07:01:18 +03:00
Vitaly Provodin
2fe486c12f JBR-2864 initial commit of DCEVM patches reworked for 15 2022-06-10 07:01:17 +03:00
Vitaly Provodin
36fcad38b9 JBR-2812 remove --with-import-modules from configure for aarch64 2022-06-10 07:01:16 +03:00
Anton Tarasov
843b2a2bc4 JBR-2812 bundle jcef in jmod format instead of modular-sdk
Build test-image with non-jcef build target
2022-06-10 07:01:15 +03:00
Vitaly Provodin
80c09fb461 JBR-2787 fix copying jcef files into jbr/jbrsdk binaries 2022-06-10 07:01:14 +03:00
Vitaly Provodin
a538475102 JBR-2758 refactor building scripts to apply patches adding required modules instead of excluding
Add jogl and gluegen modules to support jcef osr mode
2022-06-10 07:01:13 +03:00
Anton Tarasov
7ca66a9e43 JBR-2016 add jcef module and export packages to it
(cherry picked from commit cf997f71c6)
2022-06-10 07:01:12 +03:00
Vitaly Provodin
595f4c4c21 JBR-2473 modify building scripts to add dcevm clauses, add git config to docker image
(cherry picked from commit 2620c62848)
2022-06-10 07:01:11 +03:00
Vitaly Provodin
427b4337a7 JBR-2473 add initial set of DCEVM patches
(cherry picked from commit c0c0a96cf4)
2022-06-10 07:01:10 +03:00
Vitaly Provodin
e4d1f19080 JBR-2395 eliminate JavaFX from JBR 2022-06-10 07:01:09 +03:00
Vitaly Provodin
43c9e95031 JBR-2409 fix prameters for configure 2022-06-10 07:01:08 +03:00
Vitaly Provodin
4181f6cbb2 JDK14: exclude dependencies on jcef in x86, fastdebug builds 2022-06-10 07:01:07 +03:00
Vitaly Provodin
877caa0beb JBR-2396 fix CONF names 2022-06-10 07:01:07 +03:00
Vitaly Provodin
9e544ec329 JBR-2394 replace --disable-debug-symbols with --with-native-debug-symbols=none 2022-06-10 07:01:06 +03:00
Vitaly Provodin
e126b46761 add exec permitions to configure 2022-06-10 07:01:05 +03:00
Vitaly Provodin
5baa817f12 split checkout before building JBR+JFX or JBR+JCEF on two separate commands 2022-06-10 07:01:04 +03:00
Vitaly Provodin
df4f0e5daa change BOOT_JDK, fix target names 2022-06-10 07:01:03 +03:00
Vitaly Provodin
50aabd6208 JBR-2291 add vendor info into bundles 2022-06-10 07:01:02 +03:00
Vitaly Provodin
fb6569ec08 JBR-2324 address new layout in mac jcef 80.0.4+g74f7b0c+chromium-80.0.3987.122 2022-06-10 07:01:01 +03:00
Vitaly Provodin
84531de809 JBR-2320 add jdk.attach module into JBR 2022-06-10 07:01:00 +03:00
Vitaly Provodin
23cca541ec JBR-2217 provide JCEF-only (no JavaFX) bundle for master/202 branches 2022-06-10 07:00:59 +03:00
Vitaly Provodin
28aca5563a JBR-2212 add scripts for linux_x86, linux_aarch64, linux_x64_fastdebug, osx_fastdebug, windows_x86 2022-06-10 07:00:58 +03:00
Vitaly Provodin
a73c7715e9 JBR-1643 fix intermittent fialures of Windows builds at make/Init.gmk:304
combine images and test-image into one make invocation
2022-06-10 07:00:57 +03:00
Vitaly Provodin
4c6610b8bf JBR-2181 create two separate JBR bundles with JFX and JFX+JCEF 2022-06-10 07:00:56 +03:00
Vitaly Provodin
afaddce9a0 JBR-2148 modify signapp&build scripts to match to the new layout 2022-06-10 07:00:55 +03:00
Vitaly Provodin
92a40a63c9 JBR-2084 modify scripts to sign Contents/MacOS/libjli.dylib as a a normal file 2022-06-10 07:00:54 +03:00
Vitaly Provodin
3dfc060b12 JBR-1821 notarize JBR bundles as a standalone app 2022-06-10 07:00:52 +03:00
Vitaly Provodin
c91567e61d JBR-2162 move building scripts from TC to JBR repo 2022-06-10 07:00:50 +03:00
Anton Tarasov
ed6540470e JBR-2016 add jcef module and export some sun.* packages to it 2022-06-10 07:00:49 +03:00
Vitaly Provodin
5a1304e87a JBR-2014 add jdk.hotspot.agent module to jbr 2022-06-10 07:00:47 +03:00
Vitaly Provodin
0d218e8a1f JBR-1286 add jdk.compiler into JBR 2022-06-10 07:00:45 +03:00
Vitaly Provodin
93f1c6b191 JBR-1199 add JBR modules list for jlink 2022-06-10 07:00:43 +03:00
Vitaly Provodin
0c44c4f4ce Update docker script to create jdk15 build env 2022-06-10 07:00:41 +03:00
Vitaly Provodin
ace6d95cf0 JBR-3045 add pressing ESC to close the dialog after test completion
(cherry picked from commit 44d8b28b0b)
2022-06-10 07:00:39 +03:00
Vitaly Provodin
bb6086f44c JBR-3040 press the button END at the beggining in order to avoid text selection
(cherry picked from commit 1c2bf33db2)
2022-06-10 07:00:37 +03:00
Vitaly.Provodin
69abfb58fd updated JTreg exclude list 2022-06-10 07:00:36 +03:00
663 changed files with 54900 additions and 3854 deletions

2
.gitignore vendored
View File

@@ -18,3 +18,5 @@ NashornProfile.txt
/src/utils/LogCompilation/target/
/.project/
/.settings/
*.class
.idea/workspace.xml

198
README.md
View File

@@ -1,11 +1,193 @@
# Welcome to the JDK!
[![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
For build instructions please see the
[online documentation](https://openjdk.java.net/groups/build/doc/building.html),
or either of these files:
# Welcome to JetBrains Runtime!
- [doc/building.html](doc/building.html) (html version)
- [doc/building.md](doc/building.md) (markdown version)
JetBrains Runtime is a fork of [OpenJDK](https://github.com/openjdk/jdk) available for Windows, Mac OS X, and Linux.
It includes a number of enhancements in font rendering, HiDPI support, windowing/focus subsystems, performance
improvements and bugfixes.
See <https://openjdk.java.net/> for more information about
the OpenJDK Community and the JDK.
> **_NOTE_**: This is a **development** branch that is periodically synchronized with
> the [OpenJDK master](https://github.com/openjdk/jdk/tree/master) branch.
>
Release builds are based on these branches:
* [jbr11](https://github.com/JetBrains/JetBrainsRuntime/tree/jbr11) (JDK 11)
* [jbr17](https://github.com/JetBrains/JetBrainsRuntime/tree/jbr17) (JDK 17)
Download the latest releases of JetBrains Runtime to use with JetBrains IDEs. The full list
can be found on the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases).
## Releases based on JDK 17
| IDE Version | Latest JBR | Date Released |
|-------------|---------------------------------------------------------------------------------------------|---------------|
| 2022.2 | [17.0.3-b469.3](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17.0.3b469.3) | 9-Jun-2022 |
## Releases based on JDK 11
| IDE Version | Latest JBR | Date Released |
|-------------|-------------------------------------------------------------------------------------------------------|---------------|
| 2022.1 | [11_0_15-b2043.56](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr11_0_15b2043.56) | 17-May-2022 |
| 2021.3 | [11_0_14_1-b1751.46](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr11_0_14_1b1751.46) | 21-Feb-2022 |
| 2021.2 | [11_0_13-b1504.49](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jb11_0_13-b1504.49) | 15-Nov-2021 |
| 2021.1 | [11.0.11+9-b1341.60](https://confluence.jetbrains.com/pages/viewpage.action?pageId=218857477) | 15-Jun-2021 |
| 2020.3 | [11_0_11-b1145.115](https://confluence.jetbrains.com/pages/viewpage.action?pageId=219349001) | 21-Jun-2021 |
## Contents
- [Welcome to JetBrains Runtime](#welcome-to-jetbrains-runtime)
- [Products Built on JetBrains Runtime](#products-built-on-jetbrains-runtime)
- [Getting Sources](#getting-sources)
- [macOS, Linux](#macos-linux)
- [Windows](#sources-windows)
- [Configuring the Build Environment](#configuring-the-build-environment)
- [Linux (Docker)](#linux-docker)
- [Ubuntu Linux](#ubuntu-linux)
- [Windows](#build-windows)
- [macOS](#macos)
- [Developing](#developing)
- [Contributing](#contributing)
- [Resources](#resources)
## Products Built on JetBrains Runtime
* [Android Studio](https://developer.android.com/studio). The official IDE for Google's Android operating system.
* [CLion](https://www.jetbrains.com/clion/). A cross-platform IDE for C and C++ from JetBrains.
* [DataGrip](https://www.jetbrains.com/datagrip/). The IDE for Databases and SQL from JetBrains.
* [GoLand](https://www.jetbrains.com/go/). The cross-platform Go IDE from JetBrains.
* [IntelliJ IDEA](https://www.jetbrains.com/idea/). The IDE for JVM from JetBrains.
* [JProfiler](https://www.ej-technologies.com/products/jprofiler/overview.html). The Java profiler.
* [PhpStorm](https://www.jetbrains.com/phpstorm/). The PHP IDE from JetBrains.
* [PyCharm](https://www.jetbrains.com/pycharm/). The Python IDE from JetBrains.
* [Rider](https://www.jetbrains.com/rider/). The cross-platform .NET IDE from JetBrains.
* [RubyMine](https://www.jetbrains.com/ruby/). The Ruby and Rails IDE from JetBrains.
* [WebStorm](https://www.jetbrains.com/webstorm/). The JavaScript IDE from JetBrains.
* [YourKit](https://www.yourkit.com/). Java and .NET profilers.
## Getting Sources
### macOS, Linux
```
git config --global core.autocrlf input
git clone git@github.com:JetBrains/JetBrainsRuntime.git
```
### Windows
<a name="sources-windows"></a>
```
git config --global core.autocrlf false
git clone git@github.com:JetBrains/JetBrainsRuntime.git
```
## Configuring the Build Environment
Here are quick per-platform instructions for those who can't wait to get started.
Please refer to [OpenJDK build docs](https://openjdk.java.net/groups/build/doc/building.html) for in-depth
coverage of all the details.
> **_TIP:_** To get a preliminary report of what's missing, run `./configure` and check its output.
> It would usually have meaningful advice on how to solve the problem.
### Linux (Docker)
Create a container:
```
$ cd jb/project/docker
$ docker build .
...
Successfully built 942ea9900054
```
Run these commands in the new container:
```
$ docker run -v `pwd`../../../../:/JetBrainsRuntime -it 942ea9900054
# cd /JetBrainsRuntime
# sh ./configure
# make images CONF=linux-x86_64-normal-server-release
```
### Ubuntu Linux
Install the necessary tools, libraries, and headers with:
```
$ sudo apt-get install autoconf make build-essential libx11-dev libxext-dev libxrender-dev libxtst-dev \
libxt-dev libxrandr-dev libcups2-dev libfontconfig1-dev libasound2-dev
```
Get Java 18 (for instance, [Azul Zulu Builds of OpenJDK 18](https://www.azul.com/downloads/?version=java-18-sts&os=linux&package=jdk)).
Then run the following:
```
$ cd JetBrainsRuntime
$ git checkout jbr-dev
$ sh ./configure
$ make images
```
This will build the release configuration under `./build/linux-x86_64-server-release/`.
### Windows
<a name="build-windows"></a>
Install the following:
* [Cygwin x64](http://www.cygwin.com/).
Required packages: `autoconf`, `binutils`, `cpio`, `diffutils`, `file`, `gawk`, `gcc-core`, `make`, `m4`, `unzip`, `zip`.
Install those together with Cygwin.
* [Visual Studio compiler toolset](https://visualstudio.microsoft.com/downloads/).
Install with the desktop development kit, which includes Windows SDK and compilers.
Visual Studio 2019 is supported by default.
* Java 18 (for instance, [Azul Zulu Builds of OpenJDK 18](https://www.azul.com/downloads/?version=java-18-sts&os=windows&package=jdk)).
If you have problems while configuring, read [Java tips on Cygwin](http://horstmann.com/articles/cygwin-tips.html).
From the command line:
```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
"c:\Program_Files\cygwin64\bin\mintty.exe" /bin/bash -l
```
The first command sets up environment variables, the second starts a Cygwin shell with the proper environment.
In the Cygwin shell:
```
$ cd JetBrainsRuntime
$ git checkout jbr-dev
$ bash configure --with-toolchain-version=2019
$ make images
```
This will build the release configuration under `./build/windows-x86_64-server-release/`.
### macOS
Install the following:
* Xcode command line developer tools and `autoconf` via [Homebrew](https://brew.sh/).
* Java 18 (for instance, [Azul Zulu Builds of OpenJDK 18](https://www.azul.com/downloads/?version=java-18-sts&os=macos&package=jdk)).
From the command line:
```
$ cd JetBrainsRuntime
$ git checkout jbr-dev
$ sh ./configure
$ make images
```
This will build the release configuration under `./build/macosx-x86_64-server-release/`.
## Developing
You can use [CLion](https://www.jetbrains.com/clion/) to develop native parts of the JetBrains Runtime and
[IntelliJ IDEA](https://www.jetbrains.com/idea/) for the parts written in Java.
Both require projects to be created.
### CLion
Run
```
$ make compile-commands
```
in the git root and open the resulting `build/.../compile_commands.json` file as a project.
Then use `Tools | Compilation Database | Change Project Root` to point to git root of this repository.
See also this detailed step-by-step tutorial for all platforms:
[How to develop OpenJDK with CLion](https://blog.jetbrains.com/clion/2020/03/openjdk-with-clion/).
### IDEA
Run
```
$ sh ./bin/idea.sh
```
in the git root to generate project files (add `--help` for options). If you have multiple
configurations (for example, `release` and `fastdebug`), supply the `--conf <conf_name>` argument.
Then open the git root directory as a project in IDEA.
## Contributing
We are happy to receive your pull requests!
Before you submit one, please sign our [Contributor License Agreement (CLA)](https://www.jetbrains.com/agreements/cla/).
## Resources
* [JetBrains Runtime on GitHub](https://github.com/JetBrains/JetBrainsRuntime).
* [OpenJDK build instructions](https://openjdk.java.net/groups/build/doc/building.html).
* [OpenJDK test instructions](https://htmlpreview.github.io/?https://raw.githubusercontent.com/openjdk/jdk/master/doc/building.html#running-tests).

View File

@@ -25,7 +25,26 @@
# Shell script for generating an IDEA project from a given list of modules
usage() {
echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [-c|--conf <conf_name>] [modules]+"
echo "Usage: $0 [-h|--help] [-q|--quiet] [-a|--absolute-paths] [-r|--root <path>] [-o|--output <path>] [-c|--conf <conf_name>] [modules...]"
echo " -h | --help"
echo " -q | --quiet
No stdout output"
echo " -a | --absolute-paths
Use absolute paths to this jdk, so that generated .idea
project files can be moved independently of jdk sources"
echo " -r | --root <path>
Project content root
Default: $TOPLEVEL_DIR"
echo " -o | --output <path>
Where .idea directory with project files will be generated
(e.g. using '-o .' will place project files in './.idea')
Default: same as --root"
echo " -c | --conf <conf_name>
make configuration (release, slowdebug etc)"
echo " [modules...]
Generate project modules for specific java modules
(e.g. 'java.base java.desktop')
Default: all existing modules (java.* and jdk.*)"
exit 1
}
@@ -33,10 +52,13 @@ SCRIPT_DIR=`dirname $0`
#assume TOP is the dir from which the script has been called
TOP=`pwd`
cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
if [ "x$TOPLEVEL_DIR" = "x" ] ; then
cd .. ; TOPLEVEL_DIR=`pwd`
fi
cd $TOP;
IDEA_OUTPUT=$TOP/.idea
VERBOSE="false"
VERBOSE=true
ABSOLUTE_PATHS=false
CONF_ARG=
while [ $# -gt 0 ]
do
@@ -45,14 +67,24 @@ do
usage
;;
-v | --vebose )
VERBOSE="true"
-q | --quiet )
VERBOSE=false
;;
-a | --absolute-paths )
ABSOLUTE_PATHS=true
;;
-r | --root )
TOPLEVEL_DIR="$2"
shift
;;
-o | --output )
IDEA_OUTPUT=$2/.idea
IDEA_OUTPUT="$2/.idea"
shift
;;
-c | --conf )
CONF_ARG="CONF_NAME=$2"
shift
@@ -69,23 +101,21 @@ do
shift
done
if [ -e $IDEA_OUTPUT ] ; then
rm -r $IDEA_OUTPUT
if [ "x$IDEA_OUTPUT" = "x" ] ; then
IDEA_OUTPUT="$TOPLEVEL_DIR/.idea"
fi
mkdir -p $IDEA_OUTPUT || exit 1
cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
cd "$TOP" ; cd $TOPLEVEL_DIR; TOPLEVEL_DIR=`pwd`
cd "$TOP" ; cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd`
cd ..; IDEA_OUTPUT_PARENT=`pwd`
cd "$SCRIPT_DIR/.." ; OPENJDK_DIR=`pwd`
if [ "x$TOPLEVEL_DIR" = "x" ] ; then
cd $SCRIPT_DIR/..
TOPLEVEL_DIR=`pwd`
cd $IDEA_OUTPUT
fi
MAKE_DIR="$SCRIPT_DIR/../make"
IDEA_MAKE="$MAKE_DIR/ide/idea/jdk"
IDEA_MAKE="$OPENJDK_DIR/make/ide/idea/jdk"
IDEA_TEMPLATE="$IDEA_MAKE/template"
cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
cp -rn "$TOPLEVEL_DIR/jb/project/idea-project-files"/* "$IDEA_OUTPUT"
cp -rn "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT"
#override template
if [ -d "$TEMPLATES_OVERRIDE" ] ; then
@@ -94,31 +124,31 @@ if [ -d "$TEMPLATES_OVERRIDE" ] ; then
done
fi
if [ "$VERBOSE" = "true" ] ; then
echo "output dir: $IDEA_OUTPUT"
echo "idea template dir: $IDEA_TEMPLATE"
if [ "$VERBOSE" = true ] ; then
echo "Will generate IDEA project files in \"$IDEA_OUTPUT\" for project \"$TOPLEVEL_DIR\""
fi
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I $MAKE_DIR/.. idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" $CONF_ARG || exit 1
cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I "$OPENJDK_DIR" idea TOPLEVEL_DIR="$TOPLEVEL_DIR" \
MAKEOVERRIDES= IDEA_OUTPUT_PARENT="$IDEA_OUTPUT_PARENT" OUT="$IDEA_OUTPUT/env.cfg" MODULES="$*" $CONF_ARG || exit 1
cd $SCRIPT_DIR
. $IDEA_OUTPUT/env.cfg
# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set
if [ "x$MODULE_ROOTS" = "x" ] ; then
echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1
# Expect MODULES, MODULE_NAMES, RELATIVE_PROJECT_DIR, RELATIVE_BUILD_DIR to be set
if [ "xMODULES" = "x" ] ; then
echo "FATAL: MODULES is empty" >&2; exit 1
fi
if [ "x$MODULE_NAMES" = "x" ] ; then
echo "FATAL: MODULE_NAMES is empty" >&2; exit 1
fi
if [ "x$BOOT_JDK" = "x" ] ; then
echo "FATAL: BOOT_JDK is empty" >&2; exit 1
if [ "x$RELATIVE_PROJECT_DIR" = "x" ] ; then
echo "FATAL: RELATIVE_PROJECT_DIR is empty" >&2; exit 1
fi
if [ "x$SPEC" = "x" ] ; then
echo "FATAL: SPEC is empty" >&2; exit 1
if [ "x$RELATIVE_BUILD_DIR" = "x" ] ; then
echo "FATAL: RELATIVE_BUILD_DIR is empty" >&2; exit 1
fi
if [ -d "$TOPLEVEL_DIR/.hg" ] ; then
@@ -129,6 +159,43 @@ if [ -d "$TOPLEVEL_DIR/.git" ] ; then
VCS_TYPE="Git"
fi
if [ "$ABSOLUTE_PATHS" = true ] ; then
if [ "x$PATHTOOL" != "x" ]; then
PROJECT_DIR="`$PATHTOOL -am $OPENJDK_DIR`"
TOPLEVEL_PROJECT_DIR="`$PATHTOOL -am $TOPLEVEL_DIR`"
else
PROJECT_DIR="$OPENJDK_DIR"
TOPLEVEL_PROJECT_DIR="$TOPLEVEL_DIR"
fi
MODULE_DIR="$PROJECT_DIR"
TOPLEVEL_MODULE_DIR="$TOPLEVEL_PROJECT_DIR"
cd "$IDEA_OUTPUT_PARENT" && cd "$RELATIVE_BUILD_DIR" && BUILD_DIR="`pwd`"
CLION_SCRIPT_TOPDIR="$OPENJDK_DIR"
CLION_PROJECT_DIR="$PROJECT_DIR"
else
if [ "$RELATIVE_PROJECT_DIR" = "." ] ; then
PROJECT_DIR=""
else
PROJECT_DIR="/$RELATIVE_PROJECT_DIR"
fi
if [ "$RELATIVE_TOPLEVEL_PROJECT_DIR" = "." ] ; then
TOPLEVEL_PROJECT_DIR=""
else
TOPLEVEL_PROJECT_DIR="/$RELATIVE_TOPLEVEL_PROJECT_DIR"
fi
MODULE_DIR="\$MODULE_DIR\$$PROJECT_DIR"
PROJECT_DIR="\$PROJECT_DIR\$$PROJECT_DIR"
TOPLEVEL_MODULE_DIR="\$MODULE_DIR\$$TOPLEVEL_PROJECT_DIR"
TOPLEVEL_PROJECT_DIR="\$PROJECT_DIR\$$TOPLEVEL_PROJECT_DIR"
BUILD_DIR="\$PROJECT_DIR\$/$RELATIVE_BUILD_DIR"
CLION_SCRIPT_TOPDIR="$CLION_RELATIVE_PROJECT_DIR"
CLION_PROJECT_DIR="\$PROJECT_DIR\$/$CLION_SCRIPT_TOPDIR"
fi
if [ "$VERBOSE" = true ] ; then
echo "Project root: $PROJECT_DIR"
echo "Generating IDEA project files..."
fi
### Replace template variables
NUM_REPLACEMENTS=0
@@ -152,112 +219,106 @@ add_replacement() {
eval TO$NUM_REPLACEMENTS='$2'
}
add_replacement "###PATHTOOL###" "$PATHTOOL"
add_replacement "###CLION_SCRIPT_TOPDIR###" "$CLION_SCRIPT_TOPDIR"
add_replacement "###CLION_PROJECT_DIR###" "$CLION_PROJECT_DIR"
add_replacement "###PROJECT_DIR###" "$PROJECT_DIR"
add_replacement "###MODULE_DIR###" "$MODULE_DIR"
add_replacement "###TOPLEVEL_PROJECT_DIR###" "$TOPLEVEL_PROJECT_DIR"
add_replacement "###TOPLEVEL_MODULE_DIR###" "$TOPLEVEL_MODULE_DIR"
add_replacement "###MODULE_NAMES###" "$MODULE_NAMES"
add_replacement "###VCS_TYPE###" "$VCS_TYPE"
SPEC_DIR=`dirname $SPEC`
if [ "x$CYGPATH" != "x" ]; then
add_replacement "###BUILD_DIR###" "`$CYGPATH -am $SPEC_DIR`"
add_replacement "###IMAGES_DIR###" "`$CYGPATH -am $SPEC_DIR`/images/jdk"
add_replacement "###ROOT_DIR###" "`$CYGPATH -am $TOPLEVEL_DIR`"
add_replacement "###IDEA_DIR###" "`$CYGPATH -am $IDEA_OUTPUT`"
add_replacement "###BUILD_DIR###" "$BUILD_DIR"
add_replacement "###RELATIVE_BUILD_DIR###" "$RELATIVE_BUILD_DIR"
if [ "x$PATHTOOL" != "x" ]; then
add_replacement "###BASH_RUNNER_PREFIX###" "\$PROJECT_DIR\$/.idea/bash.bat"
else
add_replacement "###BASH_RUNNER_PREFIX###" ""
fi
if [ "x$PATHTOOL" != "x" ]; then
if [ "x$JT_HOME" = "x" ]; then
add_replacement "###JTREG_HOME###" ""
else
add_replacement "###JTREG_HOME###" "`$CYGPATH -am $JT_HOME`"
fi
elif [ "x$WSL_DISTRO_NAME" != "x" ]; then
add_replacement "###BUILD_DIR###" "`wslpath -am $SPEC_DIR`"
add_replacement "###IMAGES_DIR###" "`wslpath -am $SPEC_DIR`/images/jdk"
add_replacement "###ROOT_DIR###" "`wslpath -am $TOPLEVEL_DIR`"
add_replacement "###IDEA_DIR###" "`wslpath -am $IDEA_OUTPUT`"
if [ "x$JT_HOME" = "x" ]; then
add_replacement "###JTREG_HOME###" ""
else
add_replacement "###JTREG_HOME###" "`wslpath -am $JT_HOME`"
add_replacement "###JTREG_HOME###" "`$PATHTOOL -am $JT_HOME`"
fi
else
add_replacement "###BUILD_DIR###" "$SPEC_DIR"
add_replacement "###JTREG_HOME###" "$JT_HOME"
add_replacement "###IMAGES_DIR###" "$SPEC_DIR/images/jdk"
add_replacement "###ROOT_DIR###" "$TOPLEVEL_DIR"
add_replacement "###IDEA_DIR###" "$IDEA_OUTPUT"
fi
SOURCE_PREFIX="<sourceFolder url=\"file://"
SOURCE_POSTFIX="\" isTestSource=\"false\" />"
for root in $MODULE_ROOTS; do
if [ "x$CYGPATH" != "x" ]; then
root=`$CYGPATH -am $root`
elif [ "x$WSL_DISTRO_NAME" != "x" ]; then
root=`wslpath -am $root`
fi
VM_CI="jdk.internal.vm.ci/share/classes"
VM_COMPILER="src/jdk.internal.vm.compiler/share/classes"
if test "${root#*$VM_CI}" != "$root" || test "${root#*$VM_COMPILER}" != "$root"; then
for subdir in "$root"/*; do
if [ -d "$subdir" ]; then
SOURCES=$SOURCES" $SOURCE_PREFIX""$subdir"/src"$SOURCE_POSTFIX"
fi
done
else
SOURCES=$SOURCES" $SOURCE_PREFIX""$root""$SOURCE_POSTFIX"
fi
MODULE_IMLS=""
TEST_MODULE_DEPENDENCIES=""
for module in $MODULE_NAMES; do
MODULE_IMLS="$MODULE_IMLS<module fileurl=\"file://\$PROJECT_DIR$/.idea/$module.iml\" filepath=\"\$PROJECT_DIR$/.idea/$module.iml\" /> "
TEST_MODULE_DEPENDENCIES="$TEST_MODULE_DEPENDENCIES<orderEntry type=\"module\" module-name=\"$module\" scope=\"TEST\" /> "
done
add_replacement "###SOURCE_ROOTS###" "$SOURCES"
add_replacement "###MODULE_IMLS###" "$MODULE_IMLS"
add_replacement "###TEST_MODULE_DEPENDENCIES###" "$TEST_MODULE_DEPENDENCIES"
replace_template_dir "$IDEA_OUTPUT"
### Compile the custom Logger
### Generate module project files
CLASSES=$IDEA_OUTPUT/classes
if [ "$VERBOSE" = true ] ; then
echo "Generating project modules:"
fi
(
DEFAULT_IFS="$IFS"
IFS='#'
for value in $MODULES; do
(
eval "$value"
if [ "$VERBOSE" = true ] ; then
echo " $module"
fi
MAIN_SOURCE_DIRS=""
CONTENT_ROOTS=""
IFS=' '
for dir in $moduleSrcDirs; do
case $dir in
"src/"*) MAIN_SOURCE_DIRS="$MAIN_SOURCE_DIRS <sourceFolder url=\"file://$MODULE_DIR/$dir\" isTestSource=\"false\" />" ;;
*"/support/gensrc/$module") ;; # Exclude generated sources to avoid module-info conflicts, see https://youtrack.jetbrains.com/issue/IDEA-185108
*) CONTENT_ROOTS="$CONTENT_ROOTS <content url=\"file://$MODULE_DIR/$dir\">\
<sourceFolder url=\"file://$MODULE_DIR/$dir\" isTestSource=\"false\" generated=\"true\" /></content>" ;;
esac
done
if [ "x$MAIN_SOURCE_DIRS" != "x" ] ; then
CONTENT_ROOTS="<content url=\"file://$MODULE_DIR/src/$module\">$MAIN_SOURCE_DIRS</content>$CONTENT_ROOTS"
fi
add_replacement "###MODULE_CONTENT_ROOTS###" "$CONTENT_ROOTS"
DEPENDENCIES=""
for dep in $moduleDependencies; do
case $MODULE_NAMES in # Exclude skipped modules from dependencies
*"$dep"*) DEPENDENCIES="$DEPENDENCIES<orderEntry type=\"module\" module-name=\"$dep\" /> "
esac
done
add_replacement "###DEPENDENCIES###" "$DEPENDENCIES"
cp "$IDEA_OUTPUT/module.iml" "$IDEA_OUTPUT/$module.iml"
IFS="$DEFAULT_IFS"
replace_template_file "$IDEA_OUTPUT/$module.iml"
)
done
)
rm "$IDEA_OUTPUT/module.iml"
if [ "x$ANT_HOME" = "x" ] ; then
# try some common locations, before giving up
if [ -f "/usr/share/ant/lib/ant.jar" ] ; then
ANT_HOME="/usr/share/ant"
elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then
ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec"
else
echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1
fi
fi
CP=$ANT_HOME/lib/ant.jar
rm -rf $CLASSES; mkdir $CLASSES
### Create shell script runner for Windows
# If we have a Windows boot JDK, we need a .exe suffix
if [ -e "$BOOT_JDK/bin/java.exe" ] ; then
JAVAC=javac.exe
else
JAVAC=javac
if [ "x$PATHTOOL" != "x" ]; then
echo "@echo off" > "$IDEA_OUTPUT/bash.bat"
if [ "x$WSL_DISTRO_NAME" != "x" ] ; then
echo "wsl -d $WSL_DISTRO_NAME --cd \"%cd%\" -e %*" >> "$IDEA_OUTPUT/bash.bat"
else
echo "$WINENV_ROOT\bin\bash.exe -l -c \"cd %CD:\=/%/ && %*\"" >> "$IDEA_OUTPUT/bash.bat"
fi
fi
# If we are on WSL, the boot JDK might be either Windows or Linux,
# and we need to use realpath instead of CYGPATH to make javac work on both.
# We need to handle this case first since CYGPATH might be set on WSL.
if [ "x$WSL_DISTRO_NAME" != "x" ]; then
JAVAC_SOURCE_FILE=`realpath --relative-to=./ $IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java`
JAVAC_SOURCE_PATH=`realpath --relative-to=./ $IDEA_OUTPUT/src`
JAVAC_CLASSES=`realpath --relative-to=./ $CLASSES`
ANT_TEMP=`mktemp -d -p ./`
cp $ANT_HOME/lib/ant.jar $ANT_TEMP/ant.jar
JAVAC_CP=$ANT_TEMP/ant.jar
elif [ "x$CYGPATH" != "x" ] ; then ## CYGPATH may be set in env.cfg
JAVAC_SOURCE_FILE=`$CYGPATH -am $IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java`
JAVAC_SOURCE_PATH=`$CYGPATH -am $IDEA_OUTPUT/src`
JAVAC_CLASSES=`$CYGPATH -am $CLASSES`
JAVAC_CP=`$CYGPATH -am $CP`
else
JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java
JAVAC_SOURCE_PATH=$IDEA_OUTPUT/src
JAVAC_CLASSES=$CLASSES
JAVAC_CP=$CP
fi
$BOOT_JDK/bin/$JAVAC -d $JAVAC_CLASSES -sourcepath $JAVAC_SOURCE_PATH -cp $JAVAC_CP $JAVAC_SOURCE_FILE
if [ "x$WSL_DISTRO_NAME" != "x" ]; then
rm -rf $ANT_TEMP
if [ "$VERBOSE" = true ] ; then
IDEA_PROJECT_DIR="`dirname $IDEA_OUTPUT`"
if [ "x$PATHTOOL" != "x" ]; then
IDEA_PROJECT_DIR="`$PATHTOOL -am $IDEA_PROJECT_DIR`"
fi
echo "
Now you can open \"$IDEA_PROJECT_DIR\" as IDEA project
You can also run 'bash \"$IDEA_OUTPUT/jdk-clion/update-project.sh\"' to generate Clion project"
fi

0
configure vendored Normal file → Executable file
View File

230
jb/jdkdiff.py Executable file
View File

@@ -0,0 +1,230 @@
#!/usr/bin/env python3
import argparse
import math
import os.path
import sys
import subprocess
def fatal(msg):
sys.stderr.write(f"[fatal] {msg}\n")
sys.exit(1)
def verbose(options, *msg):
if options.verbose:
sys.stdout.write(f"[verbose] ")
sys.stdout.write(*msg)
sys.stdout.write('\n')
def first_line(str):
return "" if not str else str.splitlines()[0]
class Options:
def __init__(self):
ap = argparse.ArgumentParser(description="Show bugfixes differences between JBR and OpenJDK git repos",
epilog="Example: %(prog)s --jdk ./jdk11u/ --jbr ./JetBrainsRuntime/ --path src/hotspot --limit 200")
ap.add_argument('--jdk', dest='jdkpath', help='path to OpenJDK git repo', required=True)
ap.add_argument('--jbr', dest='jbrpath', help='path to JBR git repo', required=True)
ap.add_argument('--path', dest='path', help='limit to changes in this path (relative to git root)')
ap.add_argument('--limit', dest='limit', help='limit to this many log entries in --jdk repo', type=int, default=-1)
ap.add_argument('-o', dest="output_dir", help="save patches to this directory (created if necessary)")
ap.add_argument('-v', dest='verbose', help="verbose output", default=False, action='store_true')
args = ap.parse_args()
if not os.path.isdir(args.jdkpath):
fatal(f"{args.jdkpath} not a directory")
if not os.path.isdir(args.jbrpath):
fatal(f"{args.jbrpath} not a directory")
if not git_is_available():
fatal("can't run git commands; make sure git is in PATH")
self.jdkpath = args.jdkpath
self.jbrpath = args.jbrpath
self.path = args.path
self.limit = args.limit
self.output_dir = args.output_dir
self.verbose = args.verbose
class GitRepo:
def __init__(self, rootpath):
self.rootpath = rootpath
def run_git_cmd(self, git_args):
args = ["git", "-C", self.rootpath]
args.extend(git_args)
# print(f"Runnig git cmd '{' '.join(args)}'")
p = subprocess.run(args, capture_output=True, text=True)
if p.returncode != 0:
fatal(f"git returned non-zero code in {self.rootpath} ({first_line(p.stderr)})")
return p.stdout
def save_git_cmd(self, fname, git_args):
args = ["git", "-C", self.rootpath]
args.extend(git_args)
# print(f"Runnig git cmd '{' '.join(args)}'")
with open(fname, "w") as stdout_file:
p = subprocess.run(args, stdout=stdout_file)
if p.returncode != 0:
fatal(f"git returned non-zero code in {self.rootpath} ({first_line(p.stderr)})")
def current_branch(self):
branch_name = self.run_git_cmd(["branch", "--show-current"]).strip()
return branch_name
def log(self, path=None, limit=None):
cmds = ["log", "--no-decorate"]
if limit:
cmds.extend(["-n", str(limit)])
if path:
cmds.append(path)
full_log = self.run_git_cmd(cmds)
return full_log
class Commit:
def __init__(self, lines):
self.sha = lines[0].split()[1]
self.message = ""
self.bugid = None
# Commit message starts after one blank line
read_message = False
for l in lines:
if read_message:
self.message += l + "\n"
if not read_message and l == "":
read_message = True
if self.message and self.message != "" and ":" in self.message:
maybe_bugid = self.message.split(":")[0].strip()
if 10 >= len(maybe_bugid) >= 4:
self.bugid = maybe_bugid
class History:
def __init__(self, log):
log_itr = iter(log.splitlines())
self.commits = []
commit_lines = []
for line in log_itr:
if line.startswith("commit ") and len(commit_lines) > 0:
commit = Commit(commit_lines)
self.commits.append(commit)
commit_lines = []
commit_lines.append(line)
if len(commit_lines) > 0:
commit = Commit(commit_lines)
self.commits.append(commit)
def contains(self, str):
return any(str in commit.message for commit in self.commits)
def size(self):
return len(self.commits)
def print_explanation(options, jdk, jbr):
verbose(options, f"Reading history from '{jdk.rootpath}' on branch '{jdk.current_branch()}'")
if options.path:
verbose(options, f"\t(only under '{options.path}')")
verbose(options, f"Searching for same fixes in '{jbr.rootpath}' on branch '{jbr.current_branch()}'")
def git_is_available():
p = None
try:
p = subprocess.run(["git", "--help"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except:
pass
return p is not None and p.returncode == 0
def main():
check_python_min_requirements()
options = Options()
jdk = GitRepo(options.jdkpath)
jbr = GitRepo(options.jbrpath)
print_explanation(options, jdk, jbr)
commits_to_save = []
try:
jdk_log = jdk.log(options.path, options.limit)
jdk_history = History(jdk_log)
jbr_log = jbr.log(options.path)
jbr_history = History(jbr_log)
verbose(options, f"Read {jdk_history.size()} commits in JDK, {jbr_history.size()} in JBR")
for c in jdk_history.commits:
if c.bugid:
verbose(options, f"Looking for bugfix for {c.bugid}")
if not jbr_history.contains(c.bugid):
commits_to_save.append(c)
print(f"[note] Fix for {c.bugid} not found in JBR ({jbr.rootpath})")
print(f" commit {c.sha}")
print(f" {first_line(c.message).strip()}")
except KeyboardInterrupt:
fatal("Interrupted")
if len(commits_to_save) > 0 and options.output_dir:
print()
if not os.path.exists(options.output_dir):
verbose(options, f"Creating output directory {options.output_dir}")
os.makedirs(options.output_dir)
nzeroes = len(str(len(commits_to_save)))
for i, c in enumerate(reversed(commits_to_save)):
fname = os.path.join(options.output_dir, f"{str(i).zfill(nzeroes)}-{c.bugid}.patch")
print(f"[note] {c.bugid} saved as {fname}")
fname = os.path.abspath(fname)
jdk.save_git_cmd(fname, ["format-patch", "-1", c.sha, "--stdout"])
script_fname = os.path.join(options.output_dir, "apply.sh")
with open(script_fname, "w") as script_file:
print(apply_script_code.format(os.path.abspath(jbr.rootpath), os.path.abspath(options.output_dir)),
file=script_file)
print(f"[note] Execute 'bash {script_fname}' to apply patches to {jbr.rootpath}")
def check_python_min_requirements():
if sys.version_info < (3, 6):
fatal("Minimum version 3.6 is required to run this script")
apply_script_code = """
#!/bin/bash
GITROOT={0}
PATCHROOT={1}
cd $PATCHROOT || exit 1
PATCHES=$(find $PATCHROOT -name '*.patch' | sort -n)
for P in $PATCHES; do
git -C $GITROOT am $P
if [ $? != 0 ]; then
mv "$P" "$P.failed"
echo "[ERROR] Patch $P did not apply cleanly. Try applying it manually."
echo "[NOTE] Execute this script to apply the remaining patches."
exit 1
else
mv "$P" "$P.done"
fi
done
echo "[NOTE] Done applying patches; check $PATCHROOT for .patch and .patch.failed to see if all have been applied."
"""
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,13 @@
# jetbrains/runtime:jbr15env
FROM centos:7
RUN yum -y install centos-release-scl
RUN yum -y install devtoolset-8
RUN yum -y install zip bzip2 unzip tar wget make autoconf automake libtool gcc gcc-c++ libstdc++-devel alsa-devel cups-devel xorg-x11-devel libjpeg62-devel giflib-devel freetype-devel file which libXtst-devel libXt-devel libXrender-devel alsa-lib-devel fontconfig-devel libXrandr-devel libXi-devel git
# Install Java 16
RUN wget https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz \
-O - | tar xz -C /
RUN mv /zulu17.28.13-ca-jdk17.0.0-linux_x64 /jdk17.0.0
ENV PATH /opt/rh/devtoolset-8/root/usr/bin:$PATH
RUN mkdir .git
RUN git config user.email "teamcity@jetbrains.com"
RUN git config user.name "builduser"

View File

@@ -0,0 +1,48 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_aarch64.sh script.
# Pull a concrete version of Linux that does NOT recieve updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
FROM arm64v8/ubuntu:focal-20211006
# Install the necessary build tools
RUN export DEBIAN_FRONTEND=noninteractive \
export DEBCONF_NONINTERACTIVE_SEEN=true && \
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
apt-get update -qy && \
apt-get install -qy \
autoconf \
build-essential \
bzip2 \
file \
g++-10=10.3.0-1ubuntu1~20.04 \
gcc-10=10.3.0-1ubuntu1~20.04 \
git \
libasound2-dev \
libcups2-dev \
libfontconfig1-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxrender-dev \
libxt-dev \
libxtst-dev \
make \
rsync \
tar \
unzip \
zip && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
apt-get clean -qy && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set up boot JDK for building
COPY boot_jdk.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk.tar.gz && rm /jdk17/boot_jdk.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -0,0 +1,22 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_musl_aarch64.sh script.
# Pull a concrete version of Linux that does NOT recieve updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
FROM arm64v8/alpine:3.12
# Install the necessary build tools
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
fontconfig fontconfig-dev linux-headers
# Set up boot JDK for building
COPY boot_jdk_musl_aarch64.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_musl_aarch64.tar.gz && rm /jdk17/boot_jdk_musl_aarch64.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -0,0 +1,22 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_musl_x64.sh script.
# Pull a concrete version of Linux that does NOT recieve updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
FROM alpine:3.5
# Install the necessary build tools
RUN apk --no-cache add --update bash grep tar zip bzip2 rsync fontconfig build-base \
git libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev \
libxtst-dev autoconf freetype-dev cups-dev alsa-lib-dev file \
fontconfig fontconfig-dev linux-headers
# Set up boot JDK for building
COPY boot_jdk_musl_amd64.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_musl_amd64.tar.gz && rm /jdk17/boot_jdk_musl_amd64.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -0,0 +1,55 @@
# NOTE: This Dockerfile is meant to be used from the mkdocker_x86.sh script.
# Pull a concrete version of Linux that does NOT receive updates after it's
# been created. This is so that the image is as stable as possible to make
# image creation reproducible.
# NB: this also means there may be no security-related fixes there, need to
# move the version to the next manually.
#FROM i386/ubuntu:xenial
#FROM i386/ubuntu:bionic
FROM i386/ubuntu:focal
RUN linux32 \
apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN export DEBIAN_FRONTEND=noninteractive \
export DEBCONF_NONINTERACTIVE_SEEN=true && \
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
linux32 \
apt-get -y install \
autoconf \
build-essential \
curl \
file \
git \
libx11-dev \
libxext-dev \
libxrender-dev \
libxrandr-dev \
libxtst-dev \
libxt-dev \
libcups2-dev \
libasound2-data \
# libpng12-0 \
libasound2 \
libfreetype6 \
libfontconfig1-dev \
libasound2-dev \
rsync \
unzip \
zip
RUN linux32 \
apt-get -y install \
g++-10 \
gcc-10 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
apt-get clean -qy && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set up boot JDK for building
COPY boot_jdk_x86.tar.gz /jdk17/
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_x86.tar.gz && rm /jdk17/boot_jdk_x86.tar.gz
ENV BOOT_JDK=/jdk17
RUN git config --global user.email "teamcity@jetbrains.com" && \
git config --global user.name "builduser"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
set -x
# This script creates a Docker image suitable for building AArch64 variant
# of the JetBrains Runtime "dev" version.
BOOT_JDK_REMOTE_FILE=zulu17.30.15-ca-jdk17.0.1-linux_aarch64.tar.gz
BOOT_JDK_SHA=4d9c9116eb0cdd2d7fb220d6d27059f4bf1b7e95cc93d5512bd8ce3791af86c7
BOOT_JDK_LOCAL_FILE=boot_jdk.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jbrdevenv_arm64v8 -f Dockerfile.aarch64 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
set -x
# This script creates a Docker image suitable for building musl AArch64 variant
# of the JetBrains Runtime version 17.
BOOT_JDK_REMOTE_FILE=zulu17.32.13-ca-jdk17.0.2-linux_musl_aarch64.tar.gz
BOOT_JDK_SHA=6b920559abafbe9bdef386a20ecf3a2f318bc1f0d8359eb1f95aee26606bbc70
BOOT_JDK_LOCAL_FILE=boot_jdk_musl_aarch64.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jbr17buildenv -f Dockerfile.musl_aarch64 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -euo pipefail
set -x
# This script creates a Docker image suitable for building musl-x64 variant
# of the JetBrains Runtime version 17.
BOOT_JDK_REMOTE_FILE=zulu17.32.13-ca-jdk17.0.2-linux_musl_x64.tar.gz
BOOT_JDK_SHA=bcc5342011bd9f3643372aadbdfa68d47463ff0d8621668a0bdf2910614d95c6
BOOT_JDK_LOCAL_FILE=boot_jdk_musl_amd64.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jbr17buildenv -f Dockerfile.musl_x64 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -0,0 +1,26 @@
#!/bin/bash -x
# This script creates a Docker image suitable for building x86 variant
# of the JetBrains Runtime version 17.
BOOT_JDK_REMOTE_FILE=zulu17.34.19-ca-jdk17.0.3-linux_i686.tar.gz
BOOT_JDK_SHA=1c35c374ba0001e675d6e80819d5be900c4e141636d5e484992a8c550be14481
BOOT_JDK_LOCAL_FILE=boot_jdk_x86.tar.gz
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
# Obtain "boot JDK" from outside of the container.
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
else
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
fi
# Verify that what we've downloaded can be trusted.
sha256sum -c - <<EOF
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
EOF
docker build -t jetbrains/runtime:jbr17env_x86 -f Dockerfile.x86 .
# NB: the resulting container can (and should) be used without the network
# connection (--network none) during build in order to reduce the chance
# of build contamination.

View File

@@ -0,0 +1,9 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright &amp;#36;originalComment.match(&quot;Copyright (\d+)&quot;, 1, &quot;-&quot;)&amp;#36;today.year JetBrains s.r.o.&#10;DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.&#10;&#10;This code is free software; you can redistribute it and/or modify it&#10;under the terms of the GNU General Public License version 2 only, as&#10;published by the Free Software Foundation.&#10;&#10;This code is distributed in the hope that it will be useful, but WITHOUT&#10;ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&#10;FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License&#10;version 2 for more details (a copy is included in the LICENSE file that&#10;accompanied this code).&#10;&#10;You should have received a copy of the GNU General Public License version&#10;2 along with this work; if not, write to the Free Software Foundation,&#10;Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.&#10;&#10;Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA&#10;or visit www.oracle.com if you need additional information or have any&#10;questions." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="JetBrains" />
<option name="myName" value="JetBrains" />
<option name="myLocal" value="true" />
</copyright>
</component>

View File

@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="JetBrains" />
</component>

View File

@@ -0,0 +1 @@
JetBrainsRuntime

View File

@@ -0,0 +1,9 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="Copyright 2000-&amp;#36;today.year JetBrains s.r.o.&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10;http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="JetBrains" />
<option name="myName" value="JetBrains" />
<option name="myLocal" value="true" />
</copyright>
</component>

View File

@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="JetBrains" />
</component>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="IssueNavigationConfiguration">
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="(?:^|\s|\p{Punct})([A-Z]+\-\d+)(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://youtrack.jetbrains.com/issue/$1" />
</IssueNavigationLink>
<IssueNavigationLink>
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/src/jetbrains.api">
<sourceFolder url="file://$MODULE_DIR$/src/jetbrains.api/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jetbrains.api/templates" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
</component>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/jdk.iml" filepath="$PROJECT_DIR$/.idea/jdk.iml" />
###MODULE_IMLS###
<module fileurl="file://$PROJECT_DIR$/.idea/jetbrains.api.iml" filepath="$PROJECT_DIR$/.idea/jetbrains.api.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/test.iml" filepath="$PROJECT_DIR$/.idea/test.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="IssueNavigationConfiguration">
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="(?:^|\s|\p{Punct})([A-Z]+\-\d+)(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://youtrack.jetbrains.com/issue/$1" />
</IssueNavigationLink>
<IssueNavigationLink>
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -0,0 +1,135 @@
apply plugin: 'java'
import org.gradle.internal.os.OperatingSystem
repositories {
mavenCentral()
}
def test_jvm = {
if (project.hasProperty('jbsdkhome')) {
file(jbsdkhome + (OperatingSystem.current().isWindows()?"/bin/java.exe" : "/bin/java")).absolutePath
} else {
if (OperatingSystem.current().isMacOsX()) {
file('../../../build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.0.4.jdk/Contents/Home/bin/java').absolutePath
} else if (OperatingSystem.current().isLinux()) {
file('../../../build/linux-x86_64-normal-server-release/images/jdk/bin/java').absolutePath
} else {
file('../../../build/windows-x86_64-normal-server-release/images/jdk/bin/java.exe').absolutePath
}
}
}
dependencies {
testCompile('junit:junit:4.12'){
exclude group: 'org.hamcrest'
}
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'net.java.dev.jna:jna:4.4.0'
testCompile 'com.twelvemonkeys.imageio:imageio-tiff:3.3.2'
testCompile 'org.apache.commons:commons-lang3:3.0'
}
def jdk_modules = ["java.base", "java.logging", "java.prefs",
"java.se.ee", "java.sql", "java.datatransfer",
"java.management", "java.rmi", "java.security.jgss",
"java.sql.rowset", "java.desktop", "java.management.rmi",
"java.scripting", "java.security.sasl", "java.transaction",
"java.instrument", "java.naming", "java.se",
"java.smartcardio", "java.xml.crypto"]
def jdk_class_dirs = []
jdk_modules.collect(jdk_class_dirs) {
new File("../../../src/" + it + "/share/classes")
}
if (OperatingSystem.current().isMacOsX())
jdk_modules.collect(jdk_class_dirs) {
"../../../src/" + it + "/macosx/classes"
}
else if (OperatingSystem.current().isLinux()) {
jdk_modules.collect(jdk_class_dirs) {
"../../../src/" + it + "/solaris/classes"
}
jdk_modules.collect(jdk_class_dirs) {
"../../../src/" + it + "/unix/classes"
}
} else
jdk_modules.collect(jdk_class_dirs) {
"../../../src/" + it + "/windows/classes"
}
sourceSets.main.java.srcDirs = jdk_class_dirs
sourceSets {
test {
java {
srcDir "../../../test/jdk/jbu"
}
}
}
test.dependsOn.clear()
test.dependsOn tasks.compileTestJava
test {
systemProperty "jb.java2d.metal", "true"
systemProperty "testdata", file('../../../test/jdk/jbu/testdata').absolutePath
// Generate golden images for DroidFontTest and MixedTextTest
// systemProperty "gentestdata", ""
// Enable Java2D logging (https://confluence.jetbrains.com/display/JRE/Java2D+Rendering+Logging)
// systemProperty "sun.java2d.trace", "log"
// systemProperty "sun.java2d.trace", "log,pimpl"
outputs.upToDateWhen { false }
executable = test_jvm()
// Enable async/dtrace profiler
jvmArgs "-XX:+PreserveFramePointer"
// Enable native J2D logging (only in debug build)
// Can be turned on for J2D by adding "#define DEBUG 1" into jdk/src/share/native/sun/java2d/Trace.h
// environment 'J2D_TRACE_LEVEL', '4'
}
def buildDir = project.buildscript.sourceFile.parentFile.parentFile.parentFile.parentFile
def make_cmd = "make"
if (OperatingSystem.current().isWindows()) {
def cyg_make_cmd = new File("c:/cygwin64/bin/make.exe")
if (cyg_make_cmd.exists()) make_cmd = cyg_make_cmd.absolutePath
}
def test_run = false
task make_images {
doLast {
if (!test_run) {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "images")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine { println it }
assert proc.waitFor() == 0
}
}
}
task make_clean {
doLast {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "clean")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine { println it }
assert proc.waitFor() == 0
}
}
task run_test {
doLast {
test_run = true
}
}
tasks.cleanTest.dependsOn tasks.run_test
classes.dependsOn.clear()
classes.dependsOn tasks.make_images
tasks.cleanClasses.dependsOn tasks.make_clean

View File

@@ -0,0 +1,54 @@
java.base,
java.compiler,
java.datatransfer,
java.desktop,
java.instrument,
java.logging,
java.management,
java.management.rmi,
java.naming,
java.net.http,
java.prefs,
java.rmi,
java.scripting,
java.se,
java.security.jgss,
java.security.sasl,
java.smartcardio,
java.sql,
java.sql.rowset,
java.transaction.xa,
java.xml,
java.xml.crypto,
jdk.accessibility,
jdk.attach,
jdk.charsets,
jdk.compiler,
jdk.crypto.cryptoki,
jdk.crypto.ec,
jdk.dynalink,
jdk.httpserver,
jdk.internal.ed,
jdk.internal.le,
jdk.internal.vm.ci,
jdk.javadoc,
jdk.jdi,
jdk.jdwp.agent,
jdk.jfr,
jdk.jsobject,
jdk.localedata,
jdk.management,
jdk.management.agent,
jdk.management.jfr,
jdk.naming.dns,
jdk.naming.rmi,
jdk.net,
jdk.sctp,
jdk.security.auth,
jdk.security.jgss,
jdk.unsupported,
jdk.unsupported.desktop,
jdk.xml.dom,
jdk.zipfs,
jdk.hotspot.agent,
jdk.jcmd

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
# $1 - Boot JDK
# $2 - JBR part of API version
cd "`dirname "$0"`/../../../../.."
PWD="`pwd`"
CONF="$PWD/build/jbr-api.conf"
./configure --with-debug-level=release --with-boot-jdk=$1 || exit $?
make jbr-api CONF=release MAKEOVERRIDES= "JBR_API_CONF_FILE=$CONF" JBR_API_JBR_VERSION=$2 || exit $?
. $CONF || exit $?
echo "##teamcity[buildNumber '$VERSION']"
cp "$JAR" ./jbr-api-${VERSION}.jar || exit $?
cp "$SOURCES_JAR" ./jbr-api-${VERSION}-sources.jar || exit $?
echo "##teamcity[publishArtifacts '$PWD/jbr-api-${VERSION}.jar']"
echo "##teamcity[publishArtifacts '$PWD/jbr-api-${VERSION}-sources.jar']"

View File

@@ -0,0 +1,167 @@
#!/bin/bash
set -euo pipefail
set -x
function check_bundle_type_maketest() {
# check whether last char is 't', if so remove it
if [ "${bundle_type: -1}" == "t" ]; then
bundle_type="${bundle_type%?}"
do_maketest=1
else
do_maketest=0
fi
}
function getVersionProp() {
grep "^${1}" make/conf/version-numbers.conf | cut -d'=' -f2
}
while getopts ":i?" o; do
case "${o}" in
i) INC_BUILD=1 ;;
esac
done
shift $((OPTIND-1))
if [[ $# -lt 2 ]]; then
echo "Required at least two arguments: build_number bundle_type"
exit 1
fi
build_number=$1
bundle_type=$2
# shellcheck disable=SC2034
architecture=${3:-x64} # aarch64 or x64
check_bundle_type_maketest
tag_prefix="jdk-"
OPENJDK_TAG=$(git log --simplify-by-decoration --decorate=short --pretty=short | grep "$tag_prefix" | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -g | tail -n 1)
VERSION_FEATURE=$(getVersionProp "DEFAULT_VERSION_FEATURE")
VERSION_INTERIM=$(getVersionProp "DEFAULT_VERSION_INTERIM")
VERSION_UPDATE=$(getVersionProp "DEFAULT_VERSION_UPDATE")
[[ $VERSION_UPDATE = 0 ]] && JBSDK_VERSION="$VERSION_FEATURE" || JBSDK_VERSION="${VERSION_FEATURE}.${VERSION_INTERIM}.${VERSION_UPDATE}"
echo "##teamcity[setParameter name='env.JBSDK_VERSION' value='${JBSDK_VERSION}']"
JDK_BUILD_NUMBER=${JDK_BUILD_NUMBER:=$(echo $OPENJDK_TAG | awk -F "-|[+]" '{print $3}')}
[ -z $JDK_BUILD_NUMBER ] && JDK_BUILD_NUMBER=1
echo "##teamcity[setParameter name='env.JDK_UPDATE_NUMBER' value='${JDK_BUILD_NUMBER}']"
VENDOR_NAME="JetBrains s.r.o."
VENDOR_VERSION_STRING="JBR-${JBSDK_VERSION}+${JDK_BUILD_NUMBER}-${build_number}"
[ -z "$bundle_type" ] || VENDOR_VERSION_STRING="${VENDOR_VERSION_STRING}-${bundle_type}"
do_reset_changes=0
do_reset_dcevm=0
HEAD_REVISION=0
STATIC_CONF_ARGS=""
common_conf_props_file="jb/project/tools/common/static_conf_args.txt"
if [[ -f "$common_conf_props_file" ]]; then
STATIC_CONF_ARGS=$(<$common_conf_props_file)
fi
OS_NAME=$(uname -s)
# Enable reproducible builds
TZ=UTC
export TZ
SOURCE_DATE_EPOCH="$(git log -1 --pretty=%ct)"
export SOURCE_DATE_EPOCH
COPYRIGHT_YEAR=""
BUILD_TIME=""
TOUCH_TIME=""
REPRODUCIBLE_TAR_OPTS=""
case "$OS_NAME" in
Linux)
COPYRIGHT_YEAR="$(date --utc --date=@$SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date --utc --date=@$SOURCE_DATE_EPOCH +%F)"
REPRODUCIBLE_TAR_OPTS="--mtime=@$SOURCE_DATE_EPOCH --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
;;
CYGWIN*)
COPYRIGHT_YEAR="$(date --utc --date=@$SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date --utc --date=@$SOURCE_DATE_EPOCH +%F)"
REPRODUCIBLE_TAR_OPTS="--mtime=@$SOURCE_DATE_EPOCH --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
;;
Darwin)
COPYRIGHT_YEAR="$(date -u -r $SOURCE_DATE_EPOCH +%Y)"
BUILD_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%F)"
TOUCH_TIME="$(date -u -r $SOURCE_DATE_EPOCH +%Y%m%d%H%M.%S)"
REPRODUCIBLE_TAR_OPTS="--uid 0 --gid 0 --numeric-owner"
;;
esac
WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS="--with-native-debug-symbols=zipped"
REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build
--with-source-date=$SOURCE_DATE_EPOCH
--with-hotspot-build-time=$BUILD_TIME
--with-copyright-year=$COPYRIGHT_YEAR
--disable-absolute-paths-in-output
--with-build-user=builduser"
function zip_native_debug_symbols() {
image_bundle_path=$(echo $1 | cut -d"/" -f-4)
jbr_diz_name=$2
(cd $image_bundle_path && find . -name '*.diz' -exec rsync -R {} ../../../../dizfiles \; )
(cd dizfiles && find . -print0 | COPYFILE_DISABLE=1 \
tar --no-recursion --null -T - -czf ../"$jbr_diz_name".tar.gz) || do_exit $?
}
function do_exit() {
exit_code=$1
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
if [ $do_reset_dcevm -eq 1 ]; then
[ ! -z $HEAD_REVISION ] && git reset --hard $HEAD_REVISION
fi
exit "$exit_code"
}
function update_jsdk_mods() {
__jsdk=$1
__jcef_mods=$2
__orig_jsdk_mods=$3
__updated_jsdk_mods=$4
# re-create java.desktop.jmod with updated module-info.class
tmp=.java.desktop.$$.tmp
mkdir "$tmp" || exit $?
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.desktop.jmod || exit $?
"$__jsdk"/bin/javac \
--patch-module java.desktop="$__orig_jsdk_mods"/java.desktop.jmod \
--module-path "$__jcef_mods" -d "$tmp"/classes src/java.desktop/share/classes/module-info.java || exit $?
"$__jsdk"/bin/jmod \
create --class-path "$tmp"/classes --config "$tmp"/conf --header-files "$tmp"/include --legal-notice "$tmp"/legal --libs "$tmp"/lib \
java.desktop.jmod || exit $?
mv java.desktop.jmod "$__updated_jsdk_mods" || exit $?
rm -rf "$tmp"
# re-create java.base.jmod with updated hashes
tmp=.java.base.$$.tmp
mkdir "$tmp" || exit $?
hash_modules=$("$JSDK"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.base.jmod || exit $?
rm "$__updated_jsdk_mods"/java.base.jmod || exit $? # temp exclude from path
"$__jsdk"/bin/jmod \
create --module-path "$__updated_jsdk_mods" --hash-modules "$hash_modules" \
--class-path "$tmp"/classes --cmds "$tmp"/bin --config "$tmp"/conf --header-files "$tmp"/include --legal-notice "$tmp"/legal --libs "$tmp"/lib \
java.base.jmod || exit $?
mv java.base.jmod "$__updated_jsdk_mods" || exit $?
rm -rf "$tmp"
}
function get_mods_list() {
__mods=$1
echo $(ls $__mods) | sed s/\.jmod/,/g | sed s/,$//g | sed s/' '//g
}
function copy_jmods() {
__mods_list=$1
__jmods_from=$2
__jmods_to=$3
mkdir -p $__jmods_to
echo "${__mods_list}," | while read -d, mod; do cp $__jmods_from/$mod.jmod $__jmods_to/; done
}

View File

@@ -0,0 +1 @@
--with-vendor-vm-bug-url=https://youtrack.jetbrains.com/issues/JBR

View File

@@ -0,0 +1,163 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_linux_aarch64
source jb/project/tools/common/scripts/common.sh
JCEF_PATH=${JCEF_PATH:=./jcef_linux_aarch64}
function do_configure {
sh configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
}
function is_musl {
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
if [ -z $libc ]; then
# This is not Musl, return 1 == false
return 1
fi
return 0
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
libc_type_suffix=''
fastdebug_infix=''
if is_musl; then libc_type_suffix='musl-' ; fi
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}aarch64-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}aarch64-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink....
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
$JSDK/bin/jlink \
--module-path "$__modules_path" --no-man-pages --compress=2 \
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
mv release "$IMAGES_DIR"/"$__root_dir"/release
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
fi
# jmod does not preserve file permissions (JDK-8173610)
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
echo Creating "$JBR".tar.gz ...
(cd "$IMAGES_DIR" &&
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
tar $REPRODUCIBLE_TAR_OPTS \
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
gzip "$JBR".tar || do_exit $?
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=linux-aarch64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=1
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=1
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=linux-aarch64-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
make clean CONF=$RELEASE_NAME || do_exit $?
fi
make images CONF=$RELEASE_NAME || do_exit $?
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module_aarch64.patch || do_exit $?
update_jsdk_mods $JSDK $JCEF_PATH/jmods $JSDK/jmods $JSDK_MODS_DIR || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-${libc_type_suffix}test-aarch64-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
make test-image CONF=$RELEASE_NAME || do_exit $?
tar -pcf "$JBRSDK_TEST".tar -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
gzip "$JBRSDK_TEST".tar || do_exit $?
fi
do_exit 0

View File

@@ -0,0 +1,163 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_linux_x64
source jb/project/tools/common/scripts/common.sh
JCEF_PATH=${JCEF_PATH:=./jcef_linux_x64}
function do_configure {
sh configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
}
function is_musl {
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
if [ -z $libc ]; then
# This is not Musl, return 1 == false
return 1
fi
return 0
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
libc_type_suffix=''
fastdebug_infix=''
if is_musl; then libc_type_suffix='musl-' ; fi
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x64-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x64-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink....
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
$JSDK/bin/jlink \
--module-path "$__modules_path" --no-man-pages --compress=2 \
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
mv release "$IMAGES_DIR"/"$__root_dir"/release
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
fi
# jmod does not preserve file permissions (JDK-8173610)
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
echo Creating "$JBR".tar.gz ...
(cd "$IMAGES_DIR" &&
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
tar $REPRODUCIBLE_TAR_OPTS \
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
gzip "$JBR".tar || do_exit $?
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=linux-x86_64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=1
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=1
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=linux-x86_64-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
make clean CONF=$RELEASE_NAME || do_exit $?
fi
make images CONF=$RELEASE_NAME || do_exit $?
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
update_jsdk_mods $JSDK $JCEF_PATH/jmods $JSDK/jmods $JSDK_MODS_DIR || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
jbr_name_postfix="_${bundle_type}"
[ "$bundle_type" != "fd" ] && jbrsdk_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-${libc_type_suffix}test-x64-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
make test-image CONF=$RELEASE_NAME || do_exit $?
tar -pcf "$JBRSDK_TEST".tar -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
gzip "$JBRSDK_TEST".tar || do_exit $?
fi
do_exit 0

View File

@@ -0,0 +1,143 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
source jb/project/tools/common/scripts/common.sh
function do_configure {
linux32 bash configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
$STATIC_CONF_ARGS \
--enable-cds=yes \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
}
function is_musl {
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
if [ -z $libc ]; then
# This is not Musl, return 1 == false
return 1
fi
return 0
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
libc_type_suffix=''
fastdebug_infix=''
if is_musl; then libc_type_suffix='musl-' ; fi
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x86-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x86-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink....
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
$JSDK/bin/jlink \
--module-path "$__modules_path" --no-man-pages --compress=2 \
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
mv release "$IMAGES_DIR"/"$__root_dir"/release
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
fi
# jmod does not preserve file permissions (JDK-8173610)
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
echo Creating "$JBR".tar.gz ...
(cd "$IMAGES_DIR" &&
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
tar $REPRODUCIBLE_TAR_OPTS \
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
gzip "$JBR".tar || do_exit $?
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=linux-x86-server-release
case "$bundle_type" in
"jcef")
echo "not implemented" && do_exit 1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=1
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=linux-x86-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
make clean CONF=$RELEASE_NAME || do_exit $?
fi
make images CONF=$RELEASE_NAME || do_exit $?
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
echo Fixing permissions
chmod -R a+r $JSDK
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(grep -v "jdk.internal.vm" jb/project/tools/common/modules.list | xargs | sed s/" "//g) || do_exit $?
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-${libc_type_suffix}test-x86-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
make test-image CONF=$RELEASE_NAME || do_exit $?
tar -pcf "$JBRSDK_TEST".tar -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
gzip "$JBRSDK_TEST".tar || do_exit $?
fi
do_exit 0

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,166 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_mac
source jb/project/tools/common/scripts/common.sh
JCEF_PATH=${JCEF_PATH:=./jcef_mac}
BOOT_JDK=${BOOT_JDK:=$(/usr/libexec/java_home -v 17)}
function do_configure {
if [[ "${architecture}" == *aarch64* ]]; then
ENABLE_CDS="--enable-cds=no"
else
ENABLE_CDS="--enable-cds=yes"
fi
sh configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-macosx-bundle-name-base=${VENDOR_VERSION_STRING} \
--with-macosx-bundle-id-base="com.jetbrains.jbr" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build="$JDK_BUILD_NUMBER" \
--with-version-opt=b"$build_number" \
--with-boot-jdk="$BOOT_JDK" \
--enable-cds=yes \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|| do_exit $?
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
fastdebug_infix=''
tmp=.bundle.$$.tmp
mkdir "$tmp" || do_exit $?
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix:-}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${architecture}-${fastdebug_infix:-}b${build_number%%.*}
JRE_CONTENTS=$tmp/$__root_dir/Contents
mkdir -p "$JRE_CONTENTS" || do_exit $?
echo Running jlink...
"$JSDK"/bin/jlink \
--module-path "$__modules_path" --no-man-pages --compress=2 \
--add-modules "$__modules" --output "$JRE_CONTENTS/Home" || do_exit $?
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$JRE_CONTENTS/Home/release"
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' $JRE_CONTENTS/Home/release > release
mv release $JRE_CONTENTS/Home/release
cp $IMAGES_DIR/jdk-bundle/jdk-$JBSDK_VERSION.jdk/Contents/Home/lib/src.zip $JRE_CONTENTS/Home/lib
copy_jmods "$__modules" "$__modules_path" "$JRE_CONTENTS"/Home/jmods
zip_native_debug_symbols $IMAGES_DIR/jdk-bundle/jdk-$JBSDK_VERSION.jdk "${JBR}_diz"
fi
cp -R "$JSDK"/../MacOS "$JRE_CONTENTS"
cp "$JSDK"/../Info.plist "$JRE_CONTENTS"
[ -n "$bundle_type" ] && (cp -a $JCEF_PATH/Frameworks "$JRE_CONTENTS" || do_exit $?)
echo Creating "$JBR".tar.gz ...
# Normalize timestamp
find "$tmp"/"$__root_dir" -print0 | xargs -0 touch -c -h -t "$TOUCH_TIME"
(cd "$tmp" &&
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
COPYFILE_DISABLE=1 tar $REPRODUCIBLE_TAR_OPTS --no-recursion --null -T - \
-czf "$JBR".tar.gz --exclude='*.dSYM' --exclude='man') || do_exit $?
mv "$tmp"/"$JBR".tar.gz "$JBR".tar.gz
rm -rf "$tmp"
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
CONF_ARCHITECTURE=x86_64
if [[ "${architecture}" == *aarch64* ]]; then
CONF_ARCHITECTURE=aarch64
fi
RELEASE_NAME=macosx-${CONF_ARCHITECTURE}-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=1
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=1
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=macosx-${CONF_ARCHITECTURE}-server-fastdebug
JBSDK=macosx-${architecture}-server-release
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
make clean CONF=$RELEASE_NAME || do_exit $?
fi
make images CONF=$RELEASE_NAME || do_exit $?
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk-bundle/jdk-$JBSDK_VERSION.jdk/Contents/Home
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat "$JSDK"/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-osx-test-${architecture}-b${build_number}
echo Creating "$JBRSDK_TEST" ...
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
make test-image CONF=$RELEASE_NAME || do_exit $?
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
COPYFILE_DISABLE=1 tar -pczf "$JBRSDK_TEST".tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
fi
do_exit 0

View File

@@ -0,0 +1,121 @@
#!/bin/bash
set -euo pipefail
set -x
APP_DIRECTORY=$1
APPL_USER=$2
APPL_PASSWORD=$3
APP_NAME=$4
BUNDLE_ID=$5
FAKE_ROOT="${6:-fake-root}"
if [[ -z "$APP_DIRECTORY" ]] || [[ -z "$APPL_USER" ]] || [[ -z "$APPL_PASSWORD" ]]; then
echo "Usage: $0 AppDirectory Username Password"
exit 1
fi
if [[ ! -d "$APP_DIRECTORY" ]]; then
echo "AppDirectory '$APP_DIRECTORY' does not exist or not a directory"
exit 1
fi
function log() {
echo "$(date '+[%H:%M:%S]') $*"
}
function publish-log() {
id=$1
file=$2
curl -T "$file" "$ARTIFACTORY_URL/$id" || true
}
function altool-upload() {
# Since altool uses same file for upload token we have to trick it into using different folders for token file location
# Also it copies zip into TMPDIR so we override it too, to simplify cleanup
OLD_HOME="$HOME"
export HOME="$FAKE_ROOT/home"
export TMPDIR="$FAKE_ROOT/tmp"
mkdir -p "$HOME"
mkdir -p "$TMPDIR"
export _JAVA_OPTIONS="-Duser.home=$HOME -Djava.io.tmpdir=$TMPDIR"
# Reduce amount of downloads, cache transporter libraries
shared_itmstransporter="$OLD_HOME/shared-itmstransporter"
if [[ -f "$shared_itmstransporter" ]]; then
cp -r "$shared_itmstransporter" "$HOME/.itmstransporter"
fi
# For some reason altool prints everything to stderr, not stdout
set +e
xcrun altool --notarize-app \
--username "$APPL_USER" --password "$APPL_PASSWORD" \
--primary-bundle-id "$BUNDLE_ID" \
--asc-provider JetBrainssro --file "$1" 2>&1 | tee "altool.init.out"
unset TMPDIR
export HOME="$OLD_HOME"
set -e
}
#immediately exit script with an error if a command fails
set -euo pipefail
#file="$APP_NAME.zip"
#log "Zipping $file..."
#rm -rf "$file"
#ditto -c -k --sequesterRsrc --keepParent "$APP_DIRECTORY" "$file"
log "Notarizing $APP_NAME..."
rm -rf "altool.init.out" "altool.check.out"
altool-upload "$APP_NAME"
notarization_info="$(grep -e "RequestUUID" "altool.init.out" | grep -oE '([0-9a-f-]{36})')"
if [ -z "$notarization_info" ]; then
log "Faile to read RequestUUID from altool.init.out"
exit 10
fi
PATH="$PATH:/usr/local/bin/"
log "Notarization request sent, awaiting response"
spent=0
while true; do
# For some reason altool prints everything to stderr, not stdout
xcrun altool --username "$APPL_USER" --notarization-info "$notarization_info" --password "$APPL_PASSWORD" >"altool.check.out" 2>&1 || true
status="$(grep -oe 'Status: .*' "altool.check.out" | cut -c 9- || true)"
log "Current status: $status"
if [ "$status" = "invalid" ]; then
log "Notarization failed"
ec=1
elif [ "$status" = "success" ]; then
log "Notarization succeeded"
ec=0
else
if [ "$status" != "in progress" ]; then
log "Unknown notarization status, waiting more, altool output:"
cat "altool.check.out"
fi
if [[ $spent -gt 60 ]]; then
log "Waiting time out (apx 60 minutes)"
ec=2
break
fi
sleep 60
((spent += 1))
continue
fi
developer_log="developer_log.json"
log "Fetching $developer_log"
# TODO: Replace cut with trim or something better
url="$(grep -oe 'LogFileURL: .*' "altool.check.out" | cut -c 13-)"
wget "$url" -O "$developer_log" && cat "$developer_log" || true
if [ $ec != 0 ]; then
log "Publishing $developer_log"
publish-log "$notarization_info" "$developer_log"
fi
break
done
cat "altool.check.out"
rm -rf "altool.init.out" "altool.check.out"
exit $ec

View File

@@ -0,0 +1,117 @@
#!/bin/bash
set -euo pipefail
set -x
APPLICATION_PATH=$1
APP_NAME=$2
BUNDLE_ID=$3
JB_DEVELOPER_CERT=$4
JB_INSTALLER_CERT=$5
if [[ -z "$APPLICATION_PATH" ]] || [[ -z "$JB_DEVELOPER_CERT" ]]; then
echo "Usage: $0 AppDirectory CertificateID"
exit 1
fi
if [[ ! -d "$APPLICATION_PATH" ]]; then
echo "AppDirectory '$APPLICATION_PATH' does not exist or not a directory"
exit 1
fi
function log() {
echo "$(date '+[%H:%M:%S]') $*"
}
#immediately exit script with an error if a command fails
set -euo pipefail
# Cleanup files left from previous sign attempt (if any)
find "$APPLICATION_PATH" -name '*.cstemp' -exec rm '{}' \;
log "Signing libraries and executables..."
# -perm +111 searches for executables
for f in \
"Contents/Home/lib" "Contents/MacOS" \
"Contents/Home/Frameworks" \
"Contents/Frameworks"; do
if [ -d "$APPLICATION_PATH/$f" ]; then
find "$APPLICATION_PATH/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -name "*.node" -o -perm +111 \) \
-exec codesign --timestamp \
-v -s "$JB_DEVELOPER_CERT" --options=runtime --force \
--entitlements entitlements.xml {} \;
fi
done
log "Signing libraries in jars in $PWD"
# todo: add set -euo pipefail; into the inner sh -c
# `-e` prevents `grep -q && printf` loginc
# with `-o pipefail` there's no input for 'while' loop
find "$APPLICATION_PATH" -name '*.jar' \
-exec sh -c "set -u; unzip -l \"\$0\" | grep -q -e '\.dylib\$' -e '\.jnilib\$' -e '\.so\$' -e '\.tbd\$' -e '^jattach\$' && printf \"\$0\0\" " {} \; |
while IFS= read -r -d $'\0' file; do
log "Processing libraries in $file"
rm -rf jarfolder jar.jar
mkdir jarfolder
filename="${file##*/}"
log "Filename: $filename"
cp "$file" jarfolder && (cd jarfolder && jar xf "$filename" && rm "$filename")
find jarfolder \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -name "jattach" \) \
-exec codesign --timestamp \
--force \
-v -s "$JB_DEVELOPER_CERT" --options=runtime \
--entitlements entitlements.xml {} \;
(cd jarfolder; zip -q -r -o -0 ../jar.jar .)
mv jar.jar "$file"
done
rm -rf jarfolder jar.jar
log "Signing other files..."
for f in \
"Contents/Home/bin"; do
if [ -d "$APPLICATION_PATH/$f" ]; then
find "$APPLICATION_PATH/$f" \
-type f \( -name "*.jnilib" -o -name "*.dylib" -o -name "*.so" -o -name "*.tbd" -o -perm +111 \) \
-exec codesign --timestamp \
-v -s "$JB_DEVELOPER_CERT" --options=runtime --force \
--entitlements entitlements.xml {} \;
fi
done
#log "Signing executable..."
#codesign --timestamp \
# -v -s "$JB_DEVELOPER_CERT" --options=runtime \
# --force \
# --entitlements entitlements.xml "$APPLICATION_PATH/Contents/MacOS/idea"
log "Signing whole app..."
codesign --timestamp \
-v -s "$JB_DEVELOPER_CERT" --options=runtime \
--force \
--entitlements entitlements.xml "$APPLICATION_PATH"
BUILD_NAME=$(echo $APPLICATION_PATH | awk -F"/" '{ print $2 }')
log "Creating $APP_NAME.pkg..."
rm -rf "$APP_NAME.pkg"
mkdir -p unsigned
pkgbuild --identifier $BUNDLE_ID --root $APPLICATION_PATH \
--install-location /Library/Java/JavaVirtualMachines/${BUILD_NAME} unsigned/${APP_NAME}.pkg
productsign --timestamp --sign "$JB_INSTALLER_CERT" unsigned/${APP_NAME}.pkg ${APP_NAME}.pkg
#log "Signing whole app..."
#codesign --timestamp \
# -v -s "$JB_DEVELOPER_CERT" --options=runtime \
# --force \
# --entitlements entitlements.xml $APP_NAME.pkg
log "Verifying java is not broken"
find "$APPLICATION_PATH" \
-type f -name 'java' -perm +111 -exec {} -version \;

View File

@@ -0,0 +1,138 @@
#!/bin/bash
#immediately exit script with an error if a command fails
set -euo pipefail
set -x
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
INPUT_FILE=$1
EXPLODED=$2.exploded
BACKUP_JMODS=$2.backup
USERNAME=$3
PASSWORD=$4
CODESIGN_STRING=$5
JB_INSTALLER_CERT=$6
NOTARIZE=$7
BUNDLE_ID=$8
cd "$(dirname "$0")"
function log() {
echo "$(date '+[%H:%M:%S]') $*"
}
log "Deleting $EXPLODED ..."
if test -d "$EXPLODED"; then
find "$EXPLODED" -mindepth 1 -maxdepth 1 -exec chmod -R u+wx '{}' \;
fi
rm -rf "$EXPLODED"
mkdir "$EXPLODED"
rm -rf "$BACKUP_JMODS"
mkdir "$BACKUP_JMODS"
log "Unzipping $INPUT_FILE to $EXPLODED ..."
tar -xzvf "$INPUT_FILE" --directory $EXPLODED
BUILD_NAME="$(ls "$EXPLODED")"
#sed -i '' s/BNDL/APPL/ $EXPLODED/$BUILD_NAME/Contents/Info.plist
rm -f $EXPLODED/$BUILD_NAME/Contents/CodeResources
rm "$INPUT_FILE"
if test -d $EXPLODED/$BUILD_NAME/Contents/Home/jmods; then
mv $EXPLODED/$BUILD_NAME/Contents/Home/jmods $BACKUP_JMODS
fi
log "$INPUT_FILE extracted and removed"
APP_NAME=$(echo ${INPUT_FILE} | awk -F".tar" '{ print $1 }')
APPLICATION_PATH=$EXPLODED/$(ls $EXPLODED)
find "$APPLICATION_PATH/Contents/Home/bin" \
-maxdepth 1 -type f -name '*.jnilib' -print0 |
while IFS= read -r -d $'\0' file; do
if [ -f "$file" ]; then
log "Linking $file"
b="$(basename "$file" .jnilib)"
ln -sf "$b.jnilib" "$(dirname "$file")/$b.dylib"
fi
done
find "$APPLICATION_PATH/Contents/" \
-maxdepth 1 -type f -name '*.txt' -print0 |
while IFS= read -r -d $'\0' file; do
if [ -f "$file" ]; then
log "Moving $file"
mv "$file" "$APPLICATION_PATH/Contents/Resources"
fi
done
non_plist=$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist' | wc -l)
if [[ $non_plist -gt 0 ]]; then
log "Only Info.plist file is allowed in Contents directory but found $non_plist file(s):"
log "$(find "$APPLICATION_PATH/Contents/" -maxdepth 1 -type f -and -not -name 'Info.plist')"
exit 1
fi
log "Unlocking keychain..."
# Make sure *.p12 is imported into local KeyChain
security unlock-keychain -p "$PASSWORD" "/Users/$USERNAME/Library/Keychains/login.keychain"
attempt=1
limit=3
set +e
while [[ $attempt -le $limit ]]; do
log "Signing (attempt $attempt) $APPLICATION_PATH ..."
./sign.sh "$APPLICATION_PATH" "$APP_NAME" "$BUNDLE_ID" "$CODESIGN_STRING" "$JB_INSTALLER_CERT"
ec=$?
if [[ $ec -ne 0 ]]; then
((attempt += 1))
if [ $attempt -eq $limit ]; then
set -e
fi
log "Signing failed, wait for 30 sec and try to sign again"
sleep 30
else
log "Signing done"
codesign -v "$APPLICATION_PATH" -vvvvv
log "Check sign done"
spctl -a -v $APPLICATION_PATH
((attempt += limit))
fi
done
set -e
if [ "$NOTARIZE" = "yes" ]; then
log "Notarizing..."
# shellcheck disable=SC1090
source "$HOME/.notarize_token"
# Since notarization tool uses same file for upload token we have to trick it into using different folders, hence fake root
# Also it leaves copy of zip file in TMPDIR, so notarize.sh overrides it and uses FAKE_ROOT as location for temp TMPDIR
FAKE_ROOT="$(pwd)/fake-root"
mkdir -p "$FAKE_ROOT"
echo "Notarization will use fake root: $FAKE_ROOT"
./notarize.sh "$APPLICATION_PATH" "$APPLE_USERNAME" "$APPLE_PASSWORD" "$APP_NAME.pkg" "$BUNDLE_ID" "$FAKE_ROOT"
rm -rf "$FAKE_ROOT"
set +e
log "Stapling..."
xcrun stapler staple "$APPLICATION_PATH"
else
log "Notarization disabled"
log "Stapling disabled"
fi
log "Zipping $BUILD_NAME to $INPUT_FILE ..."
(
#cd "$EXPLODED"
#ditto -c -k --sequesterRsrc --keepParent "$BUILD_NAME" "../$INPUT_FILE"
if test -d $BACKUP_JMODS/jmods; then
mv $BACKUP_JMODS/jmods $APPLICATION_PATH/Contents/Home
fi
mv $APPLICATION_PATH $EXPLODED/$BUILD_NAME
tar -pczvf $INPUT_FILE --exclude='man' -C $EXPLODED $BUILD_NAME
log "Finished zipping"
)
rm -rf "$EXPLODED"
log "Done"

View File

@@ -0,0 +1,30 @@
diff --git jb/project/tools/common/modules.list jb/project/tools/common/modules.list
index 522acb7cb43..c40e689d5de 100644
--- jb/project/tools/common/modules.list
+++ jb/project/tools/common/modules.list
@@ -51,4 +51,7 @@ jdk.unsupported.desktop,
jdk.xml.dom,
jdk.zipfs,
jdk.hotspot.agent,
-jdk.jcmd
+jdk.jcmd,
+jcef,
+gluegen.rt,
+jogl.all
diff --git src/java.desktop/share/classes/module-info.java src/java.desktop/share/classes/module-info.java
index 897647ee368..781d1809493 100644
--- src/java.desktop/share/classes/module-info.java
+++ src/java.desktop/share/classes/module-info.java
@@ -116,7 +116,11 @@ module java.desktop {
// see make/GensrcModuleInfo.gmk
exports sun.awt to
jdk.accessibility,
- jdk.unsupported.desktop;
+ jdk.unsupported.desktop,
+ jcef,
+ jogl.all;
+
+ exports java.awt.peer to jcef;
exports java.awt.dnd.peer to jdk.unsupported.desktop;
exports sun.awt.dnd to jdk.unsupported.desktop;

View File

@@ -0,0 +1,30 @@
diff --git jb/project/tools/common/modules.list jb/project/tools/common/modules.list
index 522acb7..c40e689 100644
--- jb/project/tools/common/modules.list
+++ jb/project/tools/common/modules.list
@@ -51,4 +51,7 @@ jdk.unsupported.desktop,
jdk.xml.dom,
jdk.zipfs,
jdk.hotspot.agent,
-jdk.jcmd
+jdk.jcmd,
+jcef,
+gluegen.rt,
+jogl.all
diff --git src/java.desktop/share/classes/module-info.java src/java.desktop/share/classes/module-info.java
index 897647e..781d180 100644
--- src/java.desktop/share/classes/module-info.java
+++ src/java.desktop/share/classes/module-info.java
@@ -116,7 +116,11 @@ module java.desktop {
// see make/GensrcModuleInfo.gmk
exports sun.awt to
jdk.accessibility,
- jdk.unsupported.desktop;
+ jdk.unsupported.desktop,
+ jcef,
+ jogl.all;
+
+ exports java.awt.peer to jcef;
exports java.awt.dnd.peer to jdk.unsupported.desktop;
exports sun.awt.dnd to jdk.unsupported.desktop;

View File

@@ -0,0 +1,153 @@
#!/bin/bash
set -euo pipefail
while getopts ":t" o; do
case "${o}" in
t)
t="With Teamcity tests info"
TC_PRINT=1
;;
esac
done
shift $((OPTIND-1))
NEWFILEPATH=$1
CONFIGID=$2
BUILDID=$3
TOKEN=$4
#
# Get the size of new artifact
#
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
NEWFILESIZE=$(stat -c%s "$NEWFILEPATH")
;;
Darwin*)
NEWFILESIZE=$(stat -f%z "$NEWFILEPATH")
;;
CYGWIN*)
NEWFILESIZE=$(stat -c%s$4
#
# Get the size of new artifact
#
"$NEWFILEPATH")
;;
MINGW*)
NEWFILESIZE=$(stat -c%s "$NEWFILEPATH")
;;
*)
echo "Unknown machine: ${unameOut}"
exit 1
esac
FILENAME=$(basename ${NEWFILEPATH})
#
# Get pattern of artifact name
# Base filename pattern: <BUNDLE_TYPE>-<JDK_VERSION>-<OS>-<ARCH>-b<BUILD>.tar.gz: jbr_dcevm-17.0.2-osx-x64-b1234.tar.gz
# BUNDLE_TYPE: jbr, jbrsdk, jbr_dcevm, jbrsdk_jcef etc.
# OS_ARCH_PATTERN - <os_architecture>: osx-x64, linux-aarch64, windows-x64 etc.
BUNDLE_TYPE=jbrsdk
OS_ARCH_PATTERN=""
FILE_EXTENSION=tar.gz
re='(jbr[a-z_]*).*-[0-9_\.]+-(.+)-b[0-9]+(.+)'
if [[ $FILENAME =~ $re ]]; then
BUNDLE_TYPE=${BASH_REMATCH[1]}
OS_ARCH_PATTERN=${BASH_REMATCH[2]}
FILE_EXTENSION=${BASH_REMATCH[3]}
fi
if [ $TC_PRINT -eq 1 ]; then
testname_file_ext=`echo $FILE_EXTENSION | sed 's/\./_/g'`
testname=$BUNDLE_TYPE"_"$OS_ARCH_PATTERN$testname_file_ext
echo \#\#teamcity[testStarted name=\'$testname\']
fi
echo "BUNDLE_TYPE: " $BUNDLE_TYPE
echo "OS_ARCH_PATTERN: " $OS_ARCH_PATTERN
echo "FILE_EXTENSION: " $FILE_EXTENSION
echo "New size of $FILENAME = $NEWFILESIZE bytes."
function test_failed_msg() {
if [ $3 -eq 1 ]; then
echo \#\#teamcity[testFailed name=\'$1\' message=\'$2\']
fi
}
function test_finished_msg() {
if [ $2 -eq 1 ]; then
echo \#\#teamcity[testFinished name=\'$1\']
fi
}
#
# Get previous successful build ID
# Example:
# CONFIGID=IntellijCustomJdk_Jdk17_Master_LinuxX64jcef
# BUILDID=12345678
#
# expected return value
# id="123".number="567"
#
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/?locator=buildType:(id:$CONFIGID),status:success,count:1,finishDate:(build:$BUILDID,condition:before)")
re='id=\"([0-9]+)\".+number=\"([0-9\.]+)\"'
# ID: Previous successful build id
ID=0
if [[ $CURL_RESPONSE =~ $re ]]; then
ID=${BASH_REMATCH[1]}
echo "BUILD Number: ${BASH_REMATCH[2]}"
else
msg="ERROR: can't find previous build"
echo $msg
echo $CURL_RESPONSE
test_failed_msg $testname $msg $TC_PRINT
test_finished_msg $testname $TC_PRINT
exit 1
fi
#
# Get artifacts from previous successful build
#
# expected return value
# name="jbrsdk_jcef*.tar.gz size="123'
#
CURL_RESPONSE=$(curl --header "Authorization: Bearer $TOKEN" "https://buildserver.labs.intellij.net/app/rest/builds/$ID?fields=id,number,artifacts(file(name,size))")
echo "Atrifacts of previous build of $CONFIGID :"
echo $CURL_RESPONSE
# Find binary size (in response) with reg exp
re='name=\"('$BUNDLE_TYPE'[^\"]+'${OS_ARCH_PATTERN}'[^\"]+'${FILE_EXTENSION}')\" size=\"([0-9]+)\"'
if [[ $CURL_RESPONSE =~ $re ]]; then
OLDFILENAME=${BASH_REMATCH[1]}
echo "Prev artifact name: $OLDFILENAME"
OLDFILESIZE=${BASH_REMATCH[2]}
echo "Prev artifact size = $OLDFILESIZE"
let allowedSize=OLDFILESIZE+OLDFILESIZE/20 # use 5% threshold
echo "Allowed size = $allowedSize"
if [[ "$NEWFILESIZE" -gt "$allowedSize" ]]; then
msg="ERROR: new size is significally greater than prev size (need to investigate)"
echo $msg
test_failed_msg $testname $msg $TC_PRINT
test_finished_msg $testname $TC_PRINT
exit 1
else
echo "PASSED"
test_finished_msg $testname $TC_PRINT
fi
else
msg="ERROR: can't find string with size in xml response:"
echo $msg
echo $CURL_RESPONSE
test_failed_msg $testname $msg $TC_PRINT
test_finished_msg $testname $TC_PRINT
exit 1
fi

View File

@@ -0,0 +1,86 @@
#!/bin/bash
set -euo pipefail
set -x
usage ()
{
echo "Usage: perfcmp.sh [options] <test_results_cur> <test_results_ref> <results> <test_prefix> <noHeaders>"
echo "Options:"
echo -e " -h, --help\tdisplay this help"
echo -e " -tc\tprint teacmity statistic"
echo -e "test_results_cur - the file with metrics values for the current measuring"
echo -e "test_results_ref - the file with metrics values for the reference measuring"
echo -e "results - results of comaprison"
echo -e "test_prefix - specifys measuring type, makes sense for enabled -tc, by default no prefixes"
echo -e "noHeaders - by default 1-st line contains headers"
echo -e ""
echo -e "test_results_* files content should be in csv format with header and tab separator:"
echo -e "The 1-st column is the test name"
echo -e "The 2-st column is the test value"
echo -e ""
echo -e "Example:"
echo -e "Test Value"
echo -e "Testname 51.54"
}
while [ -n "$1" ]
do
case "$1" in
-h | --help) usage
exit 1 ;;
-tc) tc=1
shift
break ;;
*) break;;
esac
done
if [[ "$#" < "3" ]]; then
echo "Error: Invalid arguments"
usage
exit 1
fi
curFile=$1
refFile=$2
resFile=$3
testNamePrefix=$4
noHeaders=$5
echo $curFile
echo $refFile
echo $resFile
curValues=`cat "$curFile" | cut -f 2 | tr -d '\t'`
if [ -z $noHeaders ]; then
curValuesHeader=`echo "$curValues" | head -n +1`_cur
header=`cat "$refFile" | head -n +1 | awk -F'\t' -v x=$curValuesHeader '{print " "$1"\t"$2"_ref\t"x"\tratio"}'`
testContent=`paste -d '\t' $refFile <(echo "$curValues") | tail -n +2`
else
testContent=`paste -d '\t' $refFile <(echo "$curValues") | tail -n +1`
fi
testContent=`echo "$testContent" | awk -F'\t' '{ if ($3>$2+$2*0.1) {print "* "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} else {print " "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} }'`
if [ -z $noHeaders ]; then
echo "$header" > $resFile
fi
echo "$testContent" >> $resFile
cat "$resFile" | tr '\t' ';' | column -t -s ';' | tee $resFile
if [ -z $tc ]; then
exit 0
fi
echo "$testContent" 2>&1 | (
while read -r s; do
testname=`echo "$s" | cut -f 1 | tr -d "[:space:]" | tr -d "*"`
duration=`echo "$s" | cut -f 3`
failed=`echo "$s" | cut -c1 | grep -c "*"`
echo \#\#teamcity[testStarted name=\'$testNamePrefix$testname\']
echo "===>$s"
echo \#\#teamcity[buildStatisticValue key=\'$testNamePrefix$testname\' value=\'$duration\']
[ $failed -eq 1 ] && echo \#\#teamcity[testFailed name=\'$testNamePrefix$testname\' message=\'$s\']
echo \#\#teamcity[testFinished name=\'$testNamePrefix$testname\' duration=\'$duration\']
failed=0
done
)

View File

@@ -0,0 +1,138 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_win_aarch64
source jb/project/tools/common/scripts/common.sh
WORK_DIR=$(pwd)
JCEF_PATH=${JCEF_PATH:=$WORK_DIR/jcef_win_aarch64}
function do_configure {
sh ./configure \
--openjdk-target=aarch64-unknown-cygwin \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build=$JDK_BUILD_NUMBER \
--with-version-opt=b${build_number} \
--with-toolchain-version=$TOOLCHAIN_VERSION \
--with-boot-jdk=$BOOT_JDK \
--with-build-jdk=$BOOT_JDK \
--disable-ccache \
$STATIC_CONF_ARGS \
--enable-cds=yes || do_exit $?
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink ...
${BOOT_JDK}/bin/jlink \
--module-path $__modules_path --no-man-pages --compress=2 \
--add-modules $__modules --output $__root_dir || do_exit $?
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__arch_name/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
mv release $__root_dir/release
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
rsync -a --exclude demo --exclude sample $dir $__root_dir
done
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
fi
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=windows-aarch64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=0
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=0
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=windows-aarch64-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
fi
else
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
fi
fi
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
where cygpath
if [ $? -eq 0 ]; then
JCEF_PATH="$(cygpath -w $JCEF_PATH | sed 's/\\/\//g')"
fi
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module_aarch64.patch || do_exit $?
update_jsdk_mods "$BOOT_JDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not unchanged
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
modules+=",jdk.crypto.mscapi"
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g) || do_exit $?
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
do_exit 0

View File

@@ -0,0 +1,138 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
# Environment variables:
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
# to configure
# By default JDK_BUILD_NUMBER is set zero
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
# By default JCEF binaries should be located in ./jcef_win_x64
source jb/project/tools/common/scripts/common.sh
WORK_DIR=$(pwd)
JCEF_PATH=${JCEF_PATH:=$WORK_DIR/jcef_win_x64}
function do_configure {
sh ./configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build=$JDK_BUILD_NUMBER \
--with-version-opt=b${build_number} \
--with-toolchain-version=$TOOLCHAIN_VERSION \
--with-boot-jdk=$BOOT_JDK \
--disable-ccache \
--enable-cds=yes \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink ...
${JSDK}/bin/jlink \
--module-path $__modules_path --no-man-pages --compress=2 \
--add-modules $__modules --output $__root_dir || do_exit $?
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__arch_name/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
mv release $__root_dir/release
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
rsync -a --exclude demo --exclude sample $dir $__root_dir
done
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
fi
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=windows-x86_64-server-release
case "$bundle_type" in
"jcef")
do_reset_changes=0
do_maketest=1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=0
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=windows-x86_64-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
fi
else
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
fi
fi
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
where cygpath
if [ $? -eq 0 ]; then
JCEF_PATH="$(cygpath -w $JCEF_PATH | sed 's/\\/\//g')"
fi
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
modules+=",jdk.crypto.mscapi"
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g)
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
do_exit 0

View File

@@ -0,0 +1,127 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# $ ./java --version
# openjdk 11.0.6 2020-01-14
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
#
source jb/project/tools/common/scripts/common.sh
WORK_DIR=$(pwd)
function do_configure {
sh ./configure \
$WITH_DEBUG_LEVEL \
--with-vendor-name="$VENDOR_NAME" \
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
--with-jvm-features=shenandoahgc \
--with-version-pre= \
--with-version-build=$JDK_BUILD_NUMBER \
--with-version-opt=b${build_number} \
--with-toolchain-version=$TOOLCHAIN_VERSION \
--with-boot-jdk=$BOOT_JDK \
--disable-ccache \
--enable-cds=yes \
$STATIC_CONF_ARGS \
$REPRODUCIBLE_BUILD_OPTS \
|| do_exit $?
}
function create_image_bundle {
__bundle_name=$1
__arch_name=$2
__modules_path=$3
__modules=$4
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
echo Running jlink ...
${JSDK}/bin/jlink \
--module-path $__modules_path --no-man-pages --compress=2 \
--add-modules $__modules --output $__root_dir || do_exit $?
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__arch_name/release
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
mv release $__root_dir/release
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
rsync -a --exclude demo --exclude sample $dir $__root_dir
done
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
fi
}
WITH_DEBUG_LEVEL="--with-debug-level=release"
RELEASE_NAME=windows-x86_64-server-release
case "$bundle_type" in
"jcef")
echo "not implemented" && do_exit 1
;;
"nomod" | "")
bundle_type=""
;;
"fd")
do_reset_changes=0
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
RELEASE_NAME=windows-x86_64-server-fastdebug
;;
esac
if [ -z "${INC_BUILD:-}" ]; then
do_configure || do_exit $?
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
fi
else
if [ $do_maketest -eq 1 ]; then
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
else
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
fi
fi
IMAGES_DIR=build/$RELEASE_NAME/images
JSDK=$IMAGES_DIR/jdk
JSDK_MODS_DIR=$IMAGES_DIR/jmods
JBRSDK_BUNDLE=jbrsdk
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
# create runtime image bundle
modules=$(grep -v "jdk.internal.vm" jb/project/tools/common/modules.list | xargs | sed s/" "//g) || do_exit $?
modules+=",jdk.crypto.mscapi"
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
# create sdk image bundle
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g)
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
fi
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
do_exit 0

View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script packs test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
source jb/project/tools/common/scripts/common.sh
[ "$bundle_type" == "jcef" ] && do_maketest=1
function pack_jbr {
__bundle_name=$1
__arch_name=$2
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-aarch64-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-aarch64-${fastdebug_infix:-}b${build_number%%.*}
echo Creating $JBR.tar.gz ...
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
}
[ "$bundle_type" == "nomod" ] && bundle_type=""
JBRSDK_BUNDLE=jbrsdk
RELEASE_NAME=windows-aarch64-server-release
IMAGES_DIR=build/$RELEASE_NAME/images
BASE_DIR=.
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
pack_jbr jbr${jbr_name_postfix} jbr
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-aarch64-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
fi

View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# jcef - the release bundles with jcef
# fd - the fastdebug bundles which also include the jcef module
#
# This script packs test-image along with JDK images when bundle_type is set to "jcef".
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
#
source jb/project/tools/common/scripts/common.sh
[ "$bundle_type" == "jcef" ] && do_maketest=1
function pack_jbr {
__bundle_name=$1
__arch_name=$2
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x64-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
echo Creating $JBR.tar.gz ...
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
}
[ "$bundle_type" == "nomod" ] && bundle_type=""
JBRSDK_BUNDLE=jbrsdk
RELEASE_NAME=windows-x86_64-server-release
IMAGES_DIR=build/$RELEASE_NAME/images
BASE_DIR=.
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
pack_jbr jbr${jbr_name_postfix} jbr
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-x64-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
fi

View File

@@ -0,0 +1,50 @@
#!/bin/bash
set -euo pipefail
set -x
# The following parameters must be specified:
# build_number - specifies the number of JetBrainsRuntime build
# bundle_type - specifies bundle to be built;possible values:
# <empty> or nomod - the release bundles without any additional modules (jcef)
# fd - the fastdebug bundles which also include the jcef module
#
source jb/project/tools/common/scripts/common.sh
[ "$bundle_type" == "jcef" ] && echo "not implemented" && do_exit 1
function pack_jbr {
__bundle_name=$1
__arch_name=$2
fastdebug_infix=''
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x86-${fastdebug_infix}b${build_number}
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
echo Creating $JBR.tar.gz ...
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
}
[ "$bundle_type" == "nomod" ] && bundle_type=""
JBRSDK_BUNDLE=jbrsdk
BASE_DIR=.
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
jbr_name_postfix="_${bundle_type}"
else
jbr_name_postfix=""
fi
pack_jbr jbr${jbr_name_postfix} jbr
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
if [ $do_maketest -eq 1 ]; then
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-x86-b$build_number
echo Creating $JBRSDK_TEST.tar.gz ...
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $BASE_DIR --exclude='test/jdk/demos' test || do_exit $?
fi

84
make/JBRApi.gmk Normal file
View File

@@ -0,0 +1,84 @@
#
# Copyright 2000-2021 JetBrains s.r.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
JBR_API_ROOT_DIR := $(TOPDIR)/src/jetbrains.api
JBR_API_TOOLS_DIR := $(JBR_API_ROOT_DIR)/tools
JBR_API_SRC_DIR := $(JBR_API_ROOT_DIR)/src
JBR_API_OUTPUT_DIR := $(OUTPUTDIR)/jbr-api
JBR_API_GENSRC_DIR := $(JBR_API_OUTPUT_DIR)/gensrc
JBR_API_BIN_DIR := $(JBR_API_OUTPUT_DIR)/bin
JBR_API_VERSION_PROPERTIES := $(JBR_API_ROOT_DIR)/version.properties
JBR_API_VERSION_GENSRC := $(JBR_API_OUTPUT_DIR)/jbr-api.version
JBR_API_GENSRC_BATCH := $(JBR_API_VERSION_GENSRC)
JBR_API_SRC_FILES := $(call FindFiles, $(JBR_API_SRC_DIR))
JBR_API_GENSRC_FILES := $(foreach f, $(call FindFiles, $(JBR_API_SRC_DIR)), \
$(JBR_API_GENSRC_DIR)/$(call RelativePath, $f, $(JBR_API_SRC_DIR)))
ifeq ($(JBR_API_JBR_VERSION),)
JBR_API_JBR_VERSION := <DEVELOPMENT>
JBR_API_FAIL_ON_HASH_MISMATCH := false
else
.PHONY: $(JBR_API_VERSION_PROPERTIES)
JBR_API_FAIL_ON_HASH_MISMATCH := true
endif
ARCHIVE_BUILD_JBR_API_BIN := $(JBR_API_BIN_DIR)
$(eval $(call SetupJavaCompilation, BUILD_JBR_API, \
SMALL_JAVA := true, \
COMPILER := bootjdk, \
SRC := $(JBR_API_GENSRC_DIR), \
EXTRA_FILES := $(JBR_API_GENSRC_FILES), \
BIN := $(JBR_API_BIN_DIR), \
JAR := $(JBR_API_OUTPUT_DIR)/jbr-api.jar, \
))
$(eval $(call SetupJarArchive, BUILD_JBR_API_SOURCES_JAR, \
DEPENDENCIES := $(JBR_API_GENSRC_FILES), \
SRCS := $(JBR_API_GENSRC_DIR), \
JAR := $(JBR_API_OUTPUT_DIR)/jbr-api-sources.jar, \
SUFFIXES := .java, \
BIN := $(JBR_API_BIN_DIR), \
))
# Grouped targets may not be supported, so hack dependencies: sources -> version file -> generated sources
$(JBR_API_VERSION_GENSRC): $(JBR_API_SRC_FILES) $(JBR_API_VERSION_PROPERTIES) $(JBR_API_TOOLS_DIR)/Gensrc.java
$(ECHO) Generating sources for JBR API
$(JAVA_CMD) $(JAVA_FLAGS_SMALL) "$(JBR_API_TOOLS_DIR)/Gensrc.java" \
"$(TOPDIR)/src" "$(JBR_API_OUTPUT_DIR)" "$(JBR_API_JBR_VERSION)"
$(JBR_API_GENSRC_FILES): $(JBR_API_VERSION_GENSRC)
$(TOUCH) $@
jbr-api-check-version: $(JBR_API_GENSRC_FILES) $(JBR_API_VERSION_PROPERTIES)
$(JAVA_CMD) $(JAVA_FLAGS_SMALL) "$(JBR_API_TOOLS_DIR)/CheckVersion.java" \
"$(JBR_API_ROOT_DIR)" "$(JBR_API_GENSRC_DIR)" "$(JBR_API_FAIL_ON_HASH_MISMATCH)"
jbr-api: $(BUILD_JBR_API) $(BUILD_JBR_API_SOURCES_JAR) jbr-api-check-version
.PHONY: jbr-api jbr-api-check-version
ifneq ($(JBR_API_CONF_FILE),)
$(JBR_API_CONF_FILE): $(JBR_API_GENSRC_FILES)
$(ECHO) "VERSION=`$(CAT) $(JBR_API_VERSION_GENSRC)`" > $(JBR_API_CONF_FILE)
$(ECHO) "JAR=$(JBR_API_OUTPUT_DIR)/jbr-api.jar" >> $(JBR_API_CONF_FILE)
$(ECHO) "SOURCES_JAR=$(JBR_API_OUTPUT_DIR)/jbr-api-sources.jar" >> $(JBR_API_CONF_FILE)
jbr-api: $(JBR_API_CONF_FILE)
.PHONY: $(JBR_API_CONF_FILE)
endif

View File

@@ -1349,6 +1349,14 @@ create-main-targets-include:
@$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
$(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
################################################################################
# JBR API
$(eval $(call SetupTarget, jbr-api, \
MAKEFILE := JBRApi, \
TARGET := jbr-api \
))
################################################################################
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, Main-post.gmk))

View File

@@ -797,6 +797,15 @@ define SetupRunJtregTestBody
$1_JTREG_BASIC_OPTIONS += -ea -esa
endif
ifeq ($$(ASAN_ENABLED), yes)
$1_JTREG_BASIC_OPTIONS += -e:ASAN_OPTIONS=handle_segv=0:handle_sigfpe=0:detect_leaks=false
$1_JTREG_BASIC_OPTIONS += -e:LD_PRELOAD=libasan.so.5
endif
ifeq ($$(USAN_ENABLED), yes)
$1_JTREG_BASIC_OPTIONS += -e:LD_PRELOAD=libubsan.so.1
endif
ifneq ($$($1_JTREG_NATIVEPATH), )
$1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
endif

View File

@@ -217,6 +217,9 @@ JDKOPT_SETUP_CODE_COVERAGE
# AddressSanitizer
JDKOPT_SETUP_ADDRESS_SANITIZER
# UndefinedBehaviorSanitizer
JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER
###############################################################################
#
# Check dependencies for external and internal libraries.

View File

@@ -252,7 +252,7 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE"
# ASan doesn't work well with _FORTIFY_SOURCE
# See https://github.com/google/sanitizers/wiki/AddressSanitizer#faq
if test "x$ASAN_ENABLED" = xyes; then
if test "x$ASAN_ENABLED" = xyes || test "x$USAN_ENABLED" = xyes; then
ENABLE_FORTIFY_CFLAGS="${DISABLE_FORTIFY_CFLAGS}"
else
ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2"

View File

@@ -445,6 +445,45 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
AC_SUBST(ASAN_ENABLED)
])
###############################################################################
#
# UndefinedBehaviorSanitizer
#
AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
[
UTIL_ARG_ENABLE(NAME: usan, DEFAULT: false,
DESC: [enable UndefinedBehaviorSanitizer],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if UndefinedBehaviorSanitizer (usan) is available])
if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
test "x$TOOLCHAIN_TYPE" = "xclang"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AVAILABLE=false
fi
],
IF_ENABLED: [
USAN_FLAGS="-fsanitize=undefined"
USAN_CFLAGS="$USAN_FLAGS -fno-omit-frame-pointer"
USAN_LDFLAGS="$USAN_FLAGS"
JVM_CFLAGS="$JVM_CFLAGS $USAN_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $USAN_LDFLAGS"
CFLAGS_JDKLIB="$CFLAGS_JDKLIB $USAN_CFLAGS"
CFLAGS_JDKEXE="$CFLAGS_JDKEXE $USAN_CFLAGS"
CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $USAN_CFLAGS"
CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $USAN_CFLAGS"
LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $USAN_LDFLAGS"
LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $USAN_LDFLAGS"
USAN_ENABLED="yes"
],
IF_DISABLED: [
USAN_ENABLED="no"
])
AC_SUBST(USAN_ENABLED)
])
################################################################################
#
# Static build support. When enabled will generate static

View File

@@ -445,7 +445,16 @@ JCOV_FILTERS=@JCOV_FILTERS@
export ASAN_ENABLED:=@ASAN_ENABLED@
export DEVKIT_LIB_DIR:=@DEVKIT_LIB_DIR@
ifeq ($(ASAN_ENABLED), yes)
export ASAN_OPTIONS=handle_segv=0 detect_leaks=0
export ASAN_OPTIONS=handle_segv=0:handle_sigfpe=0:detect_leaks=false
ifneq ($(DEVKIT_LIB_DIR),)
export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
endif
endif
# UndefinedBehaviorSanitizer
export USAN_ENABLED:=@USAN_ENABLED@
export DEVKIT_LIB_DIR:=@DEVKIT_LIB_DIR@
ifeq ($(USAN_ENABLED), yes)
ifneq ($(DEVKIT_LIB_DIR),)
export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
endif

View File

@@ -1,42 +0,0 @@
<!-- importing.xml -->
<project name="jdk">
<taskdef name="wrapLogger" classname="idea.IdeaLoggerWrapper" classpath="${idea.dir}/classes"/>
<wrapLogger/>
<macrodef name="call-make">
<attribute name="dir"/>
<attribute name="args"/>
<sequential>
<exec executable="make" dir="@{dir}" failonerror="true">
<arg line="@{args}"/>
<env key="CLASSPATH" value = ""/>
</exec>
</sequential>
</macrodef>
<target name="cond-clean" unless="${intellij.ismake}">
<antcall target="clean"/>
</target>
<target name="post-make" depends="cond-clean, build-module"/>
<!--
**** Global JDK Build Targets
-->
<target name="clean">
<echo message="base = ${basedir}"/>
<call-make dir = "${build.target.dir}" args = "reconfigure"/>
<call-make dir = "${build.target.dir}" args = "clean"/>
</target>
<target name="images">
<call-make dir = "${build.target.dir}" args = "images"/>
</target>
<target name="build-module">
<call-make dir = "${build.target.dir}" args = "${module.name}"/>
</target>
</project>

View File

@@ -46,13 +46,18 @@ else #with SPEC
endif
idea:
$(ECHO) "SUPPORT=$(SUPPORT_OUTPUTDIR)" >> $(OUT)
$(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(SEL_MODULES), $(call FindModuleSrcDirs,$(mod)))\"" >> $(OUT)
$(ECHO) "MODULES=\"$(foreach mod, $(SEL_MODULES), \
module='$(mod)' \
moduleSrcDirs='$(foreach m,$(call FindModuleSrcDirs,$(mod)),$(call RelativePath,$m,$(topdir)))' \
moduleDependencies='$(call FindTransitiveDepsForModule,$(mod))' \
#)\"" > $(OUT)
$(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT)
$(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT)
$(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT)
$(ECHO) "CYGPATH=\"$(PATHTOOL)\"" >> $(OUT)
$(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT)
$(ECHO) "RELATIVE_TOPLEVEL_PROJECT_DIR=\"$(call RelativePath,$(TOPLEVEL_DIR),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
$(ECHO) "RELATIVE_PROJECT_DIR=\"$(call RelativePath,$(topdir),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
$(ECHO) "RELATIVE_BUILD_DIR=\"$(call RelativePath,$(OUTPUTDIR),$(IDEA_OUTPUT_PARENT))\"" >> $(OUT)
$(ECHO) "CLION_RELATIVE_PROJECT_DIR=\"$(call RelativePath,$(topdir),$(IDEA_OUTPUT_PARENT)/.idea/jdk-clion)\"" >> $(OUT)
$(ECHO) "PATHTOOL=\"$(PATHTOOL)\"" >> $(OUT)
$(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT)
$(ECHO) "WINENV_ROOT=\"$(WINENV_ROOT)\"" >> $(OUT)
endif

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://###ROOT_DIR###/make/ide/idea/jdk/build.xml">
<properties>
<property name="intellij.ismake" value="$IsMake$" />
<property name="build.target.dir" value="###BUILD_DIR###" />
<property name="module.name" value="###MODULE_NAMES###" />
<property name="idea.dir" value="###IDEA_DIR###" />
</properties>
<executeOn event="afterCompilation" target="post-make" />
</buildFile>
</component>
</project>

View File

@@ -3,10 +3,10 @@
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<excludeFromCompile>
<directory url="file://###ROOT_DIR###/src" includeSubdirectories="true" />
<directory url="file://###ROOT_DIR###/build" includeSubdirectories="true" />
<directory url="file://###ROOT_DIR###/make" includeSubdirectories="true" />
<directory url="file://###ROOT_DIR###/test" includeSubdirectories="true" />
<directory url="file://###PROJECT_DIR###/src" includeSubdirectories="true" />
<directory url="file://###PROJECT_DIR###/build" includeSubdirectories="true" />
<directory url="file://###PROJECT_DIR###/make" includeSubdirectories="true" />
<directory url="file://###PROJECT_DIR###/test" includeSubdirectories="false" />
</excludeFromCompile>
<resourceExtensions />
<wildcardResourcePatterns>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CidrRootsConfiguration">
<excludeRoots>
<file path="###CLION_PROJECT_DIR###/build" />
<file path="###CLION_PROJECT_DIR###/make" />
</excludeRoots>
</component>
<component name="CompDBSettings">
<option name="linkedExternalProjectsSettings">
<CompDBProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</CompDBProjectSettings>
</option>
</component>
<component name="CompDBWorkspace" PROJECT_DIR="$PROJECT_DIR$">
<contentRoot DIR="###CLION_PROJECT_DIR###" />
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
</project>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="IssueNavigationConfiguration">
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="###CLION_PROJECT_DIR###" vcs="###VCS_TYPE###" />
</component>
</project>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="CompDBLocalSettings">
<option name="availableProjects">
<map>
<entry>
<key>
<ExternalProjectPojo>
<option name="name" value="jdk-clion" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
</key>
<value>
<list>
<ExternalProjectPojo>
<option name="name" value="jdk-clion" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
</list>
</value>
</entry>
</map>
</option>
<option name="projectSyncType">
<map>
<entry key="$PROJECT_DIR$" value="RE_IMPORT" />
</map>
</option>
</component>
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
</projectState>
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cf.first.check.clang-format" value="false" />
<property name="cidr.known.project.marker" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="CPPToolchains" />
</component>
</project>

View File

@@ -0,0 +1,29 @@
#!/bin/bash
TOPDIR="###CLION_SCRIPT_TOPDIR###"
BUILD_DIR="###RELATIVE_BUILD_DIR###"
PATHTOOL="###PATHTOOL###"
cd "`dirname $0`"
SCRIPT_DIR="`pwd`"
cd "$TOPDIR"
echo "Updating Clion project files in \"$SCRIPT_DIR\" for project \"`pwd`\""
set -o pipefail
make compile-commands SPEC="$BUILD_DIR/spec.gmk" | sed 's/^/ /' || exit 1
if [ "x$PATHTOOL" != "x" ]; then
CLION_PROJECT_DIR="`$PATHTOOL -am $SCRIPT_DIR`"
sed "s/\\\\\\\\\\\\\\\\/\\\\\\\\/g" "$BUILD_DIR/compile_commands.json" > "$SCRIPT_DIR/compile_commands.json"
else
CLION_PROJECT_DIR="$SCRIPT_DIR"
cp "$BUILD_DIR/compile_commands.json" "$SCRIPT_DIR"
fi
echo "
Now you can open \"$CLION_PROJECT_DIR\" as Clion project
If Clion complains about missing files when loading a project, building it may help:
cd \"`pwd`\" && make SPEC=\"$BUILD_DIR/spec.gmk\""

View File

@@ -2,10 +2,9 @@
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://###ROOT_DIR###">
###SOURCE_ROOTS###
<excludeFolder url="file://###ROOT_DIR###/build" />
<excludeFolder url="file://###ROOT_DIR###/make" />
<content url="file://###TOPLEVEL_MODULE_DIR###">
<excludeFolder url="file://###MODULE_DIR###/build" />
<excludeFolder url="file://###MODULE_DIR###/make" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />

View File

@@ -6,11 +6,8 @@
<component name="JTRegService">
<path>###JTREG_HOME###</path>
<workDir>###BUILD_DIR###</workDir>
<jre alt="true" value="###IMAGES_DIR###" />
<jre alt="true" value="###BUILD_DIR###/images/jdk" />
<options></options>
<ant>
<target file="file://###ROOT_DIR###/make/ide/idea/jdk/build.xml" name="images" />
</ant>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" assert-keyword="true" project-jdk-type="JavaSDK">
<output url="file://###BUILD_DIR###/idea" />

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
###MODULE_CONTENT_ROOTS###
<orderEntry type="sourceFolder" forTests="false" />
###DEPENDENCIES###
<orderEntry type="inheritedJdk" />
</component>
</module>

View File

@@ -3,6 +3,8 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/jdk.iml" filepath="$PROJECT_DIR$/.idea/jdk.iml" />
###MODULE_IMLS###
<module fileurl="file://$PROJECT_DIR$/.idea/test.iml" filepath="$PROJECT_DIR$/.idea/test.iml" />
</modules>
</component>
</project>

View File

@@ -1,13 +0,0 @@
package idea;
import org.apache.tools.ant.Task;
/**
* This class implements a custom Ant task which replaces the standard Intellij IDEA Ant logger
* with a custom one which generates tighter output.
*/
public class IdeaLoggerWrapper extends Task {
public void execute() {
new JdkIdeaAntLogger(getProject());
}
}

View File

@@ -1,375 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package idea;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import java.util.EnumSet;
import java.util.Stack;
import static org.apache.tools.ant.Project.*;
/**
* This class is used to wrap the IntelliJ ant logger in order to provide more meaningful
* output when building langtools. The basic ant output in IntelliJ can be quite cumbersome to
* work with, as it provides two separate views: (i) a tree view, which is good to display build task
* in a hierarchical fashion as they are processed; and a (ii) plain text view, which gives you
* the full ant output. The main problem is that javac-related messages are buried into the
* ant output (which is made very verbose by IntelliJ in order to support the tree view). It is
* not easy to figure out which node to expand in order to see the error message; switching
* to plain text doesn't help either, as now the output is totally flat.
*
* This logger class removes a lot of verbosity from the IntelliJ ant logger by not propagating
* all the events to the IntelliJ's logger. In addition, certain events are handled in a custom
* fashion, to generate better output during the build.
*/
public final class JdkIdeaAntLogger extends DefaultLogger {
/**
* This is just a way to pass in customized binary string predicates;
*
* TODO: replace with @code{BiPredicate<String, String>} and method reference when moving to 8
*/
enum StringBinaryPredicate {
CONTAINS() {
@Override
boolean apply(String s1, String s2) {
return s1.contains(s2);
}
},
STARTS_WITH {
@Override
boolean apply(String s1, String s2) {
return s1.startsWith(s2);
}
},
MATCHES {
@Override
boolean apply(String s1, String s2) {
return s1.matches(s2);
}
};
abstract boolean apply(String s1, String s2);
}
/**
* Various kinds of ant messages that we shall intercept
*/
enum MessageKind {
/** a make error */
MAKE_ERROR(StringBinaryPredicate.CONTAINS, MSG_ERR, "error:", "compiler.err"),
/** a make warning */
MAKE_WARNING(StringBinaryPredicate.CONTAINS, MSG_WARN, "warning:", "compiler.warn"),
/** a make note */
MAKE_NOTE(StringBinaryPredicate.CONTAINS, MSG_INFO, "note:", "compiler.note"),
/** std make output */
MAKE_OTHER(StringBinaryPredicate.MATCHES, MSG_INFO, ".*"),
/** a javac crash */
JAVAC_CRASH(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "An exception has occurred in the compiler"),
/** jtreg test success */
JTREG_TEST_PASSED(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Passed: "),
/** jtreg test failure */
JTREG_TEST_FAILED(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "FAILED: "),
/** jtreg test error */
JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: "),
/** jtreg report */
JTREG_TEST_REPORT(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Report written");
StringBinaryPredicate sbp;
int priority;
String[] keys;
MessageKind(StringBinaryPredicate sbp, int priority, String... keys) {
this.sbp = sbp;
this.priority = priority;
this.keys = keys;
}
/**
* Does a given message string matches this kind?
*/
boolean matches(String s) {
for (String key : keys) {
if (sbp.apply(s, key)) {
return true;
}
}
return false;
}
}
/**
* This enum is used to represent the list of tasks we need to keep track of during logging.
*/
enum Task {
/** javac task - invoked during compilation */
MAKE("exec", MessageKind.MAKE_ERROR, MessageKind.MAKE_WARNING, MessageKind.MAKE_NOTE,
MessageKind.MAKE_OTHER, MessageKind.JAVAC_CRASH),
/** jtreg task - invoked during test execution */
JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR, MessageKind.JTREG_TEST_REPORT),
/** initial synthetic task when the logger is created */
ROOT("") {
@Override
boolean matches(String s) {
return false;
}
},
/** synthetic task catching any other tasks not in this list */
ANY("") {
@Override
boolean matches(String s) {
return true;
}
};
String taskName;
MessageKind[] msgs;
Task(String taskName, MessageKind... msgs) {
this.taskName = taskName;
this.msgs = msgs;
}
boolean matches(String s) {
return s.equals(taskName);
}
}
/**
* This enum is used to represent the list of targets we need to keep track of during logging.
* A regular expression is used to match a given target name.
*/
enum Target {
/** jtreg target - executed when launching tests */
JTREG("jtreg") {
@Override
String getDisplayMessage(BuildEvent e) {
return "Running jtreg tests: " + e.getProject().getProperty("jtreg.tests");
}
},
/** build selected modules */
BUILD_MODULE("build-module") {
@Override
String getDisplayMessage(BuildEvent e) {
return "Building modules: " + e.getProject().getProperty("module.name") + "...";
}
},
/** build images */
BUILD_IMAGES("images") {
@Override
String getDisplayMessage(BuildEvent e) {
return "Building images...";
}
},
/** build images */
CONFIGURE("-do-configure") {
@Override
String getDisplayMessage(BuildEvent e) {
return "Configuring build...";
}
},
/** synthetic target catching any other target not in this list */
ANY("") {
@Override
String getDisplayMessage(BuildEvent e) {
return "Executing Ant target(s): " + e.getProject().getProperty("ant.project.invoked-targets");
}
@Override
boolean matches(String msg) {
return true;
}
};
String targetRegex;
Target(String targetRegex) {
this.targetRegex = targetRegex;
}
boolean matches(String msg) {
return msg.matches(targetRegex);
}
abstract String getDisplayMessage(BuildEvent e);
}
/**
* A custom build event used to represent status changes which should be notified inside
* Intellij
*/
static class StatusEvent extends BuildEvent {
/** the target to which the status update refers */
Target target;
StatusEvent(BuildEvent e, Target target) {
super(new StatusTask(e, target.getDisplayMessage(e)));
this.target = target;
setMessage(getTask().getTaskName(), 2);
}
/**
* A custom task used to channel info regarding a status change
*/
static class StatusTask extends org.apache.tools.ant.Task {
StatusTask(BuildEvent event, String msg) {
setProject(event.getProject());
setOwningTarget(event.getTarget());
setTaskName(msg);
}
}
}
/** wrapped ant logger (IntelliJ's own logger) */
DefaultLogger logger;
/** flag - is this the first target we encounter? */
boolean firstTarget = true;
/** flag - should subsequent failures be suppressed ? */
boolean suppressTaskFailures = false;
/** flag - have we ran into a javac crash ? */
boolean crashFound = false;
/** stack of status changes associated with pending targets */
Stack<StatusEvent> statusEvents = new Stack<>();
/** stack of pending tasks */
Stack<Task> tasks = new Stack<>();
public JdkIdeaAntLogger(Project project) {
for (Object o : project.getBuildListeners()) {
if (o instanceof DefaultLogger) {
this.logger = (DefaultLogger)o;
project.removeBuildListener((BuildListener)o);
project.addBuildListener(this);
}
}
tasks.push(Task.ROOT);
}
@Override
public void buildStarted(BuildEvent event) {
//do nothing
}
@Override
public void buildFinished(BuildEvent event) {
//do nothing
}
@Override
public void targetStarted(BuildEvent event) {
EnumSet<Target> statusKinds = firstTarget ?
EnumSet.allOf(Target.class) :
EnumSet.complementOf(EnumSet.of(Target.ANY));
String targetName = event.getTarget().getName();
for (Target statusKind : statusKinds) {
if (statusKind.matches(targetName)) {
StatusEvent statusEvent = new StatusEvent(event, statusKind);
statusEvents.push(statusEvent);
logger.taskStarted(statusEvent);
firstTarget = false;
return;
}
}
}
@Override
public void targetFinished(BuildEvent event) {
if (!statusEvents.isEmpty()) {
StatusEvent lastEvent = statusEvents.pop();
if (lastEvent.target.matches(event.getTarget().getName())) {
logger.taskFinished(lastEvent);
}
}
}
@Override
public void taskStarted(BuildEvent event) {
String taskName = event.getTask().getTaskName();
System.err.println("task started " + taskName);
for (Task task : Task.values()) {
if (task.matches(taskName)) {
tasks.push(task);
return;
}
}
}
@Override
public void taskFinished(BuildEvent event) {
if (tasks.peek() == Task.ROOT) {
//we need to 'close' the root task to get nicer output
logger.taskFinished(event);
} else if (!suppressTaskFailures && event.getException() != null) {
//the first (innermost) task failure should always be logged
event.setMessage(event.getException().toString(), 0);
event.setException(null);
//note: we turn this into a plain message to avoid stack trace being logged by Idea
logger.messageLogged(event);
suppressTaskFailures = true;
}
tasks.pop();
}
@Override
public void messageLogged(BuildEvent event) {
String msg = event.getMessage();
boolean processed = false;
if (!tasks.isEmpty()) {
Task task = tasks.peek();
for (MessageKind messageKind : task.msgs) {
if (messageKind.matches(msg)) {
event.setMessage(msg, messageKind.priority);
processed = true;
if (messageKind == MessageKind.JAVAC_CRASH) {
crashFound = true;
}
break;
}
}
}
if (event.getPriority() == MSG_ERR || crashFound) {
//we log errors regardless of owning task
logger.messageLogged(event);
suppressTaskFailures = true;
} else if (processed) {
logger.messageLogged(event);
}
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://###MODULE_DIR###/test/jdk"></content>
<orderEntry type="sourceFolder" forTests="true" />
###TEST_MODULE_DEPENDENCIES###
<orderEntry type="inheritedJdk" />
</component>
</module>

View File

@@ -4,13 +4,13 @@
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="\d{7}" />
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$0" />
<option name="issueRegexp" value="(?:^|\s|\p{Punct})(?:JDK-)?(\d{7})(?=$|\s|\p{Punct})" />
<option name="linkRegexp" value="https://bugs.openjdk.java.net/browse/JDK-$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="###ROOT_DIR###" vcs="###VCS_TYPE###" />
<mapping directory="###TOPLEVEL_PROJECT_DIR###" vcs="###VCS_TYPE###" />
</component>
</project>

View File

@@ -2,63 +2,62 @@
<project version="4">
<component name="ChangeListManager">
<ignored path="jdk.iws" />
<ignored path="###ROOT_DIR###/build/idea/out/" />
<ignored path="###PROJECT_DIR###/build/idea/out/" />
<ignored path=".idea/" />
</component>
<component name="StructureViewFactory">
<option name="ACTIVE_ACTIONS" value=",ALPHA_COMPARATOR" />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
<buildFile url="file://###ROOT_DIR###/make/ide/idea/jdk/build.xml">
<runInBackground value="false" />
<targetFilters>
<filter targetName="clean" isVisible="true" />
<filter targetName="images" isVisible="true" />
</targetFilters>
<treeView value="false" />
<expanded value="true" />
</buildFile>
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="jdk" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="PackagesPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="jdk" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="jdk" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
<component name="RunManager" selected="Shell Script.images">
<configuration name="clean" type="ShConfigurationType" folderName="make">
<option name="SCRIPT_TEXT" value="###BASH_RUNNER_PREFIX### make clean" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="###PROJECT_DIR###" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
<configuration name="images" type="ShConfigurationType" folderName="make">
<option name="SCRIPT_TEXT" value="###BASH_RUNNER_PREFIX### make images" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="###PROJECT_DIR###" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
<configuration name="reconfigure" type="ShConfigurationType" folderName="make">
<option name="SCRIPT_TEXT" value="###BASH_RUNNER_PREFIX### make reconfigure" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="###PROJECT_DIR###" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
<list>
<item itemvalue="Shell Script.images" />
<item itemvalue="Shell Script.clean" />
<item itemvalue="Shell Script.reconfigure" />
</list>
</component>
</project>

View File

@@ -1142,6 +1142,8 @@ public class WrapperGenerator {
pw.println("/* This file is an automatically generated file, please do not edit this file, modify the XlibParser.java file instead !*/\n" );
pw.println("#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n#include <X11/Xos.h>\n#include <X11/Xatom.h>\n#include <stdio.h>\n");
pw.println("#include <X11/extensions/Xdbe.h>");
pw.println("#include <X11/extensions/XI2.h>");
pw.println("#include <X11/extensions/XInput2.h>");
pw.println("#include <X11/XKBlib.h>");
pw.println("#include \"awt_p.h\"");
pw.println("#include \"color.h\"");

View File

@@ -82,3 +82,13 @@ $(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
TARGETS += $(COPY_LEGAL)
################################################################################
FONTFILE_SRC_DIR := $(TOPDIR)/src/java.desktop/share
FONTFILE_SRCS := $(wildcard $(FONTFILE_SRC_DIR)/fonts/*.ttf) $(wildcard $(FONTFILE_SRC_DIR)/fonts/*.otf) $(FONTFILE_SRC_DIR)/fonts/fonts.dir $(FONTFILE_SRC_DIR)/fonts/font.conf
FONTFILE_TARGET_FILES := $(subst $(FONTFILE_SRC_DIR),$(LIB_DST_DIR),$(FONTFILE_SRCS))
$(LIB_DST_DIR)/fonts/%: $(FONTFILE_SRC_DIR)/fonts/%
$(call install-file)
TARGETS += $(FONTFILE_TARGET_FILES)

View File

@@ -73,6 +73,7 @@ ifeq ($(call isTargetOs, windows), true)
$(TOPDIR)/src/$(MODULE)/share/native/common/font \
$(TOPDIR)/src/$(MODULE)/share/native/common/java2d/opengl \
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/launcher \
#
endif
@@ -167,7 +168,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
LIBS_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
imm32.lib ole32.lib uuid.lib shell32.lib \
comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib dwmapi.lib, \
VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \
))
@@ -500,10 +501,12 @@ else ifeq ($(call isTargetOs, macosx), true)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c \
fontpath.c \
lcdglyph.c
lcdglyph.c \
lcdglyphDW.cpp
else
LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
lcdglyph.c
lcdglyph.c \
lcdglyphDW.cpp
endif
LIBFONTMANAGER_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS

View File

@@ -108,6 +108,17 @@ else
BUILD_JDK_JTREG_EXCLUDE += exeLibraryCache.c
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
BUILD_JDK_JTREG_LIBRARIES_LIBS_libwindows_touch_robot := user32.lib
BUILD_JDK_JTREG_EXCLUDE += libtouchscreen_device.c
else
ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_JDK_JTREG_EXCLUDE += libwindows_touch_robot.c
else
BUILD_JDK_JTREG_EXCLUDE += libtouchscreen_device.c libwindows_touch_robot.c
endif
endif
ifeq ($(call isTargetOs, linux), true)
# Unconditionally compile with debug symbols and don't ever perform
# stripping during the test libraries' build.

View File

@@ -0,0 +1,320 @@
package j2dbench.report;
import java.io.IOException;
import java.nio.file.DirectoryIteratorException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
/**
* The class reads J2DBench scores and reports them into output stream in format applicable for TeamCity charts.
* The directory, where J2DBench result files placed, is specified via command line parameter like follows:
* <p>
* <code>-basexml | -b <xml file path></code>
* </p>
* This directory must contain one file with pattern <code>*{openjdk}*.{res}</code> which is considered as a container
* of reference scores and several <code>*{jbsdk}*.{res}</code>.
* <p>
* <p> Names of these files have several mandatory fields separated by <code>"_"</code> and look like
* <code>osName_jdkName_renderName_*.res</code>
* </p>
* <p>
* If any of score is less than corresponding reference value by 5% then exit code <code>1</code> is returned otherwise
* exit code <code>0</code> is returned.
* <p>
* Standard output will contain scores in format required for TeamCity charts.
* <p>
* Created by vprovodin on 13/02/2017.
*/
public class TCChartReporter {
private static boolean printTCValues = false;
private static boolean printValues = false;
private static final DecimalFormat decimalFormat =
new DecimalFormat("0.00");
private static FileSystem defaultFileSystem = FileSystems.getDefault();
private static double getMeasurementError(String testCaseName, String osName) {
if (testCaseName.contains("text.Rendering.tests.drawString") && osName.toLowerCase().contains("lin") )
return 0.18;
return 0.1;
}
/**
* Level at which tests are grouped to be displayed in summary
*/
private static final int LEVEL = 2;
/**
* Holds the groups and corresponding group-display-names
*/
private static List<String> groups = new ArrayList<>();
private static Map<String, Double> referenceValues = new HashMap<>();
private static boolean testFailed = false;
private static void printUsage() {
String usage =
"\njava TCChartReporter [options] " +
" \n\n" +
"where options include: " +
" \n" +
" -basexml | -b <xml file path> " +
"path to base-build result";
System.out.println(usage);
System.exit(0);
}
/**
* String = getTestResultsTableForSummary()
*/
private static double generateTestCaseReport(
Object key,
Map<String, J2DAnalyzer.ResultHolder> testCaseResult,
Map<String, Integer> testCaseResultCount) {
Integer curTestCountObj = testCaseResultCount.get(key.toString());
int curTestCount = 0;
if (curTestCountObj != null) {
curTestCount = curTestCountObj;
}
double totalScore = 0;
for (int i = 0; i < curTestCount; i++) {
J2DAnalyzer.ResultHolder resultTCR = testCaseResult.get(key.toString() + "_" + i);
totalScore = totalScore + resultTCR.getScore();
}
return totalScore;
}
/**
* Generate Testcase Summary Report for TC - *.out
*/
private static void generateTestCaseSummaryReport(
String OJRname,
Map<String, Double> consoleResult,
Map<String, J2DAnalyzer.ResultHolder> testCaseResult,
Map<String, Integer> testCaseResultCount,
boolean rememberReference) {
String curGroupName, curTestName;
Object[] groupNameArray = groups.toArray();
Object[] testCaseList = consoleResult.keySet().toArray();
Arrays.sort(testCaseList);
for (Object aGroupNameArray : groupNameArray) {
double value;
curGroupName = aGroupNameArray.toString();
for (Object aTestCaseList : testCaseList) {
curTestName = aTestCaseList.toString();
if (curTestName.contains(curGroupName)) {
value = generateTestCaseReport(curTestName, testCaseResult, testCaseResultCount);
if (printTCValues)
System.out.println("##teamcity[buildStatisticValue key='" + (OJRname.isEmpty() ? "" : OJRname + ".") + curTestName
+ "' value='" + decimalFormat.format(value) + "']");
if (printValues)
System.out.println((OJRname.isEmpty() ? "" : OJRname + ".") + curTestName + "," + decimalFormat.format(value));
if (rememberReference) {
referenceValues.put(curTestName, value);
} else {
double refValue = referenceValues.getOrDefault(curTestName, 0.);
if (Math.abs(value/refValue - 1) >= getMeasurementError(curTestName, OJRname)) {
System.err.println(OJRname);
System.err.println(curTestName);
System.err.println("\treferenceValue=" + refValue);
System.err.println("\t actualValue=" + value);
System.err.println("\t diff:" + ((value / refValue - 1) * 100));
testFailed = (value < refValue);
}
}
}
}
}
}
/**
* main
*/
public static void main(String args[]) {
String baseXML = null;
int group = 2;
/* ---- Analysis Mode ----
BEST = 1;
WORST = 2;
AVERAGE = 3;
MIDAVG = 4;
------------------------ */
int analyzerMode = 4;
try {
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-basexml") ||
args[i].startsWith("-b")) {
i++;
baseXML = args[i];
} else if (args[i].startsWith("-tc")) {
printTCValues = true;
} else if (args[i].startsWith("-v"))
printValues = true;
}
} catch (Exception e) {
printUsage();
}
XMLHTMLReporter.setGroupLevel(group);
J2DAnalyzer.setMode(analyzerMode);
if (baseXML != null) {
generateComparisonReport(defaultFileSystem.getPath(baseXML));
} else {
printUsage();
}
if (testFailed)
System.exit(1);
}
/**
* Add Test Group to the list
*/
private static void addGroup(String testName) {
String testNameSplit[] = testName.replace('.', '_').split("_");
StringBuilder group = new StringBuilder(testNameSplit[0]);
for (int i = 1; i < LEVEL; i++) {
group.append(".").append(testNameSplit[i]);
}
if (!groups.contains(group.toString()))
groups.add(group.toString());
}
private static List<Path> listResFiles(Path dir, String pattern) throws IOException {
List<Path> result = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, pattern)) {
for (Path entry : stream) {
result.add(entry);
}
} catch (DirectoryIteratorException ex) {
throw ex.getCause();
}
return result;
}
/**
* Generate the reports from the base & target result XML
*/
private static void generateComparisonReport(Path directoryToResFiles) {
if (directoryToResFiles.toFile().isDirectory()) {
List<Path> jbsdkFiles, openjdkFiles;
try {
jbsdkFiles = listResFiles(directoryToResFiles, "*{jbsdk,jbre}*.{res}");
openjdkFiles = listResFiles(directoryToResFiles, "*{openjdk}*.{res}");
} catch (IOException e) {
e.printStackTrace();
return;
}
readScores(openjdkFiles.get(0), true);
for (Path file : jbsdkFiles) {
readScores(file, false);
}
} else {
readScores(directoryToResFiles, true);
}
}
private static void readScores(Path file, boolean rememberReference) {
String fileName = file.getName(file.getNameCount() - 1).toString();
String osName="", jdkName="", renderName="";
if (fileName.contains("win") || fileName.contains("linux") || fileName.contains("osx")) {
String[] fileNameComponents = fileName.split("_");
if (fileNameComponents.length > 0)
osName = fileNameComponents[0];
if (fileNameComponents.length > 1)
jdkName = fileNameComponents[1];
if (fileNameComponents.length > 2)
renderName = fileNameComponents[2];
}
String resultXMLFileName = file.toString();
J2DAnalyzer.results = new Vector();
J2DAnalyzer.readResults(resultXMLFileName);
J2DAnalyzer.SingleResultSetHolder baseSRSH =
(J2DAnalyzer.SingleResultSetHolder) J2DAnalyzer.results.elementAt(0);
Enumeration baseEnum_ = baseSRSH.getKeyEnumeration();
Vector<String> baseKeyvector = new Vector<>();
while (baseEnum_.hasMoreElements()) {
baseKeyvector.add((String) baseEnum_.nextElement());
}
String baseKeys[] = new String[baseKeyvector.size()];
baseKeyvector.copyInto(baseKeys);
J2DAnalyzer.sort(baseKeys);
Map<String, Double> consoleBaseRes = new HashMap<>();
Map<String, J2DAnalyzer.ResultHolder> testCaseBaseResult = new HashMap<>();
Map<String, Integer> testCaseResultCount = new HashMap<>();
for (String baseKey : baseKeys) {
J2DAnalyzer.ResultHolder baseTCR =
baseSRSH.getResultByKey(baseKey);
Integer curTestCountObj = testCaseResultCount.get(baseTCR.getName());
int curTestCount = 0;
if (curTestCountObj != null) {
curTestCount = curTestCountObj;
}
curTestCount++;
testCaseBaseResult.put(baseTCR.getName() + "_" + (curTestCount - 1), baseTCR);
testCaseResultCount.put(baseTCR.getName(), curTestCount);
addGroup(baseTCR.getName());
Double curTotalScoreObj = consoleBaseRes.get(baseTCR.getName());
double curTotalScore = 0;
if (curTotalScoreObj != null) {
curTotalScore = curTotalScoreObj;
}
curTotalScore = curTotalScore + baseTCR.getScore();
consoleBaseRes.put(baseTCR.getName(), curTotalScore);
}
String OJRname = osName + "." + jdkName + "." + renderName;
generateTestCaseSummaryReport((OJRname.length() == 2? "": OJRname),
consoleBaseRes,
testCaseBaseResult,
testCaseResultCount,
rememberReference);
}
}

View File

@@ -0,0 +1,74 @@
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# - Neither the name of Oracle nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SOURCEPATH=src
CLASSES=build
DIST=dist
RESOURCES=resources
RENDERPERF_CLASSES = $(CLASSES)/renderperf/RenderPerfTest.class
RENDERPERF_SOURCES = $(SOURCEPATH)/renderperf/RenderPerfTest.java
RENDERPERF_RESOURCES = $(CLASSES)/renderperf/images/duke.png
all: mkdirs $(DIST)/RenderPerfTest.jar
run: mkdirs $(DIST)/RenderPerfTest.jar
java -jar $(DIST)/RenderPerfTest.jar
$(DIST)/RenderPerfTest.jar: \
$(RENDERPERF_CLASSES) $(RENDERPERF_RESOURCES) \
$(CLASSES)/renderperf.manifest
jar cvmf $(CLASSES)/renderperf.manifest $(DIST)/RenderPerfTest.jar -C $(CLASSES) .
$(CLASSES)/renderperf/images/%: $(RESOURCES)/images/%
cp -r $< $@
$(CLASSES)/renderperf.manifest:
echo "Main-Class: renderperf.RenderPerfTest" > $@
$(DIST):
mkdir $(DIST)
$(CLASSES):
mkdir $(CLASSES)
mkdir -p $(CLASSES)/renderperf/images
mkdirs: $(DIST) $(CLASSES)
$(RENDERPERF_CLASSES): $(RENDERPERF_SOURCES)
javac -g:none -d $(CLASSES) -sourcepath $(SOURCEPATH) $<
clean:
rm -rf $(CLASSES)
rm -rf $(DIST)

View File

@@ -0,0 +1,34 @@
-----------------------------------------------------------------------
Introduction
-----------------------------------------------------------------------
RenderPerfTest is a set of on-screen rendering microbenchmarks to
analyze the performance of Java2D graphical primitives rendering
-----------------------------------------------------------------------
How To Compile
-----------------------------------------------------------------------
#> cd RenderPerfTest
The benchmark can be compiled by using either ant:
#> ant
or gnumake (assuming there's 'javac' in the path):
#> gnumake
The jar files will be generated into RenderPerfTest/dist directory.
-----------------------------------------------------------------------
How To Run RenderPerfTest
-----------------------------------------------------------------------
Run all tests
#> ant run
or
#> java -jar dist/RenderPerfTest.jar
Run particular test cases
#> java -jar dist/RenderPerfTest.jar testWhiteTextBubblesGray ...

View File

@@ -0,0 +1,94 @@
<!--
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Oracle nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project name="RenderPerfTest" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="resources" location="resources"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac includeantruntime="false" debug="off" srcdir="${src}" destdir="${build}"/>
</target>
<target name="run" depends="dist"
description="run RenderPerfTest" >
<java jar="${dist}/RenderPerfTest.jar"
fork="true"
>
</java>
</target>
<target name="resources" depends="init"
description="copy resources into build dir" >
<!-- Copy the resource files from ${resources} into ${build}/ -->
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/renderperf"/>
<mkdir dir="${build}/renderperf/images"/>
<copy todir="${build}/renderperf/images">
<fileset dir="resources/renderperf/images" />
</copy>
</target>
<target name="dist" depends="compile, resources"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- Put everything in ${build} into the J2DBench.jar file -->
<jar jarfile="${dist}/RenderPerfTest.jar" basedir="${build}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="renderperf.RenderPerfTest"/>
</manifest>
</jar>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,739 @@
/*
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package renderperf;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.QuadCurve2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
public class RenderPerfTest {
private static HashSet<String> ignoredTests = new HashSet<>();
private final static int N = 1000;
private final static float WIDTH = 800;
private final static float HEIGHT = 800;
private final static float R = 25;
private final static int BW = 50;
private final static int BH = 50;
private final static int COUNT = 300;
private final static int DELAY = 10;
private final static int RESOLUTION = 5;
private final static int COLOR_TOLERANCE = 10;
private final static int MAX_MEASURE_TIME = 5000;
interface Configurable {
void configure(Graphics2D g2d);
}
interface Renderable {
void setup(Graphics2D g2d);
void render(Graphics2D g2d);
void update();
}
static class Particles {
private float[] bx;
private float[] by;
private float[] vx;
private float[] vy;
private float r;
private int n;
private float x0;
private float y0;
private float width;
private float height;
Particles(int n, float r, float x0, float y0, float width, float height) {
bx = new float[n];
by = new float[n];
vx = new float[n];
vy = new float[n];
this.n = n;
this.r = r;
this.x0 = x0;
this.y0 = y0;
this.width = width;
this.height = height;
for (int i = 0; i < n; i++) {
bx[i] = (float) (x0 + r + 0.1 + Math.random() * (width - 2 * r - 0.2 - x0));
by[i] = (float) (y0 + r + 0.1 + Math.random() * (height - 2 * r - 0.2 - y0));
vx[i] = 0.1f * (float) (Math.random() * 2 * r - r);
vy[i] = 0.1f * (float) (Math.random() * 2 * r - r);
}
}
void render(Graphics2D g2d, ParticleRenderer renderer) {
for (int i = 0; i < n; i++) {
renderer.render(g2d, i, bx, by, vx, vy);
}
}
void update() {
for (int i = 0; i < n; i++) {
bx[i] += vx[i];
if (bx[i] + r > width || bx[i] - r < x0) vx[i] = -vx[i];
by[i] += vy[i];
if (by[i] + r > height || by[i] - r < y0) vy[i] = -vy[i];
}
}
}
ParticleRenderable createPR(ParticleRenderer renderer) {
return new ParticleRenderable(renderer);
}
static class ParticleRenderable implements Renderable {
ParticleRenderer renderer;
Configurable configure;
ParticleRenderable(ParticleRenderer renderer, Configurable configure) {
this.renderer = renderer;
this.configure = configure;
}
ParticleRenderable(ParticleRenderer renderer) {
this(renderer, null);
}
@Override
public void setup(Graphics2D g2d) {
if (configure != null) configure.configure(g2d);
}
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, renderer);
}
@Override
public void update() {
balls.update();
}
public ParticleRenderable configure(Configurable configure) {
this.configure = configure;
return this;
}
}
interface ParticleRenderer {
void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy);
}
static class FlatParticleRenderer implements ParticleRenderer {
Color[] colors;
float r;
FlatParticleRenderer(int n, float r) {
colors = new Color[n];
this.r = r;
for (int i = 0; i < n; i++) {
colors[i] = new Color((float) Math.random(),
(float) Math.random(), (float) Math.random());
}
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.fillOval((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class WhiteTextParticleRenderer implements ParticleRenderer {
float r;
WhiteTextParticleRenderer(float r) {
this.r = r;
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(Color.WHITE);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
setPaint(g2d, id);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] - r));
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)y[id]);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] + r));
}
}
static class TextParticleRenderer extends WhiteTextParticleRenderer {
Color[] colors;
float r;
TextParticleRenderer(int n, float r) {
super(r);
colors = new Color[n];
this.r = r;
for (int i = 0; i < n; i++) {
colors[i] = new Color((float) Math.random(),
(float) Math.random(), (float) Math.random());
}
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(colors[id % colors.length]);
}
}
static class LargeTextParticleRenderer extends TextParticleRenderer {
LargeTextParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
setPaint(g2d, id);
Font font = new Font("LucidaGrande", Font.PLAIN, 32);
g2d.setFont(font);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] - r));
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)y[id]);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] + r));
}
}
static class FlatOvalRotParticleRenderer extends FlatParticleRenderer {
FlatOvalRotParticleRenderer(int n, float r) {
super(n, r);
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(colors[id % colors.length]);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
setPaint(g2d, id);
if (Math.abs(vx[id] + vy[id]) > 0.001) {
AffineTransform t = (AffineTransform) g2d.getTransform().clone();
double l = vx[id] / Math.sqrt(vx[id] * vx[id] + vy[id] * vy[id]);
if (vy[id] < 0) {
l = -l;
}
g2d.translate(x[id], y[id]);
g2d.rotate(Math.acos(l));
g2d.fillOval(-(int)r, (int)(-0.5*r), (int) (2 * r), (int)r);
g2d.setTransform(t);
} else {
g2d.fillOval((int)(x[id] - r), (int)(y[id] - 0.5*r),
(int) (2 * r), (int) r);
}
}
}
static class LinGradOvalRotParticleRenderer extends FlatOvalRotParticleRenderer {
LinGradOvalRotParticleRenderer(int n, float r) {
super(n, r);
}
@Override
void setPaint(Graphics2D g2d, int id) {
Point2D start = new Point2D.Double(- r, - 0.5*r);
Point2D end = new Point2D.Double( 2 * r, r);
float[] dist = {0.0f, 1.0f};
Color[] cls = {colors[id %colors.length], colors[(colors.length - id) %colors.length]};
LinearGradientPaint p =
new LinearGradientPaint(start, end, dist, cls);
g2d.setPaint(p);
}
}
static class FlatBoxParticleRenderer extends FlatParticleRenderer {
FlatBoxParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.fillRect((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class ImgParticleRenderer extends FlatParticleRenderer {
BufferedImage dukeImg;
ImgParticleRenderer(int n, float r) {
super(n, r);
try {
dukeImg = ImageIO.read(
Objects.requireNonNull(
RenderPerfTest.class.getClassLoader().getResourceAsStream(
"renderperf/images/duke.png")));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawImage(dukeImg, (int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r), null);
}
}
static class FlatBoxRotParticleRenderer extends FlatParticleRenderer {
FlatBoxRotParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
if (Math.abs(vx[id] + vy[id]) > 0.001) {
AffineTransform t = (AffineTransform) g2d.getTransform().clone();
double l = vx[id] / Math.sqrt(vx[id] * vx[id] + vy[id] * vy[id]);
if (vy[id] < 0) {
l = -l;
}
g2d.translate(x[id], y[id]);
g2d.rotate(Math.acos(l));
g2d.fillRect(-(int)r, -(int)r, (int) (2 * r), (int) (2 * r));
g2d.setTransform(t);
} else {
g2d.fillRect((int)(x[id] - r), (int)(y[id] - r),
(int) (2 * r), (int) (2 * r));
}
}
}
static class WiredParticleRenderer extends FlatParticleRenderer {
WiredParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawOval((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class WiredBoxParticleRenderer extends FlatParticleRenderer {
WiredBoxParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawRect((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class SegParticleRenderer extends FlatParticleRenderer {
SegParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
double v = Math.sqrt(vx[id]*vx[id]+vy[id]*vy[id]);
float nvx = (float) (vx[id]/v);
float nvy = (float) (vy[id]/v);
g2d.setColor(colors[id % colors.length]);
g2d.drawLine((int)(x[id] - r*nvx), (int)(y[id] - r*nvy),
(int)(x[id] + 2*r*nvx), (int)(y[id] + 2*r*nvy));
}
}
static class WiredQuadParticleRenderer extends FlatParticleRenderer {
WiredQuadParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
if (id > 2 && (id % 3) == 0) {
g2d.setColor(colors[id % colors.length]);
g2d.draw(new QuadCurve2D.Float(x[id-3], y[id-3], x[id-2], y[id-2], x[id-1], y[id-1]));
}
}
}
static class FlatQuadParticleRenderer extends FlatParticleRenderer {
FlatQuadParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
if (id > 2 && (id % 3) == 0) {
g2d.setColor(colors[id % colors.length]);
g2d.fill(new QuadCurve2D.Float(x[id-3], y[id-3], x[id-2], y[id-2], x[id-1], y[id-1]));
}
}
}
static class PerfMeter {
private String name;
private int frame = 0;
private JPanel panel;
private long time;
private double execTime = 0;
private Color expColor = Color.RED;
AtomicBoolean waiting = new AtomicBoolean(false);
private double fps;
PerfMeter(String name) {
this.name = name;
}
PerfMeter exec(final Renderable renderable) throws Exception {
final CountDownLatch latch = new CountDownLatch(COUNT);
final CountDownLatch latchFrame = new CountDownLatch(1);
final long endTime = System.currentTimeMillis() + MAX_MEASURE_TIME;
final JFrame f = new JFrame();
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
latchFrame.countDown();
}
});
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
panel = new JPanel()
{
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
time = System.nanoTime();
Graphics2D g2d = (Graphics2D) g.create();
renderable.setup(g2d);
renderable.render(g2d);
g2d.setColor(expColor);
g.fillRect(0, 0, BW, BH);
}
};
panel.setPreferredSize(new Dimension((int)(WIDTH + BW), (int)(HEIGHT + BH)));
panel.setBackground(Color.BLACK);
f.add(panel);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
});
Robot robot = new Robot();
Timer timer = new Timer(DELAY, e -> {
if (waiting.compareAndSet(false, true)) {
Color c = robot.getPixelColor(
panel.getTopLevelAncestor().getX() + panel.getTopLevelAncestor().getInsets().left + BW / 2,
panel.getTopLevelAncestor().getY() + panel.getTopLevelAncestor().getInsets().top + BW / 2);
if (isAlmostEqual(c, Color.BLUE)) {
expColor = Color.RED;
} else {
expColor = Color.BLUE;
}
renderable.update();
panel.getParent().repaint();
} else {
while (!isAlmostEqual(
robot.getPixelColor(
panel.getTopLevelAncestor().getX() + panel.getTopLevelAncestor().getInsets().left + BW/2,
panel.getTopLevelAncestor().getY() + panel.getTopLevelAncestor().getInsets().top + BH/2),
expColor))
{
try {
Thread.sleep(RESOLUTION);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
time = System.nanoTime() - time;
execTime += time;
frame++;
waiting.set(false);
}
if (System.currentTimeMillis() < endTime) {
latch.countDown();
} else {
while(latch.getCount() > 0) latch.countDown();
}
});
timer.start();
latch.await();
SwingUtilities.invokeAndWait(() -> {
timer.stop();
f.setVisible(false);
f.dispose();
});
latchFrame.await();
if (execTime != 0 && frame != 0) {
fps = 1e9 / (execTime / frame);
} else {
fps = 0;
}
return this;
}
private void report() {
System.err.println(name + " : " + String.format("%.2f FPS", fps));
}
private boolean isAlmostEqual(Color c1, Color c2) {
return Math.abs(c1.getRed() - c2.getRed()) < COLOR_TOLERANCE ||
Math.abs(c1.getGreen() - c2.getGreen()) < COLOR_TOLERANCE ||
Math.abs(c1.getBlue() - c2.getBlue()) < COLOR_TOLERANCE;
}
}
private static final Particles balls = new Particles(N, R, BW, BH, WIDTH, HEIGHT);
private static final ParticleRenderer flatRenderer = new FlatParticleRenderer(N, R);
private static final ParticleRenderer flatOvalRotRenderer = new FlatOvalRotParticleRenderer(N, R);
private static final ParticleRenderer flatBoxRenderer = new FlatBoxParticleRenderer(N, R);
private static final ParticleRenderer flatBoxRotRenderer = new FlatBoxRotParticleRenderer(N, R);
private static final ParticleRenderer linGradOvalRotRenderer = new LinGradOvalRotParticleRenderer(N, R);
private static final ParticleRenderer wiredRenderer = new WiredParticleRenderer(N, R);
private static final ParticleRenderer wiredBoxRenderer = new WiredBoxParticleRenderer(N, R);
private static final ParticleRenderer segRenderer = new SegParticleRenderer(N, R);
private static final ParticleRenderer flatQuadRenderer = new FlatQuadParticleRenderer(N, R);
private static final ParticleRenderer wiredQuadRenderer = new WiredQuadParticleRenderer(N, R);
private static final ParticleRenderer imgRenderer = new ImgParticleRenderer(N, R);
private static final ParticleRenderer textRenderer = new TextParticleRenderer(N, R);
private static final ParticleRenderer largeTextRenderer = new LargeTextParticleRenderer(N, R);
private static final ParticleRenderer whiteTextRenderer = new WhiteTextParticleRenderer(R);
private static final Configurable AA = (Graphics2D g2d) ->
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
private static final Configurable TextLCD = (Graphics2D g2d) ->
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
private static final Configurable TextAA = (Graphics2D g2d) ->
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
public void testFlatBubbles() throws Exception {
(new PerfMeter("FlatOval")).exec(createPR(flatRenderer)).report();
}
public void testFlatBubblesAA() throws Exception {
(new PerfMeter("FlatOvalAA")).exec(createPR(flatRenderer).configure(AA)).report();
}
public void testFlatBoxBubbles() throws Exception {
(new PerfMeter("FlatBox")).exec(createPR(flatBoxRenderer)).report();
}
public void testFlatBoxBubblesAA() throws Exception {
(new PerfMeter("FlatBoxAA")).exec(createPR(flatBoxRenderer).configure(AA)).report();
}
public void testImgBubbles() throws Exception {
(new PerfMeter("Image")).exec(createPR(imgRenderer)).report();
}
public void testImgBubblesAA() throws Exception {
(new PerfMeter("ImageAA")).exec(createPR(imgRenderer).configure(AA)).report();
}
public void testFlatBoxRotBubbles() throws Exception {
(new PerfMeter("RotatedBox")).exec(createPR(flatBoxRotRenderer)).report();
}
public void testFlatBoxRotBubblesAA() throws Exception {
(new PerfMeter("RotatedBoxAA")).exec(createPR(flatBoxRotRenderer).configure(AA)).report();
}
public void testFlatOvalRotBubbles() throws Exception {
(new PerfMeter("RotatedOval")).exec(createPR(flatOvalRotRenderer)).report();
}
public void testFlatOvalRotBubblesAA() throws Exception {
(new PerfMeter("RotatedOvalAA")).exec(createPR(flatOvalRotRenderer).configure(AA)).report();
}
public void testLinGradOvalRotBubbles() throws Exception {
(new PerfMeter("LinGradRotatedOval")).exec(createPR(linGradOvalRotRenderer)).report();
}
public void testLinGradOvalRotBubblesAA() throws Exception {
(new PerfMeter("LinGradRotatedOvalAA")).exec(createPR(linGradOvalRotRenderer).configure(AA)).report();
}
public void testWiredBubbles() throws Exception {
(new PerfMeter("WiredBubbles")).exec(createPR(wiredRenderer)).report();
}
public void testWiredBubblesAA() throws Exception {
(new PerfMeter("WiredBubblesAA")).exec(createPR(wiredRenderer).configure(AA)).report();
}
public void testWiredBoxBubbles() throws Exception {
(new PerfMeter("WiredBox")).exec(createPR(wiredBoxRenderer)).report();
}
public void testWiredBoxBubblesAA() throws Exception {
(new PerfMeter("WiredBoxAA")).exec(createPR(wiredBoxRenderer).configure(AA)).report();
}
public void testLines() throws Exception {
(new PerfMeter("Lines")).exec(createPR(segRenderer)).report();
}
public void testLinesAA() throws Exception {
(new PerfMeter("LinesAA")).exec(createPR(segRenderer).configure(AA)).report();
}
public void testFlatQuad() throws Exception {
(new PerfMeter("FlatQuad")).exec(createPR(flatQuadRenderer)).report();
}
public void testFlatQuadAA() throws Exception {
(new PerfMeter("FlatQuadAA")).exec(createPR(flatQuadRenderer).configure(AA)).report();
}
public void testWiredQuad() throws Exception {
(new PerfMeter("WiredQuad")).exec(createPR(wiredQuadRenderer)).report();
}
public void testWiredQuadAA() throws Exception {
(new PerfMeter("WiredQuadAA")).exec(createPR(wiredQuadRenderer).configure(AA)).report();
}
public void testTextBubblesNoAA() throws Exception {
(new PerfMeter("TextNoAA")).exec(createPR(textRenderer)).report();
}
public void testTextBubblesLCD() throws Exception {
(new PerfMeter("TextLCD")).exec(createPR(textRenderer).configure(TextLCD)).report();
}
public void testTextBubblesGray() throws Exception {
(new PerfMeter("TextGray")).exec(createPR(textRenderer).configure(TextAA)).report();
}
public void testLargeTextBubblesNoAA() throws Exception {
(new PerfMeter("LargeTextNoAA")).exec(createPR(largeTextRenderer)).report();
}
public void testLargeTextBubblesLCD() throws Exception {
(new PerfMeter("LargeTextLCD")).exec(createPR(largeTextRenderer).configure(TextLCD)).report();
}
public void testLargeTextBubblesGray() throws Exception {
(new PerfMeter("LargeTextGray")).exec(createPR(largeTextRenderer).configure(TextAA)).report();
}
public void testWhiteTextBubblesNoAA() throws Exception {
(new PerfMeter("WhiteTextNoAA")).exec(createPR(whiteTextRenderer)).report();
}
public void testWhiteTextBubblesLCD() throws Exception {
(new PerfMeter("WhiteTextLCD")).exec(createPR(whiteTextRenderer).configure(TextLCD)).report();
}
public void testWhiteTextBubblesGray() throws Exception {
(new PerfMeter("WhiteTextGray")).exec(createPR(whiteTextRenderer).configure(TextAA)).report();
}
public static void main(String[] args)
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException
{
RenderPerfTest test = new RenderPerfTest();
if (args.length > 0) {
for (String testCase : args) {
Method m = RenderPerfTest.class.getDeclaredMethod(testCase);
m.invoke(test);
}
} else {
Method[] methods = RenderPerfTest.class.getDeclaredMethods();
for (Method m : methods) {
if (m.getName().startsWith("test") && !ignoredTests.contains(m.getName())) {
m.invoke(test);
}
}
}
}
}

View File

@@ -1118,6 +1118,10 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
return NULL;
}
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
return os::dll_load(filename, ebuf, ebuflen);
}
void os::print_dll_info(outputStream *st) {
st->print_cr("Dynamic libraries:");
LoadedLibraries::print(st);

View File

@@ -1185,6 +1185,10 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
}
#endif // !__APPLE__
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
return os::dll_load(filename, ebuf, ebuflen);
}
int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) {
outputStream * out = (outputStream *) param;
out->print_cr(INTPTR_FORMAT " \t%s", (intptr_t)base_address, name);

View File

@@ -1735,6 +1735,10 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
return NULL;
}
void * os::dll_load_utf8(const char *filename, char *ebuf, int ebuflen) {
return os::dll_load(filename, ebuf, ebuflen);
}
void * os::Linux::dlopen_helper(const char *filename, char *ebuf,
int ebuflen) {
void * result = ::dlopen(filename, RTLD_LAZY);

View File

@@ -564,6 +564,12 @@ int JVM_HANDLE_XXX_SIGNAL(int sig, siginfo_t* info,
return true; // ignore it
}
if (sig == SIGABRT) {
// Re-set the handler so that we don't recurse if/when abort() is called
// from here.
os::signal(SIGABRT, (void*)SIG_DFL);
}
// Note: it's not uncommon that JNI code uses signal/sigset to install,
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
// or have a SIGILL handler when detecting CPU type). When that happens,
@@ -1299,6 +1305,9 @@ void install_signal_handlers() {
// check because late initialization will overwrite it to UserHandler.
set_signal_handler(BREAK_SIGNAL, false);
}
if (getenv("JVM_NO_SIGABRT") == NULL) {
set_signal_handler(SIGABRT);
}
#if defined(__APPLE__)
// lldb (gdb) installs both standard BSD signal handlers, and mach exception
// handlers. By replacing the existing task exception handler, we disable lldb's mach

View File

@@ -1499,9 +1499,221 @@ static int _print_module(const char* fname, address base_address,
return 0;
}
static errno_t convert_to_UTF16(char const* source_str, UINT source_encoding, LPWSTR* dest_utf16_str) {
const int len_estimated = MultiByteToWideChar(source_encoding,
MB_ERR_INVALID_CHARS,
source_str,
-1, // source is null-terminated
NULL,
0); // estimate characters count
if (len_estimated == 0) {
// Probably source_str contains characters that cannot be represented in the source_encoding given.
*dest_utf16_str = NULL;
return EINVAL;
}
*dest_utf16_str = NEW_C_HEAP_ARRAY(WCHAR, len_estimated, mtInternal);
const int len_real = MultiByteToWideChar(source_encoding,
MB_ERR_INVALID_CHARS,
source_str,
-1, // source is null-terminated
*dest_utf16_str, len_estimated);
assert(len_real == len_estimated, "length already checked above");
return ERROR_SUCCESS;
}
// Converts a string in the "platform" encoding to UTF16.
static errno_t convert_to_UTF16(char const* platform_str, LPWSTR* utf16_str) {
return convert_to_UTF16(platform_str, CP_ACP, utf16_str);
}
static errno_t convert_UTF8_to_UTF16(char const* utf8_str, LPWSTR* utf16_str) {
return convert_to_UTF16(utf8_str, CP_UTF8, utf16_str);
}
// Converts a wide-character string in UTF-16 encoding to the 8-bit "platform" encoding.
// Unless the platform encoding is UTF-8, not all characters in the source string can be represented in the dest string.
// The function succeeds in this case anyway and just replaces these with a certain character.
static errno_t convert_UTF16_to_platform(LPWSTR source_utf16_str, char*& dest_str) {
const int len_estimated = WideCharToMultiByte(CP_ACP,
0,
source_utf16_str,
-1, // source is null-terminated
NULL,
0, // estimate characters count
NULL, NULL);
if (len_estimated == 0) {
dest_str = NULL;
return EINVAL;
}
dest_str = NEW_C_HEAP_ARRAY(CHAR, len_estimated, mtInternal);
const int len_real = WideCharToMultiByte(CP_ACP,
0,
source_utf16_str,
-1, // source is null-terminated
dest_str, len_estimated, NULL, NULL);
assert(len_real == len_estimated, "length already checked above");
return ERROR_SUCCESS;
}
class MemoryReleaserW : public StackObj {
private:
WCHAR* _object_ptr;
public:
MemoryReleaserW(WCHAR * object_ptr) : _object_ptr(object_ptr) {}
~MemoryReleaserW() { if (_object_ptr != NULL) FREE_C_HEAP_ARRAY(WCHAR, _object_ptr); }
};
class MemoryReleaser : public StackObj {
private:
CHAR* _object_ptr;
public:
MemoryReleaser(CHAR * object_ptr) : _object_ptr(object_ptr) {}
~MemoryReleaser() { if (_object_ptr != NULL) FREE_C_HEAP_ARRAY(CHAR, _object_ptr); }
};
// Loads .dll/.so and
// in case of error it checks if .dll/.so was built for the
// same architecture as Hotspot is running on
void * os::dll_load_utf8(const char *utf8_name, char *ebuf, int ebuflen) {
LPWSTR utf16_name = NULL;
errno_t err = convert_UTF8_to_UTF16(utf8_name, &utf16_name);
MemoryReleaserW release_utf16_name(utf16_name);
if (err != ERROR_SUCCESS) {
errno = err;
return NULL;
}
char* platform_name = NULL; // name of the library converted to the "platform" encoding for use in log messages
errno_t ignored_err = convert_UTF16_to_platform(utf16_name, platform_name);
MemoryReleaser release_platform_name(platform_name);
log_info(os)("attempting shared library load of %s", platform_name);
void * result = LoadLibraryW(utf16_name);
if (result != NULL) {
Events::log(NULL, "Loaded shared library %s", platform_name);
// Recalculate pdb search path if a DLL was loaded successfully.
SymbolEngine::recalc_search_path();
log_info(os)("shared library load of %s was successful", platform_name);
return result;
}
DWORD errcode = GetLastError();
// Read system error message into ebuf
// It may or may not be overwritten below (in the for loop and just above)
lasterror(ebuf, (size_t) ebuflen);
ebuf[ebuflen - 1] = '\0';
Events::log(NULL, "Loading shared library %s failed, error code %lu", platform_name, errcode);
log_info(os)("shared library load of %s failed, error code %lu", platform_name, errcode);
if (errcode == ERROR_MOD_NOT_FOUND) {
strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);
ebuf[ebuflen - 1] = '\0';
return NULL;
}
// Parsing dll below
// If we can read dll-info and find that dll was built
// for an architecture other than Hotspot is running in
// - then print to buffer "DLL was built for a different architecture"
// else call os::lasterror to obtain system error message
int fd = ::wopen(utf16_name, O_RDONLY | O_BINARY, 0);
if (fd < 0) {
return NULL;
}
uint32_t signature_offset;
uint16_t lib_arch = 0;
bool failed_to_get_lib_arch =
( // Go to position 3c in the dll
(os::seek_to_file_offset(fd, IMAGE_FILE_PTR_TO_SIGNATURE) < 0)
||
// Read location of signature
(sizeof(signature_offset) !=
(::read(fd, (void*)&signature_offset, sizeof(signature_offset))))
||
// Go to COFF File Header in dll
// that is located after "signature" (4 bytes long)
(os::seek_to_file_offset(fd,
signature_offset + IMAGE_FILE_SIGNATURE_LENGTH) < 0)
||
// Read field that contains code of architecture
// that dll was built for
(sizeof(lib_arch) != (::read(fd, (void*)&lib_arch, sizeof(lib_arch))))
);
::close(fd);
if (failed_to_get_lib_arch) {
// file i/o error - report os::lasterror(...) msg
return NULL;
}
typedef struct {
uint16_t arch_code;
char* arch_name;
} arch_t;
static const arch_t arch_array[] = {
{IMAGE_FILE_MACHINE_I386, (char*)"IA 32"},
{IMAGE_FILE_MACHINE_AMD64, (char*)"AMD 64"},
{IMAGE_FILE_MACHINE_ARM64, (char*)"ARM 64"}
};
#if (defined _M_ARM64)
static const uint16_t running_arch = IMAGE_FILE_MACHINE_ARM64;
#elif (defined _M_AMD64)
static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64;
#elif (defined _M_IX86)
static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386;
#else
#error Method os::dll_load requires that one of following \
is defined :_M_AMD64 or _M_IX86 or _M_ARM64
#endif
// Obtain a string for printf operation
// lib_arch_str shall contain string what platform this .dll was built for
// running_arch_str shall string contain what platform Hotspot was built for
char *running_arch_str = NULL, *lib_arch_str = NULL;
for (unsigned int i = 0; i < ARRAY_SIZE(arch_array); i++) {
if (lib_arch == arch_array[i].arch_code) {
lib_arch_str = arch_array[i].arch_name;
}
if (running_arch == arch_array[i].arch_code) {
running_arch_str = arch_array[i].arch_name;
}
}
assert(running_arch_str,
"Didn't find running architecture code in arch_array");
// If the architecture is right
// but some other error took place - report os::lasterror(...) msg
if (lib_arch == running_arch) {
return NULL;
}
if (lib_arch_str != NULL) {
::_snprintf(ebuf, ebuflen - 1,
"Can't load %s-bit .dll on a %s-bit platform",
lib_arch_str, running_arch_str);
} else {
// don't know what architecture this dll was build for
::_snprintf(ebuf, ebuflen - 1,
"Can't load this .dll (machine code=0x%x) on a %s-bit platform",
lib_arch, running_arch_str);
}
return NULL;
}
void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
log_info(os)("attempting shared library load of %s", name);
@@ -4448,7 +4660,7 @@ static wchar_t* wide_abs_unc_path(char const* path, errno_t & err, int additiona
set_path_prefix(buf, &prefix, &prefix_off, &needs_fullpath);
LPWSTR unicode_path = NULL;
err = convert_to_unicode(buf, &unicode_path);
err = convert_to_UTF16(buf, &unicode_path);
FREE_C_HEAP_ARRAY(char, buf);
if (err != ERROR_SUCCESS) {
return NULL;

View File

@@ -808,6 +808,19 @@ bool BlockBegin::try_merge(ValueStack* new_state, bool has_irreducible_loops) {
}
}
for_each_stack_value(existing_state, index, existing_value) {
if ( !(existing_value->as_Phi() != NULL && existing_value->as_Phi()->block() == this)) {
TRACE_PHI(tty->print_cr("Re-entered loop head without existing phi for stack - bailout"));
return false;
}
}
for_each_local_value(existing_state, index, existing_value) {
if (!(existing_value == new_state->local_at(index) || (existing_value->as_Phi() != NULL && existing_value->as_Phi()->as_Phi()->block() == this))) {
TRACE_PHI(tty->print_cr("Re-entered loop head without existing phi for modified local - bailout"));
return false;
}
}
#ifdef ASSERT
// check that all necessary phi functions are present
for_each_stack_value(existing_state, index, existing_value) {

View File

@@ -113,10 +113,12 @@ class JfrNetworkInterfaceName : public JfrSerializer {
void serialize(JfrCheckpointWriter& writer) {} // we write each constant lazily
void on_rotation() {
for (int i = 0; i < _interfaces->length(); ++i) {
const InterfaceEntry& entry = _interfaces->at(i);
if (entry.written) {
entry.written = false;
if (_interfaces != NULL) {
for (int i = 0; i < _interfaces->length(); ++i) {
const InterfaceEntry &entry = _interfaces->at(i);
if (entry.written) {
entry.written = false;
}
}
}
}

View File

@@ -1286,7 +1286,7 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree *loop, ProjNode*
Node* idx = cmp->in(1);
assert(!invar.is_invariant(idx), "index is variant");
Node* rng = cmp->in(2);
assert(rng->Opcode() == Op_LoadRange || iff->is_RangeCheck() || _igvn.type(rng)->is_int()->_lo >= 0, "must be");
// [tav: crash] assert(rng->Opcode() == Op_LoadRange || iff->is_RangeCheck() || _igvn.type(rng)->is_int()->_lo >= 0, "must be");
assert(invar.is_invariant(rng), "range must be invariant");
int scale = 1;
Node* offset = zero;

View File

@@ -3571,6 +3571,19 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
return ret;
}
#ifdef LINUX
static void unsetLdPreload() {
// Workaround for: JBR-2253 Preload libjsig.so to fix JNA crashes
// NOTE: Probably it still can affect child processes, see
// https://stackoverflow.com/questions/3275015/ld-preload-affects-new-child-even-after-unsetenvld-preload
char * envUnset = ::getenv("UNSET_LD_PRELOAD");
if (envUnset != NULL && strlen(envUnset) > 3 && strncmp("true", envUnset, 4) == 0) {
unsetenv("LD_PRELOAD");
fprintf(stdout, "LD_PRELOAD was unset\n");
}
}
#endif //LINUX
DT_RETURN_MARK_DECL(CreateJavaVM, jint
, HOTSPOT_JNI_CREATEJAVAVM_RETURN(_ret_ref));
@@ -3679,6 +3692,10 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
ThreadStateTransition::transition_from_vm(thread, _thread_in_native);
MACOS_AARCH64_ONLY(thread->enable_wx(WXExec));
#ifdef LINUX
unsetLdPreload();
#endif //LINUX
} else {
// If create_vm exits because of a pending exception, exit with that
// exception. In the future when we figure out how to reclaim memory,

View File

@@ -3433,34 +3433,30 @@ JVM_LEAF(void*, JVM_LoadZipLibrary())
return ClassLoader::zip_library_handle();
JVM_END
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name, jboolean throwException))
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* utf8_name, jboolean throwException))
//%note jvm_ct
char ebuf[1024];
void *load_result;
{
ThreadToNativeFromVM ttnfvm(thread);
load_result = os::dll_load(name, ebuf, sizeof ebuf);
load_result = os::dll_load_utf8(utf8_name, ebuf, sizeof ebuf);
}
if (load_result == NULL) {
if (throwException) {
char msg[1024];
jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
// Since 'ebuf' may contain a string encoded using
// platform encoding scheme, we need to pass
// Exceptions::unsafe_to_utf8 to the new_exception method
// as the last argument. See bug 6367357.
jio_snprintf(msg, sizeof msg, "%s: %s", utf8_name, ebuf);
Handle h_exception =
Exceptions::new_exception(thread,
vmSymbols::java_lang_UnsatisfiedLinkError(),
msg, Exceptions::unsafe_to_utf8);
msg);
THROW_HANDLE_0(h_exception);
} else {
log_info(library)("Failed to load library %s", name);
log_info(library)("Failed to load library %s", utf8_name);
return load_result;
}
}
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, name, p2i(load_result));
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, utf8_name, p2i(load_result));
return load_result;
JVM_END

View File

@@ -117,7 +117,7 @@ const char* Abstract_VM_Version::vm_vendor() {
#ifdef VENDOR
return VENDOR;
#else
return "Oracle Corporation";
return "JetBrains s.r.o.";
#endif
}

View File

@@ -888,6 +888,7 @@ bool os::print_function_and_library_name(outputStream* st,
return have_function_name || have_library_name;
}
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
void os::print_hex_dump(outputStream* st, address start, address end, int unitsize,
int bytes_per_line, address logical_start) {
assert(unitsize == 1 || unitsize == 2 || unitsize == 4 || unitsize == 8, "just checking");

View File

@@ -643,6 +643,7 @@ class os: AllStatic {
// same architecture as HotSpot is running on
// in case of an error NULL is returned and an error message is stored in ebuf
static void* dll_load(const char *name, char *ebuf, int ebuflen);
static void* dll_load_utf8(const char *name, char *ebuf, int ebuflen);
// lookup symbol in a shared library
static void* dll_lookup(void* handle, const char* name);

View File

@@ -95,4 +95,10 @@
#define ALLOW_C_FUNCTION(name, ...) __VA_ARGS__
#endif
#if defined(__clang__) || defined (__GNUC__)
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion) __attribute__((no_sanitize_address))
#else
# define ATTRIBUTE_NO_SANITIZE_ADDRESS(reason_for_exclusion)
#endif
#endif // SHARE_UTILITIES_COMPILERWARNINGS_HPP

View File

@@ -108,6 +108,11 @@ inline int g_isnan(jdouble f) { return _isnan(f); }
inline int g_isfinite(jfloat f) { return _finite(f); }
inline int g_isfinite(jdouble f) { return _finite(f); }
// Miscellaneous
// Visual Studio 2005 deprecates POSIX names - use ISO C++ names instead
#define wopen _wopen
// Formatting.
#define FORMAT64_MODIFIER "I64"

View File

@@ -520,6 +520,7 @@ void VMError::clear_step_start_time() {
// could be nested report_and_die() calls on stack (see above). Only one
// thread can report error, so large buffers are statically allocated in data
// segment.
ATTRIBUTE_NO_SANITIZE_ADDRESS("Memory is read raw here without any regard for objects' boundaries")
void VMError::report(outputStream* st, bool _verbose) {
# define BEGIN if (_current_step == 0) { _current_step = __LINE__;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@ package sun.nio.fs;
import java.nio.file.*;
import java.io.IOException;
import java.util.*;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
/**
* Bsd implementation of FileSystem
@@ -45,8 +43,8 @@ class BsdFileSystem extends UnixFileSystem {
public WatchService newWatchService()
throws IOException
{
// use polling implementation until we implement a BSD/kqueue one
return new PollingWatchService();
final boolean usePollingWatchService = Boolean.getBoolean("watch.service.polling");
return usePollingWatchService ? new PollingWatchService() : new MacOSXWatchService();
}
// lazy initialization of the list of supported attribute views

View File

@@ -0,0 +1,826 @@
/*
* Copyright (c) 2021, 2022, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.nio.fs;
import sun.util.logging.PlatformLogger;
import jdk.internal.misc.Unsafe;
import java.io.IOException;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.DirectoryIteratorException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.NotDirectoryException;
import java.nio.file.Path;
import java.nio.file.StandardWatchEventKinds;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayDeque;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.function.Consumer;
class MacOSXWatchService extends AbstractWatchService {
// Controls tracing in the native part of the watcher.
private static boolean tracingEnabled = false;
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.nio.fs.MacOSXWatchService");
private final HashMap<Object, MacOSXWatchKey> dirKeyToWatchKey = new HashMap<>();
private final HashMap<Long, MacOSXWatchKey> eventStreamToWatchKey = new HashMap<>();
private final Object watchKeysLock = new Object();
private final CFRunLoopThread runLoopThread;
MacOSXWatchService() throws IOException {
runLoopThread = new CFRunLoopThread();
runLoopThread.setDaemon(true);
runLoopThread.start();
try {
// In order to be able to schedule any FSEventStream's, a reference to a run loop is required.
runLoopThread.waitForRunLoopRef();
} catch (InterruptedException e) {
throw new IOException(e);
}
}
@Override
WatchKey register(Path dir, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException {
checkIsOpen();
final UnixPath unixDir = (UnixPath)dir;
final Object dirKey = checkPath(unixDir);
final EnumSet<FSEventKind> eventSet = FSEventKind.setOf(events);
final EnumSet<WatchModifier> modifierSet = WatchModifier.setOf(modifiers);
synchronized (closeLock()) {
checkIsOpen();
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("register for " + dir);
synchronized (watchKeysLock) {
MacOSXWatchKey watchKey = dirKeyToWatchKey.get(dirKey);
final boolean keyForDirAlreadyExists = (watchKey != null);
if (keyForDirAlreadyExists) {
eventStreamToWatchKey.remove(watchKey.getEventStreamRef());
watchKey.disable();
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("re-used existing watch key");
} else {
watchKey = new MacOSXWatchKey(this, unixDir, dirKey);
dirKeyToWatchKey.put(dirKey, watchKey);
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("created a new watch key");
}
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("starting to [re-]populate directory cache with data");
watchKey.enable(runLoopThread, eventSet, modifierSet);
eventStreamToWatchKey.put(watchKey.getEventStreamRef(), watchKey);
watchKeysLock.notify(); // So that run loop gets running again if stopped due to lack of event streams
return watchKey;
}
}
}
/**
* Invoked on the CFRunLoopThread by the native code to report directories that need to be re-scanned.
*/
private void callback(final long eventStreamRef, final String[] paths, final long eventFlagsPtr) {
synchronized (watchKeysLock) {
final MacOSXWatchKey watchKey = eventStreamToWatchKey.get(eventStreamRef);
if (watchKey != null) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("Callback fired for '" + watchKey.getRealRootPath() + "'");
watchKey.handleEvents(paths, eventFlagsPtr);
} else {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("Callback fired for watch key that is no longer there");
}
}
}
void cancel(final MacOSXWatchKey watchKey) {
synchronized (watchKeysLock) {
dirKeyToWatchKey.remove(watchKey.getRootPathKey());
eventStreamToWatchKey.remove(watchKey.getEventStreamRef());
}
}
void waitForEventSource() {
synchronized (watchKeysLock) {
if (isOpen() && eventStreamToWatchKey.isEmpty()) {
try {
watchKeysLock.wait();
} catch (InterruptedException ignore) {}
}
}
}
@Override
void implClose() {
synchronized (watchKeysLock) {
eventStreamToWatchKey.clear();
dirKeyToWatchKey.forEach((key, watchKey) -> watchKey.invalidate());
dirKeyToWatchKey.clear();
watchKeysLock.notify(); // Let waitForEventSource() go if it was waiting
runLoopThread.runLoopStop(); // Force exit from CFRunLoopRun()
}
}
private static void traceLine(final String text) {
logger.finest("NATIVE trace: " + text);
}
private class CFRunLoopThread extends Thread {
// Native reference to the CFRunLoop object of the watch service run loop.
private long runLoopRef;
public CFRunLoopThread() {
super("FileSystemWatcher");
}
synchronized void waitForRunLoopRef() throws InterruptedException {
if (runLoopRef == 0)
runLoopThread.wait(); // ...for CFRunLoopRef to become available
}
long getRunLoopRef() {
return runLoopRef;
}
synchronized void runLoopStop() {
if (runLoopRef != 0) {
// The run loop may have stuck in CFRunLoopRun() even though all of its input sources
// have been removed. Need to terminate it explicitly so that it can run to completion.
MacOSXWatchService.CFRunLoopStop(runLoopRef);
}
}
@Override
public void run() {
synchronized (this) {
runLoopRef = CFRunLoopGetCurrent();
notify();
}
while (isOpen()) {
CFRunLoopRun(MacOSXWatchService.this);
waitForEventSource();
}
synchronized (this) {
runLoopRef = 0; // CFRunLoopRef is no longer usable when the loop has been terminated
}
}
}
private void checkIsOpen() {
if (!isOpen())
throw new ClosedWatchServiceException();
}
private Object checkPath(UnixPath dir) throws IOException {
if (dir == null)
throw new NullPointerException("No path to watch");
UnixFileAttributes attrs;
try {
attrs = UnixFileAttributes.get(dir, true);
} catch (UnixException x) {
throw x.asIOException(dir);
}
if (!attrs.isDirectory())
throw new NotDirectoryException(dir.getPathForExceptionMessage());
final Object fileKey = attrs.fileKey();
if (fileKey == null)
throw new AssertionError("File keys must be supported");
return fileKey;
}
private enum FSEventKind {
CREATE, MODIFY, DELETE, OVERFLOW;
public static FSEventKind of(final WatchEvent.Kind<?> watchEventKind) {
if (StandardWatchEventKinds.ENTRY_CREATE == watchEventKind) {
return CREATE;
} else if (StandardWatchEventKinds.ENTRY_MODIFY == watchEventKind) {
return MODIFY;
} else if (StandardWatchEventKinds.ENTRY_DELETE == watchEventKind) {
return DELETE;
} else if (StandardWatchEventKinds.OVERFLOW == watchEventKind) {
return OVERFLOW;
} else {
throw new UnsupportedOperationException(watchEventKind.name());
}
}
public static EnumSet<FSEventKind> setOf(final WatchEvent.Kind<?>[] events) {
final EnumSet<FSEventKind> eventSet = EnumSet.noneOf(FSEventKind.class);
for (final WatchEvent.Kind<?> event: events) {
if (event == null) {
throw new NullPointerException("An element in event set is 'null'");
} else if (event == StandardWatchEventKinds.OVERFLOW) {
continue;
}
eventSet.add(FSEventKind.of(event));
}
if (eventSet.isEmpty())
throw new IllegalArgumentException("No events to register");
return eventSet;
}
}
private enum WatchModifier {
FILE_TREE, SENSITIVITY_HIGH, SENSITIVITY_MEDIUM, SENSITIVITY_LOW;
public static WatchModifier of(final WatchEvent.Modifier watchEventModifier) {
if (ExtendedOptions.FILE_TREE.matches(watchEventModifier)) {
return FILE_TREE;
} if (ExtendedOptions.SENSITIVITY_HIGH.matches(watchEventModifier)) {
return SENSITIVITY_HIGH;
} if (ExtendedOptions.SENSITIVITY_MEDIUM.matches(watchEventModifier)) {
return SENSITIVITY_MEDIUM;
} if (ExtendedOptions.SENSITIVITY_LOW.matches(watchEventModifier)) {
return SENSITIVITY_LOW;
} else {
throw new UnsupportedOperationException(watchEventModifier.name());
}
}
public static EnumSet<WatchModifier> setOf(final WatchEvent.Modifier[] modifiers) {
final EnumSet<WatchModifier> modifierSet = EnumSet.noneOf(WatchModifier.class);
for (final WatchEvent.Modifier modifier : modifiers) {
if (modifier == null)
throw new NullPointerException("An element in modifier set is 'null'");
modifierSet.add(WatchModifier.of(modifier));
}
return modifierSet;
}
public static double sensitivityOf(final EnumSet<WatchModifier> modifiers) {
if (modifiers.contains(SENSITIVITY_HIGH)) {
return 0.1;
} else if (modifiers.contains(SENSITIVITY_LOW)) {
return 1;
} else {
return 0.5; // aka SENSITIVITY_MEDIUM
}
}
}
private static class MacOSXWatchKey extends AbstractWatchKey {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private static final long kFSEventStreamEventFlagMustScanSubDirs = 0x00000001;
private static final long kFSEventStreamEventFlagRootChanged = 0x00000020;
private final static Path relativeRootPath = Path.of("");
// Full path to this key's watch root directory.
private final Path realRootPath;
private final int realRootPathLength;
private final Object rootPathKey;
// Kinds of events to be reported.
private EnumSet<FSEventKind> eventsToWatch;
// Should events in directories below realRootPath reported?
private boolean watchFileTree;
// Native FSEventStreamRef as returned by FSEventStreamCreate().
private long eventStreamRef;
private final Object eventStreamRefLock = new Object();
private final DirectoryTreeSnapshot directoryTreeSnapshot = new DirectoryTreeSnapshot();
MacOSXWatchKey(final MacOSXWatchService watchService, final UnixPath dir, final Object rootPathKey) throws IOException {
super(dir, watchService);
this.realRootPath = dir.toRealPath().normalize();
this.realRootPathLength = realRootPath.toString().length() + 1;
this.rootPathKey = rootPathKey;
}
synchronized void enable(final CFRunLoopThread runLoopThread,
final EnumSet<FSEventKind> eventsToWatch,
final EnumSet<WatchModifier> modifierSet) throws IOException {
assert(!isValid());
this.eventsToWatch = eventsToWatch;
this.watchFileTree = modifierSet.contains(WatchModifier.FILE_TREE);
directoryTreeSnapshot.build();
synchronized (eventStreamRefLock) {
final int kFSEventStreamCreateFlagWatchRoot = 0x00000004;
eventStreamRef = MacOSXWatchService.eventStreamCreate(
realRootPath.toString(),
WatchModifier.sensitivityOf(modifierSet),
kFSEventStreamCreateFlagWatchRoot);
if (eventStreamRef == 0)
throw new IOException("Unable to create FSEventStream");
MacOSXWatchService.eventStreamSchedule(eventStreamRef, runLoopThread.getRunLoopRef());
}
}
synchronized void disable() {
invalidate();
directoryTreeSnapshot.reset();
}
synchronized void handleEvents(final String[] paths, long eventFlagsPtr) {
if (paths == null) {
reportOverflow(null);
return;
}
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): will handle " + paths.length + " events");
final Set<Path> dirsToScan = new LinkedHashSet<>(paths.length);
final Set<Path> dirsToScanRecursively = new LinkedHashSet<>();
collectDirsToScan(paths, eventFlagsPtr, dirsToScan, dirsToScanRecursively);
for (final Path recurseDir : dirsToScanRecursively) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): scanning directory recursively " + recurseDir);
dirsToScan.removeIf(dir -> dir.startsWith(recurseDir));
assert(watchFileTree);
directoryTreeSnapshot.update(recurseDir, true);
}
for (final Path dir : dirsToScan) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): scanning directory " + dir);
directoryTreeSnapshot.update(dir, false);
}
}
private Path toRelativePath(final String absPath) {
return (absPath.length() > realRootPathLength)
? Path.of(absPath.substring(realRootPathLength))
: relativeRootPath;
}
private void collectDirsToScan(final String[] paths, long eventFlagsPtr,
final Set<Path> dirsToScan,
final Set<Path> dirsToScanRecursively) {
for (final String absPath : paths) {
if (absPath == null) {
reportOverflow(null);
continue;
}
Path path = toRelativePath(absPath);
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): event path name " + path);
if (!watchFileTree && !relativeRootPath.equals(path)) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): skipping event for a nested directory");
continue;
}
final int flags = unsafe.getInt(eventFlagsPtr);
if ((flags & kFSEventStreamEventFlagRootChanged) != 0) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("handleEvents(): watch root changed, path=" + path);
cancel();
signal();
break;
} else if ((flags & kFSEventStreamEventFlagMustScanSubDirs) != 0 && watchFileTree) {
dirsToScanRecursively.add(path);
} else {
dirsToScan.add(path);
}
final long SIZEOF_FS_EVENT_STREAM_EVENT_FLAGS = 4L; // FSEventStreamEventFlags is UInt32
eventFlagsPtr += SIZEOF_FS_EVENT_STREAM_EVENT_FLAGS;
}
}
/**
* Represents a snapshot of a directory tree.
* The snapshot includes subdirectories iff <code>watchFileTree</code> is <code>true</code>.
*/
private class DirectoryTreeSnapshot {
private final HashMap<Path, DirectorySnapshot> snapshots;
DirectoryTreeSnapshot() {
this.snapshots = new HashMap<>(watchFileTree ? 256 : 1);
}
void build() throws IOException {
final Queue<Path> pathToDo = new ArrayDeque<>();
pathToDo.offer(relativeRootPath);
while (!pathToDo.isEmpty()) {
final Path path = pathToDo.poll();
try {
createForOneDirectory(path, watchFileTree ? pathToDo : null);
} catch (IOException e) {
final boolean exceptionForRootPath = relativeRootPath.equals(path);
if (exceptionForRootPath)
throw e; // report to the user as the watch root may have disappeared
// Ignore for sub-directories as some may have been removed during the scan.
// That's OK, those kinds of changes in the directory hierarchy is what
// WatchService is used for. However, it's impossible to catch all changes
// at this point, so we may fail to report some events that had occurred before
// FSEventStream has been created to watch for those changes.
}
}
}
private DirectorySnapshot createForOneDirectory(
final Path directory,
final Queue<Path> newDirectoriesFound) throws IOException {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("Creating snapshot for one directory " + directory);
final DirectorySnapshot snapshot = DirectorySnapshot.create(getRealRootPath(), directory);
snapshots.put(directory, snapshot);
if (newDirectoriesFound != null)
snapshot.forEachDirectory(newDirectoriesFound::offer);
return snapshot;
}
void reset() {
snapshots.clear();
}
void update(final Path directory, final boolean recurse) {
if (!recurse) {
directoryTreeSnapshot.update(directory, null);
} else {
final Queue<Path> pathToDo = new ArrayDeque<>();
pathToDo.offer(directory);
while (!pathToDo.isEmpty()) {
final Path dir = pathToDo.poll();
directoryTreeSnapshot.update(dir, pathToDo);
}
}
}
private void update(final Path directory, final Queue<Path> modifiedDirs) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("update for " + directory);
final DirectorySnapshot snapshot = snapshots.get(directory);
if (snapshot == null) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("no snapshot for directory " + directory);
// This means that we missed a notification about an update of our parent.
// Report overflow (who knows what else we weren't notified about?) and
// do our best to recover from this mess by queueing our parent for an update.
reportOverflow(directory);
if (modifiedDirs != null)
modifiedDirs.offer(getParentOf(directory));
return;
}
// FSEvents API does not generate events for directories that got moved from/to the directory
// being watched, so we have to watch for new/deleted directories ourselves. If we still
// receive an event for, say, one of the new directories, it won't be reported again as this
// will count as refresh with no modifications detected.
final Queue<Path> createdDirs = new ArrayDeque<>();
final Queue<Path> deletedDirs = new ArrayDeque<>();
snapshot.update(MacOSXWatchKey.this, createdDirs, deletedDirs, modifiedDirs);
handleNewDirectories(createdDirs);
handleDeletedDirectories(deletedDirs);
}
private Path getParentOf(final Path directory) {
Path parent = directory.getParent();
if (parent == null)
parent = relativeRootPath;
return parent;
}
private void handleDeletedDirectories(final Queue<Path> deletedDirs) {
// We don't know the exact sequence in which these were deleted,
// so at least maintain a sensible order, i.e. children are deleted before the parent.
final LinkedList<Path> dirsToReportDeleted = new LinkedList<>();
while (!deletedDirs.isEmpty()) {
final Path path = deletedDirs.poll();
dirsToReportDeleted.addFirst(path);
final DirectorySnapshot directorySnapshot = snapshots.get(path);
if (directorySnapshot != null) // May be null if we're not watching the whole file tree.
directorySnapshot.forEachDirectory(deletedDirs::offer);
}
for(final Path path : dirsToReportDeleted) {
final DirectorySnapshot directorySnapshot = snapshots.remove(path);
if (directorySnapshot != null) {
// This is needed in case a directory tree was moved (mv -f) out of this directory.
directorySnapshot.forEachFile(MacOSXWatchKey.this::reportDeleted);
}
reportDeleted(path);
}
}
private void handleNewDirectories(final Queue<Path> createdDirs) {
// We don't know the exact sequence in which these were created,
// so at least maintain a sensible order, i.e. the parent created before its children.
while (!createdDirs.isEmpty()) {
final Path path = createdDirs.poll();
reportCreated(path);
if (watchFileTree) {
if (!snapshots.containsKey(path)) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("Just noticed yet another directory: " + path);
// Happens when a directory tree gets moved (mv -f) into this directory.
DirectorySnapshot newSnapshot = null;
try {
newSnapshot = createForOneDirectory(path, createdDirs);
} catch(IOException ignore) { }
if (newSnapshot != null)
newSnapshot.forEachFile(MacOSXWatchKey.this::reportCreated);
}
}
}
}
}
/**
* Represents a snapshot of a directory with a millisecond precision timestamp of the last modification.
*/
private static class DirectorySnapshot {
// Path to this directory relative to the watch root.
private final Path directory;
// Maps file names to their attributes.
private final Map<Path, Entry> files;
// A counter to keep track of files that have disappeared since the last run.
private long currentTick;
private DirectorySnapshot(final Path directory) {
this.directory = directory;
this.files = new HashMap<>();
}
static DirectorySnapshot create(final Path realRootPath, final Path directory) throws IOException {
final DirectorySnapshot snapshot = new DirectorySnapshot(directory);
try (final DirectoryStream<Path> directoryStream = Files.newDirectoryStream(realRootPath.resolve(directory))) {
for (final Path file : directoryStream) {
try {
final BasicFileAttributes attrs = Files.readAttributes(file, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
final Entry entry = new Entry(attrs.isDirectory(), attrs.lastModifiedTime().toMillis(), 0);
snapshot.files.put(file.getFileName(), entry);
} catch (IOException ignore) {}
}
} catch (DirectoryIteratorException e) {
throw e.getCause();
}
return snapshot;
}
void forEachDirectory(final Consumer<Path> consumer) {
files.forEach((path, entry) -> { if (entry.isDirectory) consumer.accept(directory.resolve(path)); } );
}
void forEachFile(final Consumer<Path> consumer) {
files.forEach((path, entry) -> { if (!entry.isDirectory) consumer.accept(directory.resolve(path)); } );
}
void update(final MacOSXWatchKey watchKey,
final Queue<Path> createdDirs,
final Queue<Path> deletedDirs,
final Queue<Path> modifiedDirs) {
currentTick++;
try (final DirectoryStream<Path> directoryStream = Files.newDirectoryStream(watchKey.getRealRootPath().resolve(directory))) {
for (final Path file : directoryStream) {
try {
final BasicFileAttributes attrs
= Files.readAttributes(file, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
final Path fileName = file.getFileName();
final Entry entry = files.get(fileName);
final boolean isNew = (entry == null);
final long lastModified = attrs.lastModifiedTime().toMillis();
final Path relativePath = directory.resolve(fileName);
if (attrs.isDirectory()) {
if (isNew) {
files.put(fileName, new Entry(true, lastModified, currentTick));
if (createdDirs != null) createdDirs.offer(relativePath);
} else {
if (!entry.isDirectory) { // Used to be a file, now a directory
if (createdDirs != null) createdDirs.offer(relativePath);
files.put(fileName, new Entry(true, lastModified, currentTick));
watchKey.reportDeleted(relativePath);
} else if (entry.isModified(lastModified)) {
if (modifiedDirs != null) modifiedDirs.offer(relativePath);
watchKey.reportModified(relativePath);
}
entry.update(lastModified, currentTick);
}
} else {
if (isNew) {
files.put(fileName, new Entry(false, lastModified, currentTick));
watchKey.reportCreated(relativePath);
} else {
if (entry.isDirectory) { // Used to be a directory, now a file.
if (deletedDirs != null) deletedDirs.offer(relativePath);
files.put(fileName, new Entry(false, lastModified, currentTick));
watchKey.reportCreated(directory.resolve(fileName));
} else if (entry.isModified(lastModified)) {
watchKey.reportModified(relativePath);
}
entry.update(lastModified, currentTick);
}
}
} catch (IOException ignore) {
// Simply skip the file we couldn't read; it'll get marked as deleted later.
}
}
} catch (IOException | DirectoryIteratorException ignore) {
// Most probably this directory has just been deleted; our parent will notice that.
}
checkDeleted(watchKey, deletedDirs);
}
private void checkDeleted(final MacOSXWatchKey watchKey, final Queue<Path> deletedDirs) {
final Iterator<Map.Entry<Path, Entry>> it = files.entrySet().iterator();
while (it.hasNext()) {
final Map.Entry<Path, Entry> mapEntry = it.next();
final Entry entry = mapEntry.getValue();
if (entry.lastTickCount != currentTick) {
final Path file = mapEntry.getKey();
it.remove();
if (entry.isDirectory) {
if (deletedDirs != null) deletedDirs.offer(directory.resolve(file));
} else {
watchKey.reportDeleted(directory.resolve(file));
}
}
}
}
/**
* Information about an entry in a directory.
*/
private static class Entry {
private long lastModified;
private long lastTickCount;
private final boolean isDirectory;
Entry(final boolean isDirectory, final long lastModified, final long lastTickCount) {
this.lastModified = lastModified;
this.lastTickCount = lastTickCount;
this.isDirectory = isDirectory;
}
boolean isModified(final long lastModified) {
return (this.lastModified != lastModified);
}
void update(final long lastModified, final long lastTickCount) {
this.lastModified = lastModified;
this.lastTickCount = lastTickCount;
}
}
}
private void reportCreated(final Path path) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("About to report CREATE for path " + path);
if (eventsToWatch.contains(FSEventKind.CREATE))
signalEvent(StandardWatchEventKinds.ENTRY_CREATE, path);
}
private void reportDeleted(final Path path) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("About to report DELETE for path " + path);
if (eventsToWatch.contains(FSEventKind.DELETE))
signalEvent(StandardWatchEventKinds.ENTRY_DELETE, path);
}
private void reportModified(final Path path) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("About to report MODIFIED for path " + path);
if (eventsToWatch.contains(FSEventKind.MODIFY))
signalEvent(StandardWatchEventKinds.ENTRY_MODIFY, path);
}
private void reportOverflow(final Path path) {
if (logger.isLoggable(PlatformLogger.Level.FINEST))
logger.finest("About to report OVERFLOW for path " + path);
if (eventsToWatch.contains(FSEventKind.OVERFLOW))
signalEvent(StandardWatchEventKinds.OVERFLOW, path);
}
public Object getRootPathKey() {
return rootPathKey;
}
public Path getRealRootPath() {
return realRootPath;
}
@Override
public boolean isValid() {
synchronized (eventStreamRefLock) {
return eventStreamRef != 0;
}
}
@Override
public void cancel() {
if (!isValid()) return;
// First, must stop the corresponding run loop:
((MacOSXWatchService) watcher()).cancel(this);
// Next, invalidate the corresponding native FSEventStream.
invalidate();
}
void invalidate() {
synchronized (eventStreamRefLock) {
if (isValid()) {
eventStreamStop(eventStreamRef);
eventStreamRef = 0;
}
}
}
long getEventStreamRef() {
synchronized (eventStreamRefLock) {
assert (isValid());
return eventStreamRef;
}
}
}
/* native methods */
private static native long eventStreamCreate(String dir, double latencyInSeconds, int flags);
private static native void eventStreamSchedule(long eventStreamRef, long runLoopRef);
private static native void eventStreamStop(long eventStreamRef);
private static native long CFRunLoopGetCurrent();
private static native void CFRunLoopRun(final MacOSXWatchService watchService);
private static native void CFRunLoopStop(long runLoopRef);
private static native void initIDs();
static {
tracingEnabled = logger.isLoggable(PlatformLogger.Level.FINEST);
System.loadLibrary("nio");
initIDs();
}
}

View File

@@ -0,0 +1,253 @@
/*
* Copyright (c) 2021, 2022, JetBrains s.r.o.. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "jni.h"
#include "jni_util.h"
#include "nio_util.h"
#include <stdarg.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#if defined(__GNUC__) || defined(__clang__)
# ifndef ATTRIBUTE_PRINTF
# define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
# endif
#endif
static void
traceLine(JNIEnv* env, const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3);
// Controls exception stack trace output and debug trace.
// Set by raising the logging level of sun.nio.fs.MacOSXWatchService to or above FINEST.
static jboolean tracingEnabled;
static jmethodID callbackMID; // MacOSXWatchService.callback()
static __thread jobject watchService; // The instance of MacOSXWatchService that is associated with this thread
JNIEXPORT void JNICALL
Java_sun_nio_fs_MacOSXWatchService_initIDs(JNIEnv* env, __unused jclass clazz)
{
jfieldID tracingEnabledFieldID = (*env)->GetStaticFieldID(env, clazz, "tracingEnabled", "Z");
CHECK_NULL(tracingEnabledFieldID);
tracingEnabled = (*env)->GetStaticBooleanField(env, clazz, tracingEnabledFieldID);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
}
callbackMID = (*env)->GetMethodID(env, clazz, "callback", "(J[Ljava/lang/String;J)V");
}
extern CFStringRef toCFString(JNIEnv *env, jstring javaString);
static void
traceLine(JNIEnv* env, const char* fmt, ...)
{
if (tracingEnabled) {
va_list vargs;
va_start(vargs, fmt);
char* buf = (char*)malloc(1024);
vsnprintf(buf, 1024, fmt, vargs);
const jstring text = JNU_NewStringPlatform(env, buf);
free(buf);
va_end(vargs);
jboolean ignoreException;
JNU_CallStaticMethodByName(env, &ignoreException, "sun/nio/fs/MacOSXWatchService", "traceLine", "(Ljava/lang/String;)V", text);
}
}
static jboolean
convertToJavaStringArray(JNIEnv* env, char **eventPaths,
const jsize numEventsToReport, jobjectArray javaEventPathsArray)
{
for (jsize i = 0; i < numEventsToReport; i++) {
const jstring path = JNU_NewStringPlatform(env, eventPaths[i]);
CHECK_NULL_RETURN(path, FALSE);
(*env)->SetObjectArrayElement(env, javaEventPathsArray, i, path);
}
return JNI_TRUE;
}
static void
callJavaCallback(JNIEnv* env, jlong streamRef, jobjectArray javaEventPathsArray, jlong eventFlags)
{
if (callbackMID != NULL && watchService != NULL) {
// We are called on the run loop thread, so it's OK to use the thread-local reference
// to the watch service.
(*env)->CallVoidMethod(env, watchService, callbackMID, streamRef, javaEventPathsArray, eventFlags);
}
}
/**
* Callback that is invoked on the run loop thread and informs of new file-system events from an FSEventStream.
*/
static void
callback(__unused ConstFSEventStreamRef streamRef,
__unused void *clientCallBackInfo,
size_t numEventsTotal,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
__unused const FSEventStreamEventId eventIds[])
{
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (!env) { // Shouldn't happen as run loop starts from Java code
return;
}
// We can get more events at once than the number of Java array elements,
// so report them in chunks.
const size_t MAX_EVENTS_TO_REPORT_AT_ONCE = (INT_MAX - 2);
jboolean success = JNI_TRUE;
for(size_t eventIndex = 0; success && (eventIndex < numEventsTotal); ) {
const size_t numEventsRemaining = (numEventsTotal - eventIndex);
const jsize numEventsToReport = (numEventsRemaining > MAX_EVENTS_TO_REPORT_AT_ONCE)
? MAX_EVENTS_TO_REPORT_AT_ONCE
: numEventsRemaining;
const jboolean localFramePushed = ((*env)->PushLocalFrame(env, numEventsToReport + 5) == JNI_OK);
success = localFramePushed;
jobjectArray javaEventPathsArray = NULL;
if (success) {
javaEventPathsArray = (*env)->NewObjectArray(env, (jsize)numEventsToReport, JNU_ClassString(env), NULL);
success = (javaEventPathsArray != NULL);
}
if (success) {
success = convertToJavaStringArray(env, &((char**)eventPaths)[eventIndex], numEventsToReport, javaEventPathsArray);
}
callJavaCallback(env, (jlong)streamRef, javaEventPathsArray, (jlong)&eventFlags[eventIndex]);
if ((*env)->ExceptionCheck(env)) {
if (tracingEnabled) (*env)->ExceptionDescribe(env);
}
if (localFramePushed) {
(*env)->PopLocalFrame(env, NULL);
}
eventIndex += numEventsToReport;
}
}
/**
* Creates a new FSEventStream and returns FSEventStreamRef for it.
*/
JNIEXPORT jlong JNICALL
Java_sun_nio_fs_MacOSXWatchService_eventStreamCreate(JNIEnv* env, __unused jclass clazz,
jstring dir, jdouble latencyInSeconds, jint flags)
{
const CFStringRef path = toCFString(env, dir);
CHECK_NULL_RETURN(path, 0);
const CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **) &path, 1, NULL);
CHECK_NULL_RETURN(pathsToWatch, 0);
const FSEventStreamRef stream = FSEventStreamCreate(
NULL,
&callback,
NULL,
pathsToWatch,
kFSEventStreamEventIdSinceNow,
(CFAbsoluteTime) latencyInSeconds,
flags
);
traceLine(env, "created event stream 0x%p", stream);
return (jlong)stream;
}
/**
* Schedules the given FSEventStream on the run loop of the current thread. Starts the stream
* so that the run loop can receive events from the stream.
*/
JNIEXPORT void JNICALL
Java_sun_nio_fs_MacOSXWatchService_eventStreamSchedule(__unused JNIEnv* env, __unused jclass clazz,
jlong eventStreamRef, jlong runLoopRef)
{
const FSEventStreamRef stream = (FSEventStreamRef)eventStreamRef;
const CFRunLoopRef runLoop = (CFRunLoopRef)runLoopRef;
FSEventStreamScheduleWithRunLoop(stream, runLoop, kCFRunLoopDefaultMode);
FSEventStreamStart(stream);
traceLine(env, "scheduled stream 0x%p on thread 0x%p", stream, CFRunLoopGetCurrent());
}
/**
* Performs the steps necessary to dispose of the given FSEventStreamRef.
* The stream must have been started and scheduled with a run loop.
*/
JNIEXPORT void JNICALL
Java_sun_nio_fs_MacOSXWatchService_eventStreamStop(__unused JNIEnv* env, __unused jclass clazz, jlong eventStreamRef)
{
const FSEventStreamRef streamRef = (FSEventStreamRef)eventStreamRef;
FSEventStreamStop(streamRef); // Unregister with the FS Events service. No more callbacks from this stream
FSEventStreamInvalidate(streamRef); // Unschedule from any runloops
FSEventStreamRelease(streamRef); // Decrement the stream's refcount
}
/**
* Returns the CFRunLoop object for the current thread.
*/
JNIEXPORT jlong JNICALL
Java_sun_nio_fs_MacOSXWatchService_CFRunLoopGetCurrent(__unused JNIEnv* env, __unused jclass clazz)
{
const CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
traceLine(env, "get current run loop: 0x%p", currentRunLoop);
return (jlong)currentRunLoop;
}
/**
* Simply calls CFRunLoopRun() to run current thread's run loop for as long as there are event sources
* attached to it.
*/
JNIEXPORT void JNICALL
Java_sun_nio_fs_MacOSXWatchService_CFRunLoopRun(__unused JNIEnv* env, __unused jclass clazz, jlong watchServiceObject)
{
traceLine(env, "running run loop on 0x%p", CFRunLoopGetCurrent());
// Thread-local pointer to the WatchService instance will be used by the callback
// on this thread.
watchService = (*env)->NewGlobalRef(env, (jobject)watchServiceObject);
CFRunLoopRun();
(*env)->DeleteGlobalRef(env, (jobject)watchService);
watchService = NULL;
traceLine(env, "run loop done on 0x%p", CFRunLoopGetCurrent());
}
JNIEXPORT void JNICALL
Java_sun_nio_fs_MacOSXWatchService_CFRunLoopStop(__unused JNIEnv* env, __unused jclass clazz, jlong runLoopRef)
{
traceLine(env, "stopping run loop 0x%p", (void*)runLoopRef);
CFRunLoopStop((CFRunLoopRef)runLoopRef);
}

Some files were not shown because too many files have changed in this diff Show More