All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intershop.gradle.icm.extension.IntershopExtension.kt Maven / Gradle / Ivy

There is a newer version: 6.2.1
Show newest version
/*
 * Copyright 2019 Intershop Communications AG.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package com.intershop.gradle.icm.extension

import groovy.lang.Closure
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.util.ConfigureUtil
import javax.inject.Inject

/**
 * Extension for ICM properties.
 */
open class IntershopExtension @Inject constructor(objectFactory: ObjectFactory)  {

    companion object {
        // names for the plugin
        const val INTERSHOP_EXTENSION_NAME = "intershop"
        const val INTERSHOP_GROUP_NAME = "Intershop Commerce Management"
    }

    val developmentConfig: DevelopmentConfiguration = objectFactory.newInstance(DevelopmentConfiguration::class.java)

    /**
     * Configures the development information configuration.
     *
     * @param closure closure with project information configuration
     */
    @Suppress("unused")
    fun developmentConfig(closure: Closure) {
        ConfigureUtil.configure(closure, developmentConfig)
    }

    /**
     * Configures the project information configuration.
     *
     * @param action action with project information configuration
     */
    fun developmentConfig(action: Action) {
        action.execute(developmentConfig)
    }

    val projectInfo: ProjectInfo = objectFactory.newInstance(ProjectInfo::class.java)

    /**
     * Configures the project information configuration.
     *
     * @param closure closure with project information configuration
     */
    @Suppress("unused")
    fun projectInfo(closure: Closure) {
        ConfigureUtil.configure(closure, projectInfo)
    }

    /**
     * Configures the project information configuration.
     *
     * @param action action with project information configuration
     */
    fun projectInfo(action: Action) {
        action.execute(projectInfo)
    }

    val projectConfig: ProjectConfiguration = objectFactory.newInstance(ProjectConfiguration::class.java)

    /**
     * Configures the base project of Intershop Commerce Management.
     *
     * @param closure closure with base project configuration of Intershop Commerce Management
     */
    @Suppress("unused")
    fun projectConfig(closure: Closure) {
        ConfigureUtil.configure(closure, projectConfig)
    }

    /**
     * Configures the base project of Intershop Commerce Management.
     *
     * @param action action with base project configuration of Intershop Commerce Management
     */
    fun projectConfig(action: Action) {
        action.execute(projectConfig)
    }

    /**
     * Provider for publication name of Maven.
     */
    val mavenPublicationNameProvider: Provider
        get() = mavenPublicationName

    /**
     *  Publishing name of Maven of the project.
     */
    var mavenPublicationName: Property = objectFactory.property(String::class.java)

    init {
        mavenPublicationName.convention("mvn")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy