Rename gradle module

This commit is contained in:
vvb2060 2022-02-20 23:53:06 +08:00
parent 4422bea212
commit 856f6e0402
No known key found for this signature in database
GPG Key ID: 59B2BF15A79E26FA
36 changed files with 129 additions and 221 deletions

4
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "library/jni/external/dex_builder"] [submodule "dex_builder"]
path = library/jni/external/dex_builder path = lsplant/src/main/jni/external/dex_builder
url = https://github.com/LSPosed/DexBuilder.git url = https://github.com/LSPosed/DexBuilder.git
branch = master branch = master

View File

@ -1,41 +1,9 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 LSPosed Contributors
*/
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository
buildscript {
repositories {
google()
mavenCentral()
}
val agpVersion by extra("7.1.1")
dependencies {
classpath("com.android.tools.build:gradle:$agpVersion")
classpath("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r")
}
}
val androidTargetSdkVersion by extra(32) val androidTargetSdkVersion by extra(32)
val androidMinSdkVersion by extra(27) val androidMinSdkVersion by extra(27)
val androidBuildToolsVersion by extra("32.0.0") val androidBuildToolsVersion by extra("32.0.0")
val androidCompileSdkVersion by extra(32) val androidCompileSdkVersion by extra(32)
val androidCompileNdkVersion by extra("23.1.7779620") val androidNdkVersion by extra("23.1.7779620")
val androidCmakeVersion by extra("3.22.1")
tasks.register("Delete", Delete::class) { tasks.register("Delete", Delete::class) {
delete(rootProject.buildDir) delete(rootProject.buildDir)

View File

@ -1,13 +1,2 @@
# Project-wide Gradle settings. android.nonTransitiveRClass=true
# IDE (e.g. Android Studio) users: android.useAndroidX=true
# 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
# 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.
org.gradle.jvmargs=-Xmx2048m -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

Binary file not shown.

View File

@ -1,120 +0,0 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 LSPosed Contributors
*/
plugins {
id("com.android.library")
}
val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra
val androidCompileSdkVersion: Int by rootProject.extra
val androidCompileNdkVersion: String by rootProject.extra
android {
compileSdk = androidCompileSdkVersion
ndkVersion = androidCompileNdkVersion
buildToolsVersion = androidBuildToolsVersion
buildFeatures {
prefabPublishing = true
}
packagingOptions {
jniLibs {
excludes += "**.so"
}
}
prefab {
create("lsplant") {
headers = "jni/include"
libraryName = "liblsplant"
name = "lsplant"
}
// only for unit test
create("dex_builder") {
headers = "jni/external/dex_builder/include"
libraryName = "libdex_builder"
name = "dex_builder"
}
}
defaultConfig {
minSdk = androidMinSdkVersion
targetSdk = androidTargetSdkVersion
externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
val flags = arrayOf(
"-Wall",
"-Werror",
"-Qunused-arguments",
"-Wno-gnu-string-literal-operator-template",
"-fno-rtti",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-fno-exceptions",
"-fno-stack-protector",
"-fomit-frame-pointer",
"-Wno-builtin-macro-redefined",
"-ffunction-sections",
"-fdata-sections",
"-Wno-unused-value",
"-Wl,--gc-sections",
"-D__FILE__=__FILE_NAME__",
"-Wl,--exclude-libs,ALL",
)
cppFlags("-std=c++20", *flags)
cFlags("-std=c18", *flags)
arguments += "-DANDROID_STL=c++_shared"
val configFlags = arrayOf(
"-Oz",
"-DNDEBUG"
).joinToString(" ")
arguments.addAll(
arrayOf(
"-DCMAKE_CXX_FLAGS_RELEASE=$configFlags",
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$configFlags",
"-DCMAKE_C_FLAGS_RELEASE=$configFlags",
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=$configFlags"
)
)
}
}
}
buildTypes {
all {
externalNativeBuild.cmake.arguments += "-DDEBUG_SYMBOLS_PATH=${project.buildDir.absolutePath}/symbols/$name"
}
}
lint {
abortOnError = true
checkReleaseBuilds = false
}
externalNativeBuild {
cmake {
path("jni/CMakeLists.txt")
}
}
}

92
lsplant/build.gradle.kts Normal file
View File

@ -0,0 +1,92 @@
plugins {
id("com.android.library")
}
val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra
val androidCompileSdkVersion: Int by rootProject.extra
val androidNdkVersion: String by rootProject.extra
val androidCmakeVersion: String by rootProject.extra
android {
compileSdk = androidCompileSdkVersion
ndkVersion = androidNdkVersion
buildToolsVersion = androidBuildToolsVersion
buildFeatures {
prefabPublishing = true
}
packagingOptions {
jniLibs {
excludes += "**.so"
}
}
prefab {
register("lsplant") {
headers = "src/main/jni/include"
}
}
defaultConfig {
minSdk = androidMinSdkVersion
targetSdk = androidTargetSdkVersion
}
buildTypes {
all {
externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
val flags = arrayOf(
"-Wall",
"-Werror",
"-Qunused-arguments",
"-Wno-gnu-string-literal-operator-template",
"-fno-rtti",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-fno-exceptions",
"-fno-stack-protector",
"-fomit-frame-pointer",
"-Wno-builtin-macro-redefined",
"-ffunction-sections",
"-fdata-sections",
"-Wno-unused-value",
"-Wl,--gc-sections",
"-D__FILE__=__FILE_NAME__",
"-Wl,--exclude-libs,ALL",
)
cppFlags("-std=c++20", *flags)
cFlags("-std=c18", *flags)
val configFlags = arrayOf(
"-Oz",
"-DNDEBUG"
).joinToString(" ")
arguments(
"-DANDROID_STL=c++_shared",
"-DCMAKE_CXX_FLAGS_RELEASE=$configFlags",
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$configFlags",
"-DCMAKE_C_FLAGS_RELEASE=$configFlags",
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=$configFlags",
"-DDEBUG_SYMBOLS_PATH=${project.buildDir.absolutePath}/symbols/$name",
)
}
}
}
}
lint {
abortOnError = true
checkReleaseBuilds = false
}
externalNativeBuild {
cmake {
path = file("src/main/jni/CMakeLists.txt")
version = androidCmakeVersion
}
}
}

View File

@ -40,6 +40,7 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
${DEBUG_SYMBOLS_PATH}/${ANDROID_ABI}/${PROJECT_NAME} ${DEBUG_SYMBOLS_PATH}/${ANDROID_ABI}/${PROJECT_NAME}
COMMAND ${CMAKE_STRIP} --strip-all $<TARGET_FILE:${PROJECT_NAME}>) COMMAND ${CMAKE_STRIP} --strip-all $<TARGET_FILE:${PROJECT_NAME}>)
target_link_libraries(${PROJECT_NAME} PUBLIC dex_builder log) target_link_libraries(${PROJECT_NAME} PRIVATE dex_builder_static)
target_link_libraries(${PROJECT_NAME} PUBLIC log)
target_link_libraries(${PROJECT_NAME}_static PRIVATE dex_builder_static) target_link_libraries(${PROJECT_NAME}_static PRIVATE dex_builder_static)
target_link_libraries(${PROJECT_NAME}_static PUBLIC log) target_link_libraries(${PROJECT_NAME}_static PUBLIC log)

View File

@ -1,3 +1,15 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id("com.android.application") version "7.1.1"
id("com.android.library") version "7.1.1"
id("org.jetbrains.kotlin.android") version "1.6.10"
}
}
dependencyResolutionManagement { dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories { repositories {
@ -8,6 +20,6 @@ dependencyResolutionManagement {
rootProject.name = "LSPlant" rootProject.name = "LSPlant"
include( include(
":library", ":lsplant",
":test" ":test",
) )

View File

@ -6,12 +6,12 @@ val androidTargetSdkVersion: Int by rootProject.extra
val androidMinSdkVersion: Int by rootProject.extra val androidMinSdkVersion: Int by rootProject.extra
val androidBuildToolsVersion: String by rootProject.extra val androidBuildToolsVersion: String by rootProject.extra
val androidCompileSdkVersion: Int by rootProject.extra val androidCompileSdkVersion: Int by rootProject.extra
val androidCompileNdkVersion: String by rootProject.extra val androidNdkVersion: String by rootProject.extra
val androidCmakeVersion: String by rootProject.extra
android { android {
namespace = "org.lsposed.lsplant.test"
compileSdk = androidCompileSdkVersion compileSdk = androidCompileSdkVersion
ndkVersion = androidCompileNdkVersion ndkVersion = androidNdkVersion
buildToolsVersion = androidBuildToolsVersion buildToolsVersion = androidBuildToolsVersion
buildFeatures { buildFeatures {
@ -19,13 +19,12 @@ android {
} }
defaultConfig { defaultConfig {
applicationId = "org.lsposed.lsplant.test" applicationId = "org.lsposed.lsplant"
minSdk = androidMinSdkVersion minSdk = androidMinSdkVersion
targetSdk = androidTargetSdkVersion targetSdk = androidTargetSdkVersion
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild { externalNativeBuild {
cmake { cmake {
arguments += "-DANDROID_STL=c++_shared" arguments += "-DANDROID_STL=c++_shared"
@ -35,14 +34,8 @@ android {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
path("src/main/jni/CMakeLists.txt") path = file("src/main/jni/CMakeLists.txt")
} version = androidCmakeVersion
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
} }
} }
@ -53,10 +46,10 @@ android {
} }
dependencies { dependencies {
implementation(project(":library")) implementation(project(":lsplant"))
implementation("io.github.vvb2060.ndk:dobby:1.2") implementation("io.github.vvb2060.ndk:dobby:1.2")
testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("com.android.support.test:runner:1.0.2") androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
} }

View File

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,6 +1,6 @@
package org.lsposed.lsplant; package org.lsposed.lsplant;
import android.support.test.runner.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Assert; import org.junit.Assert;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;

View File

@ -1,8 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest package="org.lsposed.lsplant" />
xmlns:tools="http://schemas.android.com/tools">
<application
android:label="LSPlant"
tools:ignore="MissingApplicationIcon" />
</manifest>

View File

@ -6,5 +6,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(test SHARED test.cpp elf_util.cpp) add_library(test SHARED test.cpp elf_util.cpp)
find_package(dobby REQUIRED CONFIG) find_package(dobby REQUIRED CONFIG)
find_package(library REQUIRED CONFIG) find_package(lsplant REQUIRED CONFIG)
target_link_libraries(test log dobby::dobby library::lsplant library::dex_builder) target_link_libraries(test log dobby::dobby lsplant::lsplant)