// Path: src/main/java/nebula/plugin/metrics/model/GenericCI.java
// @Value
// public class GenericCI {
//     private String build;
// 
//     private String job;
// 
//     private String host;
// 
//     private String user;
// 
//     private String os;
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/GenericSCM.java
// @Value
// public class GenericSCM {
//     private String origin;
// 
//     private String change;
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/GenericToolContainer.java
// @Value
// public class GenericToolContainer implements Tool {
//     private Object generic;
// 
//     @Override
//     public String getType() {
//         return "generic";
//     }
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/Tool.java
// public interface Tool {
//     String getType();
// }


import nebula.plugin.metrics.model.GenericCI;
import nebula.plugin.metrics.model.GenericSCM;
import nebula.plugin.metrics.model.GenericToolContainer;
import nebula.plugin.metrics.model.Tool;
import org.gradle.api.Plugin;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
/*
 *  Copyright 2015-2016 Netflix, Inc.
 *
 *  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 nebula.plugin.metrics.collector;





/**
 * Collector for Gradle info.
 */
public class GradleInfoCollector {
    private final Plugin plugin;

    public GradleInfoCollector(Plugin plugin) {
        this.plugin = checkNotNull(plugin);
    }

    public Tool getSCM() {
        Map<String, String> manifest = buildManifest();
        GenericSCM scm = new GenericSCM(manifest.get("Module-Origin"), manifest.get("Change"));
        return new GenericToolContainer(scm);
    }

    public Tool getCI() {
        Map<String, String> manifest = buildManifest();
        GenericCI ci = new GenericCI(manifest.get("Build-Number"), manifest.get("Build-Job"), manifest.get("Build-Host"), manifest.get("Built-By"), manifest.get("Build-OS"));
// Path: src/main/java/nebula/plugin/metrics/model/GenericCI.java
// @Value
// public class GenericCI {
//     private String build;
// 
//     private String job;
// 
//     private String host;
// 
//     private String user;
// 
//     private String os;
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/GenericSCM.java
// @Value
// public class GenericSCM {
//     private String origin;
// 
//     private String change;
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/GenericToolContainer.java
// @Value
// public class GenericToolContainer implements Tool {
//     private Object generic;
// 
//     @Override
//     public String getType() {
//         return "generic";
//     }
// }
// 
// Path: src/main/java/nebula/plugin/metrics/model/Tool.java
// public interface Tool {
//     String getType();
// }


// Path: src/main/java/nebula/plugin/metrics/collector/GradleInfoCollector.java
import nebula.plugin.metrics.model.GenericCI;
import nebula.plugin.metrics.model.GenericSCM;
import nebula.plugin.metrics.model.GenericToolContainer;
import nebula.plugin.metrics.model.Tool;
import org.gradle.api.Plugin;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;

/*
 *  Copyright 2015-2016 Netflix, Inc.
 *
 *  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 nebula.plugin.metrics.collector;





/**
 * Collector for Gradle info.
 */
public class GradleInfoCollector {
    private final Plugin plugin;

    public GradleInfoCollector(Plugin plugin) {
        this.plugin = checkNotNull(plugin);
    }

    public Tool getSCM() {
        Map<String, String> manifest = buildManifest();
        GenericSCM scm = new GenericSCM(manifest.get("Module-Origin"), manifest.get("Change"));
        return new GenericToolContainer(scm);
    }

    public Tool getCI() {
        Map<String, String> manifest = buildManifest();
        GenericCI ci = new GenericCI(manifest.get("Build-Number"), manifest.get("Build-Job"), manifest.get("Build-Host"), manifest.get("Built-By"), manifest.get("Build-OS"));
        return new GenericToolContainer(ci);