Skip to content
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

[KT-70029] Allow setting of configFile #5338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ abstract class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :

this.inputFilesDirectory.set(inputFilesDirectory)

this.configFile.set(project.file(npmProjectDir.map { it.resolve("webpack.config.js") }))

val platformType = binary.compilation.platformType
val moduleKind = binary.linkTask.flatMap { task ->
task.compilerOptions.moduleKind.orElse(task.compilerOptions.target.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileTree
import org.gradle.api.file.FileTreeElement
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
Expand Down Expand Up @@ -131,8 +132,7 @@ constructor(
internal var resolveFromModulesFirst: Boolean = false

@get:OutputFile
open val configFile: Provider<File> =
npmProjectDir.map { it.resolve("webpack.config.js") }
abstract val configFile: RegularFileProperty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please leave configFile as is to not change type of the field?
Instead I propose to add new property configurationFile with type RegularFileProperty with convention value npmProjectDir.map { it.resolve("webpack.config.js") }.
It should look like something like that

    @get:OutputFile
    open val configurationFile: RegularFileProperty = objects.fileProperty()
        .convention(
            objects.fileProperty().fileProvider(
                npmProjectDir.map { it.resolve("webpack.config.js") }
            )
        )

And change configFile from @get:OutputFile to @get:Deprecated (because we are going to have new property as output file)


@Nested
val output: KotlinWebpackOutput = KotlinWebpackOutput(
Expand Down Expand Up @@ -274,7 +274,7 @@ constructor(
return KotlinWebpackRunner(
npmProject,
logger,
configFile.get(),
configFile.get().asFile,
execHandleFactory,
bin,
webpackArgs,
Expand All @@ -293,7 +293,7 @@ constructor(
val runner = createRunner()

if (generateConfigOnly) {
runner.config.save(configFile.get())
runner.config.save(configFile.get().asFile)
return
}

Expand Down