File spotlessDir = new File(StandardSystemProperty.USER_DIR.value()).getParentFile(); File testlib = new File(spotlessDir, "testlib"); File cacheFile = new File(testlib, "build/tmp/testprovisioner." + name + ".cache");
/** Runs against the `spotlessSelfApply.gradle` file. */ static void runWithTestKit(Type type) throws Exception { GradleRunner.create() .withPluginClasspath() .withProjectDir(new File(StandardSystemProperty.USER_DIR.value()).getParentFile()) .withArguments( "--build-file", "spotlessSelf.gradle", "--project-cache-dir", ".gradle-selfapply", "spotless" + type.checkApply("Check", "Apply"), "--stacktrace") .forwardOutput() .build(); } }
private LineEnding.Policy lineEndingsPolicy = LineEnding.UNIX.createPolicy(); private Charset encoding = StandardCharsets.UTF_8; private Path rootDir = Paths.get(StandardSystemProperty.USER_DIR.value()); private List<FormatterStep> steps = new ArrayList<>(); private FormatExceptionPolicy exceptionPolicy = FormatExceptionPolicy.failOnlyOnError();
private static Path userHome() { return new File(StandardSystemProperty.USER_HOME.value()).toPath(); } }
/** * Returns a string representation of this system property. */ @Override public String toString() { return key() + "=" + value(); } }
/** Creates a JDK using the project's `org.gradle.java.home` property. */ public JdkConfig(Project project) { String javaHome; if (project.hasProperty(KEY_JAVA)) { javaHome = (String) project.property(KEY_JAVA); } else { javaHome = StandardSystemProperty.JAVA_HOME.value(); } Objects.requireNonNull(javaHome, "Could not find JRE dir, set 'org.gradle.java.home' to fix."); // it might point to the root of the JDK folder, or to the JRE itself // this handles the case that it is the JRE itself File jreSubdir = new File(javaHome + "/jre"); if (!jreSubdir.exists()) { javaHome = jreSubdir.getParentFile().getParentFile().getAbsolutePath(); } this.rootFolder = new File(javaHome); }