<commit_before>/*
 * Copyright 2014 juancavallotti.
 *
 * 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.mulesoft.build.studio

import com.mulesoft.build.MulePluginConstants
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
 *
 * This plugin is a customization of the eclipse plugin that adds specific
 * configurations for MuleStudio projects.
 *
 * Created by juancavallotti on 04/01/14.
 */
class StudioPlugin implements Plugin<Project> {

    private static final Logger logger = LoggerFactory.getLogger(StudioPlugin.class)

    @Override
    void apply(Project project) {

        //the studio plugin also adds the mule nature.
        project.apply(plugin: 'mule')

        //apply the base plugin and then customize.
        project.apply(plugin: 'eclipse')


        EclipseModel eclipseConfig = project.extensions.getByType(EclipseModel);

        //use the DSL to customize how the eclipse project is created.
        eclipseConfig.project {
            natures = ['org.mule.tooling.core.muleNature']
        }

        //initialize the studio dependencies.
        //TODO - this might be better if delayed until last moment for better flexibility
        StudioDependencies deps = new StudioDependencies()

        //add the compile dependencies
        project.dependencies {
            compile(deps.listCompileDeps(project))
        }

        Task currentTask

        currentTask = project.task('addDependency') << {
            deps.addDependency(project);
        }

        currentTask.description = 'Add a dependency on the studio file descriptor. - Intended for use with tooling'
        currentTask.group = MulePluginConstants.STUDIO_GROUP

        currentTask = project.task('studio') << {
            logger.info('Updating mule studio project...')
            //TODO - Add specific studio customizations
        }

        currentTask.description = 'Update MuleStudio project metadata.'
        currentTask.group = "IDE"
        currentTask.dependsOn 'eclipse'


    }
}
<commit_msg>Gradle plugin now can successfully create a studio project without any prior studio information<commit_after>/*
 * Copyright 2014 juancavallotti.
 *
 * 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.mulesoft.build.studio

import com.mulesoft.build.MulePluginConstants
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
 *
 * This plugin is a customization of the eclipse plugin that adds specific
 * configurations for MuleStudio projects.
 *
 * Created by juancavallotti on 04/01/14.
 */
class StudioPlugin implements Plugin<Project> {

    private static final Logger logger = LoggerFactory.getLogger(StudioPlugin.class)

    @Override
    void apply(Project project) {

        //the studio plugin also adds the mule nature.
        project.apply(plugin: 'mule')

        //apply the base plugin and then customize.
        project.apply(plugin: 'eclipse')


        EclipseModel eclipseConfig = project.extensions.getByType(EclipseModel);

        //use the DSL to customize how the eclipse project is created.
        eclipseConfig.project {
            natures = ['org.mule.tooling.core.muleNature', 'org.eclipse.jdt.core.javanature']
            buiildCommands = ['org.mule.tooling.core.muleBuilder']
        }

        //initialize the studio dependencies.
        //TODO - this might be better if delayed until last moment for better flexibility
        StudioDependencies deps = new StudioDependencies()

        //add the compile dependencies
        project.dependencies {
            compile(deps.listCompileDeps(project))
        }

        Task currentTask

        currentTask = project.task('addDependency') << {
            deps.addDependency(project);
        }

        currentTask.description = 'Add a dependency on the studio file descriptor. - Intended for use with tooling'
        currentTask.group = MulePluginConstants.STUDIO_GROUP

        currentTask = project.task('studio') << {
            logger.info('Updating mule studio project...')
            //TODO - Add specific studio customizations
        }

        currentTask.description = 'Update MuleStudio project metadata.'
        currentTask.group = "IDE"
        currentTask.dependsOn 'eclipse'


    }
}

{'fraction_non_alphanumeric': 0.07930785868781542, 'fraction_numerical': 0.005767844268204758, 'mean_word_length': 2.9077464788732392, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '1692159', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1397, 'n_words': 490}