Skip to content

Commit 7a3eaeb

Browse files
committed
Kotlinify PlugGeneratorJavaExecable.
1 parent 511294b commit 7a3eaeb

File tree

3 files changed

+43
-55
lines changed

3 files changed

+43
-55
lines changed

atplug-plugin-gradle/src/main/java/com/diffplug/atplug/tooling/PlugGeneratorJavaExecable.java

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (C) 2022 DiffPlug
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.diffplug.atplug.tooling
17+
18+
import com.diffplug.atplug.tooling.gradle.JavaExecable
19+
import java.io.File
20+
import java.util.*
21+
22+
/** [PlugGenerator.PlugGenerator] in a [JavaExecable] form. */
23+
class PlugGeneratorJavaExecable(toSearch: List<File>?, toLinkAgainst: Set<File>?) : JavaExecable {
24+
// inputs
25+
var toSearch: List<File>
26+
var toLinkAgainst: Set<File>
27+
28+
// outputs
29+
@JvmField var atplugInf: SortedMap<String, String>? = null
30+
31+
init {
32+
this.toSearch = ArrayList(toSearch)
33+
this.toLinkAgainst = LinkedHashSet(toLinkAgainst)
34+
}
35+
36+
override fun run() {
37+
val metadataGen = PlugGenerator(toSearch, toLinkAgainst)
38+
atplugInf = metadataGen.atplugInf
39+
}
40+
}

atplug-plugin-gradle/src/main/java/com/diffplug/atplug/tooling/gradle/PlugGenerateTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2022 DiffPlug
2+
* Copyright (C) 2020-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -185,10 +185,10 @@ private SortedMap<String, String> generate() {
185185
options.setExecutable(getLauncher().get().getExecutablePath());
186186
});
187187
});
188-
return JavaExecable.exec(workQueue, input).getAtplugInf();
188+
return JavaExecable.exec(workQueue, input).atplugInf;
189189
} else {
190190
input.run();
191-
return input.getAtplugInf();
191+
return input.atplugInf;
192192
}
193193
}
194194

0 commit comments

Comments
 (0)