clean out
add interface/InterfaceName target to create a template interface move generate_newclass.sh to generate_new.sh and take class or interface as argument Signed-off-by: philippe lhardy <philippe@pavilionartlogiciel>
This commit is contained in:
1
Makefile
1
Makefile
@@ -20,6 +20,7 @@ clean:
|
|||||||
rm -f build.xml
|
rm -f build.xml
|
||||||
rm -f dist/lib/$(DISTPREFIX)*.jar
|
rm -f dist/lib/$(DISTPREFIX)*.jar
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
cd java; make clean
|
||||||
|
|
||||||
cleanall: clean
|
cleanall: clean
|
||||||
rm -rf debian
|
rm -rf debian
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ cat <<EOF
|
|||||||
<!-- Create the distribution directory -->
|
<!-- Create the distribution directory -->
|
||||||
<mkdir dir="\${dist}/lib"/>
|
<mkdir dir="\${dist}/lib"/>
|
||||||
|
|
||||||
<!-- Put everything in \${build} into the ${project_name}-${project_version}}-${DSTAMP}.jar file -->
|
<!-- Put everything in \${build} into the ${project_name}-${project_version}.jar file ( \${DSTAMP} not used yet )-->
|
||||||
<jar jarfile="\${dist}/lib/${project_name}-${project_version}.jar" basedir="\${build}">
|
<jar jarfile="\${dist}/lib/${project_name}-${project_version}.jar" basedir="\${build}">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Main-Class" value="$project_mainclass"/>
|
<attribute name="Main-Class" value="$project_mainclass"/>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
PACKAGE=org.artisanlogiciel.games
|
PACKAGE=org.artisanlogiciel.games
|
||||||
PACKAGE_DIR=$(subst .,/,$(PACKAGE))
|
PACKAGE_DIR=$(subst .,/,$(PACKAGE))
|
||||||
OUT=out
|
OUT=out
|
||||||
|
EDITOR=emacs
|
||||||
|
|
||||||
$(OUT):
|
$(OUT):
|
||||||
mkdir -p $(OUT)
|
mkdir -p $(OUT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
find $(OUT) -name "*.class" -type f -print0|xargs -0 rm
|
@find $(OUT) -name "*.class" -type f -print0|xargs -0 rm 2>/dev/null || echo "nothing to clean"
|
||||||
|
|
||||||
test:
|
test:
|
||||||
javac -d $(OUT) $(PACKAGE_DIR)/LabyModel.java
|
javac -d $(OUT) $(PACKAGE_DIR)/LabyModel.java
|
||||||
@@ -29,17 +30,21 @@ compile/%:
|
|||||||
javac -d $(OUT) $(PACKAGE_DIR)/$(subst compile/,,$@).java
|
javac -d $(OUT) $(PACKAGE_DIR)/$(subst compile/,,$@).java
|
||||||
|
|
||||||
$(PACKAGE_DIR)/%.java:
|
$(PACKAGE_DIR)/%.java:
|
||||||
./generate_newclass.sh $(subst .java,,$(subst $(PACKAGE_DIR)/,,$@))
|
./generate_new.sh class $(subst .java,,$(subst $(PACKAGE_DIR)/,,$@))
|
||||||
|
|
||||||
|
interface/%:
|
||||||
|
./generate_new.sh interface package_dir=$(PACKAGE_DIR) $(subst interface/,,$@)
|
||||||
|
$(EDITOR) $(PACKAGE_DIR)/$(subst interface/,,$@).java
|
||||||
|
|
||||||
work/%: $(PACKAGE_DIR)/$(subst work/,,%).java
|
work/%: $(PACKAGE_DIR)/$(subst work/,,%).java
|
||||||
emacs $<
|
$(EDITOR) $<
|
||||||
|
|
||||||
work: work/LabyModel
|
work: work/LabyModel
|
||||||
|
|
||||||
save:
|
save:
|
||||||
git citool
|
git citool
|
||||||
|
|
||||||
.PHONY: clean test work display work/% run/% save compile/%
|
.PHONY: clean test work display work/% run/% save compile/% interface/%
|
||||||
|
|
||||||
# tried to avoid intermediate file removal : does not work
|
# tried to avoid intermediate file removal : does not work
|
||||||
# .SECONDARY: $(PACKAGE_DIR)/%.java
|
# .SECONDARY: $(PACKAGE_DIR)/%.java
|
||||||
|
|||||||
@@ -19,3 +19,6 @@ make run/Display
|
|||||||
|
|
||||||
#save work with git (ie git citool )
|
#save work with git (ie git citool )
|
||||||
make save
|
make save
|
||||||
|
|
||||||
|
# create an interface
|
||||||
|
make interface/InterfaceName
|
||||||
@@ -1,13 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#TODO : support "like=" to copy/renaming an existing class
|
||||||
|
|
||||||
PACKAGE=org.artisanlogiciel.games
|
PACKAGE=org.artisanlogiciel.games
|
||||||
|
|
||||||
|
TOOLP="$0 $*"
|
||||||
|
|
||||||
|
ctype=class
|
||||||
while [[ $# > 0 ]]
|
while [[ $# > 0 ]]
|
||||||
do
|
do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
class|interface)
|
||||||
|
ctype=$1
|
||||||
|
;;
|
||||||
package=*)
|
package=*)
|
||||||
PACKAGE=${1/package=/}
|
PACKAGE=${1/package=/}
|
||||||
;;
|
;;
|
||||||
|
package_dir=*)
|
||||||
|
PACKAGE_DIR=${1/package=/}
|
||||||
|
PACKAGE=${PACKAGE//\//\.}
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
CLASS=${1}
|
CLASS=${1}
|
||||||
;;
|
;;
|
||||||
@@ -36,13 +48,15 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|
||||||
|
if [[ $ctype == class ]]
|
||||||
|
then
|
||||||
cat <<EOF >$JAVA_FILE
|
cat <<EOF >$JAVA_FILE
|
||||||
package $PACKAGE;
|
package $PACKAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
$CLASS was autogenerated by $0
|
$CLASS was autogenerated by $TOOLP
|
||||||
**/
|
**/
|
||||||
public class $CLASS
|
public $ctype $CLASS
|
||||||
{
|
{
|
||||||
Object param;
|
Object param;
|
||||||
|
|
||||||
@@ -69,6 +83,27 @@ public class $CLASS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >$JAVA_FILE
|
||||||
|
package $PACKAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
$CLASS was autogenerated by $TOOLP
|
||||||
|
**/
|
||||||
|
public $ctype $CLASS
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
@return X
|
||||||
|
*/
|
||||||
|
int getX();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return Y
|
||||||
|
*/
|
||||||
|
int getY();
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$JAVA_FILE generated"
|
echo "$JAVA_FILE generated"
|
||||||
Reference in New Issue
Block a user