Package org.robovm.compiler.target
Class AbstractTarget
java.lang.Object
org.robovm.compiler.target.AbstractTarget
- All Implemented Interfaces:
Target
- Direct Known Subclasses:
ConsoleTarget,FrameworkTarget,IOSTarget
public abstract class AbstractTarget extends Object implements Target
- Author:
- niklas
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTarget() -
Method Summary
Modifier and Type Method Description voidarchive()Creates an archive suitable for distribution and stores it in theConfig.getInstallDir()directory.Filebuild(List<File> objectFiles)Builds a binary out of the specified object files.protected Targetbuild(Config config)voidbuildFat(Map<Arch,File> slices)Builds a fat binary out of the specified slices.booleancanLaunch()Returnstrueif binaries created by thisTargetcan be launched, i.e.booleancanLaunchInPlace()Returnstrueif binaries created by thisTargetcan be launched in place and doesn't have to be copied into some folder structure, e.g.protected voidcopyAppExtensions(File destDir)protected voidcopyDynamicFrameworks(File destDir, File appExecutable)protected voidcopyFile(Resource resource, File file, File destDir)protected voidcopyResources(File destDir)protected voidcopySwiftLibs(Collection<String> swiftLibraries, File targetDir, boolean strip)protected voidcopyWatchApp(File installDir)Copies watch app and its extensionsprotected LaunchercreateLauncher(LaunchParameters launchParameters)LaunchParameterscreateLaunchParameters()CreatesLaunchParametersfor launching the binary built by thisTarget.protected voiddoBuild(File outFile, List<String> ccArgs, List<File> objectFiles, List<String> libs)protected voiddoInstall(File installDir, File executable, File resourcesDir)protected voiddoInstall(File installDir, String image, File resourcesDir)protected ProcessdoLaunch(LaunchParameters launchParameters)protected FilefindDirectoryInLocations(String dirName, List<File> locations)finds directory in specified location listprotected FilegetAppDir()protected StringgetBundleId()List<Arch>getDefaultArchs()Returns a list of the default archs to build for if no archs have been specified in theConfig.protected StringgetExecutable()StringgetInstallRelativeArchivePath(Path path)protected voidgetSwiftDependencies(File file, Collection<String> swiftLibraries)protected List<String>getTargetCcArgs()protected List<String>getTargetExportedSymbols()protected List<String>getTargetLibs()voidinit(Config config)voidinstall()Installs the built binary and any supporting files into theConfig.getInstallDir()directory.protected booleanisAppExtension(File file)protected booleanisDynamicLibrary(File file)protected booleanisStaticLibrary(File file)Processlaunch(LaunchParameters launchParameters)Launches the built binary if supported.voidprepareLaunch()performs prepare launch activitiesprotected voidstripArchive(Path path, File output)protected voidstripArchives(File installDir)protected voidstripBitcode(File libFile)removes bitcode from frameworks/libraries to minimize sizeprotected voidstripExtraArches(File libFile)removes all architectures extra architectures other than binary is build for from mach-o binary (framework, lib, appext)protected StringupdateAppExtensionBundleId(File extensionPath, AppExtension config, String parentBundleId)updates application extension bundle id
-
Field Details
-
config
-
-
Constructor Details
-
AbstractTarget
protected AbstractTarget()
-
-
Method Details
-
init
Description copied from interface:Target -
canLaunch
public boolean canLaunch()Description copied from interface:TargetReturnstrueif binaries created by thisTargetcan be launched, i.e. it produces executable binaries. -
prepareLaunch
Description copied from interface:Targetperforms prepare launch activities- Specified by:
prepareLaunchin interfaceTarget- Throws:
IOException
-
createLaunchParameters
Description copied from interface:TargetCreatesLaunchParametersfor launching the binary built by thisTarget.- Specified by:
createLaunchParametersin interfaceTarget
-
getInstallRelativeArchivePath
- Specified by:
getInstallRelativeArchivePathin interfaceTarget
-
canLaunchInPlace
public boolean canLaunchInPlace()Description copied from interface:TargetReturnstrueif binaries created by thisTargetcan be launched in place and doesn't have to be copied into some folder structure, e.g. an iOS app bundle.- Specified by:
canLaunchInPlacein interfaceTarget
-
getTargetExportedSymbols
-
getTargetCcArgs
-
getTargetLibs
-
build
Description copied from interface:TargetBuilds a binary out of the specified object files.- Specified by:
buildin interfaceTarget- Throws:
IOException
-
doBuild
protected void doBuild(File outFile, List<String> ccArgs, List<File> objectFiles, List<String> libs) throws IOException- Throws:
IOException
-
getAppDir
-
getExecutable
-
getBundleId
-
buildFat
Description copied from interface:TargetBuilds a fat binary out of the specified slices.- Specified by:
buildFatin interfaceTarget- Throws:
IOException
-
copyResources
- Throws:
IOException
-
copyDynamicFrameworks
- Throws:
IOException
-
getSwiftDependencies
protected void getSwiftDependencies(File file, Collection<String> swiftLibraries) throws IOException- Throws:
IOException
-
copyAppExtensions
- Throws:
IOException
-
findDirectoryInLocations
finds directory in specified location list- Returns:
- path to directory or null if not found
-
updateAppExtensionBundleId
protected String updateAppExtensionBundleId(File extensionPath, AppExtension config, String parentBundleId)updates application extension bundle id- Parameters:
extensionPath- directory of extensionconfig- config of app extensionparentBundleId- bundle id of application (parent)- Returns:
- updated bundle ID
-
copyWatchApp
Copies watch app and its extensions- Parameters:
installDir- application install dir- Throws:
IOException
-
copySwiftLibs
protected void copySwiftLibs(Collection<String> swiftLibraries, File targetDir, boolean strip) throws IOException- Throws:
IOException
-
stripExtraArches
removes all architectures extra architectures other than binary is build for from mach-o binary (framework, lib, appext)- Throws:
IOException
-
stripBitcode
removes bitcode from frameworks/libraries to minimize size- Throws:
IOException
-
isDynamicLibrary
- Throws:
IOException
-
isStaticLibrary
- Throws:
IOException
-
isAppExtension
- Throws:
IOException
-
copyFile
- Throws:
IOException
-
install
Description copied from interface:TargetInstalls the built binary and any supporting files into theConfig.getInstallDir()directory.- Specified by:
installin interfaceTarget- Throws:
IOException
-
getDefaultArchs
Description copied from interface:TargetReturns a list of the default archs to build for if no archs have been specified in theConfig. Returns an empty list if there are no defaults.- Specified by:
getDefaultArchsin interfaceTarget
-
archive
Description copied from interface:TargetCreates an archive suitable for distribution and stores it in theConfig.getInstallDir()directory.- Specified by:
archivein interfaceTarget- Throws:
IOException
-
doInstall
- Throws:
IOException
-
doInstall
- Throws:
IOException
-
launch
Description copied from interface:TargetLaunches the built binary if supported.- Specified by:
launchin interfaceTarget- Throws:
IOException
-
doLaunch
- Throws:
IOException
-
createLauncher
- Throws:
IOException
-
build
-
stripArchives
- Throws:
IOException
-
stripArchive
- Throws:
IOException
-