Java 类org.gradle.api.Project 实例源码

项目:crnk-framework    文件:TSGeneratorTest.java   
@Before
public void setup() {
    Project project = Mockito.mock(Project.class);
    TSGeneratorExtension config = new TSGeneratorExtension(project, null);
    File outputDir = testProjectDir.getRoot();

    MetaModuleConfig metaConfig = new MetaModuleConfig();
    metaConfig.addMetaProvider(new ResourceMetaProvider());
    MetaModule metaModule = MetaModule.createServerModule(metaConfig);

    CrnkBoot boot = new CrnkBoot();
    boot.setServiceDiscovery(new EmptyServiceDiscovery());
    boot.addModule(metaModule);
    boot.boot();

    generator = new TSGenerator(outputDir, metaModule.getLookup(), config);
}
项目:Reer    文件:DefaultProject.java   
public Set<Task> getTasksByName(final String name, boolean recursive) {
    if (!isTrue(name)) {
        throw new InvalidUserDataException("Name is not specified!");
    }
    final Set<Task> foundTasks = new HashSet<Task>();
    Action<Project> action = new Action<Project>() {
        public void execute(Project project) {
            // Don't force evaluation of rules here, let the task container do what it needs to
            ((ProjectInternal) project).evaluate();

            Task task = project.getTasks().findByName(name);
            if (task != null) {
                foundTasks.add(task);
            }
        }
    };
    if (recursive) {
        allprojects(action);
    } else {
        action.execute(this);
    }
    return foundTasks;
}
项目:atlas    文件:ApDependencies.java   
private File getBaseApFile(Project project, TBuildType tBuildType) {
    File apBaseFile;
    File buildTypeBaseApFile = tBuildType.getBaseApFile();
    if (null != buildTypeBaseApFile && buildTypeBaseApFile.exists()) {
        apBaseFile = buildTypeBaseApFile;
    } else if (!isNullOrEmpty(tBuildType.getBaseApDependency())) {
        String apDependency = tBuildType.getBaseApDependency();
        // Preconditions.checkNotNull(apDependency,
        //                            "You have to specify the baseApFile property or the baseApDependency
        // dependency");
        Dependency dependency = project.getDependencies().create(apDependency);
        Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
        configuration.setTransitive(false);
        apBaseFile = Iterables.getOnlyElement(Collections2.filter(configuration.getFiles(), new Predicate<File>() {
            @Override
            public boolean apply(@Nullable File file) {
                return file.getName().endsWith(".ap");
            }
        }));
    } else {
        throw new IllegalStateException("AP is missing");
    }
    return apBaseFile;
}
项目:Reer    文件:IdeaPlugin.java   
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates IDEA project files (IML, IPR, IWS)");
    getCleanTask().setDescription("Cleans IDEA project files (IML, IPR)");

    ideaModel = project.getExtensions().create("idea", IdeaModel.class);

    configureIdeaWorkspace(project);
    configureIdeaProject(project);
    configureIdeaModule(project);
    configureForJavaPlugin(project);
    configureForScalaPlugin();
    postProcess("idea", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });
}
项目:Reer    文件:TaskPathResolver.java   
/**
 * @param path the task path, e.g. 'someTask', 'sT', ':sT', ':foo:bar:sT'
 * @param startFrom the starting project the task should be found recursively
 * @return resolved task path
 */
public ResolvedTaskPath resolvePath(String path, ProjectInternal startFrom) {
    ProjectInternal project;
    String taskName; //eg. 'someTask' or 'sT'
    String prefix; //eg. '', ':' or ':foo:bar'

    if (path.contains(Project.PATH_SEPARATOR)) {
        int idx = path.lastIndexOf(Project.PATH_SEPARATOR);
        taskName = path.substring(idx + 1);
        prefix = path.substring(0, idx+1);
        String projectPath = Project.PATH_SEPARATOR.equals(prefix) ? prefix : path.substring(0, idx);
        project = projectFinder.findProject(projectPath, startFrom);
    } else {
        project = startFrom;
        taskName = path;
        prefix = "";
    }
    return new ResolvedTaskPath(prefix, taskName, project);
}
项目:Reer    文件:EarPlugin.java   
private void wireEarTaskConventions(Project project, final EarPluginConvention earConvention) {
    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getConventionMapping().map("libDirName", new Callable<String>() {
                public String call() throws Exception {
                    return earConvention.getLibDirName();
                }
            });
            task.getConventionMapping().map("deploymentDescriptor", new Callable<DeploymentDescriptor>() {
                public DeploymentDescriptor call() throws Exception {
                    return earConvention.getDeploymentDescriptor();
                }
            });
        }
    });
}
项目:Reer    文件:DefaultCacheScopeMapping.java   
public File getBaseDirectory(Object scope, String key, VersionStrategy versionStrategy) {
    if (key.equalsIgnoreCase("projects") || key.equalsIgnoreCase("tasks") || !key.matches("\\p{Alpha}+[-//.\\w]*")) {
        throw new IllegalArgumentException(String.format("Unsupported cache key '%s'.", key));
    }
    File cacheRootDir = getRootDirectory(scope);
    String subDir = key;
    if (scope instanceof Project) {
        Project project = (Project) scope;
        subDir = "projects/" + project.getPath().replace(':', '_') + "/" + key;
    }
    if (scope instanceof Task) {
        Task task = (Task) scope;
        subDir = "tasks/" + task.getPath().replace(':', '_') + "/" + key;
    }
    return getCacheDir(cacheRootDir, versionStrategy, subDir);
}
项目:Reer    文件:BuildEnvironmentReportTask.java   
@TaskAction
public void generate() {
    ProjectReportGenerator projectReportGenerator = new ProjectReportGenerator() {
        @Override
        public void generateReport(Project project) throws IOException {
            Configuration configuration = getProject().getBuildscript().getConfigurations().getByName(ScriptHandler.CLASSPATH_CONFIGURATION);
            renderer.startConfiguration(configuration);
            renderer.render(configuration);
            renderer.completeConfiguration(configuration);
        }
    };

    ReportGenerator reportGenerator = new ReportGenerator(renderer, getClientMetaData(), null,
        getTextOutputFactory(), projectReportGenerator);
    reportGenerator.generateReport(Collections.singleton(getProject()));
}
项目:Reer    文件:JavaBasePlugin.java   
private void configureTestDefaults(final Test test, Project project, final JavaPluginConvention convention) {
    DslObject htmlReport = new DslObject(test.getReports().getHtml());
    DslObject xmlReport = new DslObject(test.getReports().getJunitXml());

    xmlReport.getConventionMapping().map("destination", new Callable<Object>() {
        public Object call() throws Exception {
            return new File(convention.getTestResultsDir(), test.getName());
        }
    });
    htmlReport.getConventionMapping().map("destination", new Callable<Object>() {
        public Object call() throws Exception {
            return new File(convention.getTestReportDir(), test.getName());
        }
    });
    test.getConventionMapping().map("binResultsDir", new Callable<Object>() {
        public Object call() throws Exception {
            return new File(convention.getTestResultsDir(), test.getName() + "/binary");
        }
    });
    test.workingDir(project.getProjectDir());
}
项目:Reer    文件:JavaPlugin.java   
private void configureSourceSets(final JavaPluginConvention pluginConvention) {
    final Project project = pluginConvention.getProject();

    SourceSet main = pluginConvention.getSourceSets().create(SourceSet.MAIN_SOURCE_SET_NAME);

    SourceSet test = pluginConvention.getSourceSets().create(SourceSet.TEST_SOURCE_SET_NAME);
    test.setCompileClasspath(project.files(main.getOutput(), project.getConfigurations().getByName(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME)));
    test.setRuntimeClasspath(project.files(test.getOutput(), main.getOutput(), project.getConfigurations().getByName(TEST_RUNTIME_CONFIGURATION_NAME)));
}
项目:atlas    文件:ZipAlignUtils.java   
public static synchronized File doZipAlign(final AndroidBuilder androidBuilder, Project project, final File apkFile) {

        final File zipalignedFile = new File(apkFile.getParent(), apkFile.getName().replace(".apk", "-zipaligned.apk"));

        project.exec(new Action<ExecSpec>() {
            @Override
            public void execute(ExecSpec execSpec) {

                String path = androidBuilder.getTargetInfo()
                        .getBuildTools().getPath(ZIP_ALIGN);
                execSpec.executable(new File(path));
                execSpec.args("-f", "4");
                execSpec.args(apkFile);
                execSpec.args(zipalignedFile);
            }
        });

        return zipalignedFile;
    }
项目:Reer    文件:CompareGradleBuildsPlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(ReportingBasePlugin.class);
    final ReportingExtension reportingExtension = project.getExtensions().findByType(ReportingExtension.class);

    project.getTasks().withType(CompareGradleBuilds.class, new Action<CompareGradleBuilds>() {
        @Override
        public void execute(final CompareGradleBuilds task) {
            ((IConventionAware) task).getConventionMapping().map("reportDir", new Callable<File>() {
                @Override
                public File call() throws Exception {
                    return reportingExtension.file(task.getName());
                }
            });
        }
    });

    project.getTasks().create("compareGradleBuilds", CompareGradleBuilds.class);
}
项目:Reer    文件:EclipsePlugin.java   
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates all Eclipse files.");
    getCleanTask().setDescription("Cleans all Eclipse files.");

    EclipseModel model = project.getExtensions().create("eclipse", EclipseModel.class);

    configureEclipseProject(project, model);
    configureEclipseJdt(project, model);
    configureEclipseClasspath(project, model);

    postProcess("eclipse", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });

    applyEclipseWtpPluginOnWebProjects(project);
}
项目:Reer    文件:DependentComponentsReport.java   
@TaskAction
public void report() {
     // Output reports per execution, not mixed.
     // Cross-project ModelRegistry operations do not happen concurrently.
    synchronized (DependentComponentsReport.class) {
        Project project = getProject();
        ModelRegistry modelRegistry = getModelRegistry();
        DependentBinariesResolver dependentBinariesResolver = modelRegistry.find("dependentBinariesResolver", DependentBinariesResolver.class);

        StyledTextOutput textOutput = getTextOutputFactory().create(DependentComponentsReport.class);
        TextDependentComponentsReportRenderer reportRenderer = new TextDependentComponentsReportRenderer(dependentBinariesResolver, showNonBuildable, showTestSuites);

        reportRenderer.setOutput(textOutput);
        reportRenderer.startProject(project);

        Set<ComponentSpec> allComponents = getAllComponents(modelRegistry);
        if (showTestSuites) {
            allComponents.addAll(getAllTestSuites(modelRegistry));
        }
        reportRenderer.renderComponents(getReportedComponents(allComponents));
        reportRenderer.renderLegend();

        reportRenderer.completeProject(project);
        reportRenderer.complete();
    }
}
项目:Reer    文件:HtmlDependencyReporter.java   
@Override
public void render(final Set<Project> projects, File outputDirectory) {
    this.outputDirectory = outputDirectory;

    HtmlReportRenderer renderer = new HtmlReportRenderer();
    renderer.render(projects, new ReportRenderer<Set<Project>, HtmlReportBuilder>() {
        @Override
        public void render(Set<Project> model, HtmlReportBuilder builder) {
            Transformer<String, Project> htmlPageScheme = projectNamingScheme("html");
            Transformer<String, Project> jsScheme = projectNamingScheme("js");
            ProjectPageRenderer projectPageRenderer = new ProjectPageRenderer(jsScheme);
            builder.renderRawHtmlPage("index.html", projects, new ProjectsPageRenderer(htmlPageScheme));
            for (Project project : projects) {
                String jsFileName = jsScheme.transform(project);
                generateJsFile(project, jsFileName);
                String htmlFileName = htmlPageScheme.transform(project);
                builder.renderRawHtmlPage(htmlFileName, project, projectPageRenderer);
            }

        }

    }, outputDirectory);
}
项目:gradle-circle-style    文件:CircleStylePlugin.java   
@Override
public void apply(Project rootProject) {
    final String circleReportsDir = System.getenv("CIRCLE_TEST_REPORTS");
    if (circleReportsDir == null) {
        return;
    }

    configureBuildFailureFinalizer(rootProject, circleReportsDir);

    final StyleTaskTimer timer = new StyleTaskTimer();
    rootProject.getGradle().addListener(timer);

    rootProject.allprojects(new Action<Project>() {
        @Override
        public void execute(final Project project) {
            project.getTasks().withType(Checkstyle.class, new Action<Checkstyle>() {
                @Override
                public void execute(Checkstyle checkstyleTask) {
                    configureCheckstyleTask(project, checkstyleTask, circleReportsDir, timer);
                }
            });
            project.getTasks().withType(FindBugs.class, new Action<FindBugs>() {
                @Override
                public void execute(FindBugs findbugsTask) {
                    configureFindbugsTask(project, findbugsTask, circleReportsDir, timer);
                }
            });
        }
    });
}
项目:gradle-java-modules    文件:JigsawPlugin.java   
private void configureCompileJavaTask(final Project project) {
    final JavaCompile compileJava = (JavaCompile) project.getTasks().findByName(JavaPlugin.COMPILE_JAVA_TASK_NAME);
    compileJava.doFirst(new Action<Task>() {
        @Override
        public void execute(Task task) {
            List<String> args = new ArrayList<>();
            args.add("--module-path");
            args.add(compileJava.getClasspath().getAsPath());
            compileJava.getOptions().setCompilerArgs(args);
            compileJava.setClasspath(project.files());
        }
    });
}
项目:atlas    文件:AddLocalJarTask.java   
private boolean isLocalJarEnabled(Project project) {
    boolean localJarEnabled = AtlasBuildContext.sBuilderAdapter.localJarEnabled;
    if (project.hasProperty("localJarEnabled")) {
        localJarEnabled = "true".equals(project.property("localJarEnabled"));
    }
    return localJarEnabled;
}
项目:Reer    文件:IdeaPlugin.java   
private static boolean includeModuleLanguageLevelOverride(Project rootProject, IdeaLanguageLevel moduleLanguageLevel) {
    if (!rootProject.getPlugins().hasPlugin(IdeaPlugin.class)) {
        return true;
    }

    IdeaProject ideaProject = ideaModelFor(rootProject).getProject();
    return !moduleLanguageLevel.equals(ideaProject.getLanguageLevel());
}
项目:Reer    文件:IdeaModelBuilder.java   
private void applyIdeaPlugin(Project root) {
    Set<Project> allProjects = root.getAllprojects();
    for (Project p : allProjects) {
        p.getPluginManager().apply(IdeaPlugin.class);
    }
    ideaPluginFor(root).performPostEvaluationActions();
}
项目:Reer    文件:JavaPlugin.java   
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
项目:placeholders-plugin    文件:LegacyPlaceholderTaskApplicator.java   
LegacyPlaceholderTaskApplicator(Project project) throws Exception {
    super(project);

    method_getOutputs = ApplicationVariant.class.getMethod("getOutputs");
    method_getOutputs.setAccessible(true);

    method_setResDir = ProcessAndroidResources.class.getMethod("setResDir", File.class);
    method_setResDir.setAccessible(true);
}
项目:gradle-site-plugin    文件:SitePlugin.java   
private ProjectDescriptor deriveProjectDescription(Project project) {
    ProjectDescriptor projectDescriptor = new ProjectDescriptor(project.getName(), project.getGroup().toString(), project.getDescription(), project.getVersion().toString(), new EnvironmentDescriptor(project.getGradle().getGradleVersion()));
    addPluginDescription(project, projectDescriptor);
    addTasksDescription(project, projectDescriptor);
    addJavaDescription(project, projectDescriptor);
    return projectDescriptor;
}
项目:Reer    文件:ComponentReport.java   
@TaskAction
public void report() {
    Project project = getProject();

    StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
    ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
    renderer.setOutput(textOutput);

    renderer.startProject(project);

    Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
    ComponentSpecContainer componentSpecs = modelElement("components", ComponentSpecContainer.class);
    if (componentSpecs != null) {
        components.addAll(componentSpecs.values());
    }

    ModelMap<ComponentSpec> testSuites = modelElement("testSuites", modelMap(ComponentSpec.class));
    if (testSuites != null) {
        components.addAll(testSuites.values());
    }

    renderer.renderComponents(components);

    ProjectSourceSet sourceSets = modelElement("sources", ProjectSourceSet.class);
    if (sourceSets != null) {
        renderer.renderSourceSets(sourceSets);
    }
    BinaryContainer binaries = modelElement("binaries", BinaryContainer.class);
    if (binaries != null) {
        renderer.renderBinaries(binaries.values());
    }

    renderer.completeProject(project);
    renderer.complete();
}
项目:jpa2ddl    文件:GeneratePlugin.java   
private void fillDefaults(Project project, GeneratePluginExtension generatePluginExtension) {
    if (!generatePluginExtension.getPackagesProvider().isPresent()) {
        throw new IllegalArgumentException("JPA2DDL: No packages property found - it must point to model packages");
    }
    if (!generatePluginExtension.getActionProvider().isPresent()) {
        generatePluginExtension.setAction(Action.CREATE);
    }
    if (!generatePluginExtension.getGenerationModeProvider().isPresent()) {
        generatePluginExtension.setGenerationMode(GenerationMode.DATABASE);
    }
    if (!generatePluginExtension.getDelimiterProvider().isPresent()) {
        generatePluginExtension.setDelimiter(";");
    }
    if (!generatePluginExtension.getFormatOutputProvider().isPresent()) {
        generatePluginExtension.setFormatOutput(true);
    }
    if (!generatePluginExtension.getSkipSequencesProvider().isPresent()) {
        generatePluginExtension.setSkipSequences(false);
    }
    if (!generatePluginExtension.getJpaPropertiesProvider().isPresent()) {
        generatePluginExtension.setJpaProperties(new Properties());
    }
    if (!generatePluginExtension.getOutputPathProvider().isPresent()) {
        String filePath = generatePluginExtension.getAction() == Action.UPDATE ? "scripts/" : "scripts/database.sql";
        generatePluginExtension.setOutputPath(project.getBuildDir().toPath().resolve("generated-resources/main/" + filePath).toFile());
    }
}
项目:Reer    文件:EclipsePlugin.java   
private static void registerEclipseArtifacts(Project project) {
    ProjectLocalComponentProvider projectComponentProvider = ((ProjectInternal) project).getServices().get(ProjectLocalComponentProvider.class);
    ProjectComponentIdentifier projectId = newProjectId(project);
    String projectName = project.getExtensions().getByType(EclipseModel.class).getProject().getName();
    projectComponentProvider.registerAdditionalArtifact(projectId, createArtifact("project", projectId, projectName, project));
    projectComponentProvider.registerAdditionalArtifact(projectId, createArtifact("classpath", projectId, projectName, project));
}
项目:Reer    文件:HtmlDependencyReporter.java   
private String toFileName(Project project, String extension) {
    String name = project.getPath();
    if (name.equals(":")) {
        return "root" + extension;
    }

    return "root" + name.replace(":", ".") + extension;
}
项目:Reer    文件:IdeaPlugin.java   
private JavaVersion getMaxJavaModuleCompatibilityVersionFor(Function<Project, JavaVersion> toJavaVersion) {
    List<Project> allJavaProjects = getAllJavaProjects();
    if (allJavaProjects.isEmpty()) {
        return JavaVersion.VERSION_1_6;
    } else {
        return Collections.max(Lists.transform(allJavaProjects, toJavaVersion));
    }
}
项目:Reer    文件:JavaBasePlugin.java   
private void createBinaryLifecycleTask(SourceSet sourceSet, Project target) {
    sourceSet.compiledBy(sourceSet.getClassesTaskName());

    Task binaryLifecycleTask = target.task(sourceSet.getClassesTaskName());
    binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
    binaryLifecycleTask.setDescription("Assembles " + sourceSet.getOutput() + ".");
    binaryLifecycleTask.dependsOn(sourceSet.getOutput().getDirs());
    binaryLifecycleTask.dependsOn(sourceSet.getCompileJavaTaskName());
    binaryLifecycleTask.dependsOn(sourceSet.getProcessResourcesTaskName());
}
项目:Reer    文件:SelectedTaskExecutionAction.java   
@Override
public void graphPopulated(TaskExecutionGraph graph) {
    Set<Project> seen = Sets.newHashSet();
    for (Task task : graph.getAllTasks()) {
        if (seen.add(task.getProject())) {
            ProjectInternal projectInternal = (ProjectInternal) task.getProject();
            projectInternal.bindAllModelRules();
        }
    }
}
项目:Reer    文件:BuildEnvironmentBuilder.java   
@Override
public Object buildAll(String modelName, Project target) {
    File gradleUserHomeDir = target.getGradle().getGradleUserHomeDir();
    String gradleVersion = target.getGradle().getGradleVersion();

    CurrentProcess currentProcess = new CurrentProcess();
    File javaHome = currentProcess.getJvm().getJavaHome();
    List<String> jvmArgs = currentProcess.getJvmOptions().getAllImmutableJvmArgs();

    DefaultBuildIdentifier buildIdentifier = new DefaultBuildIdentifier(target.getRootDir());

    return new DefaultBuildEnvironment(buildIdentifier, gradleUserHomeDir, gradleVersion, javaHome, jvmArgs);
}
项目:Reer    文件:UploadRule.java   
private Upload createUploadTask(String name, final Configuration configuration, final Project project) {
    Upload upload = project.getTasks().create(name, Upload.class);
    upload.setDescription("Uploads all artifacts belonging to " + configuration);
    upload.setGroup(BasePlugin.UPLOAD_GROUP);
    upload.setConfiguration(configuration);
    upload.setUploadDescriptor(true);
    upload.getConventionMapping().map("descriptorDestination", new Callable<File>() {
        public File call() throws Exception {
            return new File(project.getBuildDir(), "ivy.xml");
        }
    });
    return upload;
}
项目:Reer    文件:EclipseNameDeduper.java   
public void configureRoot(Project rootProject) {
    Set<Project> projects = Sets.filter(rootProject.getAllprojects(), HAS_ECLIPSE_PLUGIN);
    ImmutableMap<EclipseProject, Project> eclipseProjects = Maps.uniqueIndex(projects, GET_ECLIPSE_PROJECT);
    HierarchicalElementDeduplicator<EclipseProject> deduplicator = new HierarchicalElementDeduplicator<EclipseProject>(new EclipseDeduplicationAdapter(eclipseProjects));
    Map<EclipseProject, String> deduplicated = deduplicator.deduplicate(eclipseProjects.keySet());
    for (Map.Entry<EclipseProject, String> entry : deduplicated.entrySet()) {
        entry.getKey().setName(entry.getValue());
    }
}
项目:Reer    文件:SigningExtension.java   
/**
 * Configures the signing settings for the given project.
 */
public SigningExtension(Project project) {
    this.project = project;
    this.configuration = getDefaultConfiguration();
    this.signatureTypes = createSignatureTypeProvider();
    this.signatories = createSignatoryProvider();
    project.getTasks().withType(Sign.class, new Action<Sign>() {
        @Override
        public void execute(Sign task) {
            addSignatureSpecConventions(task);
        }
    });
}
项目:Reer    文件:ProfileEventAdapter.java   
public void afterExecute(Task task, TaskState state) {
    long now = timeProvider.getCurrentTime();
    Project project = task.getProject();
    ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
    TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath());
    taskExecution.setFinish(now);
    taskExecution.completed(state);
}
项目:Reer    文件:RhinoPlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(JavaScriptBasePlugin.class);

    JavaScriptExtension jsExtension = project.getExtensions().findByType(JavaScriptExtension.class);
    final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().create(RhinoExtension.NAME, RhinoExtension.class);

    final Configuration configuration = addClasspathConfiguration(project.getConfigurations());
    configureDefaultRhinoDependency(configuration, project.getDependencies(), rhinoExtension);

    ConventionMapping conventionMapping = ((IConventionAware) rhinoExtension).getConventionMapping();
    conventionMapping.map("classpath", new Callable<Configuration>() {
        public Configuration call() {
            return configuration;
        }
    });
    conventionMapping.map("version", new Callable<String>() {
        public String call() {
            return RhinoExtension.DEFAULT_RHINO_DEPENDENCY_VERSION;
        }
    });

    project.getTasks().withType(RhinoShellExec.class, new Action<RhinoShellExec>() {
        public void execute(RhinoShellExec task) {
            task.getConventionMapping().map("classpath", new Callable<FileCollection>() {
                public FileCollection call() {
                    return rhinoExtension.getClasspath();
                }
            });
            task.getConventionMapping().map("main", new Callable<String>() {
                public String call() {
                    return RhinoExtension.RHINO_SHELL_MAIN;
                }
            });
            task.setClasspath(rhinoExtension.getClasspath());
        }
    });
}
项目:Reer    文件:ScalaBasePlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(JavaBasePlugin.class);

    configureConfigurations(project);
    ScalaRuntime scalaRuntime = configureScalaRuntimeExtension(project);
    configureCompileDefaults(project, scalaRuntime);
    configureSourceSetDefaults(project, sourceDirectorySetFactory);
    configureScaladoc(project, scalaRuntime);
}
项目:Reer    文件:IdeaNameDeduper.java   
@Override
public IdeaModule getParent(IdeaModule element) {
    Project parent = element.getProject().getParent();
    if (parent == null) {
        return null;
    } else {
        return hasIdeaPlugin(parent) ? getModule(parent) : null;
    }
}
项目:curiostack    文件:ClusterPlugin.java   
@Override
public void apply(Project project) {
  project.getExtensions().create(ImmutableClusterExtension.NAME, ClusterExtension.class, project);

  project.afterEvaluate(
      ignored -> {
        ImmutableClusterExtension config =
            project.getExtensions().getByType(ClusterExtension.class);

        if (config.namespace() != null) {
          addNamespaceTasks(project);
        }
      });
}
项目:Reer    文件:HelloPlugin.java   
public void apply(Project project) {
  Task hello = project.getTasks().create("hello");
  hello.doLast(new Action<Task>() {
    @Override
    public void execute(Task task) {
      task.getLogger().lifecycle("Hello!");
    }
  });
}