protected List<String> getAllArgs() { List<String> allArgs = new ArrayList<String>(); if (buildScript != null) { allArgs.add("--build-file"); allArgs.add(buildScript.getAbsolutePath()); } if (projectDir != null) { allArgs.add("--project-dir"); allArgs.add(projectDir.getAbsolutePath()); } for (File initScript : initScripts) { allArgs.add("--init-script"); allArgs.add(initScript.getAbsolutePath()); } if (settingsFile != null) { allArgs.add("--settings-file"); allArgs.add(settingsFile.getAbsolutePath()); } if (quiet) { allArgs.add("--quiet"); } if (taskList) { allArgs.add("tasks"); } if (dependencyList) { allArgs.add("dependencies"); } if (!searchUpwards) { boolean settingsFoundAboveInTestDir = false; TestFile dir = new TestFile(getWorkingDir()); while (dir != null && getTestDirectoryProvider().getTestDirectory().isSelfOrDescendent(dir)) { if (dir.file("settings.gradle").isFile()) { settingsFoundAboveInTestDir = true; break; } dir = dir.getParentFile(); } if (!settingsFoundAboveInTestDir) { allArgs.add("--no-search-upward"); } } // This will cause problems on Windows if the path to the Gradle executable that is used has a // space in it (e.g. the user's dir is c:/Users/Luke Daley/) // This is fundamentally a windows issue: You can't have arguments with spaces in them if the // path to the batch script has a space // We could work around this by setting -Dgradle.user.home but GRADLE-1730 (which affects // 1.0-milestone-3) means that that // is problematic as well. For now, we just don't support running the int tests from a path with // a space in it on Windows. // When we stop testing against M3 we should change to use the system property. if (getGradleUserHomeDir() != null) { allArgs.add("--gradle-user-home"); allArgs.add(getGradleUserHomeDir().getAbsolutePath()); } allArgs.addAll(args); allArgs.addAll(tasks); return allArgs; }
public GradleExecuter withTasks(List<String> names) { tasks.clear(); tasks.addAll(names); return this; }