diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..ce9dfc0a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [magreenblatt] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..33f56a0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen and what happened instead. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Versions (please complete the following information):** + - OS: [e.g. Windows 10, MacOS 13.2, Ubuntu 22.10] + - Java Version: [e.g. OpenJDK 14] + - JCEF Version: [e.g. 87476e9] + - CEF Version: [e.g. 110.0.25] + +**Additional context** +Does the problem reproduce with the JCEF simple or detailed sample application at the same version? + +Does the problem reproduce with the CEF cefclient or cefsimple sample application at the same version? + +Does the problem reproduce with Google Chrome at the same version? + +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..11fc491e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore index e7bc7d07..d9565ba0 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,6 @@ Thumbs.db /tools/buildtools/external_bin /tools/buildtools/linux64/clang-format /tools/buildtools/mac/clang-format +# Misc working directories +/tmp /tools/buildtools/win/clang-format.exe diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..60a79ab6 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,81 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project overview + +JCEF is a Java wrapper around the C++ Chromium Embedded Framework (CEF). It is a hybrid Java + native (C++/Obj-C) project bound together by JNI. JCEF tracks a specific CEF release branch — the active version is set by `CEF_VERSION` in `CMakeLists.txt`, and the matching CEF binary distribution is downloaded by `cmake/DownloadCEF.cmake` into `third_party/cef/` at configure time. + +## Build + +The build is driven by CMake and **must** run inside a directory literally named `jcef_build/` at the repo root — `tools/run.sh`, `tools/make_distrib.sh`, etc. hard-code that path. + +```sh +mkdir jcef_build && cd jcef_build + +# macOS (arm64 host): +cmake -G "Ninja" -DPROJECT_ARCH="arm64" -DCMAKE_BUILD_TYPE=Release .. +ninja +# Or generate Xcode: cmake -G "Xcode" -DPROJECT_ARCH="arm64" .. + +# Linux: +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release .. +ninja + +# Windows (x64): +cmake -G "Visual Studio 17" -A x64 .. +# build via VS or ninja with vcvars64.bat +``` + +Configure-time side effects to be aware of: +- Downloads + extracts the CEF binary distribution. +- Generates `native/jcef_version.h` from CEF headers via `tools/make_version_header.py`. +- Downloads `clang-format` from Google Storage into `tools/buildtools//`. + +Java compilation differs by platform: +- **macOS:** the CMake build invokes Ant (`build.xml`) as a post-build step. It produces `jcef.jar` + `jcef-tests.jar`, bundles everything into `jcef_app.app` via `third_party/appbundler`, and copies the CEF framework + helper apps into the bundle. Requires `ant` (`brew install ant`). +- **Linux/Windows:** Java is compiled separately with `tools/compile.{sh,bat} ` (e.g. `linux64`, `win64`); the CMake build only handles native code. + +## Run / test / package + +```sh +# Launch the test app (Linux/Windows). On macOS run jcef_build/native/Release/jcef_app.app. +tools/run.sh [args...] + +# JUnit tests under java/tests/junittests via junit-platform-console-standalone. +tools/run_tests.sh [extra junit args...] + +# Build a redistributable in binary_distrib//. +tools/make_distrib.sh +``` + +`` is `linux32`, `linux64`, `macosx64`, `win32`, or `win64`. + +## Code style + +Chromium coding style for both C++ and Java. Run `tools/fix_style.sh [path...]` (which calls `tools/fix_style.py`) to apply clang-format. clang-format is downloaded by CMake into `tools/buildtools/`, so a configure step must have run first. + +## Architecture + +The project is organized as **Java API ↔ JNI bridge ↔ CEF C++**. + +### Java side (`java/org/cef/`) +- `CefApp` — global singleton; owns CEF process lifecycle and state machine (`CefAppState`). +- `CefClient` — per-browser client object that fans handler callbacks out to user-registered `Cef*Handler` interfaces. +- `browser/` — `CefBrowser` interface plus two implementations: `CefBrowserOsr` (off-screen rendering, OpenGL via JOGL) and `CefBrowserWr` (windowed rendering); `CefBrowserFactory` picks one. macOS uses the extra `browser/mac/CefBrowserWindowMac.java`. +- `handler/` — observer-style callback interfaces (`CefLifeSpanHandler`, `CefLoadHandler`, `CefRequestHandler`, …) each paired with an `*Adapter` no-op base class. +- `callback/`, `misc/`, `network/` — value/callback types mirrored to native. + +### Native side (`native/`) +- Files ending in `_N.cpp/.h` (e.g. `CefBrowser_N.cpp`) implement the JNI methods of the matching Java class with the `_N` suffix (e.g. `org.cef.browser.CefBrowser_N`). Headers are machine-generated via `javah`/`javac -h` — regenerate with `tools/make_all_jni_headers.{sh,bat} ` (or `make_jni_header.{sh,bat} ` for one class). When you add a new `_N` Java class, also add it to `make_all_jni_headers.*`. +- Non-`_N.cpp` files (`client_handler.cpp`, `*_handler.cpp`, `client_app.cpp`, `context.cpp`, …) implement the CEF C++ side: they receive callbacks from CEF and dispatch them up into Java via the helpers in `jni_util.{h,cpp}` and `jni_scoped_helpers.{h,cpp}`. +- Platform-specific code is split into `*_linux.cpp`, `*_mac.mm`, `*_win.cpp`, `*_posix.cpp`, plus `temp_window_{x11,mac,win}` and `critical_wait_{posix,win}`. CMake's `APPEND_PLATFORM_SOURCES` selects the right set per OS. +- `jcef_helper.cpp` builds a separate `jcef_helper`/`jcef Helper` executable — Chromium's multi-process model requires a helper binary for renderer/GPU/etc. processes. + +### Build outputs +- `jcef_build/native//` — `libjcef.{so,dylib}` / `jcef.dll`, the helper executable(s), and (on macOS) `jcef_app.app` containing the framework + Helper bundles. +- `out/` — Ant-produced Java class files / jars on macOS; mirrored layout used by `tools/compile.sh` on other platforms. + +## Other notes + +- macOS app launches require these JVM flags (already wired into `build.xml` and `run.sh`): `--add-opens=java.desktop/sun.{awt,lwawt,lwawt.macosx}=ALL-UNNAMED`, `--add-opens=java.desktop/java.awt=ALL-UNNAMED`, `--enable-native-access=ALL-UNNAMED`. Anything that calls JCEF off-bundle needs the same flags. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f7cc449..a1cd92d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ # CMake-generated project formats that have been tested with JCEF include: # # Linux: Ninja, GCC 7.5.0+, Unix Makefiles -# MacOS: Ninja, Xcode 12.2 to 13.0 -# Windows: Ninja, Visual Studio 2019+ +# MacOS: Ninja, Xcode 13.3 to 16.4 +# Windows: Ninja, Visual Studio 2022 # # Ninja is a cross-platform open-source tool for running fast builds using # pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be @@ -23,7 +23,7 @@ # # The below requirements must be met to build JCEF. # -# - CMake version 3.19 or newer. +# - CMake version 3.21 or newer. # # - Linux requirements: # Currently supported distributions include Debian 10 (Buster), Ubuntu 18 @@ -35,15 +35,14 @@ # libgtk3.0-dev (required by the cefclient target only) # # - MacOS requirements: -# Xcode 12.2 to 13.0 building on MacOS 10.15.4 (Catalina) or newer. Only -# 64-bit builds are supported. The Xcode command-line tools must also be -# installed. Newer Xcode versions may not have been been tested and are not -# recommended. +# Xcode 13.5 to 16.4 building on MacOS 12.0 (Monterey) or newer. The Xcode +# command-line tools must also be installed. Newer Xcode versions may not have +# been been tested and are not recommended. # # - Windows requirements: -# Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10 -# 64-bit is recommended. Newer versions will likely also work but may not have -# been tested. +# Visual Studio 2022 building on Windows 10 or newer. Windows 10/11 64-bit is +# recommended. Newer versions will likely also work but may not have been +# tested. # # BUILD EXAMPLES # @@ -86,24 +85,24 @@ # > ninja # # To perform a Windows build using a 32-bit CEF binary distribution: -# Using the Visual Studio 2019 IDE: -# > cmake -G "Visual Studio 16" -A Win32 .. +# Using the Visual Studio 2022 IDE: +# > cmake -G "Visual Studio 17" -A Win32 .. # Open jcef.sln in Visual Studio and select Build > Build Solution. # -# Using Ninja with Visual Studio 2019 command-line tools: +# Using Ninja with Visual Studio 2022 command-line tools: # (this path may be different depending on your Visual Studio installation) -# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat" +# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars32.bat" # > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. # > ninja # # To perform a Windows build using a 64-bit CEF binary distribution: -# Using the Visual Studio 2019 IDE: -# > cmake -G "Visual Studio 16" -A x64 .. +# Using the Visual Studio 2022 IDE: +# > cmake -G "Visual Studio 17" -A x64 .. # Open jcef.sln in Visual Studio and select Build > Build Solution. # -# Using Ninja with Visual Studio 2019 command-line tools: +# Using Ninja with Visual Studio 2022 command-line tools: # (this path may be different depending on your Visual Studio installation) -# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat" +# > "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat" # > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. # > ninja @@ -111,8 +110,8 @@ # Shared configuration. # -# For VS2019 and Xcode 12+ support. -cmake_minimum_required(VERSION 3.19) +# For VS2022 and Xcode 12+ support. +cmake_minimum_required(VERSION 3.21) # Only generate Debug and Release configuration types. set(CMAKE_CONFIGURATION_TYPES Debug Release) @@ -130,14 +129,20 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON) # Specify the CEF distribution version. if(NOT DEFINED CEF_VERSION) - set(CEF_VERSION "100.0.14+g4e5ba66+chromium-100.0.4896.75") + set(CEF_VERSION "146.0.10+g8219561+chromium-146.0.7680.179") endif() # Determine the platform. if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") if("${PROJECT_ARCH}" STREQUAL "arm64") set(CEF_PLATFORM "macosarm64") + elseif("${PROJECT_ARCH}" STREQUAL "x86_64") + set(CEF_PLATFORM "macosx64") + elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") + set(PROJECT_ARCH "arm64") + set(CEF_PLATFORM "macosarm64") else() + set(PROJECT_ARCH "x86_64") set(CEF_PLATFORM "macosx64") endif() elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") @@ -258,12 +263,19 @@ file(COPY "${CEF_ROOT}/README.txt" DESTINATION "${CMAKE_BINARY_DIR}") if(OS_WINDOWS) set(GS_PLATFORM "win32") set(GS_HASHPATH "win/clang-format.exe.sha1") + set(GS_OUTPATH "win/clang-format.exe") elseif(OS_MACOSX) set(GS_PLATFORM "darwin") - set(GS_HASHPATH "mac/clang-format.sha1") + if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") + set(GS_HASHPATH "mac/clang-format.arm64.sha1") + else() + set(GS_HASHPATH "mac/clang-format.x64.sha1") + endif() + set(GS_OUTPATH "mac/clang-format") elseif(OS_LINUX) set(GS_PLATFORM "linux*") set(GS_HASHPATH "linux64/clang-format.sha1") + set(GS_OUTPATH "linux64/clang-format") endif() message(STATUS "Downloading clang-format from Google Storage...") @@ -275,6 +287,7 @@ execute_process( "--no_auth" "--bucket" "chromium-clang-format" "-s" "tools/buildtools/${GS_HASHPATH}" + "-o" "tools/buildtools/${GS_OUTPATH}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE EXECUTE_RV ) diff --git a/README.md b/README.md index b0f854d4..d6ee5836 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ The Java Chromium Embedded Framework (JCEF) is a simple framework for embedding # Quick Links -* Building JCEF - https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding +* Building JCEF - https://chromiumembedded.github.io/java-cef/branches_and_building * Support Forum - http://magpcss.org/ceforum/viewforum.php?f=17 +* Issue Tracker - https://github.com/chromiumembedded/java-cef/issues * Downloads - https://github.com/jcefmaven/jcefbuild * Maven/Gradle Artifacts - https://github.com/jcefmaven/jcefmaven -* Donations - http://www.magpcss.org/ceforum/donate.php +* Donations - https://github.com/sponsors/magreenblatt # Introduction @@ -23,13 +24,13 @@ This project provides a Java Wrapper for CEF (JCEF). # Building JCEF -The JCEF project is an extension of the Chromium Embedded Framework (CEF) project hosted at https://bitbucket.org/chromiumembedded/cef/. JCEF maintains a development branch that tracks the most recent CEF3 release branch. JCEF source code can be downloaded, built and packaged into a binary distribution. Once you have created the binary distribution for your platform you can distribute it as a stand-alone package without further dependencies on the JCEF, CEF or Chromium source code. Visit the [BranchesAndBuilding](https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding) Wiki page for detailed instructions. +The JCEF project is an extension of the Chromium Embedded Framework (CEF) project hosted at https://github.com/chromiumembedded/cef. JCEF maintains a development branch that tracks the most recent CEF3 release branch. JCEF source code can be downloaded, built and packaged into a binary distribution. Once you have created the binary distribution for your platform you can distribute it as a stand-alone package without further dependencies on the JCEF, CEF or Chromium source code. Visit the [Branches and Building](https://chromiumembedded.github.io/java-cef/branches_and_building) page for detailed instructions. # Helping Out JCEF is still very much a work in progress. Some ways that you can help out: -\- Vote for issues in the [JCEF issue tracker](https://bitbucket.org/chromiumembedded/java-cef/issues?status=new&status=open) that are important to you. This helps with development prioritization. +\- Vote for issues in the [JCEF issue tracker](https://github.com/chromiumembedded/java-cef/issues) that are important to you. This helps with development prioritization. \- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [JCEF Forum](http://magpcss.org/ceforum/viewforum.php?f=17) and not the issue tracker for usage questions. Each JCEF issue should: @@ -40,15 +41,15 @@ JCEF is still very much a work in progress. Some ways that you can help out: \- Write unit tests for new or existing functionality. -\- Pull requests and patches are welcome. View open issues in the [JCEF issue tracker](https://bitbucket.org/chromiumembedded/java-cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas. +\- Pull requests and patches are welcome. View open issues in the [JCEF issue tracker](https://github.com/chromiumembedded/java-cef/issues) or search for TODO(cef) in the source code for ideas. If you would like to contribute source code changes to JCEF please follow the below guidelines: \- Create or find an appropriate issue for each distinct bug, feature or change. -\- Submit a [pull request](https://bitbucket.org/chromiumembedded/java-cef/wiki/ContributingWithGit) or create a patch with your changes and attach it to the JCEF issue. Changes should: +\- Submit a [pull request](https://chromiumembedded.github.io/java-cef/contributing_with_git) or create a patch with your changes and attach it to the JCEF issue. Changes should: -* Be submitted against the current [JCEF master branch](https://bitbucket.org/chromiumembedded/java-cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch. +* Be submitted against the current [JCEF master branch](https://github.com/chromiumembedded/java-cef/tree/master) unless explicitly fixing a bug in a CEF release branch. * Follow the style of existing JCEF source files. In general JCEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style). * Include new or modified unit tests as appropriate to the functionality. * Not include unnecessary or unrelated changes. \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 8c94201f..1be24c4a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ # This is a configuration file for the continuous delivery service provided # by AppVeyor.com. Its purpose is to automatically build both the 32 # and 64 bit versions of the Java Chromium Embedded Framework (JCEF). -# Please refer to https://bitbucket.org/chromiumembedded/java-cef +# Please refer to https://github.com/chromiumembedded/java-cef # for more information on JCEF. os: Visual Studio 2015 diff --git a/build.xml b/build.xml index 010b5c57..e7a77073 100644 --- a/build.xml +++ b/build.xml @@ -74,6 +74,11 @@