Skip to content

Commit

Permalink
fix: fix gradle caching issue (#100)
Browse files Browse the repository at this point in the history
* fix: fix gradle caching issue

* remove unused import
  • Loading branch information
John Plaisted authored Jun 4, 2021
1 parent 5f84ce9 commit 6887bad
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.IOException;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.apache.commons.io.FileUtils;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.provider.Property;
Expand Down Expand Up @@ -59,6 +60,12 @@ public Property<GmaEntitiesAnnotationAllowList> getEntitiesAnnotationAllowList()
@TaskAction
public void generateEvents() throws IOException {
final SchemaGenerator schemaGenerator = new SchemaGenerator();

// For caching to work across git branches, this entire directory needs to be deleted. The entire directory is
// cached; so if anything is left in here from other branch builds it will be incorrectly cached. Delete it to
// ensure that it is in 100% valid state after this task (and when cached).
FileUtils.deleteDirectory(getOutputDirectory().getSingleFile());

final String outputDir =
getOutputDirectory().getSingleFile().toPath().resolve("com").resolve("linkedin").resolve("mxe").toString();
schemaGenerator.generate(_resolverPaths.getFiles().stream().map(File::toString).collect(Collectors.toList()),
Expand Down

0 comments on commit 6887bad

Please sign in to comment.