From 815f083c7b2b394fdd862428499dd75444e700f8 Mon Sep 17 00:00:00 2001 From: wisberg Date: Sun, 25 May 2003 19:27:45 +0000 Subject: [PATCH] Fix for failure building with useEclipseCompiles testing-drivers initially (or any module that only indirectly depended on jdt.core, which has no sources) - better logging - checking zip results - returns false positive for empty zips - compile(..) API change for adopting classes Also, copyright clearly wrong - file created last fall. --- .../aspectj/internal/tools/build/Builder.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/build/src/org/aspectj/internal/tools/build/Builder.java b/build/src/org/aspectj/internal/tools/build/Builder.java index 14aa22d0f..1c35072c7 100644 --- a/build/src/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/org/aspectj/internal/tools/build/Builder.java @@ -1,6 +1,6 @@ /* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). + * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), + * 2003 Contributors. * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Common Public License v1.0 @@ -8,7 +8,7 @@ * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: - * Xerox/PARC initial implementation + * PARC initial implementation * ******************************************************************/ package org.aspectj.internal.tools.build; @@ -281,22 +281,23 @@ public abstract class Builder { if (!buildingEnabled) { return false; } - File classesDir = - useEclipseCompiles - ? new File(module.moduleDir, "bin") // FileLiteral - : new File(tempDir, "classes-" + System.currentTimeMillis()); + final File classesDir; + if (useEclipseCompiles) { + classesDir = new File(module.moduleDir, "bin"); // FileLiteral + } else { + String name = "classes-" + System.currentTimeMillis(); + classesDir = new File(tempDir, name); + } if (verbose) { handler.log("buildOnly " + module); } try { return ( - useEclipseCompiles || compile(module, classesDir, errors)) + compile(module, classesDir, useEclipseCompiles, errors)) && assemble(module, classesDir, errors); } finally { - if (!useEclipseCompiles - && (!Util.deleteContents(classesDir) - || !classesDir.delete())) { - errors.add("unable to delete " + classesDir); + if (!useEclipseCompiles && !Util.delete(classesDir)) { + errors.add("buildOnly unable to delete " + classesDir); } } } @@ -361,7 +362,7 @@ public abstract class Builder { if (!targDir.canWrite() && !targDir.mkdirs()) { if (buildSpec.verbose) { - handler.log("unable to create " + targDir); + handler.log("buildProduct unable to create " + targDir); } return false; } @@ -511,10 +512,16 @@ public abstract class Builder { /** * Compile module classes to classesDir, saving String errors. + * @param module the Module to compile + * @param classesDir the File directory to compile to + * @param useExistingClasses if true, don't recompile + * and ensure classes are available + * @param errors the List to add error messages to */ abstract protected boolean compile( Module module, File classesDir, + boolean useExistingClasses, List errors); /** -- 2.39.5