public static ImmutableSet<String> available(Project project, Collection<File> files) { return files .stream() .filter(File::exists) .map(f -> getRelativePath(project.getProjectDir(), f)) .collect(MoreCollectors.toImmutableSet()); }
private static String getTransformConfigRuleForFile(Project project, File config) { String relativeConfigPath = FileUtil.getRelativePath(project.getRootProject().getProjectDir(), config); ProjectUtil.getPlugin(project.getRootProject()).exportedPaths.add(relativeConfigPath); if (project.getProjectDir().equals(config.getParentFile())) { return ":" + config.getName(); } else { String configTarget = BuckRuleComposer.fileRule(relativeConfigPath); Preconditions.checkNotNull(configTarget); return configTarget; } } }
project -> rootBuckProject .getProjectDir() .toPath() .relativize(project.getProjectDir().toPath()) .toString()) .collect(MoreCollectors.toImmutableSet()); File exportedFile = rootBuckProject.file(exportedPath); String containingPath = FileUtil.getRelativePath(rootBuckProject.getProjectDir(), exportedFile.getParentFile()); Set<Rule> rules = pathToRules.getOrDefault(containingPath, new HashSet<>()); rules.add(new ExportFile().name(exportedFile.getName()));
@Nullable public String getConsumerProguardConfig() { Set<File> consumerProguardFiles = new ImmutableSet.Builder<File>() .addAll(getBaseVariant().getMergedFlavor().getConsumerProguardFiles()) .addAll(getBaseVariant().getBuildType().getConsumerProguardFiles()) .build(); if (consumerProguardFiles.size() > 0) { Optional<File> optionalFile = consumerProguardFiles.stream().findFirst(); return FileUtil.getRelativePath(getProject().getProjectDir(), optionalFile.get()); } return null; }
@TaskAction void clean() throws IOException { Project rootProject = getProject(); Path rootProjectPath = rootProject.getProjectDir().toPath(); project .getRootProject() .getProjectDir() .toPath() .relativize(project.getProjectDir().toPath()) .toString()) .collect(MoreCollectors.toImmutableSet());
try { return FileUtil.getRelativePath( project.getProjectDir(), found.getSingleFile()); } catch (IllegalStateException ignored) { return null;
schemaFile = Paths.get(schemaFilePath).toFile(); if (!schemaFile.exists()) { schemaFile = Paths.get(task.getProject().getProjectDir().getAbsolutePath(), schemaFilePath).toFile();
"-Xfriend-paths=" + Paths.get("buck-out/gen") .resolve(getProject().getRootProject().relativePath(getProject().getProjectDir())) .resolve(String.format("lib__%s__output", composedTargetName)) .resolve(composedTargetName + ".jar")
private void configureJoobyRun(final Project project) { project.getTasks() .withType(JoobyTask.class, joobyRun -> { ConventionMapping mapping = joobyRun.getConventionMapping(); mapping.map("classpath", () -> new JoobyProject(project).classpath()); mapping.map("src", () -> new JoobyProject(project).sources()); mapping.map("mainClassName", () -> project.getProperties().get("mainClassName")); mapping.map("srcExtensions", () -> Arrays.asList(".java", ".conf", ".properties", ".kt")); mapping.map("compiler", () -> { File eclipseClasspath = new File(project.getProjectDir(), ".classpath"); return eclipseClasspath.exists() ? "off" : "on"; }); Gradle gradle = project.getGradle(); mapping.map("block", () -> !gradle.getStartParameter().isContinuous()); mapping.map("logLevel", () -> gradle.getStartParameter().getLogLevel().name()); }); Map<String, Object> options = new HashMap<>(); options.put(Task.TASK_TYPE, JoobyTask.class); options.put(Task.TASK_DEPENDS_ON, "classes"); options.put(Task.TASK_NAME, "joobyRun"); options.put(Task.TASK_DESCRIPTION, "Run, debug and hot reload applications"); options.put(Task.TASK_GROUP, "jooby"); project.getTasks().create(options); }
@TaskAction public void process() throws Throwable { Project project = getProject(); JoobyProject joobyProject = new JoobyProject(project); String mainClass = getMainClassName(); try (URLClassLoader loader = joobyProject.newClassLoader()) { getLogger().debug("Using classloader " + loader); Path srcdir = project.getProjectDir().toPath(); Path bindir = joobyProject.classes().toPath(); Path output = new ApiParser(srcdir) .with(loader) .export(bindir, mainClass); getLogger().info("API file: " + output); } }
FileUtil.getRelativePath(project.getRootProject().getProjectDir(), configFile); ProjectUtil.getPlugin(project.getRootProject()).exportedPaths.add(relativeConfigPath);
external.add(externalDependency); } else { String rootProjectPath = project.getRootProject().getProjectDir().getAbsolutePath(); String artifactPath = artifact.getFile().getAbsolutePath(); + "outside the project can cause hard to reproduce builds" + ". Please move dependency: %s inside %s", artifact.getFile(), project.getRootProject().getProjectDir()));
@Nullable private Keystore extractKeystore() { SigningConfig mergedConfig = getBaseVariant().getMergedFlavor().getSigningConfig(); SigningConfig config = mergedConfig != null ? mergedConfig : getBaseVariant().getBuildType().getSigningConfig(); if (config != null) { String keystoreFilePath = FileUtil.getRelativePath(getRootProject().getProjectDir(), config.getStoreFile()); ProjectUtil.getPlugin(getProject()).exportedPaths.add(keystoreFilePath); return Keystore.create( keystoreFilePath, config.getStorePassword(), config.getKeyAlias(), config.getKeyPassword()); } return null; }
lintConfigPath = FileUtil.getRelativePath( target.getRootProject().getProjectDir(), target.getLintOptions().getLintConfig()); ProjectUtil.getPlugin(target.getRootProject()).exportedPaths.add(lintConfigPath); } else {
public FormatterStep createStep() { final Project project = getProject(); return TsFmtFormatterStep.create( GradleProvisioner.fromProject(project), project.getBuildDir(), npmFileOrNull(), project.getProjectDir(), typedConfigFile(), config); }
/** Sets up a format task according to the values in this extension. */ protected void setupTask(SpotlessTask task) { task.setPaddedCell(paddedCell); task.setEncoding(getEncoding().name()); task.setExceptionPolicy(exceptionPolicy); task.setTarget(target); task.setSteps(steps); task.setLineEndingsPolicy(getLineEndings().createPolicy(getProject().getProjectDir(), () -> task.target)); }
File dir = getProject().getProjectDir(); List<String> excludes = new ArrayList<>();
private File getBuildCacheDir(Project rootProject) { if (projectCacheDir != null) { return projectCacheDir; } return new File(rootProject.getProjectDir(), ".gradle"); } }
private void configureAppPlugin() { final ApplicationPluginConvention convention = this.project.getConvention().findPlugin( ApplicationPluginConvention.class ); convention.setMainClassName( "io.purplejs.boot.MainApp" ); final JavaExec runTask = (JavaExec) this.project.getTasks().getByName( ApplicationPlugin.TASK_RUN_NAME ); runTask.systemProperty( "io.purplejs.runMode", "dev" ); final String devDirs = new File( this.project.getProjectDir(), "src/main/resources" ).getAbsolutePath(); runTask.systemProperty( "io.purplejs.devSourceDirs", devDirs ); } }
public DefaultPythonDetails(Project project, File venvDir) { this.project = project; activateLink = new File(project.getProjectDir(), OperatingSystem.current().getScriptName("activate")); virtualEnvPrompt = String.format("(%s)", project.getName()); searchPath = OperatingSystem.current().getPath(); venvOverride = venvDir; this.virtualEnvironment = new DefaultVirtualEnvironment(this); pythonDefaultVersions = new PythonDefaultVersions(); }