当前位置: 首页>>代码示例>>Java>>正文


Java Mutate类代码示例

本文整理汇总了Java中org.gradle.model.Mutate的典型用法代码示例。如果您正苦于以下问题:Java Mutate类的具体用法?Java Mutate怎么用?Java Mutate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mutate类属于org.gradle.model包,在下文中一共展示了Mutate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachBinariesToAssembleLifecycle

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
void attachBinariesToAssembleLifecycle(@Path("tasks.assemble") Task assemble, ComponentSpecContainer components) {
    List<BinarySpecInternal> notBuildable = Lists.newArrayList();
    boolean hasBuildableBinaries = false;
    for (VariantComponentSpec component : components.withType(VariantComponentSpec.class)) {
        for (BinarySpecInternal binary : component.getBinaries().withType(BinarySpecInternal.class)) {
            if (binary.isBuildable()) {
                assemble.dependsOn(binary);
                hasBuildableBinaries = true;
            } else {
                notBuildable.add(binary);
            }
        }
    }
    if (!hasBuildableBinaries && !notBuildable.isEmpty()) {
        assemble.doFirst(new CheckForNotBuildableBinariesAction(notBuildable));
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:ComponentModelBasePlugin.java

示例2: createTasksForVisualStudio

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public static void createTasksForVisualStudio(TaskContainer tasks, VisualStudioExtensionInternal visualStudioExtension) {
    for (VisualStudioProject vsProject : visualStudioExtension.getProjects()) {
        vsProject.builtBy(createProjectsFileTask(tasks, vsProject));
        vsProject.builtBy(createFiltersFileTask(tasks, vsProject));
    }

    for (VisualStudioSolution vsSolution : visualStudioExtension.getSolutions()) {
        Task solutionTask = tasks.create(vsSolution.getName() + "VisualStudio");
        solutionTask.setDescription("Generates the '" + vsSolution.getName() + "' Visual Studio solution file.");
        vsSolution.setBuildTask(solutionTask);
        vsSolution.builtBy(createSolutionTask(tasks, vsSolution));

        // Lifecycle task for component
        NativeComponentSpec component = vsSolution.getComponent();
        Task lifecycleTask = tasks.maybeCreate(component.getName() + "VisualStudio");
        lifecycleTask.dependsOn(vsSolution);
        lifecycleTask.setGroup("IDE");
        lifecycleTask.setDescription("Generates the Visual Studio solution for " + component + ".");
    }

    addCleanTask(tasks);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:VisualStudioPlugin.java

示例3: realizePublishingTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void realizePublishingTasks(ModelMap<Task> tasks, PublishingExtension extension, @Path("buildDir") File buildDir) {
    // Create generatePom tasks for any Maven publication
    PublicationContainer publications = extension.getPublications();
    Task publishLifecycleTask = tasks.get(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
    Task publishLocalLifecycleTask = tasks.get(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);

    for (final MavenPublicationInternal publication : publications.withType(MavenPublicationInternal.class)) {
        String publicationName = publication.getName();

        createGeneratePomTask(tasks, publication, publicationName, buildDir);
        createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName);
        createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:MavenPublishPlugin.java

示例4: configurePrefixHeaderGenerationTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
void configurePrefixHeaderGenerationTasks(final TaskContainer tasks, ComponentSpecContainer components) {
    for (final SourceComponentSpec nativeComponentSpec : components.withType(SourceComponentSpec.class).values()) {
        for (final DependentSourceSetInternal dependentSourceSet : nativeComponentSpec.getSources().withType(DependentSourceSetInternal.class).values()) {
            if (dependentSourceSet.getPrefixHeaderFile() != null) {
                String taskName = "generate" + StringUtils.capitalize(nativeComponentSpec.getName()) + StringUtils.capitalize(dependentSourceSet.getName()) + "PrefixHeaderFile";
                tasks.create(taskName, PrefixHeaderFileGenerateTask.class, new Action<PrefixHeaderFileGenerateTask>() {
                    @Override
                    public void execute(PrefixHeaderFileGenerateTask prefixHeaderFileGenerateTask) {
                        prefixHeaderFileGenerateTask.setPrefixHeaderFile(dependentSourceSet.getPrefixHeaderFile());
                        prefixHeaderFileGenerateTask.setHeader(dependentSourceSet.getPreCompiledHeader());
                    }
                });
            }
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:NativeComponentModelPlugin.java

示例5: configurePreCompiledHeaderCompileTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
void configurePreCompiledHeaderCompileTasks(final TaskContainer tasks, BinaryContainer binaries, final LanguageTransformContainer languageTransforms, final ServiceRegistry serviceRegistry) {
    for (final NativeBinarySpecInternal nativeBinarySpec : binaries.withType(NativeBinarySpecInternal.class)) {
        for (final PchEnabledLanguageTransform<?> transform : languageTransforms.withType(PchEnabledLanguageTransform.class)) {
            nativeBinarySpec.getInputs().withType(transform.getSourceSetType(), new Action<LanguageSourceSet>() {
                @Override
                public void execute(final LanguageSourceSet languageSourceSet) {
                    final DependentSourceSet dependentSourceSet = (DependentSourceSet) languageSourceSet;
                    if (dependentSourceSet.getPreCompiledHeader() != null) {
                        nativeBinarySpec.addPreCompiledHeaderFor(dependentSourceSet);
                        final SourceTransformTaskConfig pchTransformTaskConfig = transform.getPchTransformTask();
                        String pchTaskName = pchTransformTaskConfig.getTaskPrefix() + StringUtils.capitalize(nativeBinarySpec.getProjectScopedName()) + StringUtils.capitalize(dependentSourceSet.getName()) + "PreCompiledHeader";
                        Task pchTask = tasks.create(pchTaskName, pchTransformTaskConfig.getTaskType(), new Action<DefaultTask>() {
                            @Override
                            public void execute(DefaultTask task) {
                                pchTransformTaskConfig.configureTask(task, nativeBinarySpec, dependentSourceSet, serviceRegistry);
                            }
                        });
                        nativeBinarySpec.getTasks().add(pchTask);
                    }
                }
            });
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:NativeComponentModelPlugin.java

示例6: createDebugTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
/**
 * 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));
                    }
                }
            });
        });
    }
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:31,代码来源:ProjectConfigPlugin.java

示例7: configureConfigurations

import org.gradle.model.Mutate; //导入依赖的package包/类
/**
 * Configure configurations
 *
 * @param configurations Configurations to configure
 * @param javaConfig Java configuration to apply
 */
@Mutate
public void configureConfigurations(ConfigurationContainer configurations, JavaConfig javaConfig) {
    configurations.all(c -> {
        DependencySubstitutions ds = c.getResolutionStrategy().getDependencySubstitution();

        ds.substitute(ds.module("ch.qos.logback:logback-classic"))
                .with(ds.module("org.slf4j:slf4j-api:" + javaConfig.getSlf4jVersion()));
        ds.substitute(ds.module("commons-logging:commons-logging"))
                .with(ds.module("org.slf4j:jcl-over-slf4j:" + javaConfig.getSlf4jVersion()));
        ds.substitute(ds.module("log4j:log4j"))
                .with(ds.module("org.slf4j:log4j-over-slf4j:" + javaConfig.getSlf4jVersion()));

        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-log4j12"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-nop"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-simple"));
        c.exclude(ImmutableMap.of("group", "org.slf4j", "module", "slf4j-jcl"));
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:25,代码来源:JavaConfigPlugin.java

示例8: createEclipseAnnotationsTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
/**
 * Create Eclipse annotations tasks
 *
 * @param tasks Task container
 * @param configurations Container to access configurations
 * @param buildDir Build directory
 */
@Mutate
public void createEclipseAnnotationsTasks(ModelMap<Task> tasks, ConfigurationContainer configurations,
        @Path("buildDir") File buildDir) {
    tasks.create("eclipseAnnotations", EclipseAnnotationsTask.class, t -> {
        t.setDescription("Generates external nullability annotations for dependencies.");
        t.setGroup("IDE");

        ConventionMapping parameters = t.getConventionMapping();
        parameters.map("jars", () -> {
            Set<File> jars = configurations.stream()
                    .filter(c -> c.isCanBeResolved()
                            && !c.getName().equals(JavaConfigPlugin.ANNOTATIONS_CONFIGURATION))
                    .map(c -> c.getResolvedConfiguration().getLenientConfiguration())
                    .flatMap(c -> c.getArtifacts().stream().filter(
                            a -> !(a.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier)
                                    && a.getType().equals("jar"))
                            .map(a -> a.getFile()))
                    .collect(Collectors.toSet());

            return jars;
        });
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:31,代码来源:EclipseConfigPlugin.java

示例9: configureEclipseJdtTask

import org.gradle.model.Mutate; //导入依赖的package包/类
/**
 * Configure the Eclipse JDT task
 *
 * @param eclipseJdt Eclipse JDT task
 */
@Mutate
public void configureEclipseJdtTask(@Each GenerateEclipseJdt eclipseJdt) {
    Properties properties = Classes.loadProperties(EclipseConfigPlugin.class, "org.eclipse.jdt.core.prefs");
    Properties compilerProperties = Classes.loadProperties(JavaConfigPlugin.class, "eclipseJavaCompiler.prefs");

    eclipseJdt.getJdt().getFile().withProperties(p -> {
        compilerProperties.forEach((name, value) -> {
            p.putIfAbsent(name, value);
        });

        properties.forEach((name, value) -> {
            p.putIfAbsent(name, value);
        });
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:21,代码来源:EclipseConfigPlugin.java

示例10: hideNativeTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
/**
 * Remove unintended tasks created by Gradle native plugin from task list.
 *
 * Gradle native plugins creates static library tasks automatically.  This method removes
 * them to avoid cluttering the task list.
 */
@Mutate
public void hideNativeTasks(TaskContainer tasks, BinaryContainer binaries) {
    // Gradle do not support a way to remove created tasks.  The best workaround is to clear the
    // group of the task and have another task depends on it.  Therefore, we have to create
    // a dummy task to depend on all the tasks that we do not want to show up on the task
    // list. The dummy task dependsOn itself, effectively making it non-executable and
    // invisible unless the --all option is use.
    final Task nonExecutableTask = tasks.create("nonExecutableTask");
    nonExecutableTask.dependsOn(nonExecutableTask);
    nonExecutableTask
            .setDescription("Dummy task to hide other unwanted tasks in the task list.");

    binaries.withType(NativeLibraryBinarySpec.class, new Action<NativeLibraryBinarySpec>() {
        @Override
        public void execute(NativeLibraryBinarySpec binary) {
            Task buildTask = binary.getBuildTask();
            nonExecutableTask.dependsOn(buildTask);
            buildTask.setGroup(null);
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:NdkComponentModelPlugin.java

示例11: addDefaultAndroidSourceSet

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public void addDefaultAndroidSourceSet(
        @Path("android.sources") AndroidComponentModelSourceSet sources) {
    sources.addDefaultSourceSet("resources", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("java", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("manifest", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("res", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("assets", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("aidl", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("renderscript", AndroidLanguageSourceSet.class);
    sources.addDefaultSourceSet("jniLibs", AndroidLanguageSourceSet.class);

    sources.all(new Action<FunctionalSourceSet>() {
        @Override
        public void execute(FunctionalSourceSet functionalSourceSet) {
            LanguageSourceSet manifest = functionalSourceSet.getByName("manifest");
            manifest.getSource().setIncludes(ImmutableList.of("AndroidManifest.xml"));
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BaseComponentModelPlugin.java

示例12: createVariantData

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public void createVariantData(
        ModelMap<AndroidBinary> binaries,
        ModelMap<AndroidComponentSpec> specs,
        TaskManager taskManager) {
    final VariantManager variantManager =
            ((DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME)).getVariantManager();
    binaries.afterEach(new Action<AndroidBinary>() {
        @Override
        public void execute(AndroidBinary androidBinary) {
            DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
            List<ProductFlavorAdaptor> adaptedFlavors = Lists.newArrayList();
            for (ProductFlavor flavor : binary.getProductFlavors()) {
                adaptedFlavors.add(new ProductFlavorAdaptor(flavor));
            }
            binary.setVariantData(
                    variantManager.createVariantData(
                            new BuildTypeAdaptor(binary.getBuildType()),
                            adaptedFlavors));
            variantManager.getVariantDataList().add(binary.getVariantData());
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:BaseComponentModelPlugin.java

示例13: createAndroidTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public void createAndroidTasks(
        ModelMap<Task> tasks,
        ModelMap<AndroidComponentSpec> androidSpecs,
        TaskManager taskManager,
        SdkHandler sdkHandler,
        Project project, AndroidComponentModelSourceSet androidSources) {
    // setup SDK repositories.
    for (final File file : sdkHandler.getSdkLoader().getRepositories()) {
        project.getRepositories().maven(new Action<MavenArtifactRepository>() {
            @Override
            public void execute(MavenArtifactRepository repo) {
                repo.setUrl(file.toURI());
            }
        });
    }
    // TODO: determine how to provide functionalities of variant API objects.
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BaseComponentModelPlugin.java

示例14: createBinaryTasks

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public void createBinaryTasks(
        final ModelMap<Task> tasks,
        BinaryContainer binaries,
        ModelMap<AndroidComponentSpec> specs,
        TaskManager taskManager) {
    final VariantManager variantManager =
            ((DefaultAndroidComponentSpec) specs.get(COMPONENT_NAME)).getVariantManager();
    binaries.withType(AndroidBinary.class, new Action<AndroidBinary>() {
        @Override
        public void execute(AndroidBinary androidBinary) {
            DefaultAndroidBinary binary = (DefaultAndroidBinary) androidBinary;
            variantManager.createTasksForVariantData(
                    new TaskModelMapAdaptor(tasks),
                    binary.getVariantData());
        }
    });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BaseComponentModelPlugin.java

示例15: createBinaries

import org.gradle.model.Mutate; //导入依赖的package包/类
@Mutate
public void createBinaries(BinaryContainer binaries, PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder,
                           NamedDomainObjectCollection<JvmLibrarySpec> libraries, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);

    List<Action<? super JarBinarySpec>> actions = Lists.newArrayList();
    actions.add(new JarBinarySpecInitializer(buildDir));
    actions.add(new MarkBinariesBuildable());
    Action<JarBinarySpec> initAction = Actions.composite(actions);
    JarBinariesFactory factory = new DefaultJarBinariesFactory(instantiator, initAction);

    Action<JvmLibrarySpec> createBinariesAction =
            new JvmLibrarySpecInitializer(factory, namingSchemeBuilder, toolChains, platforms);

    for (JvmLibrarySpec jvmLibrary : libraries) {
        createBinariesAction.execute(jvmLibrary);
        binaries.addAll(jvmLibrary.getBinaries());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:20,代码来源:JvmComponentPlugin.java


注:本文中的org.gradle.model.Mutate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。