Skip to content

Commit

Permalink
update agp升级至8.x,报名调整,1.0.3版本
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhiqiang1993 committed Jul 5, 2023
1 parent e6e1ac1 commit ef5c864
Show file tree
Hide file tree
Showing 46 changed files with 156 additions and 182 deletions.
64 changes: 0 additions & 64 deletions app/build.gradle

This file was deleted.

48 changes: 48 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
plugins {
alias(libs.plugins.xeonyu.application)
}

android {
namespace = "com.yzq.bsdiff.demo"
defaultConfig {
applicationId = "com.yzq.bsdiff.demo"
versionCode = 1
versionName = "0.0.1"
ndk {
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
}
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}


}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.google.material)
implementation(libs.androidx.constraintlayout)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.utilcodex)


// 依赖远程库
// implementation("com.xeonyu:bsdiff:1.0.3-SNAPSHOT")
implementation(libs.xeonyu.bsdiff)
// 依赖本地库
// implementation(project(":bsdiff"))
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xeon.xeonbsdiff.demo">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand All @@ -10,9 +9,8 @@
android:supportsRtl="true"
android:theme="@style/Theme.XeonBsDiff">
<activity
android:name="com.xeon.demo.MainActivity"
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.XeonBsDiff.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.xeon.demo
package com.yzq.bsdiff.demo

import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.xeon.xeonbsdiff.demo.databinding.ActivityMainBinding
import com.yzq.bsdiff.demo.databinding.ActivityMainBinding

/**
* @description: MainActiviy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.xeon.demo
package com.yzq.bsdiff.demo

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.FileUtils
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.PathUtils
import com.blankj.utilcode.util.ToastUtils
import com.xeon.bsdiff.utils.XeonBsDiffUtil
import com.yzq.bsdiff.BsDiffTool
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -31,19 +31,19 @@ class MainViewModel : ViewModel() {
}

/*文件后缀名*/
private val suffix = "apk"
private val suffix = "txt"

/*旧文件*/
private val oldFile = File(PathUtils.getExternalAppFilesPath(), "old.${suffix}")
private val oldFile = File(PathUtils.getInternalAppFilesPath(), "old.${suffix}")

/*新文件*/
private val newFile = File(PathUtils.getExternalAppFilesPath(), "new.${suffix}")
private val newFile = File(PathUtils.getInternalAppFilesPath(), "new.${suffix}")

/*补丁文件*/
private val patchFile = File(PathUtils.getExternalAppFilesPath(), "patch.${suffix}")
private val patchFile = File(PathUtils.getInternalAppFilesPath(), "patch.${suffix}")

/*合并后的文件*/
private val combineFile = File(PathUtils.getExternalAppFilesPath(), "combine.${suffix}")
private val combineFile = File(PathUtils.getInternalAppFilesPath(), "combine.${suffix}")

/*生成补丁文件*/
fun fileDiff() {
Expand All @@ -57,7 +57,7 @@ class MainViewModel : ViewModel() {
}

/*生成补丁包,耗时操作,记得放在子线程 返回值 0表示成功*/
val result = XeonBsDiffUtil.bsdiff(
val result = BsDiffTool.diff(
newFile.absolutePath,//新文件path
oldFile.absolutePath,//旧文件path
patchFile.absolutePath//补丁文件path
Expand Down Expand Up @@ -86,7 +86,7 @@ class MainViewModel : ViewModel() {
return@withContext
}
/*合并补丁包,耗时操作,记得放在子线程 返回值 0表示成功*/
val result = XeonBsDiffUtil.bspatch(
val result = BsDiffTool.patch(
oldFile.absolutePath,
patchFile.absolutePath,
combineFile.absolutePath
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.xeon.demo.MainActivity">
tools:context="com.yzq.bsdiff.demo.MainActivity">


<androidx.appcompat.widget.AppCompatButton
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions bsdiff/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
alias(libs.plugins.xeonyu.library)
alias(libs.plugins.vanniktechPublish)
}

android {
namespace = "com.yzq.bsdiff"

defaultConfig {
minSdk = 21
externalNativeBuild {
cmake {
cppFlags("")
}
}
}
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.10.2"
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion xeon_bsdiff/gradle.properties → bsdiff/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ POM_ARTIFACT_ID=bsdiff
POM_PACKAGING=aar
POM_DESCRIPTION=快速实现文件差分功能
#版本号
VERSION_NAME=1.0.2
VERSION_NAME=1.0.3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
4 changes: 4 additions & 0 deletions bsdiff/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>

</manifest>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ extern int bspatch_main(int argc, char *argv[]);
*/
extern "C"
JNIEXPORT jint JNICALL
Java_com_xeon_bsdiff_utils_XeonBsDiffUtil_bsdiff(JNIEnv *env, jobject thiz, jstring new_file_path, jstring old_file_path, jstring patch_file_path) {
Java_com_yzq_bsdiff_BsDiffTool_diff(JNIEnv *env, jobject thiz, jstring new_file_path,
jstring old_file_path, jstring patch_file_path) {

const char *newFile = env->GetStringUTFChars(new_file_path, nullptr);
const char *oldFile = env->GetStringUTFChars(old_file_path, nullptr);
Expand All @@ -33,7 +34,9 @@ Java_com_xeon_bsdiff_utils_XeonBsDiffUtil_bsdiff(JNIEnv *env, jobject thiz, jstr
*/
extern "C"
JNIEXPORT jint JNICALL
Java_com_xeon_bsdiff_utils_XeonBsDiffUtil_bspatch(JNIEnv *env, jobject thiz, jstring old_file_path, jstring patch_file_path, jstring combine_file_path) {
Java_com_yzq_bsdiff_BsDiffTool_patch(JNIEnv *env, jobject thiz, jstring old_file_path,
jstring patch_file_path,
jstring combine_file_path) {
const char *oldFile = env->GetStringUTFChars(old_file_path, nullptr);
const char *patchFile = env->GetStringUTFChars(patch_file_path, nullptr);
const char *combineFile = env->GetStringUTFChars(combine_file_path, nullptr);
Expand Down
38 changes: 38 additions & 0 deletions bsdiff/src/main/java/com/yzq/bsdiff/BsDiffTool.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.yzq.bsdiff

/**
* @description: BsDiff工具类
* @author : yuzhiqiang ([email protected])
* @date : 2021/11/16
* @time : 22:12
*/

object BsDiffTool {

init {
kotlin.runCatching {
System.loadLibrary("xeon_bsdiff")
}

}


/**
* 生成差分包
* @param newFilePath String 新文件地址
* @param oldFilePath String 旧文件地址
* @param patchFilePath String 生成的差分包地址
* @return Int 0表示成功
*/
external fun diff(newFilePath: String, oldFilePath: String, patchFilePath: String): Int

/**
* 合并差分包
* @param oldFilePath String 旧文件地址
* @param patchFilePath String 补丁文件地址
* @param combineFilePath String 合并后的新文件地址
* @return Int 0表示成功
*/
external fun patch(oldFilePath: String, patchFilePath: String, combineFilePath: String): Int

}
8 changes: 0 additions & 8 deletions build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false

alias(libs.plugins.vanniktechPublish) apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 28 16:39:03 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
17 changes: 13 additions & 4 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
pluginManagement {
repositories {
mavenLocal()
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
/*发布到本地仓库时测试用*/
// mavenLocal()
mavenLocal()
/*发布到snapshot仓库时使用*/
// maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
google()
mavenCentral()
}

versionCatalogs {
create("libs") {
from("com.xeonyu:version-catalog:0.0.5")
}
}
}

rootProject.name = "XeonBsDiff"
include ':app'
include ':xeon_bsdiff'
include(":app")
include(":bsdiff")
Loading

0 comments on commit ef5c864

Please sign in to comment.