< prev index next >

langtools/test/tools/sjavac/IncCompileWithChanges.java

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @summary Verify incremental changes in gensrc are handled as expected
  27  * @bug 8054689
  28  * @author Fredrik O
  29  * @author sogoel (rewrite)
  30  * @library /tools/lib
  31  * @modules jdk.compiler/com.sun.tools.javac.api
  32  *          jdk.compiler/com.sun.tools.javac.main
  33  *          jdk.compiler/com.sun.tools.sjavac
  34  *          jdk.jdeps/com.sun.tools.javap
  35  * @ignore Requires dependency code to deal with in-method dependencies.
  36  * @build Wrapper toolbox.ToolBox
  37  * @run main Wrapper IncCompileWithChanges
  38  */
  39 
  40 import java.util.*;
  41 import java.nio.file.*;
  42 
  43 import toolbox.ToolBox;
  44 
  45 public class IncCompileWithChanges extends SJavacTester {
  46     public static void main(String... args) throws Exception {
  47         IncCompileWithChanges wc = new IncCompileWithChanges();
  48         wc.test();
  49     }
  50 
  51     // Remember the previous bin and headers state here.
  52     Map<String,Long> previous_bin_state;
  53     Map<String,Long> previous_headers_state;
  54     ToolBox tb = new ToolBox();
  55 
  56     void test() throws Exception {
  57         clean(TEST_ROOT);
  58         Files.createDirectories(GENSRC);
  59         Files.createDirectories(BIN);
  60         Files.createDirectories(HEADERS);
  61 
  62         initialCompile();
  63         incrementalCompileWithChange();
  64     }
  65 
  66     /* Update A.java with a new timestamp and new final static definition.
  67      * This should trigger a recompile, not only of alfa, but also beta.
  68      * Generated native header should not be updated since native api of B was not modified.
  69      */
  70     void incrementalCompileWithChange() throws Exception {
  71         previous_bin_state = collectState(BIN);
  72         previous_headers_state = collectState(HEADERS);
  73         System.out.println("\nIn incrementalCompileWithChange() ");
  74         System.out.println("A.java updated to trigger a recompile");




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @summary Verify incremental changes in gensrc are handled as expected
  27  * @bug 8054689
  28  * @author Fredrik O
  29  * @author sogoel (rewrite)
  30  * @library /tools/lib
  31  * @modules jdk.compiler/com.sun.tools.javac.api
  32  *          jdk.compiler/com.sun.tools.javac.main
  33  *          jdk.compiler/com.sun.tools.sjavac

  34  * @ignore Requires dependency code to deal with in-method dependencies.
  35  * @build Wrapper toolbox.ToolBox
  36  * @run main Wrapper IncCompileWithChanges
  37  */
  38 
  39 import java.util.*;
  40 import java.nio.file.*;
  41 
  42 import toolbox.ToolBox;
  43 
  44 public class IncCompileWithChanges extends SJavacTester {
  45     public static void main(String... args) throws Exception {
  46         IncCompileWithChanges wc = new IncCompileWithChanges();
  47         wc.test();
  48     }
  49 
  50     // Remember the previous bin and headers state here.
  51     Map<String,Long> previous_bin_state;
  52     Map<String,Long> previous_headers_state;

  53 
  54     void test() throws Exception {
  55         clean(TEST_ROOT);
  56         Files.createDirectories(GENSRC);
  57         Files.createDirectories(BIN);
  58         Files.createDirectories(HEADERS);
  59 
  60         initialCompile();
  61         incrementalCompileWithChange();
  62     }
  63 
  64     /* Update A.java with a new timestamp and new final static definition.
  65      * This should trigger a recompile, not only of alfa, but also beta.
  66      * Generated native header should not be updated since native api of B was not modified.
  67      */
  68     void incrementalCompileWithChange() throws Exception {
  69         previous_bin_state = collectState(BIN);
  70         previous_headers_state = collectState(HEADERS);
  71         System.out.println("\nIn incrementalCompileWithChange() ");
  72         System.out.println("A.java updated to trigger a recompile");


< prev index next >