-
Notifications
You must be signed in to change notification settings - Fork 54
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
Make Klib-related Gradle tasks public #204
base: develop
Are you sure you want to change the base?
Conversation
e94154b
to
bb48561
Compare
bb48561
to
25efc08
Compare
25efc08
to
5a03695
Compare
* Path to a resulting dump file. | ||
*/ | ||
@get:InputFiles | ||
@get:SkipWhenEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can there be situations where dumpFile
is not specified for the target?
/** | ||
* Path to a resulting dump file. | ||
*/ | ||
@get:InputFiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A rather ad-hoc way)
I think in such cases it is worth writing that InputFiles
is used for a single file if it may not be present or the file may be empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated KDoc with the details on why a file could be missing and what to expect then
import java.util.jar.JarFile | ||
import javax.inject.Inject | ||
|
||
public open class KotlinApiBuildTask @Inject constructor( | ||
) : BuildTaskBase() { | ||
@OutputFile | ||
public lateinit var outputApiFile: File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why File
but not RegularFileProperty
?
It seems that because of this, lateinit
looks very unusual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change moves the property back from BuildTaskBase
, so I left the same type. However, as this PR will break binary compatibility for the Compare task, it might be worth breaking it here as well and providing a more robust implementation in return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try to add a reliable field, but maintain backward compatibility.
In BuildTaskBase
@get:Internal
public abstract var outputApiFile: File
In KotlinApiBuildTask
@get:OutputFile
...
public val realOutputApiFile: RegularFileProperty = project.objects.fileProperty()
@get:Internal
public override var outputApiFile: File
get() = realOutputApiFile.get().asFile
set(value) = realOutputApiFile.set(value)
- I didn 't check it )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue here is that we definitely want to phase these old properties out and ask users to migrate to realXXX
ones, but old properties already claimed good names :(
@PathSensitive(PathSensitivity.RELATIVE) | ||
public lateinit var projectApiFile: File | ||
@get:InputFiles | ||
@get:SkipWhenEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File can be empty or not specified?
onlyIf("There are no klibs compiled for the project") { hasCompilableTargets.get() } | ||
strictValidation.set(extension.klib.strictValidation) | ||
requiredTargets.addAll(supportedTargets()) | ||
inputAbiFile.set(klibApiDir.get().resolve(klibDumpFileName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klibApiDir.map { it.resolve(...) }
?
*/ | ||
@get:InputFiles | ||
@get:SkipWhenEmpty | ||
public val dumpFile: RegularFileProperty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provider<File>
?
Properties is not very often used in nested types, in this case, you will not need to call objects.fileProperty()
signatureVersion = SerializableSignatureVersion(extension.klib.signatureVersion) | ||
outputApiFile = apiBuildDir.resolve(klibDumpFileName) | ||
this.target.set(target) | ||
klibFile.from(project.provider { compilation.output.classesDirs }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigurableFileCollection
is a live collection, try use it directly klibFile.from(compilation.output.classesDirs )
@@ -636,29 +592,21 @@ private class KlibValidationPipelineBuilder( | |||
} | |||
|
|||
private fun Project.unsupportedTargetDumpProxy( | |||
compilation: KotlinCompilation<KotlinCommonOptions>, | |||
@Suppress("UNUSED_PARAMETER") compilation: KotlinCompilation<KotlinCommonOptions>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unused parameter is still present?
dumpFileName = klibDumpFileName | ||
dependsOn(project.tasks.withType(KotlinKlibAbiBuildTask::class.java)) | ||
target.set(unsupportedTarget) | ||
oldMergedKlibDump.set(klibApiDir.get().resolve(klibDumpFileName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oldMergedKlibDump.fileProvider(klibApiDir.map { it.resolve(...) }
What was done:
Fixed #203