Modify merge yukihookapi, yukihookapi-stub java-library project to android-library project

This commit is contained in:
2023-04-16 03:19:55 +08:00
parent c743dad733
commit 3b8eba21b0
118 changed files with 136 additions and 45 deletions

View File

@@ -1,24 +1,42 @@
plugins { plugins {
id 'java-library' id 'com.android.library'
id 'org.jetbrains.kotlin.jvm' id 'org.jetbrains.kotlin.android'
} }
java { android {
sourceCompatibility = JavaVersion.VERSION_11 namespace 'com.highcapable.yukihookapi.stub'
targetCompatibility = JavaVersion.VERSION_11 compileSdk rootProject.ext.android.compileSdk
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { defaultConfig {
minSdk rootProject.ext.android.minSdk
targetSdk rootProject.ext.android.targetSdk
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions { kotlinOptions {
jvmTarget = 11 jvmTarget = '11'
freeCompilerArgs = [ freeCompilerArgs = [
'-Xno-param-assertions', '-Xno-param-assertions',
'-Xno-call-assertions', '-Xno-call-assertions',
'-Xno-receiver-assertions' '-Xno-receiver-assertions'
] ]
} }
lintOptions {
checkReleaseBuilds false
}
} }
dependencies { dependencies {
compileOnly fileTree(include: ['*.jar'], dir: '../yukihookapi/libs') implementation 'androidx.annotation:annotation:1.6.0'
} }

View File

21
yukihookapi-stub/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# 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

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -1,25 +1,56 @@
plugins { plugins {
id 'java-library' id 'com.android.library'
id 'org.jetbrains.kotlin.jvm' id 'org.jetbrains.kotlin.android'
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
} }
java { android {
sourceCompatibility = JavaVersion.VERSION_11 namespace 'com.highcapable.yukihookapi'
targetCompatibility = JavaVersion.VERSION_11 compileSdk rootProject.ext.android.compileSdk
sourceSets.main { java.srcDir("src/api/kotlin") }
withJavadocJar()
withSourcesJar()
}
javadoc { defaultConfig {
options.addStringOption("charset", "UTF-8") minSdk rootProject.ext.android.minSdk
if (JavaVersion.current().isJava9Compatible()) options.addBooleanOption('html5', true) targetSdk rootProject.ext.android.targetSdk
buildConfigField('String', 'API_VERSION_NAME', "\"${rootProject.ext.maven.repository.apiVersion.name}\"")
buildConfigField('int', 'API_VERSION_CODE', "${rootProject.ext.maven.repository.apiVersion.code}")
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = [
'-opt-in=com.highcapable.yukihookapi.annotation.YukiPrivateApi',
'-opt-in=com.highcapable.yukihookapi.annotation.YukiGenerateApi',
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
lintOptions {
checkReleaseBuilds false
}
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
} }
kotlin { kotlin {
sourceSets.main { kotlin.srcDir("src/api/kotlin") }
sourceSets { sourceSets {
all { all {
languageSettings { languageSettings {
@@ -30,25 +61,18 @@ kotlin {
} }
} }
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = 11
freeCompilerArgs = [
'-opt-in=com.highcapable.yukihookapi.annotation.YukiPrivateApi',
'-opt-in=com.highcapable.yukihookapi.annotation.YukiGenerateApi',
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
}
dependencies { dependencies {
// Used 82 API Version // Used 82 API Version
compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82'
compileOnly project(':yukihookapi-stub') compileOnly project(':yukihookapi-stub')
compileOnly fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.annotation:annotation:1.6.0' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
}
tasks.register('androidSourcesJar', Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
} }
group = rootProject.ext.maven.repository.groupId group = rootProject.ext.maven.repository.groupId
@@ -56,9 +80,10 @@ version = rootProject.ext.maven.repository.apiVersion.name
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { release(MavenPublication) {
artifactId = 'api' artifactId = 'api'
from components.java artifact "$buildDir/outputs/aar/${project.name}-release.aar"
artifact androidSourcesJar
pom { pom {
name = rootProject.ext.maven.repository.name name = rootProject.ext.maven.repository.name
description = rootProject.ext.maven.repository.description description = rootProject.ext.maven.repository.description
@@ -97,4 +122,4 @@ publishing {
} }
} }
signing { sign(publishing.publications.mavenJava) } signing { sign publishing.publications }

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

21
yukihookapi/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# 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

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -80,10 +80,10 @@ object YukiHookAPI {
internal var isLoadedFromBaseContext = false internal var isLoadedFromBaseContext = false
/** 获取当前 [YukiHookAPI] 的版本 */ /** 获取当前 [YukiHookAPI] 的版本 */
const val API_VERSION_NAME = "1.1.8" const val API_VERSION_NAME = BuildConfig.API_VERSION_NAME
/** 获取当前 [YukiHookAPI] 的版本号 */ /** 获取当前 [YukiHookAPI] 的版本号 */
const val API_VERSION_CODE = 41 const val API_VERSION_CODE = BuildConfig.API_VERSION_CODE
/** /**
* 当前 [YukiHookAPI] 的状态 * 当前 [YukiHookAPI] 的状态

View File

@@ -32,6 +32,7 @@ package com.highcapable.yukihookapi.hook.type.java
import android.os.Build import android.os.Build
import com.highcapable.yukihookapi.hook.factory.classOf import com.highcapable.yukihookapi.hook.factory.classOf
import com.highcapable.yukihookapi.hook.factory.toClass import com.highcapable.yukihookapi.hook.factory.toClass
import com.highcapable.yukihookapi.hook.factory.toClassOrNull
import dalvik.system.BaseDexClassLoader import dalvik.system.BaseDexClassLoader
import dalvik.system.DexClassLoader import dalvik.system.DexClassLoader
import dalvik.system.InMemoryDexClassLoader import dalvik.system.InMemoryDexClassLoader
@@ -47,7 +48,6 @@ import java.lang.reflect.Member
import java.lang.reflect.Method import java.lang.reflect.Method
import java.net.HttpCookie import java.net.HttpCookie
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.http.HttpClient
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
@@ -665,9 +665,9 @@ val HttpCookieClass get() = classOf<HttpCookie>()
/** /**
* 获得 [HttpClient] 类型 * 获得 [HttpClient] 类型
* @return [Class]<[HttpClient]> * @return [Class] or null
*/ */
val HttpClientClass get() = classOf<HttpClient>() val HttpClientClass get() = "java.net.http.HttpClient".toClassOrNull()
/** /**
* 获得 [AtomicBoolean] 类型 * 获得 [AtomicBoolean] 类型

Some files were not shown because too many files have changed in this diff Show More