- java.lang.Object
-
- com.gluonhq.substrate.target.AbstractTargetConfiguration
-
- All Implemented Interfaces:
TargetConfiguration
- Direct Known Subclasses:
AndroidTargetConfiguration,IosTargetConfiguration,LinuxTargetConfiguration,MacOSTargetConfiguration,WebTargetConfiguration,WindowsTargetConfiguration
public abstract class AbstractTargetConfiguration extends java.lang.Object implements TargetConfiguration
AbstractTargetConfiguration is the main class that implements the necessary methods to compile, link and run a native image It is extended by different subclasses according to the selected target OS
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancrossCompileprotected static java.util.List<java.lang.String>ENABLED_FEATURES
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompile()Compile sets the required command line arguments and runs native-imageprotected booleancompileAdditionalSources()booleancreateSharedLib()Creates a native image that can be used as shared librarybooleancreateStaticLib()Creates a static libraryprotected java.nio.file.PathgetCLibPath()protected java.util.List<java.nio.file.Path>getLinkerLibraryPaths()Creates a list of Paths that will be added to the library search path for the linker.protected java.util.List<java.lang.String>getNativeCodeList()protected java.util.List<java.nio.file.Path>getStaticJDKLibPaths()protected java.util.List<java.lang.String>getTargetNativeCodeExtensions()booleaninstall()Installs the packaged application on the local system or on a device that is attached to the local system.booleanlink()Links a previously created objectfile with the required dependencies into a native executable or librarybooleanpackageApp()Creates a package of the application (including at least executable and other possible files) in a given format.java.lang.Stringrun()Runs the generated native imagebooleanrunUntilEnd()Run the generated native image and returns true if the process ended successfully
-
-
-
Method Detail
-
compile
public boolean compile() throws java.io.IOException, java.lang.InterruptedExceptionCompile sets the required command line arguments and runs native-image- Specified by:
compilein interfaceTargetConfiguration- Returns:
- true if the process ends successfully, false otherwise
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
link
public boolean link() throws java.io.IOException, java.lang.InterruptedExceptionDescription copied from interface:TargetConfigurationLinks a previously created objectfile with the required dependencies into a native executable or library- Specified by:
linkin interfaceTargetConfiguration- Returns:
- true if linking succeeded, false otherwise
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
packageApp
public boolean packageApp() throws java.io.IOException, java.lang.InterruptedExceptionCreates a package of the application (including at least executable and other possible files) in a given format. By default, this method is no-op returning true.- Specified by:
packageAppin interfaceTargetConfiguration- Returns:
- true if packaging succeeded or is a no-op, false if it failed.
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
install
public boolean install() throws java.io.IOException, java.lang.InterruptedExceptionInstalls the packaged application on the local system or on a device that is attached to the local system. By default, this method is no-op returning true.- Specified by:
installin interfaceTargetConfiguration- Returns:
- true if installing succeeded or is a no-op, false if it failed.
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
run
public java.lang.String run() throws java.io.IOException, java.lang.InterruptedExceptionRuns the generated native image- Specified by:
runin interfaceTargetConfiguration- Returns:
- a string with the last logged output of the process
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
runUntilEnd
public boolean runUntilEnd() throws java.io.IOException, java.lang.InterruptedExceptionRun the generated native image and returns true if the process ended successfully- Specified by:
runUntilEndin interfaceTargetConfiguration- Returns:
- true if the process ended successfully, false otherwise
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
createSharedLib
public boolean createSharedLib() throws java.io.IOException, java.lang.InterruptedExceptionCreates a native image that can be used as shared library- Specified by:
createSharedLibin interfaceTargetConfiguration- Returns:
- true if the process succeeded or false if the process failed
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
createStaticLib
public boolean createStaticLib() throws java.io.IOException, java.lang.InterruptedExceptionCreates a static library- Specified by:
createStaticLibin interfaceTargetConfiguration- Returns:
- true if the process succeeded or false if the process failed
- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
compileAdditionalSources
protected boolean compileAdditionalSources() throws java.io.IOException, java.lang.InterruptedException- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
getLinkerLibraryPaths
protected java.util.List<java.nio.file.Path> getLinkerLibraryPaths() throws java.io.IOExceptionCreates a list of Paths that will be added to the library search path for the linker. Targets are allowed to override this, e.g. in case they don't want the static JDK directory on the library path (see https://github.com/gluonhq/substrate/issues/879) Note: we should probably invert this logic: the static library path should not be used as linkLibraryPath unless explicitly asked by the target.- Returns:
- a list of Paths to add to the library search path
- Throws:
java.io.IOException
-
getTargetNativeCodeExtensions
protected java.util.List<java.lang.String> getTargetNativeCodeExtensions()
-
getNativeCodeList
protected java.util.List<java.lang.String> getNativeCodeList() throws java.io.IOException- Throws:
java.io.IOException
-
getCLibPath
protected java.nio.file.Path getCLibPath()
-
getStaticJDKLibPaths
protected java.util.List<java.nio.file.Path> getStaticJDKLibPaths() throws java.io.IOException- Throws:
java.io.IOException
-
-