src/com/esotericsoftware/scar/Build.java
static public Project project (String path) throws IOException {
		if (path == null) throw new IllegalArgumentException("path cannot be null.");

		Project defaults = new Project();

		File file = new File(canonical(path));
		if (file.isDirectory()) {
			String name = file.getName();
			defaults.set("name", name);
			defaults.set("target", file.getParent() + "/target/" + name + "/");
		} else {
			String name = file.getParentFile().getName();
			defaults.set("name", name);
			defaults.set("target", file.getParentFile().getParent() + "/target/" + name + "/");
		}

		ArrayList libs = new ArrayList();
		libs.add("lib|**/*.jar");
		libs.add("libs|**/*.jar");
		defaults.set("classpath", libs);

		defaults.set("dist", "dist");

		ArrayList source = new ArrayList();
		source.add("src|**/*.java");
		source.add("src/main/java|**/*.java");
		defaults.set("source", source);

		ArrayList resources = new ArrayList();
		resources.add("assets");
		resources.add("resources");
		resources.add("src/main/resources");
		defaults.set("resources", resources);

		Project project = project(path, defaults);

		// Remove dependency if a JAR of the same name is on the classpath.
		Paths classpath = project.getPaths("classpath");
		classpath.add(dependencyClasspaths(project, classpath, false, false));
		for (String dependency : project.getList("dependencies")) {
			String dependencyName = project(project.path(dependency)).get("name");
			for (String classpathFile : classpath) {
				String name = fileWithoutExtension(classpathFile);
				int dashIndex = name.lastIndexOf('-');
				if (dashIndex != -1) name = name.substring(0, dashIndex);
				if (name.equals(dependencyName)) {
					if (DEBUG) {
						debug(project.toString(),
							"Ignoring dependency: " + dependencyName + " (already on classpath: " + classpathFile + ")");
					}
					project.remove("dependencies", dependency);
					break;
				}
			}
		}

		return project;
	}
/** Loads the specified project with default values and loads any other projects needed for the "include" property.
	 * @param path Path to a YAML project file, or a directory containing a "project.yaml" file. */
Loads the specified project with default values and loads any other projects needed for the "include" property.
@param path Path to a YAML project file, or a directory containing a "project.yaml" file.
Loads the specified project with default values and loads any other projects needed for the " include " property . @param path Path to a YAML project file or a directory containing a " project . yaml " file .
static public Project project (String path) throws IOException {
		if (path == null) throw new IllegalArgumentException("path cannot be null.");
		Project defaults = new Project();
		File file = new File(canonical(path));
		if (file.isDirectory()) {
			String name = file.getName();
			defaults.set("name", name);
			defaults.set("target", file.getParent() + "/target/" + name + "/");
		} else {
			String name = file.getParentFile().getName();
			defaults.set("name", name);
			defaults.set("target", file.getParentFile().getParent() + "/target/" + name + "/");
		}
		ArrayList libs = new ArrayList();
		libs.add("lib|**/*.jar");
		libs.add("libs|**/*.jar");
		defaults.set("classpath", libs);
		defaults.set("dist", "dist");
		ArrayList source = new ArrayList();
		source.add("src|**/*.java");
		source.add("src/main/java|**/*.java");
		defaults.set("source", source);
		ArrayList resources = new ArrayList();
		resources.add("assets");
		resources.add("resources");
		resources.add("src/main/resources");
		defaults.set("resources", resources);
		Project project = project(path, defaults);
		Paths classpath = project.getPaths("classpath");
		classpath.add(dependencyClasspaths(project, classpath, false, false));
		for (String dependency : project.getList("dependencies")) {
			String dependencyName = project(project.path(dependency)).get("name");
			for (String classpathFile : classpath) {
				String name = fileWithoutExtension(classpathFile);
				int dashIndex = name.lastIndexOf('-');
				if (dashIndex != -1) name = name.substring(0, dashIndex);
				if (name.equals(dependencyName)) {
					if (DEBUG) {
						debug(project.toString(),
							"Ignoring dependency: " + dependencyName + " (already on classpath: " + classpathFile + ")");
					}
					project.remove("dependencies", dependency);
					break;
				}
			}
		}
		return project;
	}
static public Project project ( String path ) throws IOException { if ( path == null ) throw new IllegalArgumentException ( "path cannot be null." ) ; Project defaults = new Project ( ) ; File file = new File ( canonical ( path ) ) ; if ( file . isDirectory ( ) ) { String name = file . getName ( ) ; defaults . set ( "name" , name ) ; defaults . set ( "target" , file . getParent ( ) + "/target/" + name + "/" ) ; } else { String name = file . getParentFile ( ) . getName ( ) ; defaults . set ( "name" , name ) ; defaults . set ( "target" , file . getParentFile ( ) . getParent ( ) + "/target/" + name + "/" ) ; } ArrayList libs = new ArrayList ( ) ; libs . add ( "lib|**/*.jar" ) ; libs . add ( "libs|**/*.jar" ) ; defaults . set ( "classpath" , libs ) ; defaults . set ( "dist" , "dist" ) ; ArrayList source = new ArrayList ( ) ; source . add ( "src|**/*.java" ) ; source . add ( "src/main/java|**/*.java" ) ; defaults . set ( "source" , source ) ; ArrayList resources = new ArrayList ( ) ; resources . add ( "assets" ) ; resources . add ( "resources" ) ; resources . add ( "src/main/resources" ) ; defaults . set ( "resources" , resources ) ; Project project = project ( path , defaults ) ; Paths classpath = project . getPaths ( "classpath" ) ; classpath . add ( dependencyClasspaths ( project , classpath , false , false ) ) ; for ( String dependency : project . getList ( "dependencies" ) ) { String dependencyName = project ( project . path ( dependency ) ) . get ( "name" ) ; for ( String classpathFile : classpath ) { String name = fileWithoutExtension ( classpathFile ) ; int dashIndex = name . lastIndexOf ( '-' ) ; if ( dashIndex != - 1 ) name = name . substring ( 0 , dashIndex ) ; if ( name . equals ( dependencyName ) ) { if ( DEBUG ) { debug ( project . toString ( ) , "Ignoring dependency: " + dependencyName + " (already on classpath: " + classpathFile + ")" ) ; } project . remove ( "dependencies" , dependency ) ; break ; } } } return project ; }
Loads the specified project with default values and loads any other projects needed for the "include" property.
Loads the specified project with default values and loads any other projects needed for the " include " property .
// Remove dependency if a JAR of the same name is on the classpath.