/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 *
 * 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.badlogic.gdx.setup;

import java.util.List;
import java.util.Map;

public class ExternalExtension {

	private String name;
	private String description;
	private String version;

	private Map<String, List<String>> dependencies;

	public ExternalExtension (String name, String description, String version) {
		this.name = name;
		this.description = description;
		this.version = version;
	}

	public void setDependencies (Map<String, List<String>> dependencies) {
		this.dependencies = dependencies;
	}

	public Dependency generateDependency () {
		Dependency dep = new Dependency(name, getPlatformDependencies("core"), getPlatformDependencies("desktop"),
			getPlatformDependencies("android"), getPlatformDependencies("ios"), getPlatformDependencies("html"));

		return dep;
	}

	private String[] getPlatformDependencies (String platformName) {
		if (dependencies.get(platformName) == null) {
			return null;
		} else if (dependencies.get(platformName) != null && dependencies.get(platformName).size() == 0) {
			return new String[] {};
		} else {
			String[] arr = new String[dependencies.get(platformName).size()];
			for (int i = 0; i < dependencies.get(platformName).size(); i++) {
				arr[i] = dependencies.get(platformName).get(i) + ":" + version;
			}
			return arr;
		}
	}

	public String getName () {
		return name;
	}
}

@@ -1953,14 +1953,31 @@
 %09%09%09%09
-arr%5Bi%5D
+String dependencyString
  = d
@@ -2012,16 +2012,237 @@
 ).get(i)
+;%0A%09%09%09%09if (dependencyString.split(%22:%22).length == 3) %7B%0A%09%09%09%09%09String%5B%5D split = dependencyString.split(%22:%22);%0A%09%09%09%09%09arr%5Bi%5D = split%5B0%5D + %22:%22 + split%5B1%5D + %22:%22 + version + %22:%22 + split%5B2%5D;%0A%09%09%09%09%7D else %7B%0A%09%09%09%09%09arr%5Bi%5D = dependencyString
  + %22:%22 +
@@ -2251,16 +2251,22 @@
 ersion;%0A
+%09%09%09%09%7D%0A
 %09%09%09%7D%0A%09%09%09

Support classifiers