<commit_before>/*
 * Copyright 2015 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.javadoc

import groovy.transform.Memoized
import groovy.transform.TypeChecked

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.javadoc.Javadoc

/**
 * This is the implementation of the plugin.
 */
class JavaDocConfigurationPlugin implements Plugin<Project> {

    private Project project

    void apply(Project project) {
        this.project = project
        project.tasks.withType(Javadoc) { task ->
            task.doFirst {
                project.copy {
                    from styleSheet
                    into(new File(project.buildDir, 'javadoctmp'))
                    fileMode = 0666
                }
            }
            task.options {
                header = '<img src="{@docRoot}/images/intershop_logo.gif">'
                footer = '<img src="{@docRoot}/images/intershop_logo.gif">'

                stylesheetFile = new File(project.buildDir, 'javadoctmp/intershop.css')

                def javaVersion = System.getProperty('java.version')
                if(javaVersion.startsWith('1.8')) {
                    // This will disable doclint. doclint comes with JDK 1.8.
                    // doclint requires valid HTML 4.01 in JavaDoc
                    // invalid Javadoc will break the build!
                    addStringOption('Xdoclint:none', '-quiet')
                }

                links("http://docs.oracle.com/javase/8/docs/api/")
            }

            task.doLast {<commit_msg>fix behaviour of copy resource of javadoc plugin<commit_after>/*
 * Copyright 2015 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.javadoc

import groovy.transform.Memoized
import groovy.transform.TypeChecked
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.javadoc.Javadoc
/**
 * This is the implementation of the plugin.
 */
class JavaDocConfigurationPlugin implements Plugin<Project> {

    private Project project

    void apply(Project project) {
        this.project = project

        if(! project.tasks.findByName('copyJavaDocStylesheet')) {
            project.tasks.create('copyJavaDocStylesheet') {
                outputs.file new File(project.buildDir, 'javadoctmp/intershop.css')

                doLast {
                    project.copy {
                        from getStyleSheet()
                        into new File(project.buildDir, 'javadoctmp')
                        fileMode = 0666
                    }
                }
            }
        }

        project.tasks.withType(Javadoc) { task ->
            task.dependsOn project.tasks.copyJavaDocStylesheet
            task.options {
                header = '<img src="{@docRoot}/images/intershop_logo.gif">'
                footer = '<img src="{@docRoot}/images/intershop_logo.gif">'

                stylesheetFile = project.tasks.copyJavaDocStylesheet.outputs.files.singleFile

                def javaVersion = System.getProperty('java.version')
                if(javaVersion.startsWith('1.8')) {
                    // This will disable doclint. doclint comes with JDK 1.8.
                    // doclint requires valid HTML 4.01 in JavaDoc
                    // invalid Javadoc will break the build!
                    addStringOption('Xdoclint:none', '-quiet')
                }

                links("http://docs.oracle.com/javase/8/docs/api/")
            }

            task.doLast {
{'fraction_non_alphanumeric': 0.08941329292054558, 'fraction_numerical': 0.008659883091578264, 'mean_word_length': 2.0944407233757536, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '3875710', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1148, 'n_words': 349}