Skip to content

Commit

Permalink
[core] Fix ccache on master build (LSPosed#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored Mar 30, 2021
1 parent 7f1f5ce commit 16982c5
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 31 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ jobs:
key: ccache-cache-${{ github.sha }}
restore-keys: ccache-cache-
- name: Install ccache
run: sudo apt-get install -y ccache
run: |
sudo apt-get install -y ccache
ccache -o max_size=2G
ccache -o hash_dir=false
- name: Build with Gradle
run: |
run: |
echo 'org.gradle.caching=true' >> gradle.properties
echo 'org.gradle.parallel=true' >> gradle.properties
echo 'org.gradle.vfs.watch=true' >> gradle.properties
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url = https://github.com/topjohnwu/libcxx.git
[submodule "core/src/main/cpp/external/Dobby"]
path = core/src/main/cpp/external/Dobby
url = https://github.com/jmpews/Dobby.git
url = https://github.com/LSPosed/Dobby.git
12 changes: 8 additions & 4 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,20 @@ android {
"-fomit-frame-pointer",
"-fpie", "-fPIC",
"-Wno-builtin-macro-redefined",
"-D__FILE__=__FILE_NAME__",
"-DRIRU_MODULE",
"-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion",
"-DRIRU_MODULE_VERSION=$verCode",
"-D__FILE__=__FILE_NAME__",
"""-DRIRU_MODULE_VERSION_NAME=\"$verName\"""",
"""-DMODULE_NAME=\"$riruModuleId\""""
// "-DRIRU_MODULE_VERSION=$verCode", // this will stop ccache from hitting
// """-DRIRU_MODULE_VERSION_NAME=\"$verName\"""",
)
cppFlags("-std=c++20", *flags)
cFlags("-std=c18", *flags)
arguments("-DANDROID_STL=none")
arguments(
"-DANDROID_STL=none",
"-DVERSION_CODE=$verCode",
"-DVERSION_NAME=$verName"
)
targets("lspd")
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/cpp/external/Dobby
Submodule Dobby updated 1 files
+1 −3 CMakeLists.txt
5 changes: 4 additions & 1 deletion core/src/main/cpp/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

cmake_minimum_required(VERSION 3.4.1)

configure_file(template/config.cpp src/config.cpp)

aux_source_directory(src SRC_LIST)
aux_source_directory(src/jni SRC_JNI_LIST)
include_directories(include src)
add_executable(lspd ${SRC_LIST} ${SRC_JNI_LIST})

add_executable(lspd ${SRC_LIST} ${SRC_JNI_LIST} ${CMAKE_CURRENT_BINARY_DIR}/src/config.cpp)

SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--dynamic-list=${CMAKE_SOURCE_DIR}/dynamic_list")

Expand Down
39 changes: 21 additions & 18 deletions core/src/main/cpp/main/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,32 @@ namespace lspd {
# define LP_SELECT(lp32, lp64) lp32
#endif

static constexpr auto kEntryClassName = "org.lsposed.lspd.core.Main"_tstr;
static constexpr auto kClassLinkerClassName = "org.lsposed.lspd.nativebridge.ClassLinker"_tstr;
static constexpr auto kBridgeServiceClassName = "org.lsposed.lspd.service.BridgeService"_tstr;
static constexpr auto kDexPath = "framework/lspd.dex"_tstr;

static constexpr auto kLibArtName = "libart.so"_tstr;
static constexpr auto kLibFwName = "libandroidfw.so"_tstr;
static constexpr auto kLinkerName = LP_SELECT("linker"_tstr, "linker64"_tstr);
static constexpr auto kLibcName = "libc.so"_tstr;
static constexpr auto kLibbaseName = "libbase.so"_tstr;

static constexpr auto kLibBasePath =
inline static constexpr auto kEntryClassName = "org.lsposed.lspd.core.Main"_tstr;
inline static constexpr auto kClassLinkerClassName = "org.lsposed.lspd.nativebridge.ClassLinker"_tstr;
inline static constexpr auto kBridgeServiceClassName = "org.lsposed.lspd.service.BridgeService"_tstr;
inline static constexpr auto kDexPath = "framework/lspd.dex"_tstr;

inline static constexpr auto kLibArtName = "libart.so"_tstr;
inline static constexpr auto kLibFwName = "libandroidfw.so"_tstr;
inline static constexpr auto kLinkerName = LP_SELECT("linker"_tstr, "linker64"_tstr);
inline static constexpr auto kLibcName = "libc.so"_tstr;
inline static constexpr auto kLibbaseName = "libbase.so"_tstr;

inline static constexpr auto kLibBasePath =
LP_SELECT("/system/lib/"_tstr,
"/system/lib64/"_tstr);

static constexpr auto kBinBasePath = "/system/bin/"_tstr;
inline static constexpr auto kBinBasePath = "/system/bin/"_tstr;

static constexpr auto kLibFwPath = kLibBasePath + kLibFwName;
static constexpr auto kLinkerPath = kBinBasePath + kLinkerName;
static constexpr auto kLibcPath = kLibBasePath + kLibcName;
static constexpr auto kLibbasePath = kLibBasePath + kLibbaseName;
inline static constexpr auto kLibFwPath = kLibBasePath + kLibFwName;
inline static constexpr auto kLinkerPath = kBinBasePath + kLinkerName;
inline static constexpr auto kLibcPath = kLibBasePath + kLibcName;
inline static constexpr auto kLibbasePath = kLibBasePath + kLibbaseName;

inline constexpr const char *const BoolToString(bool b) {
inline constexpr const char *BoolToString(bool b) {
return b ? "true" : "false";
}

extern const int versionCode;
extern const char* const versionName;
}
6 changes: 3 additions & 3 deletions core/src/main/cpp/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace lspd {

void onModuleLoaded() {
LOGI("onModuleLoaded: welcome to LSPosed!");
LOGI("onModuleLoaded: version %s (%d)", RIRU_MODULE_VERSION_NAME, RIRU_MODULE_VERSION);
LOGI("onModuleLoaded: version %s (%d)", versionName, versionCode);
// rirud must be used in onModuleLoaded
Context::GetInstance()->PreLoadDex(magiskPath + '/' + kDexPath);
InitSymbolCache();
Expand Down Expand Up @@ -99,8 +99,8 @@ namespace lspd {
.moduleApiVersion = RIRU_MODULE_API_VERSION,
.moduleInfo = RiruModuleInfo{
.supportHide = !isDebug,
.version = RIRU_MODULE_VERSION,
.versionName = RIRU_MODULE_VERSION_NAME,
.version = versionCode,
.versionName = versionName,
.onModuleLoaded = lspd::onModuleLoaded,
.forkAndSpecializePre = lspd::nativeForkAndSpecializePre,
.forkAndSpecializePost = lspd::nativeForkAndSpecializePost,
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/cpp/main/template/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "config.h"

namespace lspd {
const int versionCode = ${VERSION_CODE};
extern const char* const versionName = "${VERSION_NAME}";
}
12 changes: 11 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
rootProject.name = "LSPosed"
include(":core", ":hiddenapi-stubs", ":app", ":service", ":interface", ":hiddenapi-bridge", ":manager-service")
include(
":core",
":hiddenapi-stubs",
":app",
":service",
":interface",
":hiddenapi-bridge",
":manager-service"
)

val serviceRoot = "service"
project(":interface").projectDir = file("$serviceRoot${File.separator}interface")
project(":service").projectDir = file("$serviceRoot${File.separator}service")

buildCache { local { removeUnusedEntriesAfterDays = 1 } }

0 comments on commit 16982c5

Please sign in to comment.