@@ -115,17 +115,18 @@ fun Project.createNativeBenchmarkExecTask(
115
115
val linkTask = binary.linkTask
116
116
onlyIf { linkTask.enabled }
117
117
118
+ dependsOn(linkTask)
119
+
118
120
val executableFile = linkTask.outputFile.get()
119
- executable = executableFile.absolutePath
120
- this .config = config
121
- this .workingDir = target.workingDir?.let { File (it) }
121
+ onlyIf { executableFile.exists() }
122
+
123
+ this .executable = executableFile
124
+ this .nativeFork = config.nativeFork
125
+ this .workingDir = target.workingDir
122
126
this .benchProgressPath = createTempFile(" bench" , " .txt" ).absolutePath
123
127
124
- onlyIf { executableFile.exists() }
125
128
benchsDescriptionDir = file(project.buildDir.resolve(target.extension.benchsDescriptionDir).resolve(config.name))
126
129
127
- dependsOn(linkTask)
128
-
129
130
reportFile = setupReporting(target, config)
130
131
configFile = writeParameters(target.name, reportFile, traceFormat(), config)
131
132
@@ -141,32 +142,36 @@ open class NativeBenchmarkExec() : DefaultTask() {
141
142
@Option(option = "filter", description = "Configures the filter for benchmarks to run.")
142
143
var filter: String? = null
143
144
*/
144
- @Input
145
- lateinit var executable: String
146
-
147
- var workingDir: File ? = null
145
+ @InputFile
146
+ lateinit var executable: File
148
147
149
148
@Input
149
+ @Optional
150
+ var workingDir: String? = null
151
+
152
+ @InputFile
150
153
lateinit var configFile: File
151
154
152
155
@Input
153
- lateinit var config: BenchmarkConfiguration
156
+ @Optional
157
+ var nativeFork: String? = null
154
158
155
- @Input
159
+ @OutputFile
156
160
lateinit var reportFile: File
157
161
158
- @Input
162
+ @Internal
159
163
lateinit var benchsDescriptionDir: File
160
164
161
- @Input
165
+ @Internal
162
166
lateinit var benchProgressPath: String
163
167
164
168
private fun execute (args : Collection <String >) {
165
169
project.exec {
166
- it.executable = executable
170
+ it.executable = executable.absolutePath
167
171
it.args(args)
168
- if (workingDir != null )
169
- it.workingDir = workingDir
172
+ workingDir?.let { dir ->
173
+ it.workingDir = File (dir)
174
+ }
170
175
}
171
176
}
172
177
@@ -178,7 +183,7 @@ open class NativeBenchmarkExec() : DefaultTask() {
178
183
val detailedConfigFiles = project.fileTree(benchsDescriptionDir).files.sortedBy { it.absolutePath }
179
184
val runResults = mutableMapOf<String , String >()
180
185
181
- val forkPerBenchmark = config. nativeFork.let { it == null || it == " perBenchmark" }
186
+ val forkPerBenchmark = nativeFork.let { it == null || it == " perBenchmark" }
182
187
183
188
detailedConfigFiles.forEach { runConfig ->
184
189
val runConfigPath = runConfig.absolutePath
0 commit comments