Re-writing accessors transformer using the new AGP API#7694
Re-writing accessors transformer using the new AGP API#7694rorbech merged 31 commits intofeature/new-agp-transformer-apifrom
Conversation
dependencies.list
Outdated
| ANDROID_BUILD_TOOLS=30.0.3 | ||
| KOTLIN=1.5.31 | ||
| KOTLIN_COROUTINES=1.5.2 | ||
| KOTLIN=1.6.20 |
There was a problem hiding this comment.
Probably you can try 1.7 as is the latest stable available
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip |
|
@rorbech I updated the current WIP
For reference: |
|
I manually verified that all our |
Update config.yml
Remove export compliance clause
cmelchior
left a comment
There was a problem hiding this comment.
Awesome work 🥇 🕺 ... As I don't really know the new transform API it was a bit hard to track some of the changes, but if all our sample projects are building and tests are running, I think we can assume that things are working 🥳
I only left some minor comments.
...s/architectureComponentsExample/src/main/java/io/realm/examples/arch/PersonListFragment.java
Outdated
Show resolved
Hide resolved
realm/realm-library/src/main/java/io/realm/internal/objectstore/OsMutableSubscriptionSet.java
Outdated
Show resolved
Hide resolved
realm/realm-library/src/main/java/io/realm/internal/objectstore/OsSubscription.java
Outdated
Show resolved
Hide resolved
| val metadataCollector = | ||
| io.realm.buildtransformer.asm.visitors.AnnotationVisitor(annotationDescriptor) | ||
|
|
||
| forEachJarEntry { jarEntry, inputStream -> |
There was a problem hiding this comment.
It is a bit unclear why we iterate the jar entries twice, some documentation for each block would be nice.
| return@iterateDirs // Directory was deleted | ||
| forEachJarEntry { jarEntry, inputStream -> | ||
| val bytes = inputStream.use { inputStream -> | ||
| if (jarEntry.name.endsWith(".class")) { |
There was a problem hiding this comment.
What happens with ressource files in the JAR? We seem to skip them here, but I'm not sure how they then end up in the outputprovider?
There was a problem hiding this comment.
They are handled by the else branch 🎉 🤪
| private lateinit var metadata: ProjectMetaData | ||
| private var analytics: RealmAnalytics? = null | ||
|
|
||
| init { |
There was a problem hiding this comment.
Same, running all of this logic directly in the constructor feels ...iffy
There was a problem hiding this comment.
Same, I just exposed transform as internal and call it on the constructed object instead of implicitly from the init-block.
realm-transformer/src/main/kotlin/io/realm/transformer/RealmTransformer.kt
Show resolved
Hide resolved
| classPool.close(); | ||
| fun copyProcessedClasses() { | ||
| for ((fqname: String, clazz: CtClass) in processedClasses) { | ||
| outputProvider.putNextEntry(JarEntry("${fqname.replace('.', '/')}.class")) |
There was a problem hiding this comment.
Does this also work on Windows or should we use File.separatorChar?
There was a problem hiding this comment.
I would argue heavily that the Zip file entry header should be platform agnostic ... otherwise you would need to supply different Zip-files for each platform. And since it works on one platform then I assume that it would also work on the others.
Closes #7714