[Assorted-commits] SF.net SVN: assorted: [467] simple-build/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-18 19:57:30
|
Revision: 467 http://assorted.svn.sourceforge.net/assorted/?rev=467&view=rev Author: yangzhang Date: 2008-02-18 11:57:27 -0800 (Mon, 18 Feb 2008) Log Message: ----------- added java support Modified Paths: -------------- simple-build/trunk/src/SimpleBuild.scala simple-build/trunk/src/build-templates/scala simple-build/trunk/src/setup.bash Added Paths: ----------- simple-build/trunk/src/build-templates/java simple-build/trunk/src/capture-javac-deps Removed Paths: ------------- simple-build/trunk/src/capture-scala-deps Modified: simple-build/trunk/src/SimpleBuild.scala =================================================================== --- simple-build/trunk/src/SimpleBuild.scala 2008-02-16 21:59:33 UTC (rev 466) +++ simple-build/trunk/src/SimpleBuild.scala 2008-02-18 19:57:27 UTC (rev 467) @@ -14,6 +14,7 @@ "c" -> "c", "cc" -> "cpp", "cpp" -> "cpp", + "java" -> "java", "scala" -> "scala" ) def err(x: AnyRef) { Console.err println x } @@ -35,6 +36,11 @@ "mainclass" -> "symbol", "classpath" -> "list|srcdir|:", "srcs" -> "list|srcdir| " + ), + "java" -> Map( + "mainclass" -> "symbol", + "classpath" -> "list|srcdir|:", + "srcs" -> "list|srcdir| " ) ) val ids = Iterator from 0 Copied: simple-build/trunk/src/build-templates/java (from rev 456, simple-build/trunk/src/build-templates/scala) =================================================================== --- simple-build/trunk/src/build-templates/java (rev 0) +++ simple-build/trunk/src/build-templates/java 2008-02-18 19:57:27 UTC (rev 467) @@ -0,0 +1,39 @@ +# Output locations. + +SCRIPT := $(OUTDIR)/$(TARGET) +ifeq (,$(VERSION)) + JAR := $(OUTDIR)/$(TARGET).jar +else + JAR := $(OUTDIR)/$(TARGET)-$(VERSION).jar +endif +CLASSDIR := $(OUTDIR)/$(TARGET)-classes + +# Flags. + +JAVACFLAGS:= -deprecation -unchecked -sourcepath $(SRCPATH) -d $(CLASSDIR) -cp $(CLASSPATH) +JAVAC := capture-javac-deps 2 $(JAR) $(OUTDIR)/.deps javac -verbose + +$(TARGET): $(SCRIPT) $(JAR) + +$(SCRIPT): $(MAKEFILE_LIST) + mkdir -p $(@D) + if [ ! -z "$(MAINCLASS)" ]; then \ + echo "#!/usr/bin/env bash\n\nJAVA_OPTS=\"$(JRUNFLAGS) \$${JAVA_OPTS:-}\" exec java -cp $(JAR):$(CLASSPATH) $(MAINCLASS) \"\$$@\"" > $(SCRIPT) ;\ + chmod +x $(SCRIPT) ;\ + fi + +$(JAR): $(SRCS) + mkdir -p $(CLASSDIR) + $(JAVAC) $(JAVACFLAGS) $< + jar cf $@ -C $(CLASSDIR) . + +-include $(OUTDIR)/.deps + +install: $(TARGET) + mkdir -p $(BINDIR) + cp $(SCRIPT) $(BINDIR) + +clean: + rm -rf $(SCRIPT) $(JAR) $(CLASSDIR) + +.PHONY: $(TARGET) clean Modified: simple-build/trunk/src/build-templates/scala =================================================================== --- simple-build/trunk/src/build-templates/scala 2008-02-16 21:59:33 UTC (rev 466) +++ simple-build/trunk/src/build-templates/scala 2008-02-18 19:57:27 UTC (rev 467) @@ -12,14 +12,16 @@ SRCPATH := $(SRCPATH):$(SCALA_COMMONS_SRC) SFLAGS := -deprecation -unchecked -sourcepath $(SRCPATH) -d $(CLASSDIR) -cp $(CLASSPATH) -SCALAC := capture-scala-deps $(JAR) $(OUTDIR)/.deps fsc -verbose +SCALAC := capture-javac-deps 1 $(JAR) $(OUTDIR)/.deps fsc -verbose $(TARGET): $(SCRIPT) $(JAR) $(SCRIPT): $(MAKEFILE_LIST) mkdir -p $(@D) - echo "#!/usr/bin/env bash\n\nJAVA_OPTS=\"$(JRUNFLAGS) \$${JAVA_OPTS:-}\" exec scala -cp $(JAR):$(CLASSPATH) $(MAINCLASS) \"\$$@\"" > $(SCRIPT) - chmod +x $(SCRIPT) + if [ ! -z "$(MAINCLASS)" ]; then \ + echo "#!/usr/bin/env bash\n\nJAVA_OPTS=\"$(JRUNFLAGS) \$${JAVA_OPTS:-}\" exec scala -cp $(JAR):$(CLASSPATH) $(MAINCLASS) \"\$$@\"" > $(SCRIPT) ;\ + chmod +x $(SCRIPT) ;\ + fi $(JAR): $(SRCS) mkdir -p $(CLASSDIR) Copied: simple-build/trunk/src/capture-javac-deps (from rev 456, simple-build/trunk/src/capture-scala-deps) =================================================================== --- simple-build/trunk/src/capture-javac-deps (rev 0) +++ simple-build/trunk/src/capture-javac-deps 2008-02-18 19:57:27 UTC (rev 467) @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset + +verbosefd="$1" +target="$2" +depsfile="$3" +shift; shift; shift + +# Get the top-level source files. This is no longer used. +mainsrcs=() +for i in "$@" ; do + if [[ "${i%.scala}" != "$i" ]] + then mainsrcs=( "${mainsrcs[@]:-$i}" "$i" ) + fi +done + +generate-deps() { + while read line ; do + if [[ "${line#[}" == "$line" ]] ; then + # Line doesn't start with '[' (normal output). + echo "$line" + else + # Line starts with '[' (verbose output). + echo "$line" 1>&3 + fi + done 3> >( + { + # Parse just the verbose output and emit the deps file. + echo "$target: \\" + sed -n ' + /^\[loaded source file / { + s/^\[loaded source file \(.*\) in [[:digit:]]*ms\]/\1/ + p + } + ' | sed ' + { s/^/\t/; s/$/ \\/ } + $ { a\\t + } + ' + } > "$depsfile" + ) +} + +# Run the compiler. Verbose output can come from either stdout or stderr. +case $verbosefd in + 1 ) "$@" 1> >( generate-deps ) ;; + 2 ) "$@" 2> >( generate-deps ) ;; + * ) echo "bad verbosefd: $verbosefd"; exit 1 ;; +esac Deleted: simple-build/trunk/src/capture-scala-deps =================================================================== --- simple-build/trunk/src/capture-scala-deps 2008-02-16 21:59:33 UTC (rev 466) +++ simple-build/trunk/src/capture-scala-deps 2008-02-18 19:57:27 UTC (rev 467) @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -o nounset - -target="$1" -depsfile="$2" -shift; shift - -# Get the top-level source files. This is no longer used. -mainsrcs=() -for i in "$@" ; do - if [[ "${i%.scala}" != "$i" ]] - then mainsrcs=( "${mainsrcs[@]:-$i}" "$i" ) - fi -done - -# Run the compiler. -"$@" | while read line ; do - if [[ "${line#[}" == "$line" ]] ; then - # Line doesn't start with '[' (normal output). - echo "$line" - else - # Line starts with '[' (verbose output). - echo "$line" 1>&3 - fi -done 3> >( - { - # Parse just the verbose output and emit the deps file. - echo "$target: \\" - sed -n ' - /^\[loaded source file / { - s/^\[loaded source file \(.*\) in [[:digit:]]*ms\]/\1/ - p - } - ' | sed ' - { s/^/\t/; s/$/ \\/ } - $ { a\\t - } - ' - } > "$depsfile" -) Modified: simple-build/trunk/src/setup.bash =================================================================== --- simple-build/trunk/src/setup.bash 2008-02-16 21:59:33 UTC (rev 466) +++ simple-build/trunk/src/setup.bash 2008-02-18 19:57:27 UTC (rev 467) @@ -3,4 +3,5 @@ pkg=simple-build . simple-setup.bash -install bin/ build.bash capture-scala-deps +install bin/ build.bash capture-javac-deps +install share/$pkg/ build-templates This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |