Skip to content

Commit

Permalink
Add environment hook for CLASSPATH
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <[email protected]>
  • Loading branch information
jacobperron committed Jul 9, 2021
1 parent 77e4d37 commit e16c81e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions colcon_gradle/task/gradle/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from distutils import dir_util
import glob
import os
from pathlib import Path
import shutil

from colcon_core.environment import create_environment_scripts
from colcon_core.logging import colcon_logger
from colcon_core.plugin_system import satisfies_version
from colcon_core.shell import create_environment_hook
from colcon_core.shell import get_command_environment
from colcon_core.task import run
from colcon_core.task import TaskExtensionPoint
Expand Down Expand Up @@ -62,6 +64,20 @@ async def build( # noqa: D102
logger.info(
"Building Gradle package in '{args.path}'".format_map(locals()))

if additional_hooks is None:
additional_hooks = []

# add jars and classes to CLASSPATH with wildcards
# https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html#A1100762
additional_hooks += create_environment_hook(
'classpath_jars', Path(args.install_base), pkg.name,
'CLASSPATH', os.path.join('share', pkg.name, 'java', '*'),
mode='prepend')
additional_hooks += create_environment_hook(
'classpath_classes', Path(args.install_base), pkg.name,
'CLASSPATH', os.path.join('share', pkg.name, 'java'),
mode='prepend')

try:
env = await get_command_environment(
'build', args.build_base, self.context.dependencies)
Expand Down

0 comments on commit e16c81e

Please sign in to comment.