Search in sources :

Example 6 with Config

use of org.robovm.compiler.config.Config in project robovm by robovm.

the class AppCompiler method build.

/**
     * Builds the binary (possibly a fat binary with multiple archs).
     */
public void build() throws IOException {
    List<Arch> archs = this.config.getArchs();
    if (archs.isEmpty()) {
        archs = config.getTarget().getDefaultArchs();
    }
    if (archs.isEmpty()) {
        throw new IllegalArgumentException("No archs specified in config");
    }
    if (archs.size() == 1 && this.config.getArch().equals(archs.get(0))) {
        // No need to clone configs for each slice.
        compile();
    } else {
        Map<Arch, File> slices = new TreeMap<>();
        for (Arch arch : archs) {
            this.config.getLogger().info("Building %s slice", arch);
            Config sliceConfig = this.config.builder().arch(arch).tmpDir(new File(this.config.getTmpDir(), arch.toString())).build();
            new AppCompiler(sliceConfig).compile();
            slices.put(arch, new File(sliceConfig.getTmpDir(), sliceConfig.getExecutableName()));
            for (Path path : sliceConfig.getResourcesPaths()) {
                if (!this.config.getResourcesPaths().contains(path)) {
                    this.config.addResourcesPath(path);
                }
            }
        }
        this.config.getTarget().buildFat(slices);
    }
}
Also used : Path(org.robovm.compiler.clazz.Path) Config(org.robovm.compiler.config.Config) Arch(org.robovm.compiler.config.Arch) TreeMap(java.util.TreeMap) File(java.io.File)

Aggregations

File (java.io.File)6 Config (org.robovm.compiler.config.Config)6 Path (org.robovm.compiler.clazz.Path)3 Arch (org.robovm.compiler.config.Arch)3 ArrayList (java.util.ArrayList)2 OutputStreamWriter (java.io.OutputStreamWriter)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 ExecuteException (org.apache.commons.exec.ExecuteException)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 Clazz (org.robovm.compiler.clazz.Clazz)1 ClazzInfo (org.robovm.compiler.clazz.ClazzInfo)1 Clazzes (org.robovm.compiler.clazz.Clazzes)1 MethodInfo (org.robovm.compiler.clazz.MethodInfo)1 FakeHome (org.robovm.compiler.config.FakeHome)1 OS (org.robovm.compiler.config.OS)1