Java Code Examples for org.gradle.model.Mutate

The following examples show how to use org.gradle.model.Mutate. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@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());
    }
}
 
Example 2
@Mutate
void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) {
    Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME);
    for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
        if (!binary.isLegacyBinary()) {
            Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName());
            binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
            binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary));
            binary.setBuildTask(binaryLifecycleTask);

            if (binary.isBuildable()) {
                assembleTask.dependsOn(binary);
            }
        }
    }
}
 
Example 3
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
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(String.format("Generates the '%s' Visual Studio solution file.", vsSolution.getName()));
        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(String.format("Generates the Visual Studio solution for %s.", component));
    }

    addCleanTask(tasks);
}
 
Example 4
public static <R, T> RuleSourceBackedRuleAction<R, T> create(ModelType<T> subjectType, R ruleSourceInstance) {
    ModelType<R> ruleSourceType = ModelType.typeOf(ruleSourceInstance);
    List<Method> mutateMethods = JavaReflectionUtil.findAllMethods(ruleSourceType.getConcreteClass(), new Spec<Method>() {
        public boolean isSatisfiedBy(Method element) {
            return element.isAnnotationPresent(Mutate.class);
        }
    });
    if (mutateMethods.size() != 1) {
        throw invalid(ruleSourceType, "must have at exactly one method annotated with @Mutate");
    }
    Method ruleMethod = mutateMethods.get(0);
    if (ruleMethod.getReturnType() != Void.TYPE) {
        throw invalid(ruleSourceType, "rule method must return void");
    }
    Type[] parameterTypes = ruleMethod.getGenericParameterTypes();
    if (parameterTypes.length == 0) {
        throw invalid(ruleSourceType, "rule method must have at least one parameter");
    }
    if (!subjectType.isAssignableFrom(ModelType.of(parameterTypes[0]))) {
        throw invalid(ruleSourceType, String.format("first parameter of rule method must be of type %s", subjectType));
    }
    return new RuleSourceBackedRuleAction<R, T>(ruleSourceInstance, new JavaMethod<R, T>(ruleSourceType.getConcreteClass(), subjectType.getConcreteClass(), ruleMethod));
}
 
Example 5
@Mutate
public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class);
    final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class);
    final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class);

    toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() {
        public VisualCpp create(String name) {
            return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class);
}
 
Example 6
@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());
    }
}
 
Example 7
@Mutate
void createLifecycleTaskForBinary(TaskContainer tasks, BinaryContainer binaries) {
    Task assembleTask = tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME);
    for (BinarySpecInternal binary : binaries.withType(BinarySpecInternal.class)) {
        if (!binary.isLegacyBinary()) {
            Task binaryLifecycleTask = tasks.create(binary.getNamingScheme().getLifecycleTaskName());
            binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
            binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary));
            binary.setBuildTask(binaryLifecycleTask);

            if (binary.isBuildable()) {
                assembleTask.dependsOn(binary);
            }
        }
    }
}
 
Example 8
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
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(String.format("Generates the '%s' Visual Studio solution file.", vsSolution.getName()));
        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(String.format("Generates the Visual Studio solution for %s.", component));
    }

    addCleanTask(tasks);
}
 
Example 9
public static <R, T> RuleSourceBackedRuleAction<R, T> create(ModelType<T> subjectType, R ruleSourceInstance) {
    ModelType<R> ruleSourceType = ModelType.typeOf(ruleSourceInstance);
    List<Method> mutateMethods = JavaReflectionUtil.findAllMethods(ruleSourceType.getConcreteClass(), new Spec<Method>() {
        public boolean isSatisfiedBy(Method element) {
            return element.isAnnotationPresent(Mutate.class);
        }
    });
    if (mutateMethods.size() != 1) {
        throw invalid(ruleSourceType, "must have at exactly one method annotated with @Mutate");
    }
    Method ruleMethod = mutateMethods.get(0);
    if (ruleMethod.getReturnType() != Void.TYPE) {
        throw invalid(ruleSourceType, "rule method must return void");
    }
    Type[] parameterTypes = ruleMethod.getGenericParameterTypes();
    if (parameterTypes.length == 0) {
        throw invalid(ruleSourceType, "rule method must have at least one parameter");
    }
    if (!subjectType.isAssignableFrom(ModelType.of(parameterTypes[0]))) {
        throw invalid(ruleSourceType, String.format("first parameter of rule method must be of type %s", subjectType));
    }
    return new RuleSourceBackedRuleAction<R, T>(ruleSourceInstance, new JavaMethod<R, T>(ruleSourceType.getConcreteClass(), subjectType.getConcreteClass(), ruleMethod));
}
 
Example 10
@Mutate
public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class);
    final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class);
    final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class);

    toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() {
        public VisualCpp create(String name) {
            return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class);
}
 
Example 11
@Mutate
public void registerJavaPlatformType(PlatformContainer platforms, ServiceRegistry serviceRegistry) {
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    platforms.registerFactory(JavaPlatform.class, new NamedDomainObjectFactory<JavaPlatform>() {
        public JavaPlatform create(String name) {
            return instantiator.newInstance(DefaultJavaPlatform.class, name);
        }
    });
}
 
Example 12
@Mutate
public void createJavaPlatforms(PlatformContainer platforms, ServiceRegistry serviceRegistry) {
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    //Create default platforms available for Java
    for (JavaVersion javaVersion: JavaVersion.values()) {
        DefaultJavaPlatform javaPlatform = instantiator.newInstance(DefaultJavaPlatform.class, javaVersion);
        platforms.add(javaPlatform);
    }
}
 
Example 13
@Mutate
public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
    for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
        Task jarTask = createJarTask(tasks, projectJarBinary);
        projectJarBinary.builtBy(jarTask);
        projectJarBinary.getTasks().add(jarTask);
    }
}
 
Example 14
@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());
            }
        }
    });
}
 
Example 15
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
public static void createVisualStudioModelForBinaries(VisualStudioExtensionInternal visualStudioExtension, BinaryContainer binaryContainer) {
    for (NativeBinarySpec binary : binaryContainer.withType(NativeBinarySpec.class)) {
        VisualStudioProjectConfiguration configuration = visualStudioExtension.getProjectRegistry().addProjectConfiguration(binary);

        // Only create a solution if one of the binaries is buildable
        if (binary.isBuildable()) {
            DefaultVisualStudioProject visualStudioProject = configuration.getProject();
            visualStudioExtension.getSolutionRegistry().addSolution(visualStudioProject);
        }
    }
}
 
Example 16
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void realizePublishingTasks(CollectionBuilder<Task> tasks, @Path("tasks.publish") Task publishLifecycleTask, @Path("tasks.publishToMavenLocal") Task publishLocalLifecycleTask,
                                   PublishingExtension extension) {
    // Create generatePom tasks for any Maven publication
    PublicationContainer publications = extension.getPublications();

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

        createGeneratePomTask(tasks, publication, publicationName);
        createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName);
        createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName);
    }
}
 
Example 17
@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()));
    }
}
 
Example 18
@Mutate
public void createCUnitTestSuitePerComponent(TestSuiteContainer testSuites, NamedDomainObjectSet<NativeComponentSpec> components, ProjectSourceSet projectSourceSet, ServiceRegistry serviceRegistry) {
    Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    for (NativeComponentSpec component : components) {
        testSuites.add(createCUnitTestSuite(component, instantiator, projectSourceSet));
    }
}
 
Example 19
@Mutate
public void configureCUnitTestSuiteSources(ProjectSourceSet projectSourceSet, TestSuiteContainer testSuites, @Path("buildDir") File buildDir) {

    for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) {
        FunctionalSourceSet suiteSourceSet = ((ComponentSpecInternal) suite).getMainSource();
        CSourceSet launcherSources = suiteSourceSet.maybeCreate(CUNIT_LAUNCHER_SOURCE_SET, CSourceSet.class);
        File baseDir = new File(buildDir, String.format("src/%s/cunitLauncher", suite.getName()));
        launcherSources.getSource().srcDir(new File(baseDir, "c"));
        launcherSources.getExportedHeaders().srcDir(new File(baseDir, "headers"));
        CSourceSet testSources = suiteSourceSet.maybeCreate("c", CSourceSet.class);
        testSources.lib(launcherSources);
    }
}
 
Example 20
@Mutate
public void createCUnitLauncherTasks(TaskContainer tasks, TestSuiteContainer testSuites, ProjectSourceSet sources) {
    for (final CUnitTestSuiteSpec suite : testSuites.withType(CUnitTestSuiteSpec.class)) {

        String taskName = suite.getName() + "CUnitLauncher";
        GenerateCUnitLauncher skeletonTask = tasks.create(taskName, GenerateCUnitLauncher.class);

        CSourceSet launcherSources = findLaucherSources(suite);
        skeletonTask.setSourceDir(launcherSources.getSource().getSrcDirs().iterator().next());
        skeletonTask.setHeaderDir(launcherSources.getExportedHeaders().getSrcDirs().iterator().next());
        launcherSources.builtBy(skeletonTask);
    }
}
 
Example 21
@Mutate
public void createCUnitTestBinaries(final BinaryContainer binaries, TestSuiteContainer testSuites, @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry) {
    for (final CUnitTestSuiteSpec cUnitTestSuite : testSuites.withType(CUnitTestSuiteSpec.class)) {
        for (NativeBinarySpec testedBinary : cUnitTestSuite.getTestedComponent().getNativeBinaries()) {

            DefaultCUnitTestSuiteBinary testBinary = createTestBinary(serviceRegistry, cUnitTestSuite, testedBinary);

            configure(testBinary, buildDir);

            cUnitTestSuite.getBinaries().add(testBinary);
            binaries.add(testBinary);
        }
    }
}
 
Example 22
@Mutate
public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() {
        public Clang create(String name) {
            return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class);
}
 
Example 23
@Mutate
public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() {
        public Gcc create(String name) {
            return instantiator.newInstance(GccToolChain.class, instantiator, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory);
        }
    });
    toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class);
}
 
Example 24
/**
 * Create all source sets for each AndroidBinary.
 */
@Mutate
public void createVariantSourceSet(
        @Path("android.sources") final AndroidComponentModelSourceSet sources,
        @Path("android.buildTypes") final ModelMap<BuildType> buildTypes,
        @Path("android.productFlavors") ModelMap<ProductFlavor> flavors,
        List<ProductFlavorCombo<ProductFlavor>> flavorGroups, ProjectSourceSet projectSourceSet,
        LanguageRegistry languageRegistry) {
    sources.setProjectSourceSet(projectSourceSet);
    for (LanguageRegistration languageRegistration : languageRegistry) {
        sources.registerLanguage(languageRegistration);
    }

    // Create main source set.
    sources.create("main");

    for (BuildType buildType : buildTypes.values()) {
        sources.maybeCreate(buildType.getName());

        for (ProductFlavorCombo group : flavorGroups) {
            sources.maybeCreate(group.getName());
            if (!group.getFlavorList().isEmpty()) {
                sources.maybeCreate(
                        group.getName() + StringHelper.capitalize(buildType.getName()));
            }

        }

    }
    if (flavorGroups.size() != flavors.size()) {
        // If flavorGroups and flavors are the same size, there is at most 1 flavor
        // dimension.  So we don't need to reconfigure the source sets for flavorGroups.
        for (ProductFlavor flavor : flavors.values()) {
            sources.maybeCreate(flavor.getName());
        }
    }
}
 
Example 25
@Mutate
public void registerJavaPlatformType(PlatformContainer platforms, ServiceRegistry serviceRegistry) {
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    platforms.registerFactory(JavaPlatform.class, new NamedDomainObjectFactory<JavaPlatform>() {
        public JavaPlatform create(String name) {
            return instantiator.newInstance(DefaultJavaPlatform.class, name);
        }
    });
}
 
Example 26
@Mutate
public void createJavaPlatforms(PlatformContainer platforms, ServiceRegistry serviceRegistry) {
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    //Create default platforms available for Java
    for (JavaVersion javaVersion: JavaVersion.values()) {
        DefaultJavaPlatform javaPlatform = instantiator.newInstance(DefaultJavaPlatform.class, javaVersion);
        platforms.add(javaPlatform);
    }
}
 
Example 27
@Mutate
public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
    for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
        Task jarTask = createJarTask(tasks, projectJarBinary);
        projectJarBinary.builtBy(jarTask);
        projectJarBinary.getTasks().add(jarTask);
    }
}
 
Example 28
@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());
            }
        }
    });
}
 
Example 29
@Mutate
@SuppressWarnings("GroovyUnusedDeclaration")
public static void createVisualStudioModelForBinaries(VisualStudioExtensionInternal visualStudioExtension, BinaryContainer binaryContainer) {
    for (NativeBinarySpec binary : binaryContainer.withType(NativeBinarySpec.class)) {
        VisualStudioProjectConfiguration configuration = visualStudioExtension.getProjectRegistry().addProjectConfiguration(binary);

        // Only create a solution if one of the binaries is buildable
        if (binary.isBuildable()) {
            DefaultVisualStudioProject visualStudioProject = configuration.getProject();
            visualStudioExtension.getSolutionRegistry().addSolution(visualStudioProject);
        }
    }
}
 
Example 30
@Mutate
@SuppressWarnings("UnusedDeclaration")
public void realizePublishingTasks(CollectionBuilder<Task> tasks, @Path("tasks.publish") Task publishLifecycleTask, @Path("tasks.publishToMavenLocal") Task publishLocalLifecycleTask,
                                   PublishingExtension extension) {
    // Create generatePom tasks for any Maven publication
    PublicationContainer publications = extension.getPublications();

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

        createGeneratePomTask(tasks, publication, publicationName);
        createLocalInstallTask(tasks, publishLocalLifecycleTask, publication, publicationName);
        createPublishTasksForEachMavenRepo(tasks, extension, publishLifecycleTask, publication, publicationName);
    }
}