Skip to content

Commit

Permalink
finalize input/output immediately on donwgradeFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jul 10, 2024
1 parent 0eb787e commit f356c86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,20 @@ abstract class DowngradeFiles : ConventionTask(), DowngradeFlags {
project.extensions.getByType(JVMDowngraderExtension::class.java)
}

private var _inputCollection: FileCollection by FinalizeOnRead(MustSet())

@get:InputFiles
var inputCollection: FileCollection by FinalizeOnRead(MustSet())
var inputCollection: FileCollection
get() = _inputCollection
set(value) {
_inputCollection = value

// use _inputCollection to finalize it immediately
val fd = _inputCollection.map { it to temporaryDir.resolve(it.name) }
outputs.dirs(*fd.filter { it.first.isDirectory }.map { it.second }.toTypedArray())
outputs.files(*fd.filter { it.first.isFile }.map { it.second }.toTypedArray())

}

@get:InputFiles
var classpath: FileCollection by FinalizeOnRead(LazyMutable {
Expand All @@ -40,11 +52,6 @@ abstract class DowngradeFiles : ConventionTask(), DowngradeFlags {
*/
@get:Internal
val outputCollection: FileCollection by lazy {
val fd = inputCollection.map { it to temporaryDir.resolve(it.name) }

outputs.dirs(*fd.filter { it.first.isDirectory }.map { it.second }.toTypedArray())
outputs.files(*fd.filter { it.first.isFile }.map { it.second }.toTypedArray())

outputs.files
}

Expand Down
8 changes: 0 additions & 8 deletions src/shared/java/xyz/wagyourtail/jvmdg/util/AsyncUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,6 @@ public void run() {
return FileVisitResult.CONTINUE;
}
});
// while (!futures.isEmpty()) {
// try {
// futures.poll().get();
// } catch (InterruptedException | ExecutionException e) {
// throw new RuntimeException(e);
// }
// }
// return null;
return (Future) waitForFutures(futures);
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/xyz/wagyourtail/jvmdg/test/JavaRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ public enum JavaVersion {
V19,
V20,
V21,
V22;
V22,
V23;

public static JavaVersion fromClassVers(int vers) {
return JavaVersion.values()[vers - 45];
Expand Down

0 comments on commit f356c86

Please sign in to comment.