Skip to content

Commit

Permalink
remove @InputDirectory to avoid memory leak (#561) (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpern authored Jul 28, 2023
1 parent 0bd6275 commit 47b2c47
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package pl.allegro.tech.build.axion.release.domain

import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional

Expand Down Expand Up @@ -38,16 +36,16 @@ abstract class RepositoryConfig extends BaseExtension {
customKey.convention(gradleProperty(CUSTOM_KEY_PROPERTY))
customKeyFile.convention(gradleProperty(CUSTOM_KEY_FILE_PROPERTY)
.map({ layout.projectDirectory.file(it) }))
directory.convention(repositoryDirectory)
directory.convention(repositoryDirectory.asFile.absolutePath)
}

@Input
@Optional
abstract Property<String> getType()

@InputDirectory
@Input
@Optional
abstract DirectoryProperty getDirectory()
abstract Property<String> getDirectory()

@Input
@Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ScmPropertiesFactory {
static ScmProperties create(VersionConfig config) {
return new ScmProperties(
config.repository.type.get(),
config.repository.directory.asFile.get(),
new File(config.repository.directory.get()),
config.repository.remote.get(),
config.repository.pushTagsOnly().get(),
config.repository.fetchTags().get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RepositoryConfigFactoryTest extends Specification {
RepositoryConfig config = Fixtures.repositoryConfig(project)

then:
config.directory.asFile.get() == project.rootDir
new File(config.directory.get()) == project.rootDir
}

def "should not initialize authorization options when no flags on project"() {
Expand Down

0 comments on commit 47b2c47

Please sign in to comment.