Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-2039

DefaultAntBuilder always uses script directory as basedir

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-milestone-6
    • Fix Version/s: None

      Description

      The DefaultAntBuilder.importBuild() method hard-codes a basedir value to the directory containing the script:

      File baseDir = file.parentFile

      Set existingAntTargets = new HashSet(antProject.targets.keySet())
      File oldBaseDir = antProject.baseDir
      antProject.baseDir = baseDir

      This cannot be overridden and forces the basedir to the script's dirctory.

      One possible solution would be to add an optional parameter that for the basedir. This would require that the gradle script be aware of the ant script's basedir, but would be easy to implement.

      A more complex solution would be probably involve loading a new AntBuilder and interrogating it or delegating to it. This would allow the ant script to determine its basedir, but would probably require a significant rewrite of the function or possibly significant overhead.

      A workaround is to create an second ant script located in the first's basedir. This script would contain a single line that imports the first.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            mbrand Michael Brand
            Votes:
            10 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: