Buildr
  1. Buildr
  2. BUILDR-107

compile_task.from(sources) does not support files that are java classes in a named package

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.3.3
    • Fix Version/s: Wish List
    • Component/s: Compilers
    • Labels:
      None
    • Environment:
      Trunk revision 679935

      Description

      Compile tasks accepts source files. Yet they do not handle them correctly when the source file is a java class in a named package. Compile tasks believes that "src/main/java/thepackage/Test1.java" should be compiled to "target/classes/Test1.class" instead of "target/classes/thepackage/Test1.class".

      When changing compile_spec.rb to use java source files in a named package, there are two failing tests.

      1)
      'Buildr::CompileTask#invoke should not force compilation if sources older than compiled' FAILED
      Expected the tasks foo:compile to not run, but they all ran.
      /buildr-trunk/spec/compile_spec.rb:323:

      2)
      'Buildr::CompileTask#invoke should not force compilation if dependencies older than compiled' FAILED
      Expected the tasks foo:compile to not run, but they all ran.
      /buildr-trunk/spec/compile_spec.rb:342:

      I can think of two ways to fix this issue. Either compile tasks should reject source files and accept only source directory. Or they need to be smarter and figure out the package of java source files.

        Activity

        lacton created issue -
        lacton made changes -
        Field Original Value New Value
        Attachment BUILDR-107_specs.patch [ 12386983 ]
        Hide
        Assaf Arkin added a comment -

        Third option, compare the timestamp to the target directory. The last thing the compiler does is touch the target directory, so after successful compile, target is newer then sources and the next compile will do nothing. So that's another option to determine if there's work to be done.

        However, it also creates the target directory on first run, so it will be newer than sources even if compilation failed, so we need a solution for that.

        Show
        Assaf Arkin added a comment - Third option, compare the timestamp to the target directory. The last thing the compiler does is touch the target directory, so after successful compile, target is newer then sources and the next compile will do nothing. So that's another option to determine if there's work to be done. However, it also creates the target directory on first run, so it will be newer than sources even if compilation failed, so we need a solution for that.
        Assaf Arkin made changes -
        Fix Version/s 1.3.4 [ 12313418 ]
        Alex Boisvert made changes -
        Fix Version/s 1.4 [ 12313152 ]
        Fix Version/s 1.3.4 [ 12313418 ]
        Pepijn Van Eeckhoudt made changes -
        Comment [ Looking at the code in HEAD it seems like this has been resolved in 819657; Alex Boisvert's fix for BUILDR-322. compile_map tries to read the package line from the source files and maps the source file to a target file accordingly. The bit of code in question currently handles java, groovy and scala, but is in the base compile.rb file. This should probably be pushed down to each specific compiler instead. ]
        Antoine Toulme made changes -
        Fix Version/s Wish List [ 12314810 ]
        Fix Version/s 1.4 [ 12313152 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            lacton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development