Class BuildContext

java.lang.Object
io.quarkus.builder.BuildContext

public final class BuildContext extends Object
The context passed to a deployer's operation.
Author:
David M. Lloyd
  • Constructor Details

  • Method Details

    • getBuildTargetName

      public String getBuildTargetName()
      Get the name of this build target. The resultant string is useful for diagnostic messages and does not have any other significance.
      Returns:
      the name of this build target (not null)
    • produce

      public void produce(BuildItem item)
      Produce the given item. If the type refers to an item which is declared with multiplicity, then this method can be called more than once for the given type, otherwise it must be called no more than once.
      Parameters:
      item - the item value (must not be null)
      Throws:
      IllegalArgumentException - if the item does not allow multiplicity but this method is called more than one time, or if the type of item could not be determined
    • produce

      public void produce(List<? extends MultiBuildItem> items)
      Produce the given items. This method can be called more than once for the given type
      Parameters:
      items - the items (must not be null)
      Throws:
      IllegalArgumentException - if the type of item could not be determined
    • produce

      public <T extends BuildItem> void produce(Class<T> type, T item)
      Produce the given item. If the type refers to an item which is declared with multiplicity, then this method can be called more than once for the given type, otherwise it must be called no more than once.
      Parameters:
      type - the item type (must not be null)
      item - the item value (may be null)
      Throws:
      IllegalArgumentException - if this deployer was not declared to produce type, or if type is null, or if the item does not allow multiplicity but this method is called more than one time
    • consume

      public <T extends SimpleBuildItem> T consume(Class<T> type)
      Consume the value produced for the named item.
      Parameters:
      type - the item type (must not be null)
      Returns:
      the produced item (may be null)
      Throws:
      IllegalArgumentException - if this deployer was not declared to consume type, or if type is null
      ClassCastException - if the cast failed
    • consumeMulti

      public <T extends MultiBuildItem> List<T> consumeMulti(Class<T> type)
      Consume all the values produced for the named item. If the item type implements Comparable, it will be sorted by natural order before return. The returned list is a mutable copy.
      Parameters:
      type - the item element type (must not be null)
      Returns:
      the produced items (may be empty, will not be null)
      Throws:
      IllegalArgumentException - if this deployer was not declared to consume type, or if type is null
    • consumeMulti

      public <T extends MultiBuildItem> List<T> consumeMulti(Class<T> type, Comparator<? super T> comparator)
      Consume all the values produced for the named item, re-sorting it according to the given comparator. The returned list is a mutable copy.
      Parameters:
      type - the item element type (must not be null)
      comparator - the comparator to use (must not be null)
      Returns:
      the produced items (may be empty, will not be null)
      Throws:
      IllegalArgumentException - if this deployer was not declared to consume type, or if type is null
    • note

      public void note(Location location, String format, Object... args)
      Emit a build note. This indicates information that the user may be interested in.
      Parameters:
      location - the location of interest (may be null)
      format - the format string (see String.format(String, Object...))
      args - the format arguments
    • warn

      public void warn(Location location, String format, Object... args)
      Emit a build warning. This indicates a significant build problem that the user should be made aware of.
      Parameters:
      location - the location of interest (may be null)
      format - the format string (see String.format(String, Object...))
      args - the format arguments
    • error

      public void error(Location location, String format, Object... args)
      Emit a build error. This indicates a build problem that prevents the build from proceeding.
      Parameters:
      location - the location of interest (may be null)
      format - the format string (see String.format(String, Object...))
      args - the format arguments
    • getExecutor

      public ExecutorService getExecutor()
      Get an executor which can be used for asynchronous tasks.
      Returns:
      an executor which can be used for asynchronous tasks
    • depFinished

      void depFinished()
    • run

      void run()