Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc-register 1.1.2 在 AGP 7.2 以上编译报错 #194

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
/build
/captures
.externalNativeBuild
repo-local
*.pyc
/repo-local
32 changes: 25 additions & 7 deletions bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,33 @@ publish {
website = siteUrl
}

apply plugin: 'maven'
uploadArchives {
//apply plugin: 'maven'
//uploadArchives {
// repositories {
// mavenDeployer {
// repository(url: uri('../repo-local')) //deploy到本地仓库
// pom.groupId = publishedGroupId
// pom.artifactId = artifact
// pom.version = libraryVersion + '-SNAPSHOT'
// }
// }
//}

apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = publishedGroupId
artifactId = artifact
version = libraryVersion + '-SNAPSHOT'
from components.java
}
}
repositories {
mavenDeployer {
repository(url: uri('../repo-local')) //deploy到本地仓库
pom.groupId = publishedGroupId
pom.artifactId = artifact
pom.version = libraryVersion + '-SNAPSHOT'
maven {
url = uri('../repo-local')
}
}
}


18 changes: 10 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.51'
ext.kotlin_version = '1.7.20'

repositories {
maven{ url rootProject.file("repo-local") }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'com.novoda:bintray-release:0.9.2'
classpath 'com.billy.android:cc-register:1.1.2'
// classpath 'com.billy.android:cc-register:1.1.2'
classpath 'com.billy.android:cc-register:1.1.3-SNAPSHOT'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -24,15 +25,16 @@ buildscript {
allprojects {
repositories {
maven{ url rootProject.file("repo-local") }
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven { url "https://jitpack.io" }
google()
jcenter()
mavenCentral()
}
}

ext {
compileVersion = 28
buildVersion = '28.0.3'
compileVersion = 32
buildVersion = '30.0.3'
minVersion = 8

// support v7(28.0.0) minSdkVersion is 14
Expand Down
32 changes: 27 additions & 5 deletions cc-register/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ apply plugin: 'groovy'


dependencies {
compile gradleApi()
compile localGroovy()
implementation gradleApi()
implementation localGroovy()
}

repositories {
mavenCentral()
}
dependencies {
compile 'com.android.tools.build:gradle:2.2.0'
implementation 'com.android.tools.build:gradle:7.2.1'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'commons-codec:commons-codec:1.15'
implementation 'commons-io:commons-io:2.11.0'
}

ext {
Expand All @@ -26,7 +29,7 @@ ext {
siteUrl = 'https://github.com/luckybilly/CC'
gitUrl = 'https://github.com/luckybilly/CC.git'

libraryVersion = '1.1.2'
libraryVersion = '1.1.3'

developerId = 'billy'
developerName = 'billy'
Expand All @@ -37,4 +40,23 @@ ext {
allLicenses = ["Apache-2.0"]
}

apply from: rootProject.file('bintray.gradle')

//apply from: rootProject.file('bintray.gradle')

// 写在 bintray.gradle 不会生成 gradle task
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = publishedGroupId
artifactId = artifact
version = libraryVersion + '-SNAPSHOT'
from components.java
}
}
repositories {
maven {
url = uri('../repo-local')
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class CodeScanner {
private static int ASM_LEVEL = 0
static int getAsmApiLevel() {
if (ASM_LEVEL > 0) return ASM_LEVEL
int api = Opcodes.ASM5
int api = Opcodes.ASM9
for (i in (10..5)) {
try {
def field = Opcodes.class.getDeclaredField("ASM" + i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.billy.android.register

import com.android.builder.model.AndroidProject

import com.google.gson.Gson
import org.gradle.api.Project

Expand Down Expand Up @@ -77,7 +77,7 @@ class RegisterCache {
}

private static String getCacheFileDir(Project project) {
return project.getBuildDir().absolutePath + File.separator + AndroidProject.FD_INTERMEDIATES + File.separator + CACHE_INFO_DIR + File.separator
return project.getBuildDir().absolutePath + File.separator + "intermediates" + File.separator + CACHE_INFO_DIR + File.separator
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.billy.android.register.cc.generator

import com.billy.android.register.RegisterTransform
import org.objectweb.asm.*
import org.objectweb.asm.ClassWriter
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes

/**
* 生成provider类
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class RegistryCodeGenerator {
private byte[] doGenerateCode(InputStream inputStream) {
ClassReader cr = new ClassReader(inputStream)
ClassWriter cw = new ClassWriter(cr, 0)
ClassVisitor cv = new MyClassVisitor(Opcodes.ASM5, cw)
ClassVisitor cv = new MyClassVisitor(Opcodes.ASM9, cw)
cr.accept(cv, ClassReader.EXPAND_FRAMES)
return cw.toByteArray()
}
Expand All @@ -123,7 +123,7 @@ class RegistryCodeGenerator {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions)
if (name == extension.initMethodName) { //注入代码到指定的方法之中
boolean _static = (access & Opcodes.ACC_STATIC) > 0
mv = new MyMethodVisitor(Opcodes.ASM5, mv, _static)
mv = new MyMethodVisitor(Opcodes.ASM9, mv, _static)
}
return mv
}
Expand Down
2 changes: 1 addition & 1 deletion cc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {

dependencies {
//发布到bintray时,要写成compile才行
compile "com.billy.android:pools:0.0.6"
implementation "com.billy.android:pools:0.0.6"
compileOnly "com.android.support:appcompat-v7:${rootProject.supportVersion}"
compileOnly project(':android_internal')
}
Expand Down
7 changes: 5 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.billy.cc.demo">

<application android:name=".MyApp"
<application
android:name=".MyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.billy.cc.demo.MainActivity">
<activity
android:name="com.billy.cc.demo.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
3 changes: 1 addition & 2 deletions demo_component_kt/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply from: rootProject.file('cc-settings-demo.gradle')
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.compileVersion

Expand All @@ -22,7 +21,7 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:${rootProject.supportVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6e6cdd8e7f5c253c46ac7824552c5688
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
91cd0e358368fdcbf70e8679667b02e381541743
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6fff5a0a8d00ebc0c5f65ad35835f8fd0e507d8904ba9feeeee42bf5c252fbbc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5fc234edff6ab0f00582ad57ed51704ec7760ef4d1ada4b1e9973566cc2186041493e92b909d9664674332b128f780481273ed59441c627cdb626f07e80b0fe7
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"formatVersion": "1.1",
"component": {
"group": "com.billy.android",
"module": "cc-register",
"version": "1.1.3-SNAPSHOT",
"attributes": {
"org.gradle.status": "integration"
}
},
"createdBy": {
"gradle": {
"version": "7.4"
}
},
"variants": [
{
"name": "apiElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": 11,
"org.gradle.libraryelements": "jar",
"org.gradle.usage": "java-api"
},
"files": [
{
"name": "cc-register-1.1.3-SNAPSHOT.jar",
"url": "cc-register-1.1.3-SNAPSHOT.jar",
"size": 144829,
"sha512": "5fc234edff6ab0f00582ad57ed51704ec7760ef4d1ada4b1e9973566cc2186041493e92b909d9664674332b128f780481273ed59441c627cdb626f07e80b0fe7",
"sha256": "6fff5a0a8d00ebc0c5f65ad35835f8fd0e507d8904ba9feeeee42bf5c252fbbc",
"sha1": "91cd0e358368fdcbf70e8679667b02e381541743",
"md5": "6e6cdd8e7f5c253c46ac7824552c5688"
}
]
},
{
"name": "runtimeElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "external",
"org.gradle.jvm.version": 11,
"org.gradle.libraryelements": "jar",
"org.gradle.usage": "java-runtime"
},
"dependencies": [
{
"group": "com.android.tools.build",
"module": "gradle",
"version": {
"requires": "7.2.1"
}
},
{
"group": "com.google.code.gson",
"module": "gson",
"version": {
"requires": "2.9.0"
}
},
{
"group": "commons-codec",
"module": "commons-codec",
"version": {
"requires": "1.15"
}
},
{
"group": "commons-io",
"module": "commons-io",
"version": {
"requires": "2.11.0"
}
}
],
"files": [
{
"name": "cc-register-1.1.3-SNAPSHOT.jar",
"url": "cc-register-1.1.3-SNAPSHOT.jar",
"size": 144829,
"sha512": "5fc234edff6ab0f00582ad57ed51704ec7760ef4d1ada4b1e9973566cc2186041493e92b909d9664674332b128f780481273ed59441c627cdb626f07e80b0fe7",
"sha256": "6fff5a0a8d00ebc0c5f65ad35835f8fd0e507d8904ba9feeeee42bf5c252fbbc",
"sha1": "91cd0e358368fdcbf70e8679667b02e381541743",
"md5": "6e6cdd8e7f5c253c46ac7824552c5688"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6e69651e0b6882e69e3d5e978718bc2b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f6095d00673e2d8587bc4d1383a1545e89b8801b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a1f3e5958d37bac7a70a78eb7f8b82601dfe160d1a77c1d3288050fc893f6fcc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e28ea188c9fd1889f786871c763f5f8c9a3fb3a5093cf67b4a81525e8f44be4f672f8a58cdaed89f244619a5713985de5cd6eb6b3d2b5bf9ca11da750184c7b8
Loading