Skip to content

Commit

Permalink
Improvement: Make Jextract tasks cacheable
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaracha committed Oct 12, 2024
1 parent ad70f60 commit e4e65e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Create changelog file for release notes
- The source set the generated sources are added to is now user-selectable via extension property, `main` is chosen by default.
- DownloadTask became cacheable, so the downloaded Jextract archives can be shared and re-used via build cache.
- Tasks became cacheable, so the downloaded Jextract archives and generated sources can be shared and re-used via build cache.

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
import javax.inject.Inject

@CacheableTask
abstract class DumpIncludesTask @Inject constructor(private val workerExecutor: WorkerExecutor) : DefaultTask() {
interface LibraryConfig {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val header: RegularFileProperty
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
val includes: ListProperty<Directory>
@get:OutputFile
val argFile: RegularFileProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
import javax.inject.Inject

@CacheableTask
abstract class GenerateBindingsTask @Inject constructor(private val workerExecutor: WorkerExecutor) : DefaultTask() {
interface LibraryConfig {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val header: RegularFileProperty
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
val includes: ListProperty<Directory>
@get:Input
val definedMacros: ListProperty<String>
Expand All @@ -34,6 +37,7 @@ abstract class GenerateBindingsTask @Inject constructor(private val workerExecut
val whitelist: MapProperty<String, Set<String>>
@get:Optional
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
val argFile: RegularFileProperty
@get:Input
val libraries: ListProperty<String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import javax.inject.Inject

abstract class Generator @Inject constructor(objects: ObjectFactory) {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
val location: DirectoryProperty = objects.directoryProperty()
@get:Internal
val executable: Provider<RegularFile> = location.map { g ->
Expand Down

0 comments on commit e4e65e7

Please sign in to comment.