This is an old revision of the document!
My wishlist of Java related checks in portlint
I am no Perl hacker nor I have time to learn Perl for now. Still there are many Java related sanity checks that could be performed by portlint. I will list them here just in case some volunteer shows up…
bsd.java.mk 2.0 syntax
WHEN: defined(_USE_BSD_JAVA_MK_1_0)
LEVEL: Warning (but will soon be critical)
MESSAGE: The port uses bsd.java.mk 1.0 syntax. You should consider updating it to 2.0 syntax. Please refer to the Porter's handbook for further information.
Use of Java features without USE_JAVA
WHEN: !defined(USE_JAVA) && (defined(JAVA_VERSION) || defined(JAVA_OS) || defined(JAVA_VENDOR) || defined(USE_ANT) || defined(JAVA_RUN) || defined(JAVA_BUILD) || defined(USE_JIKES))
LEVEL: Critical
MESSAGE: The port uses Java features but USE_JAVA is not defined.
Use of Ant and GNU Make
WHEN: defined(USE_ANT) && defined(USE_GMAKE)
LEVEL: Warning
MESSAGE: A port shall not define both USE_ANT and USE_GMAKE.
Use of Ant and do-build
WHEN: defined(USE_ANT) && target(do-build)
LEVEL: Critical
MESSAGE: USE_ANT is intended only for ports that build with Ant. You should not override 'do-build' when also defining USE_ANT.
Use of Java features without the 'java' category
WHEN: defined(USE_JAVA) && "${CATEGORIES:Mjava}"==""
LEVEL: Warning
MESSAGE: The port uses Java but is not part of the 'java' category.
Only 'java' category
WHEN: "${CATEGORIES:Mjava}" == "${CATEGORIES}"
LEVEL: Critical
MESSAGE: The java category shall not be the only one for a port.
'java' main catefory
WHEN: echo “${CATEGORIES}” | grep -q '^java'
LEVEL: Warning
MESSAGE: Save for ports directly related to the Java language, porters are also encouraged not to use java as the main category of a port.
NOTE: This check is only to pbe performed for new ports
NO_BUILD and JAVA_BUILD
WHEN: defined(NO_BUILD) && defined(JAVA_BUILD)
LEVEL: Critical
MESSAGE: JAVA_BUILD and NO_BUILD cannot be set at the same time.
NOTE: This check is already performed by bsd.java.mk but I would prefer it to be in portlint to speedup index build (and cleanup bsd.*.mk).
Use of JAVAJARDIR
WHEN: grep -q '\${PREFIX}/share/java/classes' Makefile
LEVEL: Critical
MESSAGE: You should use ${JAVAJARDIR} rather than ${PREFIX}/share/java/classes
Use of JAVASHAREDIR
WHEN: grep -q '\${PREFIX}/share/java' Makefile
LEVEL: Critical
MESSAGE: You should use ${JAVASHAREDIR} rather than ${PREFIX}/share/java
Use of JAVALIBDIR
WHEN: make PREFIX=XXX -V BUILD_DEPENDS -V RUN_DEPENDS | grep -q 'XXX/share/java/classes'
LEVEL: Critical
MESSAGE: You should use ${JAVALIBDIR} in BUILD_DEPENDS/RUN_DEPENDS to define dependencies on JAR files installed in ${JAVAJARDIR}.
Use of 'javavm'
WHEN: grep -q 'javavm' ${FILESDIR}/*
LEVEL: Warning
MESSAGE: Since javavmwrapper 2.0, the 'javavm' command to invoke a JVM is deprecated. Use 'java' instead.