For our cross version integration tests we used to rely on our packaged archives that we unzip before we run our tests.
I migrated this unpacking to be done via artifact transforms requesting by directory type variant of the dependency.
That works great so far, but now when I wanna test the current version of my distribution I don’t download the distribution from anywhere
but build it locally.
By changing the providing subproject (the one that builds the distribution) to provide an unpacked version of my distribution in the first place
I wanna safe the unnecessary packing / unpacking cycle. The problem is, that I don’t know how to do that without internal classes.
My current approach looks like this:
def creatingDirTask = tasks.register('directoryDistributionCreatedTask', Copy)
Configuration configuration = configurations.getByName("default")
ConfigurationPublications publications = configuration.getOutgoing();
ConfigurationVariantInternal variant = (ConfigurationVariantInternal) publications.getVariants().maybeCreate("directory");
variant.getAttributes().attribute(ArtifactAttributes.ARTIFACT_FORMAT, ArtifactTypeDefinition.DIRECTORY_TYPE);
variant.artifactsProvider(new Factory<List<PublishArtifact>>() {
@Override
List<PublishArtifact> create() {
List<PublishArtifact> artifacts = new ArrayList<>();
artifacts.add(new AbstractPublishArtifact(buildCopyTask) {
@Override
String getName() {
return creatingDirTask.name
}
@Override
String getExtension() {
return ""
}
@Override
String getType() {
return ArtifactTypeDefinition.DIRECTORY_TYPE;
}
@Override
String getClassifier() {
return null
}
@Override
File getFile() {
return creatingDirTask.get().getOutputs().getFiles().getSingleFile();
}
@Override
Date getDate() {
return null
}
@Override
boolean shouldBePublished() {
return false
}
});
return artifacts;
}
})
as you can see there are a bunch of internal classes there. Is there a more idiomatic way to achieve what I’m looking for?