@Nullable public String getProguardMapping() { if (!minifyEnabled || proguardMappingFile == null || !proguardMappingFile.exists()) { return null; } return FileUtil.getRelativePath(getProject().getRootDir(), proguardMappingFile); }
@Nullable public String getProguardConfig() { if (minifyEnabled) { Set<File> proguardFiles = new ImmutableSet.Builder<File>() .addAll(getBaseVariant().getMergedFlavor().getProguardFiles()) .addAll(getBaseVariant().getBuildType().getProguardFiles()) .build(); Preconditions.checkArgument( proguardFiles.size() == 1, "%s proguard files found. Only one can be used.", proguardFiles.size()); File proguardFile = proguardFiles.iterator().next(); Preconditions.checkArgument( proguardFile.exists(), "Proguard file %s does not exist", proguardFile); return FileUtil.getRelativePath(getProject().getRootDir(), proguardFile); } return null; }
private void processDependencies( Map<VersionlessDependency, Collection<ExternalDependency>> dependencyMap) { Path rootPath = project.getRootDir().toPath(); File cacheDir = rootPath.resolve(externalDependenciesExtension.getCache()).toFile(); if (cacheDir.exists()) {
rootBuckProject.getRootDir().toPath().resolve(entry.getKey()).resolve(BUCK).toFile(); try (OutputStream os = new FileOutputStream(buckFile, currentProjectPaths.contains(entry.getKey()))) {
.forProjectDirectory(project.getRootDir()) .connect();
static GradleException youShouldTurnOnPaddedCell(SpotlessTask task) { Path rootPath = task.getProject().getRootDir().toPath(); return new GradleException(StringPrinter.buildStringFromLines( "You have a misbehaving rule which can't make up its mind.", "This means that spotlessCheck will fail even after spotlessApply has run.", "", "This is a bug in a formatting rule, not Spotless itself, but Spotless can", "work around this bug and generate helpful bug reports for the broken rule", "if you add 'paddedCell()' to your build.gradle as such: ", "", " spotless {", " format 'someFormat', {", " ...", " paddedCell()", " }", " }", "", "The next time you run spotlessCheck, it will put helpful bug reports into", "'" + rootPath.relativize(diagnoseDir(task).toPath()) + "', and spotlessApply", "and spotlessCheck will be self-consistent from here on out.", "", "For details see " + URL)); }
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") static void check(SpotlessTask task, Formatter formatter, List<File> problemFiles) throws IOException { if (problemFiles.isEmpty()) { // if the first pass was successful, then paddedCell() mode is unnecessary task.getLogger().info(StringPrinter.buildStringFromLines( task.getName() + " is in paddedCell() mode, but it doesn't need to be.", "If you remove that option, spotless will run ~2x faster.", "For details see " + URL)); } File diagnoseDir = diagnoseDir(task); File rootDir = task.getProject().getRootDir(); List<File> stillFailing = PaddedCellBulk.check(rootDir, diagnoseDir, formatter, problemFiles); if (!stillFailing.isEmpty()) { throw task.formatViolationsFor(formatter, problemFiles); } } }
.lineEndingsPolicy(lineEndingsPolicy) .encoding(Charset.forName(encoding)) .rootDir(getProject().getRootDir().toPath()) .steps(steps) .exceptionPolicy(exceptionPolicy)
public String getBinPath() { if ("".equals(version)) { return "yarn"; } return format("%s/.gradle/%s/yarn-%s.js", project.getRootDir(), workingDir, version); }
private String formatPath(File dir) { Path root = Paths.get(getProject().getRootDir().toURI()); Path path = Paths.get(dir.toURI()); if (path.startsWith(root)) { return root.relativize(path).toString(); } else { return path.toAbsolutePath().toString(); } }
public void execute(InitTravisTask t) { t.setDescription("Creates '.travis.yml' file if not already present."); t.setOutputFile(new File(project.getRootDir(), ".travis.yml")); } });
public void execute(InitTravisTask t) { t.setDescription("Creates '.travis.yml' file if not already present."); t.setOutputFile(new File(project.getRootDir(), ".travis.yml")); } });
@Override public void apply(Project project) { projectPath = project.getProjectDir().toPath(); multiProjectPath = project.getRootDir().toPath().resolve(".."); createTask(project, "generateTestSuitesStandalone"); createTask(project, "generateTestSuitesMultiProject"); }
@Override public void apply(Project project) { projectPath = project.getProjectDir().toPath(); multiProjectPath = project.getRootDir().toPath().resolve(".."); createTask(project, "generateTestSuitesStandalone"); createTask(project, "generateTestSuitesMultiProject"); }
@NotNull private TeamCityDSLExtension createExtension(Project project) { TeamCityDSLExtension extension = project.getExtensions().create(EXTENSION_NAME, TeamCityDSLExtension.class); extension.setTeamcityVersion(DEFAULT_TEAMCITY_VERSION); extension.setFormat(DEFAULT_FORMAT); extension.setBaseDir(new File(project.getRootDir(), DEFAULT_BASE_DIR)); extension.setDestDir(new File(project.getBuildDir(), DEFAULT_DEST_DIR)); return extension; }
public void execute(InitTravisTask t) { t.setDescription("Creates '.travis.yml' file if not already present."); t.setOutputFile(new File(project.getRootDir(), ".travis.yml")); } });
private List<DependencyUpdate> loadDependencyReport() { Path path = Paths.get(getProject().getRootDir().getAbsolutePath(), "build", "dependencyUpdates", "report.json"); Object dependencyUpdatesJson = new JsonSlurper().parse(path.toFile()); return getOutDatedDependencies(dependencyUpdatesJson); }
private void createWebProject(Project project) { Task createWebDir = project.getTasks().create("createWebDir"); createWebDir.dependsOn(":createJavaDir"); createWebDir.setGroup(Task_Group_Nuke); createWebDir.getActions().add(task -> { WarPluginConvention warPluginConvention = new WarPluginConvention(project); File file = new File(project.getRootDir(), warPluginConvention.getWebAppDirName()); createIfNotExist(file); }); }
public BuildChangeLogTask() { Project project = getProject(); setGitDir(project.getRootDir()); setTicketIdPrefixes("CLDSVCS", "LPS", "SOS", "SYNC"); }
public synchronized ProjectConnection getConnection() { if (connection == null) { this.connection = GradleConnector.newConnector().forProjectDirectory(this.project.getRootDir()).connect(); } return this.connection; }