From e7ea8c2fe242deeec867240295ea077537c7b102 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Thu, 21 Mar 2019 17:51:04 +0100 Subject: [PATCH 01/15] Q Preview 1 compatiblity On several older Android versions we needed to relocate app_process to prevent it from being executed in a restricted SELinux context, but this causes the "Error finding namespace of apex: no namespace called runtime" linker error on Q Preview 1. Running app_process straight from /system/bin (and daemonizer from /data/.../lib) works fine however on QP1, so we just skip relocating altogher for now. Closes #4 --- .../eu/chainfire/librootjava/AppProcess.java | 28 +++++++++++++++++++ .../librootjavadaemon/RootDaemon.java | 25 +++++++++++------ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/librootjava/src/main/java/eu/chainfire/librootjava/AppProcess.java b/librootjava/src/main/java/eu/chainfire/librootjava/AppProcess.java index 7649f54..4698b13 100644 --- a/librootjava/src/main/java/eu/chainfire/librootjava/AppProcess.java +++ b/librootjava/src/main/java/eu/chainfire/librootjava/AppProcess.java @@ -283,6 +283,29 @@ public static boolean guessIfAppProcessIs64Bits(String app_process) { return !isRunningAs32BitOn64BitArch(); } + /** + * Should app_process be relocated ?
+ *
+ * On older Android versions we must relocate the app_process binary to prevent it from + * running in a restricted SELinux context. On Q this presents us with the linker error: + * "Error finding namespace of apex: no namespace called runtime". However, at least + * on the first preview release of Q, running straight from /system/bin works and does + * not give us a restricted SELinux context, so we skip relocation. + * + * TODO: Revisit on new Q preview and production releases. Maybe spend some time figuring out what causes the namespace error and if we can fix it. + * + * @see #getAppProcessRelocate(Context, String, List, List, String) + * + * @return should app_process be relocated ? + */ + @TargetApi(Build.VERSION_CODES.M) + public static boolean shouldAppProcessBeRelocated() { + return !( + (Build.VERSION.SDK_INT >= 29) || + ((Build.VERSION.SDK_INT == 28) && (Build.VERSION.PREVIEW_SDK_INT != 0)) + ); + } + /** * Create script to relocate specified app_process binary to a different location.
*
@@ -290,6 +313,7 @@ public static boolean guessIfAppProcessIs64Bits(String app_process) { * SELinux context that we do not want. Relocating it bypasses that.
* * @see #getAppProcess() + * @see #shouldAppProcessBeRelocated() * * @param context Application or activity context * @param appProcessBase Path to original app_process or null for default @@ -301,6 +325,10 @@ public static boolean guessIfAppProcessIs64Bits(String app_process) { public static String getAppProcessRelocate(Context context, String appProcessBase, List preLaunch, List postExecution, String path) { if (appProcessBase == null) appProcessBase = getAppProcess(); if (path == null) { + if (!shouldAppProcessBeRelocated()) { + return appProcessBase; + } + path = "/dev"; if ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0) { File cacheDir = context.getCacheDir(); diff --git a/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java b/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java index fb63aad..ac625bb 100644 --- a/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java +++ b/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java @@ -73,18 +73,27 @@ public static List patchLaunchScript(Context context, List scrip // patch the main script line String app_process_path = app_process.substring(0, app_process.lastIndexOf('/')); - // copy our executable - String libSrc = RootJava.getLibraryPath(context, "daemonize"); - String libDest = app_process_path + "/.daemonize_" + AppProcess.UUID; - boolean onData = libDest.startsWith("/data/"); + // our executable + String libSource = RootJava.getLibraryPath(context, "daemonize"); + String libExec; + + if (app_process_path.startsWith("/system/bin")) { + // app_process was not relocated, assume caller knows what he's doing, and + // run our executable from its library location + libExec = libSource; + } else { + // copy our executable + libExec = app_process_path + "/.daemonize_" + AppProcess.UUID; + boolean onData = libExec.startsWith("/data/"); - ret.add(String.format(Locale.ENGLISH, "%s cp %s %s >/dev/null 2>/dev/null", AppProcess.BOX, libSrc, libDest)); - ret.add(String.format(Locale.ENGLISH, "%s chmod %s %s >/dev/null 2>/dev/null", AppProcess.BOX, onData ? "0766" : "0700", libDest)); - if (onData) ret.add(String.format(Locale.ENGLISH, "restorecon %s >/dev/null 2>/dev/null", libDest)); + ret.add(String.format(Locale.ENGLISH, "%s cp %s %s >/dev/null 2>/dev/null", AppProcess.BOX, libSource, libExec)); + ret.add(String.format(Locale.ENGLISH, "%s chmod %s %s >/dev/null 2>/dev/null", AppProcess.BOX, onData ? "0766" : "0700", libExec)); + if (onData) ret.add(String.format(Locale.ENGLISH, "restorecon %s >/dev/null 2>/dev/null", libExec)); + } // inject executable into command int idx = line.indexOf(app_process); - ret.add(line.substring(0, idx) + libDest + " " + line.substring(idx)); + ret.add(line.substring(0, idx) + libExec + " " + line.substring(idx)); in_post = true; } else if (in_post && line.contains("box rm")) { From 7c2da99845a0e782371385fc1072218be16ed167 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Thu, 21 Mar 2019 18:24:52 +0100 Subject: [PATCH 02/15] v1.3.0 --- librootjava/README.md | 2 +- librootjava/build.gradle | 2 +- librootjava_example/build.gradle | 4 ++-- librootjavadaemon/README.md | 2 +- librootjavadaemon/build.gradle | 6 +++--- librootjavadaemon_example/build.gradle | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/librootjava/README.md b/librootjava/README.md index dc817d3..7bca846 100644 --- a/librootjava/README.md +++ b/librootjava/README.md @@ -431,7 +431,7 @@ an Android 10 preview comes out! ## Gradle ``` -implementation 'eu.chainfire:librootjava:1.2.0' +implementation 'eu.chainfire:librootjava:1.3.0' ``` ## Notes diff --git a/librootjava/build.gradle b/librootjava/build.gradle index ebd8b67..250c360 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -51,7 +51,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.2.0' + libraryVersion = '1.3.0' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index d3e3078..6a58f6d 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -35,8 +35,8 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.2.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.2.0' + implementation 'eu.chainfire:librootjava:1.3.0' } diff --git a/librootjavadaemon/README.md b/librootjavadaemon/README.md index a9f14f4..175f953 100644 --- a/librootjavadaemon/README.md +++ b/librootjavadaemon/README.md @@ -151,7 +151,7 @@ on the Android site. ## Gradle ``` -implementation 'eu.chainfire:librootjavadaemon:1.2.0' +implementation 'eu.chainfire:librootjavadaemon:1.3.0' ``` You should update to the latest libRootJava and libRootJavaDaemon at the diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index 3bdb6ae..2414543 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -27,10 +27,10 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.2.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.2.0' + implementation 'eu.chainfire:librootjava:1.3.0' } task sourcesJar(type: Jar) { @@ -64,7 +64,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.2.0' + libraryVersion = '1.3.0' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index 0f22add..1019acc 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -36,10 +36,10 @@ dependencies { //implementation project(':librootjavadaemon') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.2.0-SNAPSHOT') { changing = true } - //implementation('eu.chainfire:librootjavadaemon:1.2.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjavadaemon:1.3.0-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.2.0' - implementation 'eu.chainfire:librootjavadaemon:1.2.0' + implementation 'eu.chainfire:librootjava:1.3.0' + implementation 'eu.chainfire:librootjavadaemon:1.3.0' } From aae3fa31af42c0a172b5656b467309aaa8449760 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Mon, 13 May 2019 16:52:37 +0200 Subject: [PATCH 03/15] Fix ProGuard issue Closes #1 This fix worked for the same issue in a different project, not sure why the issue shows up only for some projects, and even only for some people cloning the same git. --- librootjava_example/build.gradle | 1 + librootjavadaemon_example/build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index 6a58f6d..9a34f77 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -15,6 +15,7 @@ android { buildTypes { release { minifyEnabled true + useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index 1019acc..017d4b8 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -15,6 +15,7 @@ android { buildTypes { release { minifyEnabled true + useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } From aeab2d73ec0867ae14f7a8d209f670937eac6899 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Mon, 21 Dec 2020 18:07:25 +0100 Subject: [PATCH 04/15] Android 11 doesn't like # character in service names --- .../main/java/eu/chainfire/librootjavadaemon/RootDaemon.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java b/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java index ac625bb..f122409 100644 --- a/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java +++ b/librootjavadaemon/src/main/java/eu/chainfire/librootjavadaemon/RootDaemon.java @@ -184,7 +184,7 @@ public interface OnExitListener { */ @SuppressLint("PrivateApi") public static void daemonize(String packageName, int code, boolean surviveFrameworkRestart, OnExitListener exitListener) { - String id = packageName + "#" + String.valueOf(code) + "#daemonize"; + String id = packageName + "_" + String.valueOf(code) + "_daemonize"; File apk = new File(System.getenv("CLASSPATH")); final String version = String.format(Locale.ENGLISH, "%s:%d:%d", apk.getAbsolutePath(), apk.lastModified(), apk.length()); From 2cc1e9b788f89c483a0fff7d471c13eaf45abdb9 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Mon, 21 Dec 2020 18:20:12 +0100 Subject: [PATCH 05/15] v1.3.1 --- librootjava/README.md | 2 +- librootjava/build.gradle | 2 +- librootjava_example/build.gradle | 4 ++-- librootjavadaemon/README.md | 2 +- librootjavadaemon/build.gradle | 6 +++--- librootjavadaemon_example/build.gradle | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/librootjava/README.md b/librootjava/README.md index 7bca846..3fa19ca 100644 --- a/librootjava/README.md +++ b/librootjava/README.md @@ -431,7 +431,7 @@ an Android 10 preview comes out! ## Gradle ``` -implementation 'eu.chainfire:librootjava:1.3.0' +implementation 'eu.chainfire:librootjava:1.3.1' ``` ## Notes diff --git a/librootjava/build.gradle b/librootjava/build.gradle index 250c360..e5ec9f5 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -51,7 +51,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.0' + libraryVersion = '1.3.1' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index 9a34f77..d4f33ce 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -36,8 +36,8 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.0' + implementation 'eu.chainfire:librootjava:1.3.1' } diff --git a/librootjavadaemon/README.md b/librootjavadaemon/README.md index 175f953..88f3a84 100644 --- a/librootjavadaemon/README.md +++ b/librootjavadaemon/README.md @@ -151,7 +151,7 @@ on the Android site. ## Gradle ``` -implementation 'eu.chainfire:librootjavadaemon:1.3.0' +implementation 'eu.chainfire:librootjavadaemon:1.3.1' ``` You should update to the latest libRootJava and libRootJavaDaemon at the diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index 2414543..97dd435 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -27,10 +27,10 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.0' + implementation 'eu.chainfire:librootjava:1.3.1' } task sourcesJar(type: Jar) { @@ -64,7 +64,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.0' + libraryVersion = '1.3.1' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index 017d4b8..9d81a7e 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -37,10 +37,10 @@ dependencies { //implementation project(':librootjavadaemon') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.0-SNAPSHOT') { changing = true } - //implementation('eu.chainfire:librootjavadaemon:1.3.0-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjavadaemon:1.3.1-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.0' - implementation 'eu.chainfire:librootjavadaemon:1.3.0' + implementation 'eu.chainfire:librootjava:1.3.1' + implementation 'eu.chainfire:librootjavadaemon:1.3.1' } From 8759ccbde9f978139c799d29434e6a69cc63a213 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Wed, 23 Dec 2020 10:28:11 +0100 Subject: [PATCH 06/15] Deprecation notice --- .github/workflows/ci.yml | 12 ++++++++++++ librootjava/README.md | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..44f1e65 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,12 @@ +name: ci +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - uses: gradle/wrapper-validation-action@v1 + - run: ./gradlew build diff --git a/librootjava/README.md b/librootjava/README.md index 3fa19ca..b94740a 100644 --- a/librootjava/README.md +++ b/librootjava/README.md @@ -1,5 +1,7 @@ # libRootJava +[![ci][1]][2] + Run Java (and Kotlin) code as root! - Runs code directly from your APK @@ -20,6 +22,18 @@ crediting me is appreciated. If you modify the library itself when you use it in your projects, you are kindly requested to share the sources of those modifications. +## Deprecated + +This library is not under active development right now, as I've mostly +moved away from the Android world. While I believe it still works great, +if it breaks due to changes on new Android versions or root solutions, +fixes may be slow to appear. + +If you're writing a new app, you might consider using +[TopJohnWu's libsu](https://github.com/topjohnwu/libsu) instead. Barring +some edge-cases (that I personally seem to be the biggest user of) the +capabilities should be similar, but it's likely to be better maintained. + ## Spaghetti Sauce Project This library is part of the [Spaghetti Sauce Project](https://github.com/Chainfire/spaghetti_sauce_project). @@ -438,4 +452,7 @@ implementation 'eu.chainfire:librootjava:1.3.1' This library includes its own Logger class that is used throughout, which should probably have been refactored out. -It wasn't. \ No newline at end of file +It wasn't. + +[1]: https://github.com/Chainfire/libsuperuser/workflows/ci/badge.svg +[2]: https://github.com/Chainfire/libsuperuser/actions From 45e78151523fd4cae58ee5c75c31a8e782c57a87 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Wed, 23 Dec 2020 10:30:12 +0100 Subject: [PATCH 07/15] Update CI --- librootjava/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librootjava/README.md b/librootjava/README.md index b94740a..361ce2f 100644 --- a/librootjava/README.md +++ b/librootjava/README.md @@ -454,5 +454,5 @@ This library includes its own Logger class that is used throughout, which should probably have been refactored out. It wasn't. -[1]: https://github.com/Chainfire/libsuperuser/workflows/ci/badge.svg -[2]: https://github.com/Chainfire/libsuperuser/actions +[1]: https://github.com/Chainfire/librootjava/workflows/ci/badge.svg +[2]: https://github.com/Chainfire/librootjava/actions From 28bed81511a8f0a7f7d3f7e2f37aa6656d255b5f Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Wed, 23 Dec 2020 10:32:56 +0100 Subject: [PATCH 08/15] gradlew permission for CI --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From ed22c74cb63f6e5d74e94fa4dba29ad9b8779f2a Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Wed, 23 Dec 2020 10:36:36 +0100 Subject: [PATCH 09/15] Build without local.properties --- librootjava/build.gradle | 4 +++- librootjavadaemon/build.gradle | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/librootjava/build.gradle b/librootjava/build.gradle index e5ec9f5..f95c3a4 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -83,7 +83,9 @@ group = publishedGroupId bintray { Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) + if (project.rootProject.file('local.properties').exists()) { + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + } user = properties.getProperty('bintray.user') key = properties.getProperty('bintray.apikey') diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index 97dd435..fa108e1 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -96,7 +96,9 @@ group = publishedGroupId bintray { Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) + if (project.rootProject.file('local.properties').exists()) { + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + } user = properties.getProperty('bintray.user') key = properties.getProperty('bintray.apikey') From 607a6d48aa486e7f829b0fef0f053f1e5f96a45e Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 11:35:03 +0100 Subject: [PATCH 10/15] Move from jCenter/binTray to JitPack --- build.gradle | 2 +- jitpack.yml | 2 ++ librootjava/build.gradle | 34 +----------------------- librootjava_example/build.gradle | 8 +++--- librootjavadaemon/build.gradle | 36 ++------------------------ librootjavadaemon_example/build.gradle | 12 ++++----- 6 files changed, 16 insertions(+), 78 deletions(-) create mode 100644 jitpack.yml diff --git a/build.gradle b/build.gradle index 9a78710..4ae2089 100644 --- a/build.gradle +++ b/build.gradle @@ -6,13 +6,13 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } allprojects { repositories { google() + maven { url 'https://jitpack.io' } jcenter() mavenLocal() } diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..d1e6c1e --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +install: + - ./gradlew clean :librootjava:install :librootjavadaemon:install diff --git a/librootjava/build.gradle b/librootjava/build.gradle index f95c3a4..ec94150 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' android { compileSdkVersion 26 @@ -51,7 +50,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.1' + libraryVersion = '1.3.2' developerId = 'Chainfire' developerName = 'Jorrit Jongma' @@ -81,35 +80,6 @@ task installMavenLocal(type: Upload) { version = libraryVersion group = publishedGroupId -bintray { - Properties properties = new Properties() - if (project.rootProject.file('local.properties').exists()) { - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - } - user = properties.getProperty('bintray.user') - key = properties.getProperty('bintray.apikey') - - configurations = ['archives'] - dryRun = false - publish = true - pkg { - repo = bintrayRepo - name = libraryName - desc = libraryDescription - websiteUrl = siteUrl - issueTrackerUrl = issueTrackerUrl // doesn't actually work? - vcsUrl = gitUrl - //githubRepo = gitUrl // some more bintray weirdness here, breaks upload - //githubReleaseNotesFile = 'README.md' - licenses = allLicenses - publicDownloadNumbers = true - version { - name = libraryVersion - released = new Date() - } - } -} - install { repositories.mavenInstaller { pom.project { @@ -140,5 +110,3 @@ install { } } } - -bintrayUpload.dependsOn install diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index d4f33ce..1069792 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -28,7 +28,7 @@ dependencies { implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'eu.chainfire:libsuperuser:1.0.0.+' + implementation 'eu.chainfire:libsuperuser:1.1.1' // --- librootjava dependency --- @@ -36,8 +36,8 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.2-SNAPSHOT') { changing = true } - /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.1' + /* Use jitpack version */ + implementation 'eu.chainfire:librootjava:1.3.2' } diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index fa108e1..58d01a4 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' android { compileSdkVersion 26 @@ -30,7 +29,7 @@ dependencies { //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.1' + implementation 'eu.chainfire:librootjava:1.3.2' } task sourcesJar(type: Jar) { @@ -64,7 +63,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.1' + libraryVersion = '1.3.2' developerId = 'Chainfire' developerName = 'Jorrit Jongma' @@ -94,35 +93,6 @@ task installMavenLocal(type: Upload) { version = libraryVersion group = publishedGroupId -bintray { - Properties properties = new Properties() - if (project.rootProject.file('local.properties').exists()) { - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - } - user = properties.getProperty('bintray.user') - key = properties.getProperty('bintray.apikey') - - configurations = ['archives'] - dryRun = false - publish = true - pkg { - repo = bintrayRepo - name = libraryName - desc = libraryDescription - websiteUrl = siteUrl - issueTrackerUrl = issueTrackerUrl // doesn't actually work? - vcsUrl = gitUrl - //githubRepo = gitUrl // some more bintray weirdness here, breaks upload - //githubReleaseNotesFile = 'README.md' - licenses = allLicenses - publicDownloadNumbers = true - version { - name = libraryVersion - released = new Date() - } - } -} - install { repositories.mavenInstaller { pom.project { @@ -153,5 +123,3 @@ install { } } } - -bintrayUpload.dependsOn install diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index 9d81a7e..ad46554 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -28,7 +28,7 @@ dependencies { implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'eu.chainfire:libsuperuser:1.0.0.+' + implementation 'eu.chainfire:libsuperuser:1.1.1' // --- librootjava and librootjavadaemon dependencies --- @@ -37,10 +37,10 @@ dependencies { //implementation project(':librootjavadaemon') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } - //implementation('eu.chainfire:librootjavadaemon:1.3.1-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.2-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjavadaemon:1.3.2-SNAPSHOT') { changing = true } - /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.1' - implementation 'eu.chainfire:librootjavadaemon:1.3.1' + /* Use jitpack version */ + implementation 'eu.chainfire:librootjava:1.3.2' + implementation 'eu.chainfire:librootjavadaemon:1.3.2' } From acdaf6b7ca134e43ad8db40c907beca52a3a1d43 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 12:33:09 +0100 Subject: [PATCH 11/15] Build updates --- build.gradle | 2 +- gradle.properties | 19 ++++++++----------- gradle/wrapper/gradle-wrapper.properties | 4 ++-- librootjava/build.gradle | 4 ++-- .../java/eu/chainfire/librootjava/Logger.java | 2 +- librootjava_example/build.gradle | 3 +-- librootjavadaemon/build.gradle | 4 ++-- librootjavadaemon_example/build.gradle | 3 +-- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 4ae2089..5e67a91 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:4.1.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' } } diff --git a/gradle.properties b/gradle.properties index 1d3591c..9c36dce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,15 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit +## For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - +# # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m +# Default value: -Xmx1024m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - +# # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +#Sat Feb 05 12:08:52 CET 2022 +#android.enableJetifier=true +android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 48effd2..44d10f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Nov 09 13:15:43 CET 2018 +#Sat Feb 05 12:08:34 CET 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/librootjava/build.gradle b/librootjava/build.gradle index ec94150..7cec259 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -2,8 +2,8 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 26 - buildToolsVersion '28.0.3' + compileSdkVersion 30 + buildToolsVersion '30.0.3' defaultConfig { minSdkVersion 21 /* was 14 pre-Binder/AIDL */ targetSdkVersion 26 diff --git a/librootjava/src/main/java/eu/chainfire/librootjava/Logger.java b/librootjava/src/main/java/eu/chainfire/librootjava/Logger.java index 5ad1ee0..b2f81f9 100644 --- a/librootjava/src/main/java/eu/chainfire/librootjava/Logger.java +++ b/librootjava/src/main/java/eu/chainfire/librootjava/Logger.java @@ -23,7 +23,7 @@ @SuppressWarnings({"unused", "WeakerAccess"}) public class Logger { private static String getDefaultLogTag(){ - String tag = BuildConfig.APPLICATION_ID; + String tag = BuildConfig.LIBRARY_PACKAGE_NAME; int p; while ((p = tag.indexOf('.')) >= 0) { tag = tag.substring(p + 1); diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index 1069792..3de06c8 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion '28.0.3' + buildToolsVersion '30.0.3' defaultConfig { applicationId "eu.chainfire.librootjava_example" @@ -15,7 +15,6 @@ android { buildTypes { release { minifyEnabled true - useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index 58d01a4..bc594e9 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -2,8 +2,8 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 26 - buildToolsVersion '28.0.3' + compileSdkVersion 30 + buildToolsVersion '30.0.3' defaultConfig { minSdkVersion 21 targetSdkVersion 26 diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index ad46554..4278d2c 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion '28.0.3' + buildToolsVersion '30.0.3' defaultConfig { applicationId "eu.chainfire.librootjavadaemon_example" @@ -15,7 +15,6 @@ android { buildTypes { release { minifyEnabled true - useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } From 4c0af8fcfbe20fc85db9f4995d9337784d262cb4 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 12:40:45 +0100 Subject: [PATCH 12/15] Fix CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44f1e65..baee9c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,4 +9,5 @@ jobs: with: java-version: 1.8 - uses: gradle/wrapper-validation-action@v1 - - run: ./gradlew build + - run: ./gradlew :librootjava:build + From c5aa981aa334ed4a50f43b90a1246e8f600ad413 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 12:47:58 +0100 Subject: [PATCH 13/15] Update README and version numbers --- librootjava/README.md | 19 +++++++++++++++++-- librootjava/build.gradle | 2 +- librootjava_example/build.gradle | 4 ++-- librootjavadaemon/README.md | 19 ++++++++++++++++++- librootjavadaemon/build.gradle | 6 +++--- librootjavadaemon_example/build.gradle | 8 ++++---- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/librootjava/README.md b/librootjava/README.md index 361ce2f..b866116 100644 --- a/librootjava/README.md +++ b/librootjava/README.md @@ -1,6 +1,6 @@ # libRootJava -[![ci][1]][2] +[![ci][1]][2] [![](https://jitpack.io/v/eu.chainfire/librootjava.svg)](https://jitpack.io/#eu.chainfire/librootjava) Run Java (and Kotlin) code as root! @@ -444,8 +444,23 @@ an Android 10 preview comes out! ## Gradle +Root `build.gradle`: + +``` +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } +} ``` -implementation 'eu.chainfire:librootjava:1.3.1' + +Module `build.gradle`: + +``` +dependencies { + implementation 'eu.chainfire:librootjava:1.3.3' +} ``` ## Notes diff --git a/librootjava/build.gradle b/librootjava/build.gradle index 7cec259..4ff774b 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -50,7 +50,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.2' + libraryVersion = '1.3.3' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjava_example/build.gradle b/librootjava_example/build.gradle index 3de06c8..fdf499e 100644 --- a/librootjava_example/build.gradle +++ b/librootjava_example/build.gradle @@ -35,8 +35,8 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.2-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.3-SNAPSHOT') { changing = true } /* Use jitpack version */ - implementation 'eu.chainfire:librootjava:1.3.2' + implementation 'eu.chainfire:librootjava:1.3.3' } diff --git a/librootjavadaemon/README.md b/librootjavadaemon/README.md index 88f3a84..339d4b7 100644 --- a/librootjavadaemon/README.md +++ b/librootjavadaemon/README.md @@ -1,5 +1,7 @@ # libRootJavaDaemon +[![](https://jitpack.io/v/eu.chainfire/librootjava.svg)](https://jitpack.io/#eu.chainfire/librootjava) + Add-on for [libRootJava](../librootjava) to run the root process as a daemon. @@ -150,8 +152,23 @@ on the Android site. ## Gradle +Root `build.gradle`: + +``` +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } +} +``` + +Module `build.gradle`: + ``` -implementation 'eu.chainfire:librootjavadaemon:1.3.1' +dependencies { + implementation 'eu.chainfire:librootjavadaemon:1.3.3' +} ``` You should update to the latest libRootJava and libRootJavaDaemon at the diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index bc594e9..6f84b84 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -26,10 +26,10 @@ dependencies { //implementation project(':librootjava') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.1-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.3-SNAPSHOT') { changing = true } /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.2' + implementation 'eu.chainfire:librootjava:1.3.3' } task sourcesJar(type: Jar) { @@ -63,7 +63,7 @@ ext { gitUrl = 'https://github.com/Chainfire/librootjava.git' issueTrackerUrl = 'https://github.com/Chainfire/librootjava/issues' - libraryVersion = '1.3.2' + libraryVersion = '1.3.3' developerId = 'Chainfire' developerName = 'Jorrit Jongma' diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index 4278d2c..eb1a075 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -36,10 +36,10 @@ dependencies { //implementation project(':librootjavadaemon') /* Use local Maven repository version, installed by installMavenLocal Gradle task */ - //implementation('eu.chainfire:librootjava:1.3.2-SNAPSHOT') { changing = true } - //implementation('eu.chainfire:librootjavadaemon:1.3.2-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjava:1.3.3-SNAPSHOT') { changing = true } + //implementation('eu.chainfire:librootjavadaemon:1.3.3-SNAPSHOT') { changing = true } /* Use jitpack version */ - implementation 'eu.chainfire:librootjava:1.3.2' - implementation 'eu.chainfire:librootjavadaemon:1.3.2' + implementation 'eu.chainfire:librootjava:1.3.3' + implementation 'eu.chainfire:librootjavadaemon:1.3.3' } From 1a08dff59238e6807a6ed06f46313138699e4543 Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 13:03:10 +0100 Subject: [PATCH 14/15] Update README again and clean bintray references --- librootjava/build.gradle | 4 ---- librootjavadaemon/README.md | 2 +- librootjavadaemon/build.gradle | 8 ++------ librootjavadaemon_example/build.gradle | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/librootjava/build.gradle b/librootjava/build.gradle index 4ff774b..5ff11ec 100644 --- a/librootjava/build.gradle +++ b/librootjava/build.gradle @@ -59,9 +59,6 @@ ext { licenseName = 'The Apache Software License, Version 2.0' licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' allLicenses = ["Apache-2.0"] - - bintrayRepo = 'maven' - bintrayName = artifact } task installMavenLocal(type: Upload) { @@ -76,7 +73,6 @@ task installMavenLocal(type: Upload) { } } -// Workaround bintray bug ignoring these from pom and bintray settings version = libraryVersion group = publishedGroupId diff --git a/librootjavadaemon/README.md b/librootjavadaemon/README.md index 339d4b7..c2f5496 100644 --- a/librootjavadaemon/README.md +++ b/librootjavadaemon/README.md @@ -167,7 +167,7 @@ Module `build.gradle`: ``` dependencies { - implementation 'eu.chainfire:librootjavadaemon:1.3.3' + implementation 'eu.chainfire.librootjava:librootjavadaemon:1.3.3' } ``` diff --git a/librootjavadaemon/build.gradle b/librootjavadaemon/build.gradle index 6f84b84..5e9a168 100644 --- a/librootjavadaemon/build.gradle +++ b/librootjavadaemon/build.gradle @@ -28,8 +28,8 @@ dependencies { /* Use local Maven repository version, installed by installMavenLocal Gradle task */ //implementation('eu.chainfire:librootjava:1.3.3-SNAPSHOT') { changing = true } - /* Use bintray/jcenter version */ - implementation 'eu.chainfire:librootjava:1.3.3' + /* Use jitpack version */ + implementation 'eu.chainfire.librootjava:librootjava:1.3.3' } task sourcesJar(type: Jar) { @@ -72,9 +72,6 @@ ext { licenseName = 'The Apache Software License, Version 2.0' licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' allLicenses = ["Apache-2.0"] - - bintrayRepo = 'maven' - bintrayName = artifact } task installMavenLocal(type: Upload) { @@ -89,7 +86,6 @@ task installMavenLocal(type: Upload) { } } -// Workaround bintray bug ignoring these from pom and bintray settings version = libraryVersion group = publishedGroupId diff --git a/librootjavadaemon_example/build.gradle b/librootjavadaemon_example/build.gradle index eb1a075..af9981a 100644 --- a/librootjavadaemon_example/build.gradle +++ b/librootjavadaemon_example/build.gradle @@ -41,5 +41,5 @@ dependencies { /* Use jitpack version */ implementation 'eu.chainfire:librootjava:1.3.3' - implementation 'eu.chainfire:librootjavadaemon:1.3.3' + implementation 'eu.chainfire.librootjava:librootjavadaemon:1.3.3' } From baf99656d0a85b50bc626e1bfca963c2cb3ba87e Mon Sep 17 00:00:00 2001 From: Jorrit Jongma Date: Sat, 5 Feb 2022 13:15:08 +0100 Subject: [PATCH 15/15] Update jCenter dependency to mavenCentral --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5e67a91..d168446 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:4.1.3' @@ -13,7 +13,7 @@ allprojects { repositories { google() maven { url 'https://jitpack.io' } - jcenter() + mavenCentral() mavenLocal() } }