Added source-code.
This commit is contained in:
parent
71d021fc38
commit
2ef28f6c2e
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Ignore binary files
|
||||||
|
bin/
|
27
build.xml
Normal file
27
build.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<project name="CoffeeBreak" basedir="." default="main" >
|
||||||
|
<property name="src.dir" value="src" />
|
||||||
|
<property name="bin.dir" value="bin" />
|
||||||
|
<property name="classes.dir" value="${bin.dir}/classes" />
|
||||||
|
<property name="jar.dir" value="${bin.dir}/jar" />
|
||||||
|
<property name="main-class" value="coffeebreak.CoffeeBreak" />
|
||||||
|
|
||||||
|
<target name="clean" >
|
||||||
|
<delete dir="bin" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" >
|
||||||
|
<mkdir dir="${classes.dir}" />
|
||||||
|
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="jar" depends="compile" >
|
||||||
|
<mkdir dir="${jar.dir}" />
|
||||||
|
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}" >
|
||||||
|
<manifest>
|
||||||
|
<attribute name="Main-Class" value="${main-class}" />
|
||||||
|
</manifest>
|
||||||
|
</jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="main" depends="jar" />
|
||||||
|
</project>
|
38
src/coffeebreak/CoffeeBreak.java
Normal file
38
src/coffeebreak/CoffeeBreak.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package coffeebreak;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Nicolás A. Ortega
|
||||||
|
* @copyright Nicolás A. Ortega
|
||||||
|
* @license GNU GPLv3
|
||||||
|
* @year 2014
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CoffeeBreak {
|
||||||
|
public static final String usage = "Usage: coffeebreak [compiler]";
|
||||||
|
public String[] compilers = {"gcc", "g++", "clang++", "javac", "ant"};
|
||||||
|
|
||||||
|
public CoffeeBreak(String compiler) {
|
||||||
|
int compid = -1;
|
||||||
|
compilerLoop:
|
||||||
|
for(int i = 0; i < compilers.length; i++) {
|
||||||
|
if(compiler.equals(compilers[i])) {
|
||||||
|
compid = i;
|
||||||
|
break compilerLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(compid == -1) {
|
||||||
|
System.out.println("This compiler is not supported. Add it!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("You chose compiler " + compiler);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if(args.length != 1) {
|
||||||
|
System.out.println("Invalid number of arguments.\n" + usage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new CoffeeBreak(args[0]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user