private void configureJoobyAssets(final Project project) { project.getTasks() .withType(AssetTask.class, task -> { ConventionMapping mapping = task.getConventionMapping(); mapping.map("env", () -> "dist"); mapping.map("maxAge", () -> "365d"); mapping.map("mainClassName", () -> project.getProperties().get("mainClassName")); mapping.map("output", () -> new JoobyProject(project).classes()); mapping.map("assemblyOutput", () -> new File(project.getBuildDir(), "__public_")); }); Map<String, Object> options = new HashMap<>(); options.put(Task.TASK_TYPE, AssetTask.class); options.put(Task.TASK_DEPENDS_ON, "classes"); options.put(Task.TASK_NAME, "joobyAssets"); options.put(Task.TASK_DESCRIPTION, "Process, optimize and compress static files"); options.put(Task.TASK_GROUP, "jooby"); project.getTasks().create(options); }
File destinationDir = new File(project.getBuildDir(), taskName); destinationDir.mkdirs(); File pathingJarPath = new File(destinationDir, project.getName() + "-pathing.jar");
/** * Returns the locally install apollo-codegen version as found in the package.json file. * * @return null if build/apollo-codegen/node_modules/apollo-codegen/package.json wasn't found, version otherwise */ private String getApolloVersion() { File packageFile = new File(getProject().getBuildDir(), INSTALL_DIR + "/package.json"); if (!packageFile.isFile()) { return null; } Moshi moshi = new Moshi.Builder().build(); JsonAdapter<PackageJson> adapter = moshi.adapter(PackageJson.class); try { PackageJson packageJson = adapter.fromJson(Okio.buffer(Okio.source(packageFile))); return packageJson.version; } catch (IOException e) { e.printStackTrace(); return null; } } private boolean isSameApolloCodegenVersion(String packageVersion) {
public ApolloCodegenInstallTask() { // TODO: set to const when ApolloPlugin is in java setGroup("apollo"); setDescription("Runs npm install for apollo-codegen"); installDir = getProject().file(getProject().getBuildDir() + File.separator + INSTALL_DIR); File workingDir = new File(getProject().getBuildDir(), "apollo-codegen"); setWorkingDir(workingDir); apolloPackageFile = getProject().file(workingDir + File.separator + "package.json"); final boolean isSameCodegenVersion = isSameApolloCodegenVersion(getApolloVersion()); if (!isSameCodegenVersion) { Utils.deleteDirectory(installDir); } getOutputs().upToDateWhen(new Spec<Task>() { public boolean isSatisfiedBy(Task element) { return apolloPackageFile.isFile() && isSameCodegenVersion; } }); }
private File getCacheFile() { return new File(getProject().getBuildDir(), getName()); }
private static File diagnoseDir(SpotlessTask task) { return new File(task.getProject().getBuildDir(), "spotless-diagnose-" + task.formatName()); }
FormatterStep createStep() { final Project project = getProject(); return PrettierFormatterStep.create( GradleProvisioner.fromProject(project), project.getBuildDir(), npmFileOrNull(), new com.diffplug.spotless.npm.PrettierConfig( this.prettierConfigFile != null ? project.file(this.prettierConfigFile) : null, this.prettierConfig)); } }
public FormatterStep createStep() { final Project project = getProject(); return TsFmtFormatterStep.create( GradleProvisioner.fromProject(project), project.getBuildDir(), npmFileOrNull(), project.getProjectDir(), typedConfigFile(), config); }
relativizeIfSubdir(excludes, dir, getProject().getBuildDir()); for (Project subproject : getProject().getSubprojects()) { relativizeIfSubdir(excludes, dir, subproject.getBuildDir());
@Override public File getVirtualEnv() { if (venvOverride == null) { return new File(project.getBuildDir(), "venv"); } else { return venvOverride; } }
/** * Creates a new download action * @param project the project to be built */ public DownloadAction(Project project) { this.project = project; this.downloadTaskDir = new File(project.getBuildDir(), "download-task"); }
public DeployableExtension(Project project) { deployableBuildDir = new File(project.getBuildDir(), "deployable"); deployableBinDir = new File(deployableBuildDir, "bin"); deployableEtcDir = new File(deployableBuildDir, "etc"); }
@Override public File call() throws Exception { String reportsDir = extension.getReportDir(); if (reportsDir == null) { return new File(new File(project.getBuildDir(), FD_REPORTS), FD_ANDROID_TESTS); } else { return project.file(reportsDir); } } });
@OutputDirectory public File getOutputDir() { return new File( getProject().getBuildDir(), "webjars" ); }
public AppExtension( final Project project ) { this.project = project; this.instructions = new HashMap<>(); this.devSourcePaths = new ArrayList<>(); addDevSourcePath( this.project.getProjectDir(), "src", "main", "resources" ); addDevSourcePath( this.project.getBuildDir(), "resources", "main" ); this.rawDevSourcePaths = new ArrayList<>(); this.systemApp = false; this.capabilities = new HashSet<>(); }
@Override @Nullable public File getCacheDir(boolean create) { File dir = new File(gradleProject.getRootProject().getBuildDir(), FD_INTERMEDIATES + separator + "lint-cache"); //$NON-NLS-1$ if (dir.exists() || create && dir.mkdirs()) { return dir; } return super.getCacheDir(create); }
private File resolveHomeDir() { final File file = this.homeDir.getOrNull(); return file != null ? file : getProject().getBuildDir(); }
public TransformationTask() { // empty classpath this.classpath = this.getProject().files(); this.destinationDir = Paths.get(this.getProject().getBuildDir().toString(), "transformations", this.getName()).toFile(); }
@OutputFile public File getSourceDigestFile() { Project project = getProject(); String pathname = "npm/" + getNpmCommand() + "/" + getName() + "/.digest"; return new File(project.getBuildDir(), pathname); }
@TaskAction public void cloneRepository() { if (!isTargetEmpty()) { LOG.lifecycle("{} - target directory already exists and is not empty. Skipping execution of the task. Exists: {}", getPath(), targetDir); return; } LOG.lifecycle(" Cloning repository {}\n into {}", repositoryUrl, targetDir); getProject().getBuildDir().mkdirs(); // build dir can be not created yet ProcessRunner processRunner = Exec.getProcessRunner(getProject().getBuildDir()); processRunner.run(getCloneCommand()); }