gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 152d518)
raw | patch | inline | side by side (parent: 152d518)
author | Doni Pracner <quinnuendo@gmail.com> | |
Thu, 13 Mar 2014 21:20:02 +0000 (22:20 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Thu, 13 Mar 2014 21:20:02 +0000 (22:20 +0100) |
build.xml | patch | blob | history | |
com/quemaster/ant/m2/m2compile.java | [deleted file] | patch | blob | history |
src/com/quemaster/ant/m2/m2compile.java | [new file with mode: 0644] | patch | blob |
src/svetovid/next.java | [new file with mode: 0644] | patch | blob |
svetovid/next.java | [deleted file] | patch | blob | history |
diff --git a/build.xml b/build.xml
index 4e3a24c2601fdacc2040719711b6e3c02fc73f90..5504b9d521c40e0ea221d9d87131175f749ebf00 100644 (file)
--- a/build.xml
+++ b/build.xml
<project name="ant-tasks" default='build'>
<property name="bin.dir" value="bin"/>
<project name="ant-tasks" default='build'>
<property name="bin.dir" value="bin"/>
- <property name="src.dir" value="."/>
+ <property name="src.dir" value="src"/>
<property name="dist.dir" value='dist'/>
<target name='init'>
<property name="dist.dir" value='dist'/>
<target name='init'>
diff --git a/com/quemaster/ant/m2/m2compile.java b/com/quemaster/ant/m2/m2compile.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.quemaster.ant.m2;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.condition.Os;
-import java.util.ArrayList;
-
-import java.io.*;
-
-/**
- m2compile is an Ant Task that executes a Modula 2 compiler on the give
- module in the given dir. Currently it just assumes that the Native
- XDS Modula 2 compiler "xc" is in the PATH, and if the OS is not
- in the Windows family uses "wine" to execute it.
- */
-public class m2compile extends Task {
- private String module="program";
- private File dir=null;
-
-
-
- // needs to check wheter the compilation is needed
- // based on the timestamps of the exe and mod
-
- // The method executing the task
- public void execute() throws BuildException {
- int exit = -1;
- ArrayList<String> list = new ArrayList<String>();
- if (!Os.isFamily(Os.FAMILY_WINDOWS))
- list.add("wine");
- list.add("xc");
- list.add("=make");
- list.add("=all");
- list.add(module);
- try{
- ProcessBuilder pb = new ProcessBuilder(list);
- pb.directory(dir);
- pb.inheritIO();
-
- Process p = pb.start();
- p.waitFor();
- exit = p.exitValue();
-
- }catch (Exception ex) {
- throw new BuildException(ex);
- }
- if (exit != 0)
- throw new BuildException("compilation ended with code "+exit);
- }
-
- public void setModule(String msg) {
- this.module = msg;
- }
-
- public void setDir(File msg) {
- this.dir = msg;
- }
-
- public static void main(String[] args){
- m2compile m = new m2compile();
-
- m.execute();
- }
-}
diff --git a/src/com/quemaster/ant/m2/m2compile.java b/src/com/quemaster/ant/m2/m2compile.java
--- /dev/null
@@ -0,0 +1,64 @@
+package com.quemaster.ant.m2;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import java.util.ArrayList;
+
+import java.io.*;
+
+/**
+ m2compile is an Ant Task that executes a Modula 2 compiler on the give
+ module in the given dir. Currently it just assumes that the Native
+ XDS Modula 2 compiler "xc" is in the PATH, and if the OS is not
+ in the Windows family uses "wine" to execute it.
+ */
+public class m2compile extends Task {
+ private String module="program";
+ private File dir=null;
+
+
+
+ // needs to check wheter the compilation is needed
+ // based on the timestamps of the exe and mod
+
+ // The method executing the task
+ public void execute() throws BuildException {
+ int exit = -1;
+ ArrayList<String> list = new ArrayList<String>();
+ if (!Os.isFamily(Os.FAMILY_WINDOWS))
+ list.add("wine");
+ list.add("xc");
+ list.add("=make");
+ list.add("=all");
+ list.add(module);
+ try{
+ ProcessBuilder pb = new ProcessBuilder(list);
+ pb.directory(dir);
+ pb.inheritIO();
+
+ Process p = pb.start();
+ p.waitFor();
+ exit = p.exitValue();
+
+ }catch (Exception ex) {
+ throw new BuildException(ex);
+ }
+ if (exit != 0)
+ throw new BuildException("compilation ended with code "+exit);
+ }
+
+ public void setModule(String msg) {
+ this.module = msg;
+ }
+
+ public void setDir(File msg) {
+ this.dir = msg;
+ }
+
+ public static void main(String[] args){
+ m2compile m = new m2compile();
+
+ m.execute();
+ }
+}
diff --git a/src/svetovid/next.java b/src/svetovid/next.java
--- /dev/null
+++ b/src/svetovid/next.java
@@ -0,0 +1,106 @@
+package svetovid;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+import java.io.*;
+
+/**
+ * Na osnovu spiska i trenutnog studenta nadji sledeceg.
+ * cita se iz current.txt, a pise u taj i current.properties
+ * Ovo se onda korisiti za kopiranje fajlova u buildu
+ * (bio je task init)
+ */
+public class next extends Task {
+ private String student, group;
+ private String current;
+ private String file="studenti.txt";
+ private String separator="\t";
+ private String currentFilename="current.txt",
+ currentProperties="current.properties";
+
+
+ private void setCurrent(String c) throws Exception{
+ current = c;
+ if (current != null){
+ String[] s = current.split(separator);
+ if (s.length<2)
+ throw new Exception("problem setting current student name - can't split group and name");
+ student = s[1];
+ group = s[0];
+ } else {
+ student = null;
+ group = null;
+ }
+ }
+
+ private void loadCurrent(){
+ try{
+ File f = new File(currentFilename);
+ if (f.exists()){
+ BufferedReader r = new BufferedReader(
+ new InputStreamReader(
+ new FileInputStream(f)));
+ setCurrent(r.readLine());
+ r.close();
+ } else
+ setCurrent(null);
+ }catch (Exception ex) {
+ throw new BuildException(ex);
+ }
+ }
+
+ private void saveCurrent(){
+ try{
+ PrintWriter w = new PrintWriter(new FileWriter(currentFilename));
+ w.println(current);
+ w.close();
+ }catch (Exception ex) {
+ throw new BuildException(ex);
+ }
+ //now the properties file
+ try{
+ PrintWriter w = new PrintWriter(new FileWriter(currentProperties));
+ w.println("student.group="+group);
+ w.println("student.current="+student);
+ w.close();
+ }catch (Exception ex) {
+ throw new BuildException(ex);
+ }
+ }
+
+ // The method executing the task
+ public void execute() throws BuildException {
+ loadCurrent();
+ try{
+ BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+ String s = r.readLine();
+ if (current != null) {
+ while (s!=null && s.compareTo(current)!=0)
+ s= r.readLine();
+ setCurrent(r.readLine());
+ } else {
+ setCurrent(s);
+ }
+ r.close();
+ }catch (Exception ex) {
+ throw new BuildException(ex);
+ }
+ saveCurrent();
+ }
+
+ public void setSeparator(String msg) {
+ this.separator = msg;
+ }
+
+ public void setFile(String msg) {
+ this.file = msg;
+ }
+
+ public void setCurrentFilename(String msg) {
+ this.currentFilename = msg;
+ }
+ public void setCurrentProperties(String msg) {
+ this.currentProperties = msg;
+ }
+}
diff --git a/svetovid/next.java b/svetovid/next.java
--- a/svetovid/next.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package svetovid;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-import java.io.*;
-
-/**
- * Na osnovu spiska i trenutnog studenta nadji sledeceg.
- * cita se iz current.txt, a pise u taj i current.properties
- * Ovo se onda korisiti za kopiranje fajlova u buildu
- * (bio je task init)
- */
-public class next extends Task {
- private String student, group;
- private String current;
- private String file="studenti.txt";
- private String separator="\t";
- private String currentFilename="current.txt",
- currentProperties="current.properties";
-
-
- private void setCurrent(String c) throws Exception{
- current = c;
- if (current != null){
- String[] s = current.split(separator);
- if (s.length<2)
- throw new Exception("problem setting current student name - can't split group and name");
- student = s[1];
- group = s[0];
- } else {
- student = null;
- group = null;
- }
- }
-
- private void loadCurrent(){
- try{
- File f = new File(currentFilename);
- if (f.exists()){
- BufferedReader r = new BufferedReader(
- new InputStreamReader(
- new FileInputStream(f)));
- setCurrent(r.readLine());
- r.close();
- } else
- setCurrent(null);
- }catch (Exception ex) {
- throw new BuildException(ex);
- }
- }
-
- private void saveCurrent(){
- try{
- PrintWriter w = new PrintWriter(new FileWriter(currentFilename));
- w.println(current);
- w.close();
- }catch (Exception ex) {
- throw new BuildException(ex);
- }
- //now the properties file
- try{
- PrintWriter w = new PrintWriter(new FileWriter(currentProperties));
- w.println("student.group="+group);
- w.println("student.current="+student);
- w.close();
- }catch (Exception ex) {
- throw new BuildException(ex);
- }
- }
-
- // The method executing the task
- public void execute() throws BuildException {
- loadCurrent();
- try{
- BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
- String s = r.readLine();
- if (current != null) {
- while (s!=null && s.compareTo(current)!=0)
- s= r.readLine();
- setCurrent(r.readLine());
- } else {
- setCurrent(s);
- }
- r.close();
- }catch (Exception ex) {
- throw new BuildException(ex);
- }
- saveCurrent();
- }
-
- public void setSeparator(String msg) {
- this.separator = msg;
- }
-
- public void setFile(String msg) {
- this.file = msg;
- }
-
- public void setCurrentFilename(String msg) {
- this.currentFilename = msg;
- }
- public void setCurrentProperties(String msg) {
- this.currentProperties = msg;
- }
-}