Compiles this project and any dependencies it may have. @return The set of projects which were compiled. @throws IOException On read/write errors. @since 2016/10/27
()
| 895 | * @since 2016/10/27 |
| 896 | */ |
| 897 | public Set<BuildProject> compile() |
| 898 | throws IOException |
| 899 | { |
| 900 | Set<BuildProject> rv = new LinkedHashSet<>(); |
| 901 | |
| 902 | // Build loop |
| 903 | try |
| 904 | { |
| 905 | // {@squirreljme.error NB02 The specified project eventually |
| 906 | // depends on itself. (The project name)} |
| 907 | if (this._incompile) |
| 908 | throw new IllegalStateException(String.format( |
| 909 | "NB02 %s", this.name)); |
| 910 | |
| 911 | // Currently compiling |
| 912 | this._incompile = true; |
| 913 | |
| 914 | // Compile dependencies first |
| 915 | Map<String, BuildProject> projects = |
| 916 | NewBootstrap.this.projects; |
| 917 | for (String dep : this.depends) |
| 918 | { |
| 919 | // {@squirreljme.error NB06 The dependency of a given |
| 920 | // project does not exist. (This project; The project it |
| 921 | // depends on)} |
| 922 | BuildProject dp = projects.get(dep); |
| 923 | if (dp == null) |
| 924 | throw new IllegalStateException(String.format( |
| 925 | "NB06 %s %s", this.name, dep)); |
| 926 | |
| 927 | // Compile the dependency and add it to the merge group |
| 928 | for (BuildProject bp : dp.compile()) |
| 929 | rv.add(bp); |
| 930 | } |
| 931 | |
| 932 | // Other complation state |
| 933 | __compileStep(rv); |
| 934 | } |
| 935 | |
| 936 | // Clear compile state |
| 937 | finally |
| 938 | { |
| 939 | this._incompile = false; |
| 940 | } |
| 941 | |
| 942 | // Add self to dependency chain |
| 943 | rv.add(this); |
| 944 | |
| 945 | // Return it |
| 946 | return rv; |
| 947 | } |
| 948 | |
| 949 | /** |
| 950 | * Returns the name of this project. |