/[gentoo-x86]/eclass/java-utils-2.eclass
Gentoo

Diff of /eclass/java-utils-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.168 Revision 1.169
4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> 4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5# Copyright (c) 2004-2015, Gentoo Foundation 5# Copyright (c) 2004-2015, Gentoo Foundation
6# 6#
7# Licensed under the GNU General Public License, v2 7# Licensed under the GNU General Public License, v2
8# 8#
9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.168 2015/07/31 07:56:17 monsieurp Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.169 2015/08/02 23:12:16 chewi Exp $
10 10
11# @ECLASS: java-utils-2.eclass 11# @ECLASS: java-utils-2.eclass
12# @MAINTAINER: 12# @MAINTAINER:
13# java@gentoo.org 13# java@gentoo.org
14# @AUTHOR: 14# @AUTHOR:
260 pushd "${dir}" > /dev/null || die "pushd ${dir} failed" 260 pushd "${dir}" > /dev/null || die "pushd ${dir} failed"
261 find -L -type f ! -path "./target/*" ! -path "./sources.lst" ! -name "MANIFEST.MF" ! -regex ".*\.\(class\|jar\|java\)" "${@}" -print0 | xargs -0 jar uf "${jar}" || die "jar failed" 261 find -L -type f ! -path "./target/*" ! -path "./sources.lst" ! -name "MANIFEST.MF" ! -regex ".*\.\(class\|jar\|java\)" "${@}" -print0 | xargs -0 jar uf "${jar}" || die "jar failed"
262 popd > /dev/null || die "popd failed" 262 popd > /dev/null || die "popd failed"
263} 263}
264 264
265# @FUNCTION: java-pkg_rm_files 265# @FUNCTION: java-pkg_rm_files
266# @USAGE: java-pkg_rm_files File1.java File2.java ... 266# @USAGE: java-pkg_rm_files File1.java File2.java ...
267# @DESCRIPTION: 267# @DESCRIPTION:
268# Remove unneeded files in ${S}. 268# Remove unneeded files in ${S}.
269# 269#
270# Every now and then, you'll run into situations whereby a file needs removing, 270# Every now and then, you'll run into situations whereby a file needs removing,
271# be it a unit test or a regular java class. 271# be it a unit test or a regular java class.
272# 272#
273# You can use this function by either: 273# You can use this function by either:
274# - calling it yourself in java_prepare() and feeding java-pkg_rm_files with 274# - calling it yourself in java_prepare() and feeding java-pkg_rm_files with
275# the list of files you wish to remove. 275# the list of files you wish to remove.
276# - defining an array in the ebuild named JAVA_RM_FILES with the list of files 276# - defining an array in the ebuild named JAVA_RM_FILES with the list of files
277# you wish to remove. 277# you wish to remove.
1581# @DESCRIPTION: 1581# @DESCRIPTION:
1582# Returns the compiler executable 1582# Returns the compiler executable
1583java-pkg_get-javac() { 1583java-pkg_get-javac() {
1584 debug-print-function ${FUNCNAME} $* 1584 debug-print-function ${FUNCNAME} $*
1585 1585
1586 1586 java-pkg_init-compiler_
1587 local compiler="${GENTOO_COMPILER}" 1587 local compiler="${GENTOO_COMPILER}"
1588 1588
1589 local compiler_executable 1589 local compiler_executable
1590 if [[ "${compiler}" = "javac" ]]; then 1590 if [[ "${compiler}" = "javac" ]]; then
1591 # nothing fancy needs to be done for javac 1591 # nothing fancy needs to be done for javac
1600 # try to get value of JAVAC 1600 # try to get value of JAVAC
1601 compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})" 1601 compiler_executable="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${JAVAC})"
1602 export JAVAC=${old_javac} 1602 export JAVAC=${old_javac}
1603 1603
1604 if [[ -z ${compiler_executable} ]]; then 1604 if [[ -z ${compiler_executable} ]]; then
1605 echo "JAVAC is empty or undefined in ${compiler_env}" 1605 die "JAVAC is empty or undefined in ${compiler_env}"
1606 return 1
1607 fi 1606 fi
1608 1607
1609 # check that it's executable 1608 # check that it's executable
1610 if [[ ! -x ${compiler_executable} ]]; then 1609 if [[ ! -x ${compiler_executable} ]]; then
1611 echo "${compiler_executable} doesn't exist, or isn't executable" 1610 die "${compiler_executable} doesn't exist, or isn't executable"
1612 return 1
1613 fi 1611 fi
1614 else 1612 else
1615 echo "Could not find environment file for ${compiler}" 1613 die "Could not find environment file for ${compiler}"
1616 return 1
1617 fi 1614 fi
1618 fi 1615 fi
1619 echo ${compiler_executable} 1616 echo ${compiler_executable}
1620} 1617}
1621 1618
1636 1633
1637 debug-print "want source: ${want_source}" 1634 debug-print "want source: ${want_source}"
1638 debug-print "want target: ${want_target}" 1635 debug-print "want target: ${want_target}"
1639 1636
1640 if [[ -z "${want_source}" || -z "${want_target}" ]]; then 1637 if [[ -z "${want_source}" || -z "${want_target}" ]]; then
1641 debug-print "could not find valid -source/-target values for javac"
1642 echo "Could not find valid -source/-target values for javac" 1638 die "Could not find valid -source/-target values for javac"
1643 return 1
1644 else 1639 else
1645 echo "${source_str} ${target_str}" 1640 echo "${source_str} ${target_str}"
1646 fi 1641 fi
1647} 1642}
1648 1643
2004# Javac wrapper function. Will use the appropriate compiler, based on 1999# Javac wrapper function. Will use the appropriate compiler, based on
2005# /etc/java-config/compilers.conf 2000# /etc/java-config/compilers.conf
2006ejavac() { 2001ejavac() {
2007 debug-print-function ${FUNCNAME} $* 2002 debug-print-function ${FUNCNAME} $*
2008 2003
2009 java-pkg_init-compiler_
2010
2011 local compiler_executable 2004 local compiler_executable
2012 compiler_executable=$(java-pkg_get-javac) 2005 compiler_executable=$(java-pkg_get-javac)
2013 if [[ ${?} != 0 ]]; then
2014 eerror "There was a problem determining compiler: ${compiler_executable}"
2015 die "get-javac failed"
2016 fi
2017 2006
2018 local javac_args 2007 local javac_args
2019 javac_args="$(java-pkg_javac-args)" 2008 javac_args="$(java-pkg_javac-args)"
2020 if [[ ${?} != 0 ]]; then
2021 eerror "There was a problem determining JAVACFLAGS: ${javac_args}"
2022 die "java-pkg_javac-args failed"
2023 fi
2024 2009
2025 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}" 2010 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
2026 ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed" 2011 ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
2027} 2012}
2028 2013
2624 java-pkg_setup-vm 2609 java-pkg_setup-vm
2625 2610
2626 export JAVA=$(java-config --java) 2611 export JAVA=$(java-config --java)
2627 export JAVAC=$(java-config --javac) 2612 export JAVAC=$(java-config --javac)
2628 JAVACFLAGS="$(java-pkg_javac-args)" 2613 JAVACFLAGS="$(java-pkg_javac-args)"
2629 if [[ ${?} != 0 ]]; then
2630 eerror "There was a problem determining JAVACFLAGS: ${JAVACFLAGS}"
2631 die "java-pkg_javac-args failed"
2632 fi
2633 [[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}" 2614 [[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}"
2634 export JAVACFLAGS 2615 export JAVACFLAGS
2635 2616
2636 export JAVA_HOME="$(java-config -g JAVA_HOME)" 2617 export JAVA_HOME="$(java-config -g JAVA_HOME)"
2637 export JDK_HOME=${JAVA_HOME} 2618 export JDK_HOME=${JAVA_HOME}

Legend:
Removed from v.1.168  
changed lines
  Added in v.1.169

  ViewVC Help
Powered by ViewVC 1.1.20