diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/coverage.yml similarity index 54% rename from .github/workflows/ci-linux.yml rename to .github/workflows/coverage.yml index fb31b1361..e2b34260d 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/coverage.yml @@ -1,61 +1,13 @@ -name: Endstone CI (Linux) +name: Linux on: push: branches: - - next + - main pull_request: workflow_dispatch: jobs: - build: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] - build_type: [ Debug, Release ] - - name: Build on ${{ matrix.os }} (${{ matrix.build_type }}) - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' - - - name: Set up Clang 15 - env: - LLVM_VERSION: 15 - run: | - sudo apt-get update -y -q - sudo apt-get install -y -q lsb-release wget software-properties-common gnupg - sudo wget https://apt.llvm.org/llvm.sh - sudo chmod +x llvm.sh - sudo ./llvm.sh ${LLVM_VERSION} - sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 - sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100 - sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100 - - - name: Set up CMake and Ninja - uses: lukka/get-cmake@latest - - - name: Build with Conan - run: | - python -m pip install --upgrade pip - pip install conan - conan profile detect --force - conan export third_party/funchook --version 1.1.3 - conan create . --build=missing -pr:a .github/conan_profiles/linux -s build_type=${{ matrix.build_type }} - coverage: name: Code Coverage runs-on: ubuntu-20.04 diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker.yml similarity index 89% rename from .github/workflows/docker-publish.yml rename to .github/workflows/docker.yml index 908d9e663..1d85798a2 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker.yml @@ -1,15 +1,16 @@ -name: Docker Publish +name: Docker on: schedule: - cron: '0 0 * * *' push: - branches: [ "next" ] - tags: [ 'v*.*.*' ] + branches: + - main + tags: + - '*' jobs: build: - runs-on: ubuntu-latest permissions: packages: write @@ -46,7 +47,7 @@ jobs: endstone/endstone ghcr.io/endstonemc/endstone tags: | - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'next') }} + type=raw,value=latest,enable=${{is_default_branch}} type=pep440,pattern={{version}} - name: Build and Push Docker Image diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000..8101a8423 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,57 @@ +name: Linux + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-20.04, ubuntu-22.04 ] + build_type: [ Debug, Release ] + + name: Build on ${{ matrix.os }} (${{ matrix.build_type }}) + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + + - name: Set up Clang 15 + env: + LLVM_VERSION: 15 + run: | + sudo apt-get update -y -q + sudo apt-get install -y -q lsb-release wget software-properties-common gnupg + sudo wget https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh ${LLVM_VERSION} + sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 + sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100 + sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100 + + - name: Set up CMake and Ninja + uses: lukka/get-cmake@latest + + - name: Build with Conan + run: | + python -m pip install --upgrade pip + pip install conan + conan profile detect --force + conan export third_party/funchook --version 1.1.3 + conan create . --build=missing -pr:a .github/conan_profiles/linux -s build_type=${{ matrix.build_type }} diff --git a/.github/workflows/cd.yml b/.github/workflows/wheel.yml similarity index 87% rename from .github/workflows/cd.yml rename to .github/workflows/wheel.yml index 1ba87e20e..a9a787042 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/wheel.yml @@ -1,16 +1,16 @@ -name: Endstone CD +name: Wheel on: push: branches: - - next + - main tags: - '*' workflow_dispatch: jobs: build_wheels_windows: - name: Build wheel for Python ${{ matrix.python }} on Windows + name: Build Wheels for Python ${{ matrix.python }} on Windows strategy: fail-fast: false @@ -46,28 +46,28 @@ jobs: conan export third_party/funchook --version 1.1.3 conan install . --build=missing -pr:a .github/conan_profiles/windows - - name: Build wheels + - name: Build Wheels run: | python -m pip install -U pip pip install wheel python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose - - name: Test wheels + - name: Test Wheels run: | pip install pytest Get-ChildItem ./wheelhouse/ -Filter *.whl | ForEach-Object { pip install $_.FullName } - pytest endstone_python/test + pytest python/tests - - name: Upload artifacts + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: artifact path: ./wheelhouse/*.whl build_wheels_linux: - name: Build wheel for Python ${{ matrix.python }} on Ubuntu + name: Build Wheels for Python ${{ matrix.python }} on Ubuntu strategy: fail-fast: false @@ -113,31 +113,31 @@ jobs: conan export third_party/funchook --version 1.1.3 conan install . --build=missing -pr:a .github/conan_profiles/linux - - name: Build wheels + - name: Build Wheels run: | python -m pip install -U pip pip install wheel python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose - - name: Repair wheels + - name: Repair Wheels run: | pip install auditwheel setuptools "patchelf>=0.14" python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w wheelhouse wheelhouse/*.whl - - name: Test wheels + - name: Test Wheels run: | pip install pytest pip install wheelhouse/*.whl - pytest endstone_python/test + pytest python/tests - - name: Upload artifacts + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: artifact path: ./wheelhouse/*.whl build_sdist: - name: Build source distribution + name: Build Source Distribution runs-on: ubuntu-latest steps: - name: Checkout Code @@ -148,14 +148,14 @@ jobs: - name: Build sdist run: pipx run build --sdist - - name: Upload artifacts + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: artifact path: dist/*.tar.gz publish: - name: Publish + name: Publish Wheels to PyPI if: contains(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: [ build_wheels_windows, build_wheels_linux, build_sdist ] @@ -165,16 +165,16 @@ jobs: contents: write steps: - - name: Restore artifacts + - name: Restore Artifacts uses: actions/download-artifact@v3 with: name: artifact path: dist - - name: Release + - name: Create a Release uses: softprops/action-gh-release@v1 with: files: dist/* - - name: Publish package to PyPI + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/windows.yml similarity index 96% rename from .github/workflows/ci-windows.yml rename to .github/workflows/windows.yml index 8edea50dc..adf386a47 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/windows.yml @@ -1,9 +1,9 @@ -name: Endstone CI (Windows) +name: Windows on: push: branches: - - next + - main pull_request: workflow_dispatch: diff --git a/.gitignore b/.gitignore index eaf56475d..dde2b8b38 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ _deps .idea/* build/* bedrock_server/* -wheelhouse/* \ No newline at end of file +wheelhouse/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bc002a31..472db13a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,95 @@ endif () add_compile_definitions(PYBIND11_DETAILED_ERROR_MESSAGES) -add_subdirectory(endstone_api) -add_subdirectory(endstone_python) -add_subdirectory(endstone_core) -add_subdirectory(endstone_runtime) +# ======== +# packages +# ======== +find_package(fmt CONFIG REQUIRED) +find_package(Python COMPONENTS Interpreter Development REQUIRED) +find_package(pybind11 CONFIG REQUIRED) +find_package(spdlog CONFIG REQUIRED) +find_package(funchook CONFIG REQUIRED) +find_package(magic_enum CONFIG REQUIRED) +if (UNIX) + find_package(LIEF CONFIG REQUIRED) +endif () + +find_package(GTest CONFIG REQUIRED) + + +# ================= +# endstone::headers +# ================= +add_library(endstone_headers INTERFACE) +add_library(endstone::headers ALIAS endstone_headers) +target_include_directories(endstone_headers INTERFACE include) +target_link_libraries(endstone_headers INTERFACE fmt::fmt) + +include(GNUInstallDirs) +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + +# ================ +# endstone::python +# ================ +file(GLOB_RECURSE ENDSTONE_PYTHON_SOURCE_FILES CONFIGURE_DEPENDS "src/endstone_python/*.cpp") +pybind11_add_module(endstone_python MODULE ${ENDSTONE_PYTHON_SOURCE_FILES}) +target_include_directories(endstone_python PUBLIC include) +target_link_libraries(endstone_python PRIVATE endstone::headers) + +include(GNUInstallDirs) +install(TARGETS endstone_python DESTINATION "endstone/_internal/" COMPONENT endstone_wheel OPTIONAL) + + +# ============== +# endstone::core +# ============== +file(GLOB_RECURSE ENDSTONE_CORE_SOURCE_FILES CONFIGURE_DEPENDS "src/endstone_core/*.cpp") +add_library(endstone_core ${ENDSTONE_CORE_SOURCE_FILES}) +add_library(endstone::core ALIAS endstone_core) +target_link_libraries(endstone_core PUBLIC endstone::headers spdlog::spdlog) +if (UNIX) + target_link_libraries(endstone_core PUBLIC ${CMAKE_DL_LIBS}) +endif () +target_compile_definitions(endstone_core PUBLIC ENDSTONE_VERSION="${ENDSTONE_VERSION}") + +include(GNUInstallDirs) +install(TARGETS endstone_core + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + +# ================= +# endstone::runtime +# ================= +file(GLOB_RECURSE ENDSTONE_RUNTIME_SOURCE_FILES CONFIGURE_DEPENDS "src/endstone_runtime/*.cpp") +add_library(endstone_runtime SHARED ${ENDSTONE_RUNTIME_SOURCE_FILES}) +add_library(endstone::runtime ALIAS endstone_runtime) +target_link_libraries(endstone_runtime PRIVATE endstone::core funchook::funchook magic_enum::magic_enum pybind11::embed) +if (WIN32) + target_link_libraries(endstone_runtime PRIVATE dbghelp.lib) +elseif (UNIX) + target_link_libraries(endstone_runtime PRIVATE LIEF::LIEF) + target_link_options(endstone_runtime PRIVATE "-Wl,--exclude-libs,ALL") + target_compile_options(endstone_runtime PRIVATE "-fvisibility=hidden") +endif () + +include(GNUInstallDirs) +install(TARGETS endstone_runtime + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS endstone_runtime DESTINATION "endstone/_internal/" COMPONENT endstone_wheel OPTIONAL) + + +# ===== +# tests +# ===== +if (NOT BUILD_TESTING STREQUAL OFF) + file(GLOB ENDSTONE_TEST_FILES "tests/*.cpp") + add_executable(endstone_test ${ENDSTONE_TEST_FILES}) + target_link_libraries(endstone_test PRIVATE GTest::gtest_main endstone::core) + include(GoogleTest) + gtest_discover_tests(endstone_test) +endif () diff --git a/Dockerfile b/Dockerfile index cd0292492..ef4ad37f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN apt-get update -y -q \ WORKDIR /usr/src/endstone -RUN git clone --branch next https://github.com/EndstoneMC/endstone.git . +RUN git clone https://github.com/EndstoneMC/endstone.git . RUN python -m pip install --upgrade pip \ && pip install conan \ @@ -48,7 +48,7 @@ RUN python -m pip install --upgrade pip \ && python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose \ && python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w wheelhouse wheelhouse/*.whl \ && pip install wheelhouse/*.whl \ - && pytest endstone_python/test + && pytest python/tests FROM base AS final diff --git a/conanfile.py b/conanfile.py index ba977e7c6..dcd92711c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -44,15 +44,7 @@ class EndstoneRecipe(ConanFile): "lief/*:with_vdex": False, } - # Sources are located in the same place as this recipe, copy them to the recipe - exports_sources = ( - "CMakeLists.txt", - "cmake/*", - "endstone_api/*", - "endstone_core/*", - "endstone_python/*", - "endstone_runtime/*", - ) + exports_sources = "CMakeLists.txt", "src/*", "include/*", "tests/*" def set_version(self): if self.version: @@ -154,14 +146,14 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.components["api"].libs = [] - self.cpp_info.components["api"].libdirs = [] - self.cpp_info.components["api"].set_property("cmake_target_name", "endstone::api") - self.cpp_info.components["api"].requires = ["fmt::fmt"] + self.cpp_info.components["headers"].libs = [] + self.cpp_info.components["headers"].libdirs = [] + self.cpp_info.components["headers"].set_property("cmake_target_name", "endstone::headers") + self.cpp_info.components["headers"].requires = ["fmt::fmt"] self.cpp_info.components["core"].libs = ["endstone_core"] self.cpp_info.components["core"].set_property("cmake_target_name", "endstone::core") - self.cpp_info.components["core"].requires = ["api", "spdlog::spdlog"] + self.cpp_info.components["core"].requires = ["spdlog::spdlog"] self.cpp_info.components["core"].defines = ["PYBIND11_USE_SMART_HOLDER_AS_DEFAULT"] if self.settings.os == "Linux": self.cpp_info.components["core"].system_libs.extend(["dl", "stdc++fs"]) @@ -169,7 +161,6 @@ def package_info(self): self.cpp_info.components["runtime"].libs = ["endstone_runtime"] self.cpp_info.components["runtime"].set_property("cmake_target_name", "endstone::runtime") self.cpp_info.components["runtime"].requires = [ - "api", "core", "funchook::funchook", "magic_enum::magic_enum", diff --git a/endstone_api/CMakeLists.txt b/endstone_api/CMakeLists.txt deleted file mode 100644 index c5a3a1b4f..000000000 --- a/endstone_api/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -project(endstone_api LANGUAGES CXX) - -find_package(fmt CONFIG REQUIRED) - -add_library(endstone_api INTERFACE) -add_library(endstone::api ALIAS endstone_api) -target_include_directories(endstone_api INTERFACE include) -target_link_libraries(endstone_api INTERFACE fmt::fmt) - -include(GNUInstallDirs) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/endstone_core/CMakeLists.txt b/endstone_core/CMakeLists.txt deleted file mode 100644 index 7a52c088e..000000000 --- a/endstone_core/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -project(endstone_core LANGUAGES CXX) - - -find_package(spdlog CONFIG REQUIRED) -find_package(GTest CONFIG REQUIRED) - - -file(GLOB_RECURSE ENDSTONE_CORE_SOURCE_FILES CONFIGURE_DEPENDS "src/*.cpp") -add_library(endstone_core ${ENDSTONE_CORE_SOURCE_FILES}) -add_library(endstone::core ALIAS endstone_core) -target_include_directories(endstone_core PUBLIC include) -target_link_libraries(endstone_core PUBLIC endstone::api spdlog::spdlog) -if (UNIX) - target_link_libraries(endstone_core PUBLIC ${CMAKE_DL_LIBS}) -endif () -if (NOT DEFINED ENDSTONE_VERSION) - message(FATAL_ERROR "ENDSTONE_VERSION is not defined") -else () - target_compile_definitions(endstone_core PUBLIC ENDSTONE_VERSION="${ENDSTONE_VERSION}") -endif () - - -include(GNUInstallDirs) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(TARGETS endstone_core - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - - -if (NOT BUILD_TESTING STREQUAL OFF) - file(GLOB ENDSTONE_CORE_TEST_FILES "test/*.cpp") - add_executable(endstone_core_test ${ENDSTONE_CORE_TEST_FILES}) - target_link_libraries(endstone_core_test PRIVATE GTest::gtest_main endstone_core) - include(GoogleTest) - gtest_discover_tests(endstone_core_test) -endif () \ No newline at end of file diff --git a/endstone_python/.gitignore b/endstone_python/.gitignore deleted file mode 100644 index fc3decf4b..000000000 --- a/endstone_python/.gitignore +++ /dev/null @@ -1 +0,0 @@ -python/endstone/_internal/version.py \ No newline at end of file diff --git a/endstone_python/CMakeLists.txt b/endstone_python/CMakeLists.txt deleted file mode 100644 index 9f9d2e5ba..000000000 --- a/endstone_python/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -project(endstone_python LANGUAGES CXX) - - -find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) -find_package(pybind11 CONFIG REQUIRED) - - -file(GLOB_RECURSE ENDSTONE_PYTHON_SOURCE_FILES CONFIGURE_DEPENDS "src/*.cpp") -pybind11_add_module(endstone_python MODULE ${ENDSTONE_PYTHON_SOURCE_FILES}) -target_include_directories(endstone_python PUBLIC include) -target_link_libraries(endstone_python PRIVATE endstone::api) - - -include(GNUInstallDirs) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(TARGETS endstone_python - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(TARGETS endstone_python DESTINATION "endstone/_internal/" COMPONENT endstone_wheel OPTIONAL) diff --git a/endstone_runtime/CMakeLists.txt b/endstone_runtime/CMakeLists.txt deleted file mode 100644 index 02e7ca9ac..000000000 --- a/endstone_runtime/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -project(endstone_runtime LANGUAGES CXX) - - -find_package(funchook CONFIG REQUIRED) -find_package(magic_enum CONFIG REQUIRED) -find_package(Python COMPONENTS Interpreter Development.Embed REQUIRED) -find_package(pybind11 CONFIG REQUIRED) -if (UNIX) - find_package(LIEF CONFIG REQUIRED) -endif () -find_package(GTest CONFIG REQUIRED) - - -file(GLOB_RECURSE ENDSTONE_RUNTIME_SOURCE_FILES CONFIGURE_DEPENDS "src/*.cpp") -add_library(endstone_runtime SHARED ${ENDSTONE_RUNTIME_SOURCE_FILES}) -add_library(endstone::runtime ALIAS endstone_runtime) -target_include_directories(endstone_runtime PUBLIC include) -target_link_libraries(endstone_runtime PRIVATE endstone::api endstone::core funchook::funchook magic_enum::magic_enum pybind11::embed) -if (WIN32) - target_link_libraries(endstone_runtime PRIVATE dbghelp.lib) -elseif (UNIX) - target_link_libraries(endstone_runtime PRIVATE LIEF::LIEF) - target_link_options(endstone_runtime PRIVATE "-Wl,--exclude-libs,ALL") - target_compile_options(endstone_runtime PRIVATE "-fvisibility=hidden") -endif () - - -include(GNUInstallDirs) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(TARGETS endstone_runtime - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(TARGETS endstone_runtime DESTINATION "endstone/_internal/" COMPONENT endstone_wheel OPTIONAL) diff --git a/endstone_api/include/bedrock/bedrock.h b/include/bedrock/bedrock.h similarity index 100% rename from endstone_api/include/bedrock/bedrock.h rename to include/bedrock/bedrock.h diff --git a/endstone_api/include/bedrock/bedrock_log.h b/include/bedrock/bedrock_log.h similarity index 100% rename from endstone_api/include/bedrock/bedrock_log.h rename to include/bedrock/bedrock_log.h diff --git a/endstone_api/include/bedrock/command/command.h b/include/bedrock/command/command.h similarity index 100% rename from endstone_api/include/bedrock/command/command.h rename to include/bedrock/command/command.h diff --git a/endstone_api/include/bedrock/command/command_origin.h b/include/bedrock/command/command_origin.h similarity index 100% rename from endstone_api/include/bedrock/command/command_origin.h rename to include/bedrock/command/command_origin.h diff --git a/endstone_api/include/bedrock/command/command_registry.h b/include/bedrock/command/command_registry.h similarity index 100% rename from endstone_api/include/bedrock/command/command_registry.h rename to include/bedrock/command/command_registry.h diff --git a/endstone_api/include/bedrock/command/command_version.h b/include/bedrock/command/command_version.h similarity index 100% rename from endstone_api/include/bedrock/command/command_version.h rename to include/bedrock/command/command_version.h diff --git a/endstone_api/include/bedrock/command/stop_command.h b/include/bedrock/command/stop_command.h similarity index 100% rename from endstone_api/include/bedrock/command/stop_command.h rename to include/bedrock/command/stop_command.h diff --git a/endstone_api/include/bedrock/common.h b/include/bedrock/common.h similarity index 100% rename from endstone_api/include/bedrock/common.h rename to include/bedrock/common.h diff --git a/endstone_api/include/bedrock/core.h b/include/bedrock/core.h similarity index 100% rename from endstone_api/include/bedrock/core.h rename to include/bedrock/core.h diff --git a/endstone_api/include/bedrock/server/dedicated_server.h b/include/bedrock/server/dedicated_server.h similarity index 100% rename from endstone_api/include/bedrock/server/dedicated_server.h rename to include/bedrock/server/dedicated_server.h diff --git a/endstone_api/include/bedrock/server/server_instance.h b/include/bedrock/server/server_instance.h similarity index 100% rename from endstone_api/include/bedrock/server/server_instance.h rename to include/bedrock/server/server_instance.h diff --git a/endstone_api/include/bedrock/type_id.h b/include/bedrock/type_id.h similarity index 100% rename from endstone_api/include/bedrock/type_id.h rename to include/bedrock/type_id.h diff --git a/endstone_api/include/bedrock/uuid.h b/include/bedrock/uuid.h similarity index 100% rename from endstone_api/include/bedrock/uuid.h rename to include/bedrock/uuid.h diff --git a/endstone_api/include/endstone/logger.h b/include/endstone/logger.h similarity index 100% rename from endstone_api/include/endstone/logger.h rename to include/endstone/logger.h diff --git a/endstone_api/include/endstone/plugin/plugin.h b/include/endstone/plugin/plugin.h similarity index 100% rename from endstone_api/include/endstone/plugin/plugin.h rename to include/endstone/plugin/plugin.h diff --git a/endstone_api/include/endstone/plugin/plugin_description.h b/include/endstone/plugin/plugin_description.h similarity index 100% rename from endstone_api/include/endstone/plugin/plugin_description.h rename to include/endstone/plugin/plugin_description.h diff --git a/endstone_api/include/endstone/plugin/plugin_loader.h b/include/endstone/plugin/plugin_loader.h similarity index 100% rename from endstone_api/include/endstone/plugin/plugin_loader.h rename to include/endstone/plugin/plugin_loader.h diff --git a/endstone_api/include/endstone/plugin/plugin_manager.h b/include/endstone/plugin/plugin_manager.h similarity index 100% rename from endstone_api/include/endstone/plugin/plugin_manager.h rename to include/endstone/plugin/plugin_manager.h diff --git a/endstone_api/include/endstone/server.h b/include/endstone/server.h similarity index 100% rename from endstone_api/include/endstone/server.h rename to include/endstone/server.h diff --git a/endstone_core/include/endstone_core/endstone_server.h b/include/endstone_core/endstone_server.h similarity index 100% rename from endstone_core/include/endstone_core/endstone_server.h rename to include/endstone_core/endstone_server.h diff --git a/endstone_core/include/endstone_core/logger_factory.h b/include/endstone_core/logger_factory.h similarity index 100% rename from endstone_core/include/endstone_core/logger_factory.h rename to include/endstone_core/logger_factory.h diff --git a/endstone_core/include/endstone_core/plugin/cpp_plugin_loader.h b/include/endstone_core/plugin/cpp_plugin_loader.h similarity index 100% rename from endstone_core/include/endstone_core/plugin/cpp_plugin_loader.h rename to include/endstone_core/plugin/cpp_plugin_loader.h diff --git a/endstone_core/include/endstone_core/plugin/endstone_plugin_manager.h b/include/endstone_core/plugin/endstone_plugin_manager.h similarity index 100% rename from endstone_core/include/endstone_core/plugin/endstone_plugin_manager.h rename to include/endstone_core/plugin/endstone_plugin_manager.h diff --git a/endstone_python/include/endstone_python/endstone_python.h b/include/endstone_python/endstone_python.h similarity index 100% rename from endstone_python/include/endstone_python/endstone_python.h rename to include/endstone_python/endstone_python.h diff --git a/endstone_runtime/include/endstone_runtime/hook.h b/include/endstone_runtime/hook.h similarity index 100% rename from endstone_runtime/include/endstone_runtime/hook.h rename to include/endstone_runtime/hook.h diff --git a/endstone_runtime/include/endstone_runtime/platform.h b/include/endstone_runtime/platform.h similarity index 100% rename from endstone_runtime/include/endstone_runtime/platform.h rename to include/endstone_runtime/platform.h diff --git a/endstone_runtime/include/endstone_runtime/python_plugin_loader.h b/include/endstone_runtime/python_plugin_loader.h similarity index 100% rename from endstone_runtime/include/endstone_runtime/python_plugin_loader.h rename to include/endstone_runtime/python_plugin_loader.h diff --git a/pyproject.toml b/pyproject.toml index 86474759f..4acadd6cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,14 +48,14 @@ endstone = "endstone._internal.bootstrap:cli" [tool.scikit-build] cmake.args = ["-G Ninja", "--preset conan-release"] cmake.define = { BUILD_TESTING = "OFF" } -wheel.packages = ["endstone_python/python/endstone"] +wheel.packages = ["python/src/endstone"] wheel.license-files = ["LICENSE"] install.components = ["endstone_wheel"] install.strip = false metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" -sdist.include = ["endstone_python/python/endstone/_internal/version.py"] +sdist.include = ["python/src/endstone/_internal/version.py"] [tool.setuptools_scm] -write_to = "endstone_python/python/endstone/_internal/version.py" +write_to = "python/src/endstone/_internal/version.py" version_scheme = "guess-next-dev" local_scheme = "no-local-version" diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 000000000..fb1bd3f3e --- /dev/null +++ b/python/.gitignore @@ -0,0 +1 @@ +src/endstone/_internal/version.py \ No newline at end of file diff --git a/endstone_python/python/endstone/__init__.py b/python/src/endstone/__init__.py similarity index 100% rename from endstone_python/python/endstone/__init__.py rename to python/src/endstone/__init__.py diff --git a/endstone_python/python/endstone/_internal/__init__.py b/python/src/endstone/_internal/__init__.py similarity index 100% rename from endstone_python/python/endstone/_internal/__init__.py rename to python/src/endstone/_internal/__init__.py diff --git a/endstone_python/python/endstone/_internal/bootstrap/__init__.py b/python/src/endstone/_internal/bootstrap/__init__.py similarity index 100% rename from endstone_python/python/endstone/_internal/bootstrap/__init__.py rename to python/src/endstone/_internal/bootstrap/__init__.py diff --git a/endstone_python/python/endstone/_internal/bootstrap/base.py b/python/src/endstone/_internal/bootstrap/base.py similarity index 100% rename from endstone_python/python/endstone/_internal/bootstrap/base.py rename to python/src/endstone/_internal/bootstrap/base.py diff --git a/endstone_python/python/endstone/_internal/bootstrap/linux.py b/python/src/endstone/_internal/bootstrap/linux.py similarity index 100% rename from endstone_python/python/endstone/_internal/bootstrap/linux.py rename to python/src/endstone/_internal/bootstrap/linux.py diff --git a/endstone_python/python/endstone/_internal/bootstrap/windows.py b/python/src/endstone/_internal/bootstrap/windows.py similarity index 100% rename from endstone_python/python/endstone/_internal/bootstrap/windows.py rename to python/src/endstone/_internal/bootstrap/windows.py diff --git a/endstone_python/python/endstone/_internal/plugin_loader.py b/python/src/endstone/_internal/plugin_loader.py similarity index 100% rename from endstone_python/python/endstone/_internal/plugin_loader.py rename to python/src/endstone/_internal/plugin_loader.py diff --git a/endstone_python/python/endstone/logger.py b/python/src/endstone/logger.py similarity index 100% rename from endstone_python/python/endstone/logger.py rename to python/src/endstone/logger.py diff --git a/endstone_python/python/endstone/logger.pyi b/python/src/endstone/logger.pyi similarity index 100% rename from endstone_python/python/endstone/logger.pyi rename to python/src/endstone/logger.pyi diff --git a/endstone_python/python/endstone/plugin.py b/python/src/endstone/plugin.py similarity index 100% rename from endstone_python/python/endstone/plugin.py rename to python/src/endstone/plugin.py diff --git a/endstone_python/python/endstone/plugin.pyi b/python/src/endstone/plugin.pyi similarity index 100% rename from endstone_python/python/endstone/plugin.pyi rename to python/src/endstone/plugin.pyi diff --git a/endstone_python/python/endstone/server.py b/python/src/endstone/server.py similarity index 100% rename from endstone_python/python/endstone/server.py rename to python/src/endstone/server.py diff --git a/endstone_python/python/endstone/server.pyi b/python/src/endstone/server.pyi similarity index 100% rename from endstone_python/python/endstone/server.pyi rename to python/src/endstone/server.pyi diff --git a/endstone_python/test/test_imports.py b/python/tests/test_imports.py similarity index 100% rename from endstone_python/test/test_imports.py rename to python/tests/test_imports.py diff --git a/endstone_python/test/test_plugin_description.py b/python/tests/test_plugin_description.py similarity index 100% rename from endstone_python/test/test_plugin_description.py rename to python/tests/test_plugin_description.py diff --git a/endstone_core/src/endstone_core/endstone_server.cpp b/src/endstone_core/endstone_server.cpp similarity index 96% rename from endstone_core/src/endstone_core/endstone_server.cpp rename to src/endstone_core/endstone_server.cpp index dc8523bad..5a98b89c8 100644 --- a/endstone_core/src/endstone_core/endstone_server.cpp +++ b/src/endstone_core/endstone_server.cpp @@ -22,6 +22,10 @@ namespace fs = std::filesystem; #include "endstone_core/logger_factory.h" #include "endstone_core/plugin/cpp_plugin_loader.h" +#if !defined(ENDSTONE_VERSION) +#error ENDSTONE_VERSION is not defined +#endif + EndstoneServer::EndstoneServer() : logger_(LoggerFactory::getLogger("EndstoneServer")) { plugin_manager_ = std::make_unique(*this); diff --git a/endstone_core/src/endstone_core/logger_factory.cpp b/src/endstone_core/logger_factory.cpp similarity index 100% rename from endstone_core/src/endstone_core/logger_factory.cpp rename to src/endstone_core/logger_factory.cpp diff --git a/endstone_core/src/endstone_core/plugin/cpp_plugin_loader.cpp b/src/endstone_core/plugin/cpp_plugin_loader.cpp similarity index 100% rename from endstone_core/src/endstone_core/plugin/cpp_plugin_loader.cpp rename to src/endstone_core/plugin/cpp_plugin_loader.cpp diff --git a/endstone_core/src/endstone_core/plugin/endstone_plugin_manager.cpp b/src/endstone_core/plugin/endstone_plugin_manager.cpp similarity index 100% rename from endstone_core/src/endstone_core/plugin/endstone_plugin_manager.cpp rename to src/endstone_core/plugin/endstone_plugin_manager.cpp diff --git a/endstone_python/src/endstone_python/endstone_python.cpp b/src/endstone_python/endstone_python.cpp similarity index 100% rename from endstone_python/src/endstone_python/endstone_python.cpp rename to src/endstone_python/endstone_python.cpp diff --git a/endstone_python/src/endstone_python/logger.cpp b/src/endstone_python/logger.cpp similarity index 100% rename from endstone_python/src/endstone_python/logger.cpp rename to src/endstone_python/logger.cpp diff --git a/endstone_python/src/endstone_python/plugin/plugin.cpp b/src/endstone_python/plugin/plugin.cpp similarity index 100% rename from endstone_python/src/endstone_python/plugin/plugin.cpp rename to src/endstone_python/plugin/plugin.cpp diff --git a/endstone_python/src/endstone_python/plugin/plugin_description.cpp b/src/endstone_python/plugin/plugin_description.cpp similarity index 100% rename from endstone_python/src/endstone_python/plugin/plugin_description.cpp rename to src/endstone_python/plugin/plugin_description.cpp diff --git a/endstone_python/src/endstone_python/plugin/plugin_loader.cpp b/src/endstone_python/plugin/plugin_loader.cpp similarity index 100% rename from endstone_python/src/endstone_python/plugin/plugin_loader.cpp rename to src/endstone_python/plugin/plugin_loader.cpp diff --git a/endstone_python/src/endstone_python/plugin/plugin_manager.cpp b/src/endstone_python/plugin/plugin_manager.cpp similarity index 100% rename from endstone_python/src/endstone_python/plugin/plugin_manager.cpp rename to src/endstone_python/plugin/plugin_manager.cpp diff --git a/endstone_python/src/endstone_python/server.cpp b/src/endstone_python/server.cpp similarity index 100% rename from endstone_python/src/endstone_python/server.cpp rename to src/endstone_python/server.cpp diff --git a/endstone_runtime/src/bedrock/bedrock_log.cpp b/src/endstone_runtime/bedrock/bedrock_log.cpp similarity index 100% rename from endstone_runtime/src/bedrock/bedrock_log.cpp rename to src/endstone_runtime/bedrock/bedrock_log.cpp diff --git a/endstone_runtime/src/bedrock/command_registry.cpp b/src/endstone_runtime/bedrock/command_registry.cpp similarity index 100% rename from endstone_runtime/src/bedrock/command_registry.cpp rename to src/endstone_runtime/bedrock/command_registry.cpp diff --git a/endstone_runtime/src/bedrock/common.cpp b/src/endstone_runtime/bedrock/common.cpp similarity index 100% rename from endstone_runtime/src/bedrock/common.cpp rename to src/endstone_runtime/bedrock/common.cpp diff --git a/endstone_runtime/src/bedrock/dedicated_server.cpp b/src/endstone_runtime/bedrock/dedicated_server.cpp similarity index 100% rename from endstone_runtime/src/bedrock/dedicated_server.cpp rename to src/endstone_runtime/bedrock/dedicated_server.cpp diff --git a/endstone_runtime/src/bedrock/server_instance.cpp b/src/endstone_runtime/bedrock/server_instance.cpp similarity index 100% rename from endstone_runtime/src/bedrock/server_instance.cpp rename to src/endstone_runtime/bedrock/server_instance.cpp diff --git a/endstone_runtime/src/bedrock/stop_command.cpp b/src/endstone_runtime/bedrock/stop_command.cpp similarity index 100% rename from endstone_runtime/src/bedrock/stop_command.cpp rename to src/endstone_runtime/bedrock/stop_command.cpp diff --git a/endstone_runtime/src/bedrock/type_id.cpp b/src/endstone_runtime/bedrock/type_id.cpp similarity index 100% rename from endstone_runtime/src/bedrock/type_id.cpp rename to src/endstone_runtime/bedrock/type_id.cpp diff --git a/endstone_runtime/src/endstone_runtime/linux/hook.cpp b/src/endstone_runtime/linux/hook.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/linux/hook.cpp rename to src/endstone_runtime/linux/hook.cpp diff --git a/endstone_runtime/src/endstone_runtime/linux/platform.cpp b/src/endstone_runtime/linux/platform.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/linux/platform.cpp rename to src/endstone_runtime/linux/platform.cpp diff --git a/endstone_runtime/src/endstone_runtime/main.cpp b/src/endstone_runtime/main.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/main.cpp rename to src/endstone_runtime/main.cpp diff --git a/endstone_runtime/src/endstone_runtime/python/python_plugin_loader.cpp b/src/endstone_runtime/python/python_plugin_loader.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/python/python_plugin_loader.cpp rename to src/endstone_runtime/python/python_plugin_loader.cpp diff --git a/endstone_runtime/src/endstone_runtime/windows/hook.cpp b/src/endstone_runtime/windows/hook.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/windows/hook.cpp rename to src/endstone_runtime/windows/hook.cpp diff --git a/endstone_runtime/src/endstone_runtime/windows/platform.cpp b/src/endstone_runtime/windows/platform.cpp similarity index 100% rename from endstone_runtime/src/endstone_runtime/windows/platform.cpp rename to src/endstone_runtime/windows/platform.cpp diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 99959264e..213593864 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -9,4 +9,4 @@ add_executable(test_server src/test_server.cpp src/dummy_bedrock.cpp) target_link_libraries(test_server endstone::core) add_library(test_plugin SHARED src/test_plugin.cpp) -target_link_libraries(test_plugin endstone::api) \ No newline at end of file +target_link_libraries(test_plugin endstone::headers) \ No newline at end of file diff --git a/endstone_core/test/test_endstone_server.cpp b/tests/test_endstone_server.cpp similarity index 100% rename from endstone_core/test/test_endstone_server.cpp rename to tests/test_endstone_server.cpp diff --git a/endstone_core/test/test_logger.cpp b/tests/test_logger.cpp similarity index 100% rename from endstone_core/test/test_logger.cpp rename to tests/test_logger.cpp