[Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3 There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242 ^KTI-1473 In Progress
This commit is contained in:
committed by
Space Team
parent
b784544f8d
commit
a19bd2ed2e
+10
-5
@@ -1,6 +1,10 @@
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader.SKIP_CODE
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.ClassWriter
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.ACC_PUBLIC
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
plugins {
|
||||
@@ -20,7 +24,7 @@ val toolsJarStubs by tasks.registering {
|
||||
val toolsJarFile = toolsJar().singleFile
|
||||
inputs.file(toolsJarFile)
|
||||
|
||||
val outDir = buildDir.resolve(name)
|
||||
val outDir = layout.buildDirectory.dir(name)
|
||||
outputs.dir(outDir)
|
||||
|
||||
val usedInternalApiPackages = listOf(
|
||||
@@ -28,7 +32,8 @@ val toolsJarStubs by tasks.registering {
|
||||
)
|
||||
|
||||
doLast {
|
||||
outDir.deleteRecursively()
|
||||
val outputDirectoryFile = outDir.get().asFile
|
||||
outputDirectoryFile.deleteRecursively()
|
||||
val zipFile = ZipFile(toolsJarFile)
|
||||
zipFile.stream()
|
||||
.filter { it.name.endsWith(".class") }
|
||||
@@ -63,7 +68,7 @@ val toolsJarStubs by tasks.registering {
|
||||
}, SKIP_CODE)
|
||||
|
||||
if (isExported) {
|
||||
val result = File(outDir, zipEntry.name)
|
||||
val result = File(outputDirectoryFile, zipEntry.name)
|
||||
result.parentFile.mkdirs()
|
||||
result.writeBytes(classWriter.toByteArray())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user