use of org.robovm.compiler.target.ios.IOSTarget in project robovm by robovm.
the class Config method build.
private Config build() throws IOException {
// Create a clone of this Config before we have done anything with it so
// that builder() has a fresh Config it can use.
this.configBeforeBuild = clone(this);
if (home == null) {
home = Home.find();
}
if (bootclasspath == null) {
bootclasspath = new ArrayList<File>();
}
if (classpath == null) {
classpath = new ArrayList<File>();
}
if (mainJar != null) {
mainClass = getMainClass(mainJar);
classpath.add(mainJar);
}
if (executableName == null && imageName != null) {
executableName = imageName;
}
if (!skipLinking && executableName == null && mainClass == null) {
throw new IllegalArgumentException("No target and no main class specified");
}
if (!skipLinking && classpath.isEmpty()) {
throw new IllegalArgumentException("No classpath specified");
}
if (skipLinking) {
skipInstall = true;
}
if (executableName == null) {
executableName = mainClass;
}
if (imageName == null || !imageName.equals(executableName)) {
imageName = executableName;
}
List<File> realBootclasspath = bootclasspath == null ? new ArrayList<File>() : bootclasspath;
if (!isSkipRuntimeLib()) {
realBootclasspath = new ArrayList<File>(bootclasspath);
realBootclasspath.add(0, home.rtPath);
}
this.vtableCache = new VTable.Cache();
this.itableCache = new ITable.Cache();
this.marshalerLookup = new MarshalerLookup(this);
if (!skipInstall) {
if (installDir == null) {
installDir = new File(".", executableName);
}
installDir.mkdirs();
}
if (targetType != null) {
if (ConsoleTarget.TYPE.equals(targetType)) {
target = new ConsoleTarget();
} else if (IOSTarget.TYPE.equals(targetType)) {
target = new IOSTarget();
} else {
for (TargetPlugin plugin : getTargetPlugins()) {
if (plugin.getTarget().getType().equals(targetType)) {
target = plugin.getTarget();
break;
}
}
if (target == null) {
throw new IllegalArgumentException("Unsupported target '" + targetType + "'");
}
}
} else {
// Auto
if (os == OS.ios) {
target = new IOSTarget();
} else {
target = new ConsoleTarget();
}
}
if (!getArchs().isEmpty()) {
sliceArch = getArchs().get(0);
}
target.init(this);
os = target.getOs();
sliceArch = target.getArch();
dataLayout = new DataLayout(getTriple());
osArchDepLibDir = new File(new File(home.libVmDir, os.toString()), sliceArch.toString());
if (treeShakerMode != null && treeShakerMode != TreeShakerMode.none && os.getFamily() == Family.darwin && sliceArch == Arch.x86) {
logger.warn("Tree shaking is not supported when building " + "for OS X/iOS x86 32-bit due to a bug in Xcode's linker. No tree " + "shaking will be performed. Run in 64-bit mode instead to " + "use tree shaking.");
treeShakerMode = TreeShakerMode.none;
}
dependencyGraph = new DependencyGraph(getTreeShakerMode());
RamDiskTools ramDiskTools = new RamDiskTools();
ramDiskTools.setupRamDisk(this, this.cacheDir, this.tmpDir);
this.cacheDir = ramDiskTools.getCacheDir();
this.tmpDir = ramDiskTools.getTmpDir();
File osDir = new File(cacheDir, os.toString());
File archDir = new File(osDir, sliceArch.toString());
osArchCacheDir = new File(archDir, debug ? "debug" : "release");
osArchCacheDir.mkdirs();
this.clazzes = new Clazzes(this, realBootclasspath, classpath);
mergeConfigsFromClasspath();
return this;
}
Aggregations