Struct android_build::JavaBuild

source ·
pub struct JavaBuild { /* private fields */ }
Expand description

A builder for a javac command that can be invoked.

If you need to customize the javac command beyond what is provided here, you can use the JavaBuild::command() method to get a Command that can be further customized with additional arguments.

Documentation on javac options are based on https://dev.java/learn/jvm/tools/core/javac/.

Implementations§

source§

impl JavaBuild

source

pub fn new() -> Self

Creates a new JavaBuild instance with default values, which can be further customized using the builder methods.

source

pub fn compile(&self) -> Result<ExitStatus>

Executes the javac command based on this JavaBuild instance.

source

pub fn command(&self) -> Result<Command>

Returns a Command based on this JavaBuild instance that can be inspected or customized before being executed.

source

pub fn java_home<P: Into<PathBuf>>(&mut self, java_home: P) -> &mut Self

Override the default JAVA_HOME path.

If not set, the default path is found using the JAVA_HOME env var.

source

pub fn debug_info(&mut self, debug_info: DebugInfo) -> &mut Self

Set which debug info should be included in the generated class files

source

pub fn nowarn(&mut self, nowarn: bool) -> &mut Self

If set to true, all warnings are disabled.

source

pub fn verbose(&mut self, verbose: bool) -> &mut Self

Enable verbose output.

source

pub fn deprecation(&mut self, deprecation: bool) -> &mut Self

Configure the output about deprecation usage.

  • If true, javac will output full descriptions of all places where deprecated members/classes are used or overridden.
  • If false, javac will output only a summary on a per-source file basis.
source

pub fn enable_preview_features( &mut self, enable_preview_features: bool ) -> &mut Self

Enable or disable preview language features.

source

pub fn class_path<P: AsRef<OsStr>>(&mut self, class_path: P) -> &mut Self

Specify where to find user class files and annotation processors.

If no class paths are provided, the current directory will be used.

source

pub fn source_path<P: AsRef<OsStr>>(&mut self, source_path: P) -> &mut Self

Specify where to find input source files.

If not specified, class_paths will be searched for source files.

source

pub fn boot_class_path<P: AsRef<OsStr>>( &mut self, boot_class_path: P ) -> &mut Self

Specify where to find bootstrap class files.

If set, this will override the default search locations.

source

pub fn extension_dir<P: AsRef<OsStr>>(&mut self, extension_dir: P) -> &mut Self

Specify where to find installed extensions.

If set, this will override the default search locations.

source

pub fn endorsed_dir<P: AsRef<OsStr>>(&mut self, endorsed_dir: P) -> &mut Self

Specify where to find endorsed standards.

If set, this will override the default endorsed standards path.

source

pub fn annotation_processor<S: AsRef<OsStr>>( &mut self, annotation_processor: S ) -> &mut Self

Add an annotation processor to be run during compilation.

Setting this will bypass the default discovery process.

source

pub fn annotation_processor_path<P: AsRef<OsStr>>( &mut self, annotation_processor_path: P ) -> &mut Self

Add a path to search for annotation processors.

If not provided, the class paths will be searched by default.

source

pub fn method_paramater_metadata( &mut self, method_paramater_metadata: bool ) -> &mut Self

Enable generation of metadata on method parameters such that the reflection API can be used to retrieve parameter info.

source

pub fn classes_out_dir<P: AsRef<OsStr>>( &mut self, classes_out_dir: P ) -> &mut Self

Specify where to place generated class files.

If not provided, class files will be placed in the same directory as the source files.

source

pub fn sources_out_dir<P: AsRef<OsStr>>( &mut self, sources_out_dir: P ) -> &mut Self

Specify where to place generated source files.

source

pub fn headers_out_dir<P: AsRef<OsStr>>( &mut self, headers_out_dir: P ) -> &mut Self

Specify where to place generated native header files.

source

pub fn annotation_parameter<K, V>(&mut self, key: K, value: V) -> &mut Self
where K: Into<String>, V: Into<String>,

Add a key-value pair to be passed as an option to an annotation processor.

source

pub fn warnings_as_errors(&mut self, warnings_as_errors: bool) -> &mut Self

If set to true, warnings are treated as compilation errors.

source

pub fn file<P: AsRef<OsStr>>(&mut self, file: P) -> &mut Self

Adds a Java source file to be compiled by javac.

source

pub fn files<P>(&mut self, files: P) -> &mut Self
where P: IntoIterator, P::Item: AsRef<OsStr>,

Adds multiple Java source files to be compiled by javac.

This is the same as calling JavaBuild::file() multiple times.

Trait Implementations§

source§

impl Clone for JavaBuild

source§

fn clone(&self) -> JavaBuild

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for JavaBuild

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for JavaBuild

source§

fn default() -> JavaBuild

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.