Better incremental builds
This commit is contained in:
parent
41446ec9ba
commit
60b3b8ddce
3
build.py
3
build.py
@ -170,8 +170,7 @@ def build_binary(args):
|
||||
|
||||
header('* Building binaries: ' + ' '.join(args.target))
|
||||
|
||||
# Force update logging.h timestamp to trigger recompilation for the flags to make a difference
|
||||
os.utime(os.path.join('native', 'jni', 'utils', 'include', 'logging.h'))
|
||||
os.utime(os.path.join('native', 'jni', 'include', 'flags.h'))
|
||||
|
||||
# Basic flags
|
||||
base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'],
|
||||
|
@ -14,8 +14,8 @@ android {
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
// Pass arguments to ndk-build.
|
||||
arguments('B_MAGISK=1', 'B_INIT=1', 'B_BOOT=1', 'B_BXZ=1', 'MAGISK_VERSION=debug',
|
||||
'MAGISK_VER_CODE=99999', 'MAGISK_DEBUG=-DMAGISK_DEBUG')
|
||||
arguments('B_MAGISK=1', 'B_INIT=1', 'B_BOOT=1', 'B_BXZ=1',
|
||||
'MAGISK_DEBUG=-DMAGISK_DEBUG')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "daemon.h"
|
||||
#include "resetprop.h"
|
||||
#include "selinux.h"
|
||||
#include "flags.h"
|
||||
|
||||
static char buf[PATH_MAX], buf2[PATH_MAX];
|
||||
static struct vector module_list;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "daemon.h"
|
||||
#include "resetprop.h"
|
||||
#include "selinux.h"
|
||||
#include "flags.h"
|
||||
|
||||
int setup_done = 0;
|
||||
int seperate_vendor = 0;
|
||||
@ -69,7 +70,7 @@ static void *request_handler(void *args) {
|
||||
su_daemon_receiver(client, &credential);
|
||||
break;
|
||||
case CHECK_VERSION:
|
||||
write_string(client, MAGISK_VER_STR);
|
||||
write_string(client, xstr(MAGISK_VERSION) ":MAGISK");
|
||||
close(client);
|
||||
break;
|
||||
case CHECK_VERSION_CODE:
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "magisk.h"
|
||||
#include "utils.h"
|
||||
#include "daemon.h"
|
||||
#include "flags.h"
|
||||
|
||||
static int loggable = 0;
|
||||
static struct vector log_cmd, clear_cmd;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "magisk.h"
|
||||
#include "daemon.h"
|
||||
#include "selinux.h"
|
||||
#include "flags.h"
|
||||
|
||||
char *argv0;
|
||||
|
||||
@ -66,7 +67,7 @@ int magisk_main(int argc, char *argv[]) {
|
||||
if (argc < 2)
|
||||
usage();
|
||||
if (strcmp(argv[1], "-c") == 0) {
|
||||
printf("%s (%d)\n", MAGISK_VER_STR, MAGISK_VER_CODE);
|
||||
printf("%s (%d)\n", xstr(MAGISK_VERSION) ":MAGISK", MAGISK_VER_CODE);
|
||||
return 0;
|
||||
} else if (strcmp(argv[1], "-v") == 0) {
|
||||
int fd = connect_daemon();
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "utils.h"
|
||||
#include "daemon.h"
|
||||
#include "magisk.h"
|
||||
#include "flags.h"
|
||||
|
||||
#define DEFAULT_DT_DIR "/proc/device-tree/firmware/android"
|
||||
|
||||
|
15
native/jni/include/flags.h
Normal file
15
native/jni/include/flags.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
/* Include this header anywhere you access MAGISK_DEBUG, MAGISK_VERSION, MAGISK_VER_CODE.
|
||||
*
|
||||
* This file is only for more precise incremental builds. We can make sure code that uses
|
||||
* external flags are re-compiled by updating the timestamp of this file
|
||||
* */
|
||||
|
||||
#ifndef MAGISK_VERSION
|
||||
#define MAGISK_VERSION 99.99
|
||||
#endif
|
||||
|
||||
#ifndef MAGISK_VER_CODE
|
||||
#define MAGISK_VER_CODE 99999
|
||||
#endif
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "logging.h"
|
||||
|
||||
#define MAGISK_VER_STR xstr(MAGISK_VERSION) ":MAGISK"
|
||||
#define MAIN_SOCKET "d30138f2310a9fb9c54a3e0c21f58591"
|
||||
#define LOG_SOCKET "5864cd77f2f8c59b3882e2d35dbf51e4"
|
||||
#define JAVA_PACKAGE_NAME "com.topjohnwu.magisk"
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "daemon.h"
|
||||
#include "utils.h"
|
||||
#include "magiskhide.h"
|
||||
#include "flags.h"
|
||||
|
||||
static int sockfd = -1;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "utils.h"
|
||||
#include "su.h"
|
||||
#include "selinux.h"
|
||||
#include "flags.h"
|
||||
|
||||
struct su_context *su_ctx;
|
||||
|
||||
@ -182,7 +183,7 @@ int su_daemon_main(int argc, char **argv) {
|
||||
printf("%d\n", MAGISK_VER_CODE);
|
||||
exit2(EXIT_SUCCESS);
|
||||
case 'v':
|
||||
printf("%s\n", MAGISKSU_VER_STR);
|
||||
printf("%s\n", xstr(MAGISK_VERSION) ":MAGISKSU (topjohnwu)");
|
||||
exit2(EXIT_SUCCESS);
|
||||
case 'z':
|
||||
// Do nothing, placed here for legacy support :)
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "db.h"
|
||||
#include "list.h"
|
||||
|
||||
#define MAGISKSU_VER_STR xstr(MAGISK_VERSION) ":MAGISKSU (topjohnwu)"
|
||||
#define DEFAULT_SHELL "/system/bin/sh"
|
||||
|
||||
struct su_info {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "magisk.h"
|
||||
#include "utils.h"
|
||||
#include "img.h"
|
||||
#include "flags.h"
|
||||
|
||||
#define round_size(a) ((((a) / 32) + 2) * 32)
|
||||
#define SOURCE_TMP "/dev/.img_src"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "logging.h"
|
||||
#include "utils.h"
|
||||
#include "resetprop.h"
|
||||
#include "flags.h"
|
||||
|
||||
unsigned get_shell_uid() {
|
||||
struct passwd* ppwd = getpwnam("shell");
|
||||
|
Loading…
Reference in New Issue
Block a user