<commit_before>/*
 * Copyright 2016 <NAME>
 *
 * 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 igel.gradle.publish

import org.gradle.api.Action
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar

class GroovyPublishPlugin extends BasePublishPlugin {

    @Override
    protected Action<MavenPublication> getMavenConfiguration(Project target) {
        // check that 'groovy' plugin is applied
        // because we need 'java' component and 'main' source set
        if (!target.plugins.hasPlugin('groovy')) {
            throw new GradleException('plugin \'groovy\' should be applied first')
        }

        // create a task to prepare source code jar
        Task sourcesJarTask = target.task('sourcesJar', type: Jar) {
            group = 'documentation'
            description = 'Assembles a jar archive containing the main source code.'
            classifier = 'sources'
            from target.sourceSets.main.allSource
        }

        // return maven configuration
        return { MavenPublication publication ->
            publication.from target.components.java
            publication.artifact sourcesJarTask
        }
    }

}<commit_msg>implement groovydoc for igel.publish.groovy<commit_after>/*
 * Copyright 2016 <NAME>
 *
 * 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 igel.gradle.publish

import org.gradle.api.Action
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.javadoc.Groovydoc

class GroovyPublishPlugin extends BasePublishPlugin {

    @Override
    protected Action<MavenPublication> getMavenConfiguration(Project target) {
        // check that 'groovy' plugin is applied
        // because we need 'java' component, 'main' source set and groovydoc task
        if (!target.plugins.hasPlugin('groovy')) {
            throw new GradleException('plugin \'groovy\' should be applied first')
        }

        // create a task to prepare source code jar
        Task sourcesJarTask = target.task('sourcesJar', type: Jar) {
            group = 'documentation'
            description = 'Assembles a jar archive containing the main source code.'
            classifier = 'sources'
            from target.sourceSets.main.allSource
        }

        // create a task to prepare groovydoc jar
        Groovydoc groovydocTask = target.tasks['groovydoc'] as Groovydoc
        Task groovydocJarTask = target.task('groovydocJar', type: Jar,
                dependsOn: groovydocTask) {
            group = 'documentation'
            description = 'Assembles a jar archive containing the Groovydoc API documentation.'
            classifier = 'groovydoc'
            from groovydocTask.destinationDir
        }

        // return maven configuration
        return { MavenPublication publication ->
            publication.from target.components.java
            publication.artifact sourcesJarTask
            publication.artifact groovydocJarTask
        }
    }

}
{'fraction_non_alphanumeric': 0.07688679245283019, 'fraction_numerical': 0.0037735849056603774, 'mean_word_length': 2.8554545454545455, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3959557', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1070, 'n_words': 382}