Slackbot
10/03/2022, 9:52 PMChris Lee
10/03/2022, 10:06 PMinto(…)
is the equivalent of mainSpec.addChild().into(…)
Chris Lee
10/03/2022, 10:07 PMval foo by tasks.registering(Sync::class) {
into("something")
}
Chris Lee
10/03/2022, 10:11 PM@Override
public CopySpec from(Object sourcePath, Action<? super CopySpec> configureAction) {
Preconditions.checkNotNull(configureAction, "Gradle does not allow passing null for the configuration action for CopySpec.from().");
CopySpecInternal child = addChild();
child.from(sourcePath);
CopySpecWrapper wrapper = instantiator.newInstance(CopySpecWrapper.class, child);
configureAction.execute(wrapper);
return wrapper;
}
Chris Lee
10/03/2022, 10:11 PMval pluginName = "blah"
val foo by tasks.registering(Sync::class) {
from("$pluginName/lib") {
}
}
Chris Lee
10/03/2022, 10:15 PMinto
mirrors the behaviour of adding a child copyspec and configuring it:
@Override
public CopySpec into(Object destPath, Action<? super CopySpec> copySpec) {
Preconditions.checkNotNull(copySpec, "Gradle does not allow passing null for the configuration action for CopySpec.into().");
CopySpecInternal child = addChild();
child.into(destPath);
CopySpecWrapper wrapper = instantiator.newInstance(CopySpecWrapper.class, child);
copySpec.execute(wrapper);
return wrapper;
}
@Override
public CopySpec into(Object destPath, Action<? super CopySpec> copySpec) {
getMainSpec().into(destPath, copySpec);
return this;
}
Chris Lee
10/03/2022, 10:28 PMval plugin = into(project.provider { "${pluginName.get()}/lib" })
Jakub Chrzanowski
10/04/2022, 3:19 AMinto
method and passing destination dir to the mainSpec.addChild()
did the job!