@Override public void buildStarted(CompileContext context) { if (myForStubs) { File stubRoot = getStubRoot(context); if (stubRoot.exists() && !FileUtil.deleteWithRenaming(stubRoot)) { context.processMessage( new CompilerMessage( myBuilderName, BuildMessage.Kind.ERROR, "External make cannot clean " + stubRoot.getPath())); } } }
private static Map<ModuleBuildTarget, String> getStubGenerationOutputs( ModuleChunk chunk, CompileContext context) throws IOException { Map<ModuleBuildTarget, String> generationOutputs = new HashMap<ModuleBuildTarget, String>(); File commonRoot = getStubRoot(context); for (ModuleBuildTarget target : chunk.getTargets()) { File targetRoot = new File( commonRoot, target.getModule().getName() + File.separator + target.getTargetType().getTypeId()); if (targetRoot.exists() && !FileUtil.deleteWithRenaming(targetRoot)) { throw new IOException("External make cannot clean " + targetRoot.getPath()); } if (!targetRoot.mkdirs()) { throw new IOException("External make cannot create " + targetRoot.getPath()); } generationOutputs.put(target, targetRoot.getPath()); } return generationOutputs; }