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/.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 3b65a374..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,7 +129,7 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON) # Specify the CEF distribution version. if(NOT DEFINED CEF_VERSION) - set(CEF_VERSION "135.0.20+ge7de5c3+chromium-135.0.7049.85") + set(CEF_VERSION "146.0.10+g8219561+chromium-146.0.7680.179") endif() # Determine the platform. diff --git a/README.md b/README.md index e2443d49..d6ee5836 100644 --- a/README.md +++ b/README.md @@ -2,12 +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 @@ -24,7 +24,7 @@ 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 @@ -47,9 +47,9 @@ If you would like to contribute source code changes to JCEF please follow the be \- 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 @@