Java 类org.gradle.api.internal.project.ProjectIdentifier 实例源码

项目:Reer    文件:PlayApplicationPlugin.java   
@Mutate
void createPlayRunTask(ModelMap<Task> tasks, @Path("binaries") ModelMap<PlayApplicationBinarySpecInternal> playBinaries, final ServiceRegistry serviceRegistry, final PlayPluginConfigurations configurations, ProjectIdentifier projectIdentifier, final PlayToolChainInternal playToolChain) {

    for (final PlayApplicationBinarySpecInternal binary : playBinaries) {
        String runTaskName = binary.getTasks().taskName("run");

        tasks.create(runTaskName, PlayRun.class, new Action<PlayRun>() {
            public void execute(PlayRun playRun) {
                playRun.setDescription("Runs the Play application for local development.");
                playRun.setGroup(RUN_GROUP);
                playRun.setHttpPort(DEFAULT_HTTP_PORT);
                playRun.setPlayToolProvider(playToolChain.select(binary.getTargetPlatform()));
                playRun.setApplicationJar(binary.getJarFile());
                playRun.setAssetsJar(binary.getAssetsJarFile());
                playRun.setAssetsDirs(binary.getAssets().getAssetDirs());
                playRun.setRuntimeClasspath(configurations.getPlayRun().getNonChangingArtifacts());
                playRun.setChangingClasspath(configurations.getPlayRun().getChangingArtifacts());
                playRun.dependsOn(binary.getBuildTask());
            }
        });
    }
}
项目:gradle-project-config    文件:ProjectConfigPlugin.java   
/**
 * Create debug tasks
 *
 * @param tasks Task container to create new tasks
 * @param config Project configuration
 * @param project Current project identifier
 */
@Mutate
public void createDebugTasks(ModelMap<Task> tasks, ProjectConfig config, ProjectIdentifier project) {
    // Create debug task to dump dependencies
    if (config.isEnableDebugTasks()) {
        tasks.create("debugDependencies", Task.class, tt -> {
            tt.doLast(t -> {
                PrintStream out = System.out;
                out.print("Project: ");
                out.println(project.getName());

                for (Configuration configuration : t.getProject().getConfigurations()) {
                    out.print("  Configuration: ");
                    out.println(configuration.getName());

                    for (Dependency dependency : configuration.getDependencies()) {
                        out.print("    Dependency: ");
                        out.println(formatDependency(dependency));
                    }
                }
            });
        });
    }
}
项目:gradle-project-config    文件:EclipseConfigPlugin.java   
/**
 * Initialize the Eclipse configuration
 *
 * @param eclipse Eclipse configuration to initialize
 * @param project Current Gradle project
 */
@Defaults
public void initializeEclipseConfig(EclipseConfig eclipse, ProjectIdentifier project) {
    try {
        Map<String, Object> context = new HashMap<>();
        context.put("project", project);

        @NonNull URL resource = Validate
                .notNull(Resources.getResource(EclipseConfigPlugin.class, "codetemplates.xml"));
        String templateText = Resources.toString(resource, Charsets.UTF_8);
        TemplateEngine engine = new SimpleTemplateEngine();

        String templates = engine.createTemplate(templateText).make(context).toString();

        eclipse.getUi().setCodeTemplates(templates);
    }
    catch (Exception e) {
        throw new RuntimeException("Could not set code templates", e);
    }
}
项目:Pushjet-Android    文件:AbstractProjectSpec.java   
public <T extends ProjectIdentifier> T selectProject(ProjectRegistry<? extends T> registry) {
    checkPreconditions(registry);
    List<T> matches = new ArrayList<T>();
    for (T project : registry.getAllProjects()) {
        if (select(project)) {
            matches.add(project);
        }
    }
    if (matches.isEmpty()) {
        throw new InvalidUserDataException(formatNoMatchesMessage());
    }
    if (matches.size() != 1) {
        throw new InvalidUserDataException(formatMultipleMatchesMessage(matches));
    }
    return matches.get(0);
}
项目:Reer    文件:ComponentModelBasePlugin.java   
@Finalize
void applyFallbackSourceConventions(@Each LanguageSourceSet languageSourceSet, ProjectIdentifier projectIdentifier) {
    // Only apply default locations when none explicitly configured
    if (languageSourceSet.getSource().getSourceDirectories().isEmpty()) {
        File baseDir = projectIdentifier.getProjectDir();
        String defaultSourceDir = Joiner.on(File.separator).skipNulls().join(baseDir.getPath(), "src", emptyToNull(languageSourceSet.getParentName()), emptyToNull(languageSourceSet.getName()));
        languageSourceSet.getSource().srcDir(defaultSourceDir);
    }
}
项目:Reer    文件:VisualStudioPlugin.java   
@Model
public static VisualStudioExtensionInternal visualStudio(ServiceRegistry serviceRegistry, ProjectIdentifier projectIdentifier) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    ProjectModelResolver projectModelResolver = serviceRegistry.get(ProjectModelResolver.class);
    FileResolver fileResolver = serviceRegistry.get(FileResolver.class);

    return instantiator.newInstance(DefaultVisualStudioExtension.class, projectIdentifier, instantiator, projectModelResolver, fileResolver);
}
项目:Reer    文件:VisualStudioPlugin.java   
@Mutate
public static void includeBuildFileInProject(VisualStudioExtensionInternal visualStudio, final ProjectIdentifier projectIdentifier) {
    visualStudio.getProjects().all(new Action<VisualStudioProject>() {
        public void execute(VisualStudioProject project) {
            if (projectIdentifier.getBuildFile() != null) {
                ((DefaultVisualStudioProject) project).addSourceFile(projectIdentifier.getBuildFile());
            }
        }
    });
}
项目:Reer    文件:PublishingPlugin.java   
@Mutate
void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) {
    for (Publication publication : extension.getPublications()) {
        PublicationInternal internalPublication = (PublicationInternal) publication;
        projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates()));
    }
}
项目:Reer    文件:AbstractProjectSpec.java   
public <T extends ProjectIdentifier> T selectProject(ProjectRegistry<? extends T> registry) {
    checkPreconditions(registry);
    List<T> matches = new ArrayList<T>();
    select(registry, matches);
    if (matches.isEmpty()) {
        throw new InvalidUserDataException(formatNoMatchesMessage());
    }
    if (matches.size() != 1) {
        throw new InvalidUserDataException(formatMultipleMatchesMessage(matches));
    }
    return matches.get(0);
}
项目:Reer    文件:ProjectDirectoryProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getProjectDir().equals(dir)) {
            matches.add(candidate);
        }
    }
}
项目:Reer    文件:DefaultProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getProjectDir().equals(currentDir)) {
            matches.add(candidate);
        }
    }
    if (useRootWhenNoMatch && matches.isEmpty()) {
        matches.add(candidates.getProject(":"));
    }
}
项目:Reer    文件:BuildFileProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getBuildFile().equals(buildFile)) {
            matches.add(candidate);
        }
    }
}
项目:Reer    文件:PlayApplicationPlugin.java   
@ComponentBinaries
void createBinaries(ModelMap<PlayApplicationBinarySpec> binaries, final PlayApplicationSpecInternal componentSpec,
                    final PlatformResolvers platforms, final PlayToolChainInternal playToolChainInternal, final PlayPluginConfigurations configurations,
                    @Path("buildDir") final File buildDir, final ProjectIdentifier projectIdentifier) {

    binaries.create("binary", new Action<PlayApplicationBinarySpec>() {
        public void execute(PlayApplicationBinarySpec playBinary) {
            PlayApplicationBinarySpecInternal playBinaryInternal = (PlayApplicationBinarySpecInternal) playBinary;
            final File binaryBuildDir = new File(buildDir, playBinaryInternal.getProjectScopedName());

            final PlayPlatform chosenPlatform = resolveTargetPlatform(componentSpec, platforms);
            initialiseConfigurations(configurations, chosenPlatform);

            playBinaryInternal.setTargetPlatform(chosenPlatform);
            playBinaryInternal.setToolChain(playToolChainInternal);

            File mainJar = new File(binaryBuildDir, "lib/" + projectIdentifier.getName() + ".jar");
            File assetsJar = new File(binaryBuildDir, "lib/" + projectIdentifier.getName() + "-assets.jar");
            playBinaryInternal.setJarFile(mainJar);
            playBinaryInternal.setAssetsJarFile(assetsJar);

            configurations.getPlay().addArtifact(new DefaultPublishArtifact(projectIdentifier.getName(), "jar", "jar", null, new Date(), mainJar, playBinaryInternal));
            configurations.getPlay().addArtifact(new DefaultPublishArtifact(projectIdentifier.getName(), "jar", "jar", "assets", new Date(), assetsJar, playBinaryInternal));

            JvmAssembly jvmAssembly = ((PlayApplicationBinarySpecInternal) playBinary).getAssembly();
            jvmAssembly.getClassDirectories().add(new File(binaryBuildDir, "classes"));
            jvmAssembly.getResourceDirectories().add(new File(binaryBuildDir, "resources"));

            PublicAssets assets = playBinary.getAssets();
            assets.addAssetDir(new File(projectIdentifier.getProjectDir(), "public"));

            playBinaryInternal.setClasspath(configurations.getPlay().getAllArtifacts());
        }
    });
}
项目:intellij-ce-playground    文件:NdkComponentModelPlugin.java   
@Model(ModelConstants.NDK_HANDLER)
public NdkHandler ndkHandler(
        ProjectIdentifier projectId,
        @Path("android.compileSdkVersion") String compileSdkVersion,
        @Path("android.ndk") NdkConfig ndkConfig) {
    while (projectId.getParentIdentifier() != null) {
        projectId = projectId.getParentIdentifier();
    }

    return new NdkHandler(projectId.getProjectDir(), compileSdkVersion,
            ndkConfig.getToolchain(), ndkConfig.getToolchainVersion());
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
protected RegisterTypeRule(ModelType<? extends T> type, ModelType<? extends U> implementation, ModelRuleDescriptor descriptor, Action<? super RegistrationContext<T, U>> registerAction) {
    this.type = type;
    this.implementation = implementation;
    this.descriptor = descriptor;
    this.registerAction = registerAction;

    subject = ModelReference.of("extensions", ExtensionContainer.class);
    inputs = ImmutableList.<ModelReference<?>>of(ModelReference.of(ProjectIdentifier.class));
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public final void mutate(final ExtensionContainer extensionContainer, final Inputs inputs) {
    RuleContext.inContext(getDescriptor(), new Runnable() {
        public void run() {
            RegistrationContext<T, U> context = new RegistrationContext<T, U>(type, implementation, extensionContainer, inputs.get(0, ModelType.of(ProjectIdentifier.class)).getInstance());
            registerAction.execute(context);
        }
    });
}
项目:Pushjet-Android    文件:ComponentTypeRuleDefinitionHandler.java   
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) {
    componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name);
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name);

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator);

            return created;
        }
    });
}
项目:Pushjet-Android    文件:VisualStudioPlugin.java   
@Mutate
public static void includeBuildFileInProject(VisualStudioExtensionInternal visualStudio, final ProjectIdentifier projectIdentifier) {
    visualStudio.getProjects().all(new Action<VisualStudioProject>() {
        public void execute(VisualStudioProject project) {
            if (projectIdentifier.getBuildFile() != null) {
                ((DefaultVisualStudioProject) project).addSourceFile(projectIdentifier.getBuildFile());
            }
        }
    });
}
项目:Pushjet-Android    文件:PublishingPlugin.java   
@Mutate
void addConfiguredPublicationsToProjectPublicationRegistry(ProjectPublicationRegistry projectPublicationRegistry, PublishingExtension extension, ProjectIdentifier projectIdentifier) {
    for (Publication publication : extension.getPublications()) {
        PublicationInternal internalPublication = (PublicationInternal) publication;
        projectPublicationRegistry.registerPublication(projectIdentifier.getPath(), new DefaultProjectPublication(internalPublication.getCoordinates()));
    }
}
项目:Pushjet-Android    文件:AbstractProjectSpec.java   
public <T extends ProjectIdentifier> T selectProject(ProjectRegistry<? extends T> registry) {
    checkPreconditions(registry);
    List<T> matches = new ArrayList<T>();
    select(registry, matches);
    if (matches.isEmpty()) {
        throw new InvalidUserDataException(formatNoMatchesMessage());
    }
    if (matches.size() != 1) {
        throw new InvalidUserDataException(formatMultipleMatchesMessage(matches));
    }
    return matches.get(0);
}
项目:Pushjet-Android    文件:ProjectDirectoryProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getProjectDir().equals(dir)) {
            matches.add(candidate);
        }
    }
}
项目:Pushjet-Android    文件:DefaultProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getProjectDir().equals(currentDir)) {
            matches.add(candidate);
        }
    }
    if (useRootWhenNoMatch && matches.isEmpty()) {
        matches.add(candidates.getProject(":"));
    }
}
项目:Pushjet-Android    文件:BuildFileProjectSpec.java   
@Override
protected <T extends ProjectIdentifier> void select(ProjectRegistry<? extends T> candidates, List<? super T> matches) {
    for (T candidate : candidates.getAllProjects()) {
        if (candidate.getBuildFile().equals(buildFile)) {
            matches.add(candidate);
        }
    }
}
项目:Pushjet-Android    文件:AbstractProjectSpec.java   
public boolean containsProject(ProjectRegistry<?> registry) {
    checkPreconditions(registry);
    for (ProjectIdentifier project : registry.getAllProjects()) {
        if (select(project)) {
            return true;
        }
    }
    return false;
}
项目:Reer    文件:ComponentBasePlugin.java   
@Hidden
@Model
ComponentSpecFactory componentSpecFactory(ProjectIdentifier projectIdentifier, Instantiator instantiator, ITaskFactory taskFactory, SourceDirectorySetFactory sourceDirectorySetFactory) {
    return new ComponentSpecFactory(projectIdentifier, instantiator, taskFactory, sourceDirectorySetFactory);
}
项目:Reer    文件:ProjectLayout.java   
public ProjectLayout(ProjectIdentifier projectIdentifier, File buildDir) {
    this.projectIdentifier = projectIdentifier;
    this.buildDir = buildDir;
}
项目:Reer    文件:ProjectLayout.java   
public ProjectIdentifier getProjectIdentifier() {
    return projectIdentifier;
}
项目:Reer    文件:ComponentModelBasePlugin.java   
@Model
public ProjectLayout projectLayout(ProjectIdentifier projectIdentifier, @Path("buildDir") File buildDir) {
    return new ProjectLayout(projectIdentifier, buildDir);
}
项目:Reer    文件:DefaultVisualStudioExtension.java   
public DefaultVisualStudioExtension(ProjectIdentifier projectIdentifier, Instantiator instantiator, ProjectModelResolver projectModelResolver, FileResolver fileResolver) {
    VisualStudioProjectMapper projectMapper = new VisualStudioProjectMapper();
    projectRegistry = new VisualStudioProjectRegistry(projectIdentifier, fileResolver, projectMapper, instantiator);
    VisualStudioProjectResolver projectResolver = new VisualStudioProjectResolver(projectModelResolver);
    solutionRegistry = new VisualStudioSolutionRegistry(projectIdentifier, fileResolver, projectResolver, instantiator);
}
项目:Reer    文件:VisualStudioProjectRegistry.java   
public VisualStudioProjectRegistry(ProjectIdentifier projectIdentifier, FileResolver fileResolver, VisualStudioProjectMapper projectMapper, Instantiator instantiator) {
    super(DefaultVisualStudioProject.class, instantiator);
    this.projectIdentifier = projectIdentifier;
    this.fileResolver = fileResolver;
    this.projectMapper = projectMapper;
}
项目:Reer    文件:VisualStudioSolutionRegistry.java   
public VisualStudioSolutionRegistry(ProjectIdentifier projectIdentifier, FileResolver fileResolver, VisualStudioProjectResolver projectResolver, Instantiator instantiator) {
    super(DefaultVisualStudioSolution.class, instantiator);
    this.projectIdentifier = projectIdentifier;
    this.fileResolver = fileResolver;
    this.projectResolver = projectResolver;
}
项目:Reer    文件:AbstractProjectSpec.java   
public boolean containsProject(ProjectRegistry<? extends ProjectIdentifier> registry) {
    checkPreconditions(registry);
    List<ProjectIdentifier> matches = new ArrayList<ProjectIdentifier>();
    select(registry, matches);
    return !matches.isEmpty();
}
项目:Reer    文件:ProjectDirectoryProjectSpec.java   
protected String formatMultipleMatchesMessage(Iterable<? extends ProjectIdentifier> matches) {
    return String.format("Multiple projects in this build have project directory '%s': %s", dir, matches);
}
项目:Reer    文件:DefaultProjectDescriptor.java   
public ProjectIdentifier getParentIdentifier() {
    return parent;
}
项目:Reer    文件:DefaultProjectSpec.java   
protected String formatMultipleMatchesMessage(Iterable<? extends ProjectIdentifier> matches) {
    return String.format("Multiple projects in this build have project directory '%s': %s", currentDir, matches);
}
项目:Reer    文件:BuildFileProjectSpec.java   
protected String formatMultipleMatchesMessage(Iterable<? extends ProjectIdentifier> matches) {
    return String.format("Multiple projects in this build have build file '%s': %s", buildFile, matches);
}
项目:Reer    文件:PlayTestPlugin.java   
@Mutate
void createTestTasks(ModelMap<Task> tasks, @Path("binaries") ModelMap<PlayApplicationBinarySpecInternal> playBinaries, final PlayPluginConfigurations configurations,
                     final FileResolver fileResolver, final ProjectIdentifier projectIdentifier, @Path("buildDir") final File buildDir) {
    for (final PlayApplicationBinarySpecInternal binary : playBinaries) {
        final PlayToolProvider playToolProvider = binary.getToolChain().select(binary.getTargetPlatform());
        final FileCollection testCompileClasspath = getTestCompileClasspath(binary, playToolProvider, configurations);

        final String testCompileTaskName = binary.getTasks().taskName("compile", "tests");
        final File testSourceDir = fileResolver.resolve("test");
        final FileCollection testSources = new SimpleFileCollection(testSourceDir).getAsFileTree().matching(new PatternSet().include("**/*.scala", "**/*.java"));
        final File testClassesDir = new File(buildDir, binary.getProjectScopedName() + "/testClasses");
        tasks.create(testCompileTaskName, PlatformScalaCompile.class, new Action<PlatformScalaCompile>() {
            public void execute(PlatformScalaCompile scalaCompile) {
                scalaCompile.setDescription("Compiles the scala and java test sources for the " + binary.getDisplayName() + ".");

                scalaCompile.setClasspath(testCompileClasspath);

                scalaCompile.dependsOn(binary.getBuildTask());
                scalaCompile.setPlatform(binary.getTargetPlatform().getScalaPlatform());
                scalaCompile.setDestinationDir(testClassesDir);
                scalaCompile.setSource(testSources);
                String targetCompatibility = binary.getTargetPlatform().getJavaPlatform().getTargetCompatibility().getMajorVersion();
                scalaCompile.setSourceCompatibility(targetCompatibility);
                scalaCompile.setTargetCompatibility(targetCompatibility);

                IncrementalCompileOptions incrementalOptions = scalaCompile.getScalaCompileOptions().getIncrementalOptions();
                incrementalOptions.setAnalysisFile(new File(buildDir, "tmp/scala/compilerAnalysis/" + testCompileTaskName + ".analysis"));
            }
        });

        final String testTaskName = binary.getTasks().taskName("test");
        final File binaryBuildDir = new File(buildDir, binary.getProjectScopedName());
        tasks.create(testTaskName, Test.class, new Action<Test>() {
            public void execute(Test test) {
                test.setDescription("Runs " + WordUtils.uncapitalize(binary.getDisplayName() + "."));

                test.setClasspath(getRuntimeClasspath(testClassesDir, testCompileClasspath));

                test.setTestClassesDir(testClassesDir);
                test.setBinResultsDir(new File(binaryBuildDir, "results/" + testTaskName + "/bin"));
                test.getReports().getJunitXml().setDestination(new File(binaryBuildDir, "reports/test/xml"));
                test.getReports().getHtml().setDestination(new File(binaryBuildDir, "reports/test"));
                test.dependsOn(testCompileTaskName);
                test.setWorkingDir(projectIdentifier.getProjectDir());
            }
        });
        binary.getTasks().add(tasks.get(testTaskName));
    }
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public RegistrationContext(ModelType<? extends T> type, ModelType<? extends U> implementation, ExtensionContainer extensions, ProjectIdentifier projectIdentifier) {
    this.type = type;
    this.implementation = implementation;
    this.extensions = extensions;
    this.projectIdentifier = projectIdentifier;
}
项目:Pushjet-Android    文件:ComponentModelRuleDefinitionHandler.java   
public ProjectIdentifier getProjectIdentifier() {
    return projectIdentifier;
}
项目:Pushjet-Android    文件:AbstractProjectSpec.java   
public boolean containsProject(ProjectRegistry<? extends ProjectIdentifier> registry) {
    checkPreconditions(registry);
    List<ProjectIdentifier> matches = new ArrayList<ProjectIdentifier>();
    select(registry, matches);
    return !matches.isEmpty();
}