Skip to content

Commit 4d05803

Browse files
author
wuzuchang
committed
Update gradle version
1 parent e55f114 commit 4d05803

21 files changed

Lines changed: 205 additions & 511 deletions

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ stringObfuscate{
99
}
1010

1111
android {
12-
compileSdkVersion 32
12+
compileSdkVersion 33
1313
buildToolsVersion "29.0.3"
1414

1515
defaultConfig {
1616
applicationId "com.wzc.gradle.plugin"
1717
minSdkVersion 21
18-
targetSdkVersion 32
18+
targetSdkVersion 33
1919
versionCode 1
2020
versionName "1.0"
2121

@@ -36,11 +36,11 @@ android {
3636

3737
dependencies {
3838

39-
implementation 'androidx.appcompat:appcompat:1.2.0'
40-
implementation 'com.google.android.material:material:1.3.0'
41-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
39+
implementation 'androidx.appcompat:appcompat:1.4.1'
40+
implementation 'com.google.android.material:material:1.5.0'
41+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
4242
implementation project(path: ':test_library')
43-
testImplementation 'junit:junit:4.+'
44-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
45-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
43+
testImplementation 'junit:junit:'
44+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
45+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
4646
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/Theme.MyGradlePlugin">
12-
<activity android:name=".MainActivity">
12+
<activity android:name=".MainActivity"
13+
android:exported="true">
1314
<intent-filter>
1415
<action android:name="android.intent.action.MAIN" />
1516

build.gradle

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
21
buildscript {
3-
repositories {
4-
google()
5-
mavenCentral()
6-
maven { url 'https://jitpack.io' }
7-
// flatDir {
8-
// dirs 'plugin_libs'
9-
// }
2+
repositories{
3+
flatDir {
4+
dirs 'plugin_libs'
5+
}
106
}
117
dependencies {
12-
classpath "com.android.tools.build:gradle:4.1.3"
13-
classpath 'com.github.wuzuchang:StringObfuscatedPlugin:1.0.0'
8+
// classpath 'com.github.wuzuchang:StringObfuscatePlugin:1.0.0'
9+
classpath 'com.wzc.string.obfuscate:StringObfuscatePlugin:2.0.0'
1410
}
1511
}
1612

17-
allprojects {
18-
repositories {
19-
google()
20-
mavenCentral()
21-
maven { url 'https://jitpack.io' }
22-
// flatDir {
23-
// dirs 'plugin_libs'
24-
// }
25-
}
26-
}
27-
28-
task clean(type: Delete) {
29-
delete rootProject.buildDir
13+
plugins {
14+
id 'com.android.application' version '7.4.1' apply false
15+
id 'com.android.library' version '7.4.1' apply false
16+
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
3017
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
19.5 KB
Binary file not shown.

settings.gradle

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
maven { url 'https://jitpack.io' }
7+
}
8+
}
9+
dependencyResolutionManagement {
10+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
11+
repositories {
12+
google()
13+
mavenCentral()
14+
maven { url 'https://jitpack.io' }
15+
}
16+
}
17+
rootProject.name = "StringObfuscatedPlugin"
118
include ':string_obfuscated'
219
include ':app'
320
include ':test_library'
4-
rootProject.name = "StringObfuscatedPlugin"

string_obfuscated/build.gradle

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,71 @@
11
plugins {
2-
id 'groovy'
2+
id 'java-gradle-plugin'
3+
id 'org.jetbrains.kotlin.jvm'
34
id 'maven-publish'
4-
id 'maven'
55
}
66

7-
group = 'com.wzc.string.obfuscate'
8-
def version = '1.0.0' //版本
9-
def artifactId = 'StringObfuscatePlugin' //唯一标示
7+
def group = 'com.wzc.string.obfuscate'
8+
def versionCode = '2.0.0' //版本
9+
def pluginName = 'StringObfuscatePlugin' //唯一标示
1010

11-
afterEvaluate {
12-
publishing {
13-
publications {
14-
mavenJava(MavenPublication) {
15-
groupId = 'com.wzc.string.obfuscate'
16-
artifactId = "StringObfuscatePlugin"
17-
version = '1.0.0'
18-
artifact("$buildDir/libs/string_obfuscated.jar")
19-
}
11+
//插件配置,这样就不需要创建META-INF/gradle-plugins文件目录了
12+
gradlePlugin {
13+
plugins {
14+
//定义的信息可以和发布信息不相同
15+
MethodTracer {
16+
id = "${group}" //定义插件id
17+
version = versionCode
18+
implementationClass = 'com.wzc.gradle.plugin.PluginLaunch' //定义插件实现类
19+
}
20+
}
21+
}
22+
23+
publishing {
24+
publications {
25+
//PubName
26+
plugin(MavenPublication) {
27+
groupId = group
28+
artifactId = pluginName
29+
version = versionCode
30+
artifact("$buildDir/libs/string_obfuscated-${version}.jar")
31+
}
32+
}
33+
repositories {
34+
maven {
35+
// change to point to your repo, e.g. http://my.org/repo
36+
url = "$buildDir/repo"
2037
}
2138
}
2239
}
2340

2441
dependencies {
2542
implementation gradleApi()
2643
implementation localGroovy()
27-
implementation 'com.android.tools.build:gradle:4.1.0'
44+
// 实现Transform的时候会用到,gradle插件版本:https://developer.android.com/studio/releases/gradle-plugin?hl=zh-cn#updating-gradle
45+
// 这里注意使用的gradle插件(AGP)版本不要超过你Android studio 最大支持的版本:https://developer.android.com/studio/releases?hl=zh-cn#android_gradle_plugin_and_android_studio_compatibility
46+
// gradle/wrapper 中设置你gradle版本
47+
implementation("com.android.tools.build:gradle:7.3.1") {
48+
exclude group: "org.ow2.asm"
49+
}
50+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10") {
51+
exclude group: "org.ow2.asm"
52+
}
53+
implementation("org.ow2.asm:asm:9.3")
54+
implementation("org.ow2.asm:asm-commons:9.3")
55+
implementation("org.ow2.asm:asm-util:9.3")
2856
}
29-
repositories {
30-
mavenCentral()
57+
58+
java {
59+
sourceCompatibility = JavaVersion.VERSION_1_8
60+
targetCompatibility = JavaVersion.VERSION_1_8
3161
}
3262

3363
task copyPluginFile {
3464
doLast {
3565
copy {
3666
from '../string_obfuscated/build/libs/'
3767
into '../plugin_libs'
38-
rename 'string_obfuscated.jar', artifactId + '-' + version + '.jar'
68+
rename "string_obfuscated-${versionCode}.jar", "${pluginName}-${versionCode}.jar"
3969
}
4070
}
4171
}

string_obfuscated/src/main/groovy/com/wzc/gradle/plugin/launch/PluginLaunch.groovy

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)