| 849 | | static class TargetBuilder : AbstractTargetBuilder |
|---|
| 850 | | { |
|---|
| 851 | | |
|---|
| 852 | | this(Project project, ProjectTarget target) |
|---|
| 853 | | { |
|---|
| 854 | | super(project, target); |
|---|
| 855 | | |
|---|
| 856 | | buildTarget(); |
|---|
| 857 | | } |
|---|
| 858 | | |
|---|
| 859 | | ~this() |
|---|
| 860 | | { |
|---|
| 861 | | writefln("closing down target builder"); |
|---|
| 862 | | } |
|---|
| 863 | | |
|---|
| 864 | | /** |
|---|
| 865 | | * build a target |
|---|
| 866 | | */ |
|---|
| 867 | | private void buildTarget() |
|---|
| 868 | | { |
|---|
| 869 | | if ( target !is null ) |
|---|
| 870 | | { |
|---|
| 871 | | project.lastBuildTarget = target; |
|---|
| 872 | | project.workspace.setLastBuildProject(project); |
|---|
| 873 | | |
|---|
| 874 | | String compCom = target.getCompilerCommand(); |
|---|
| 875 | | |
|---|
| 876 | | buildConsole.exec( |
|---|
| 877 | | target.getBaseDirSrc(), |
|---|
| 878 | | compCom, |
|---|
| 879 | | true, // async |
|---|
| 880 | | &linkTarget, |
|---|
| 881 | | &compOutputReader, |
|---|
| 882 | | &compErrorReader |
|---|
| 883 | | ); |
|---|
| 884 | | } |
|---|
| 885 | | } |
|---|
| 886 | | |
|---|
| 887 | | /** |
|---|
| 888 | | * links the target. |
|---|
| 889 | | * This is called from the Compile spawned command. |
|---|
| 890 | | * Params: |
|---|
| 891 | | * spawn = |
|---|
| 892 | | * Returns: true |
|---|
| 893 | | */ |
|---|
| 894 | | bool linkTarget(Spawn spawn) |
|---|
| 895 | | { |
|---|
| 896 | | gdkThreadsEnter(); |
|---|
| 897 | | |
|---|
| 898 | | if ( spawn.exitStatus == 0 ) |
|---|
| 899 | | { |
|---|
| 900 | | String linkCom = target.getLinkCommand(); |
|---|
| 901 | | // if ( Leds.leds.getPropValue("popupBuildOutput",true) ) |
|---|
| 902 | | // { |
|---|
| 903 | | // compilerBox.addLinkerCommand(linkCom); |
|---|
| 904 | | // } |
|---|
| 905 | | Path.chdir(project.getBaseDir()); |
|---|
| 906 | | buildConsole.exec(target.getBaseDirObj(), linkCom, |
|---|
| 907 | | true, |
|---|
| 908 | | &endLink, |
|---|
| 909 | | &linkOutputReader, |
|---|
| 910 | | &linkErrorReader |
|---|
| 911 | | ); |
|---|
| 912 | | //buildConsole.exec(new String("."), linkCom, true); |
|---|
| 913 | | } |
|---|
| 914 | | //if ( lastP_OpenExitStatus != 0 ) |
|---|
| 915 | | { |
|---|
| 916 | | project.workspace.refreshDockableLabel(buildConsole); |
|---|
| 917 | | project.workspace.getProjectView().setProjectStatus(project); |
|---|
| 918 | | } |
|---|
| 919 | | |
|---|
| 920 | | Gdk.flush(); |
|---|
| 921 | | gdkThreadsLeave(); |
|---|
| 922 | | return true; |
|---|
| 923 | | } |
|---|
| 924 | | |
|---|
| 925 | | bool endLink(Spawn spawn) |
|---|
| 926 | | { |
|---|
| 927 | | if ( target.isNativeTargetPlatform() |
|---|
| 928 | | && target.crossWindows |
|---|
| 929 | | ) |
|---|
| 930 | | { |
|---|
| 931 | | target.setTargetPlatform(ProjectTarget.Platform.WINDOWS32); |
|---|
| 932 | | buildTarget(); |
|---|
| 933 | | } |
|---|
| 934 | | else |
|---|
| 935 | | { |
|---|
| 936 | | gdkThreadsEnter(); |
|---|
| 937 | | project.compileEnd(); |
|---|
| 938 | | Gdk.flush(); |
|---|
| 939 | | gdkThreadsLeave(); |
|---|
| 940 | | } |
|---|
| 941 | | return true; // consume |
|---|
| 942 | | } |
|---|
| 943 | | |
|---|
| 944 | | } |
|---|
| | 852 | // static class TargetBuilder : AbstractTargetBuilder |
|---|
| | 853 | // { |
|---|
| | 854 | // |
|---|
| | 855 | // this(Project project, ProjectTarget target) |
|---|
| | 856 | // { |
|---|
| | 857 | // super(project, target); |
|---|
| | 858 | // |
|---|
| | 859 | // buildTarget(); |
|---|
| | 860 | // } |
|---|
| | 861 | // |
|---|
| | 862 | // ~this() |
|---|
| | 863 | // { |
|---|
| | 864 | // writefln("closing down target builder"); |
|---|
| | 865 | // } |
|---|
| | 866 | // |
|---|
| | 867 | // /** |
|---|
| | 868 | // * build a target |
|---|
| | 869 | // */ |
|---|
| | 870 | // private void buildTarget() |
|---|
| | 871 | // { |
|---|
| | 872 | // if ( target !is null ) |
|---|
| | 873 | // { |
|---|
| | 874 | // project.lastBuildTarget = target; |
|---|
| | 875 | // project.workspace.setLastBuildProject(project); |
|---|
| | 876 | // |
|---|
| | 877 | // String compCom = target.getCompilerCommand(); |
|---|
| | 878 | // |
|---|
| | 879 | // buildConsole.exec( |
|---|
| | 880 | // target.getBaseDirSrc(), |
|---|
| | 881 | // compCom, |
|---|
| | 882 | // true, // async |
|---|
| | 883 | // &linkTarget, |
|---|
| | 884 | // &compOutputReader, |
|---|
| | 885 | // &compErrorReader |
|---|
| | 886 | // ); |
|---|
| | 887 | // } |
|---|
| | 888 | // } |
|---|
| | 889 | // |
|---|
| | 890 | // /** |
|---|
| | 891 | // * links the target. |
|---|
| | 892 | // * This is called from the Compile spawned command. |
|---|
| | 893 | // * Params: |
|---|
| | 894 | // * spawn = |
|---|
| | 895 | // * Returns: true |
|---|
| | 896 | // */ |
|---|
| | 897 | // bool linkTarget(Spawn spawn) |
|---|
| | 898 | // { |
|---|
| | 899 | // gdkThreadsEnter(); |
|---|
| | 900 | // |
|---|
| | 901 | // if ( spawn.exitStatus == 0 ) |
|---|
| | 902 | // { |
|---|
| | 903 | // String linkCom = target.getLinkCommand(); |
|---|
| | 904 | //// if ( Leds.leds.getPropValue("popupBuildOutput",true) ) |
|---|
| | 905 | //// { |
|---|
| | 906 | //// compilerBox.addLinkerCommand(linkCom); |
|---|
| | 907 | //// } |
|---|
| | 908 | // Path.chdir(project.getBaseDir()); |
|---|
| | 909 | // buildConsole.exec(target.getBaseDirObj(), linkCom, |
|---|
| | 910 | // true, |
|---|
| | 911 | // &endLink, |
|---|
| | 912 | // &linkOutputReader, |
|---|
| | 913 | // &linkErrorReader |
|---|
| | 914 | // ); |
|---|
| | 915 | // //buildConsole.exec(new String("."), linkCom, true); |
|---|
| | 916 | // } |
|---|
| | 917 | // //if ( lastP_OpenExitStatus != 0 ) |
|---|
| | 918 | // { |
|---|
| | 919 | // project.workspace.refreshDockableLabel(buildConsole); |
|---|
| | 920 | // project.workspace.getProjectView().setProjectStatus(project); |
|---|
| | 921 | // } |
|---|
| | 922 | // |
|---|
| | 923 | // Gdk.flush(); |
|---|
| | 924 | // gdkThreadsLeave(); |
|---|
| | 925 | // return true; |
|---|
| | 926 | // } |
|---|
| | 927 | // |
|---|
| | 928 | // bool endLink(Spawn spawn) |
|---|
| | 929 | // { |
|---|
| | 930 | // if ( target.isNativeTargetPlatform() |
|---|
| | 931 | // && target.crossWindows |
|---|
| | 932 | // ) |
|---|
| | 933 | // { |
|---|
| | 934 | // target.setTargetPlatform(ProjectTarget.Platform.WINDOWS32); |
|---|
| | 935 | // buildTarget(); |
|---|
| | 936 | // } |
|---|
| | 937 | // else |
|---|
| | 938 | // { |
|---|
| | 939 | // gdkThreadsEnter(); |
|---|
| | 940 | // project.compileEnd(); |
|---|
| | 941 | // Gdk.flush(); |
|---|
| | 942 | // gdkThreadsLeave(); |
|---|
| | 943 | // } |
|---|
| | 944 | // return true; // consume |
|---|
| | 945 | // } |
|---|
| | 946 | // |
|---|
| | 947 | // } |
|---|
| 1202 | | //if ( getCurrTarget(props.get("lastTarget","")) !is null ) |
|---|
| 1203 | | //{ |
|---|
| 1204 | | // printf("compiler command = %.*s\n", currTarget.getCompilerCommand()); |
|---|
| 1205 | | // printf("link command = %.*s\n", currTarget.getLinkCommand()); |
|---|
| 1206 | | // currTarget.generateMakefile(); |
|---|
| 1207 | | //} |
|---|
| 1208 | | |
|---|
| 1209 | | // first build dependencies |
|---|
| 1210 | | bool failed = buildDependences(); |
|---|
| 1211 | | |
|---|
| 1212 | | if ( !failed ) |
|---|
| 1213 | | { |
|---|
| 1214 | | String buildCommand = getPropValue("makeCommand",""); |
|---|
| 1215 | | // \todo how do we clear an associative array? |
|---|
| 1216 | | ProjectError[][String] t; |
|---|
| 1217 | | projectErrors = t; |
|---|
| 1218 | | |
|---|
| 1219 | | baseSrcPath = getSrcPath(); |
|---|
| 1220 | | |
|---|
| 1221 | | if ( buildCommand.length > 0 ) |
|---|
| 1222 | | { |
|---|
| 1223 | | clearFileViews(); |
|---|
| 1224 | | setCompiling(true); |
|---|
| 1225 | | String grabOutput = new String(); |
|---|
| 1226 | | String grabError = new String(); |
|---|
| 1227 | | int exitStatus; |
|---|
| 1228 | | //workspace.getErrorPane().drawNow(); |
|---|
| 1229 | | // if ( Leds.leds.getPropValue("popupBuildOutput",true) ) |
|---|
| | 1229 | writefln("- Project.build target = %s", target); |
|---|
| | 1230 | |
|---|
| | 1231 | new TargetBuilder_compd(this, target); |
|---|
| | 1232 | |
|---|
| | 1233 | // //if ( getCurrTarget(props.get("lastTarget","")) !is null ) |
|---|
| | 1234 | // //{ |
|---|
| | 1235 | // // printf("compiler command = %.*s\n", currTarget.getCompilerCommand()); |
|---|
| | 1236 | // // printf("link command = %.*s\n", currTarget.getLinkCommand()); |
|---|
| | 1237 | // // currTarget.generateMakefile(); |
|---|
| | 1238 | // //} |
|---|
| | 1239 | // |
|---|
| | 1240 | // // first build dependencies |
|---|
| | 1241 | // bool failed = buildDependences(target.dependences); |
|---|
| | 1242 | // |
|---|
| | 1243 | // if ( !failed ) |
|---|
| | 1244 | // { |
|---|
| | 1245 | // String buildCommand = getPropValue("makeCommand",""); |
|---|
| | 1246 | // // \todo how do we clear an associative array? |
|---|
| | 1247 | // ProjectError[][String] t; |
|---|
| | 1248 | // projectErrors = t; |
|---|
| | 1249 | // |
|---|
| | 1250 | // baseSrcPath = getSrcPath(); |
|---|
| | 1251 | // |
|---|
| | 1252 | // if ( buildCommand.length > 0 ) |
|---|
| | 1253 | // { |
|---|
| | 1254 | // clearFileViews(); |
|---|
| | 1255 | // setCompiling(true); |
|---|
| | 1256 | // String grabOutput = new String(); |
|---|
| | 1257 | // String grabError = new String(); |
|---|
| | 1258 | // int exitStatus; |
|---|
| | 1259 | // //workspace.getErrorPane().drawNow(); |
|---|
| | 1260 | //// if ( Leds.leds.getPropValue("popupBuildOutput",true) ) |
|---|
| | 1261 | //// { |
|---|
| | 1262 | //// compilerWindow = workspace.getCompilerWindow(); |
|---|
| | 1263 | //// CompilerBox compilerBox = compilerWindow.getCompilerBox(); |
|---|
| | 1264 | //// compilerBox.clearAll(); |
|---|
| | 1265 | //// compilerBox.addCompilerCommand(buildCommand); |
|---|
| | 1266 | //// } |
|---|
| | 1267 | // if ( newConsole ) |
|---|
| 1236 | | if ( newConsole ) |
|---|
| 1237 | | { |
|---|
| 1238 | | BuildConsole buildConsole = new BuildConsole(workspace,this, buildCommand); |
|---|
| 1239 | | workspace.addConsole(buildConsole); |
|---|
| 1240 | | buildConsole.exec( |
|---|
| 1241 | | getBaseDir(), |
|---|
| 1242 | | buildCommand |
|---|
| 1243 | | //grabOutput, grabError, exitStatus, null |
|---|
| 1244 | | ); |
|---|
| 1245 | | } |
|---|
| 1246 | | else |
|---|
| 1247 | | { |
|---|
| 1248 | | workspace.getSystemConsole().exec( |
|---|
| 1249 | | getBaseDir(), |
|---|
| 1250 | | buildCommand |
|---|
| 1251 | | //grabOutput, grabError, exitStatus, null |
|---|
| 1252 | | ); |
|---|
| 1253 | | } |
|---|
| 1254 | | |
|---|
| 1255 | | //if ( exitStatus != 0 ) |
|---|
| 1256 | | { |
|---|
| 1257 | | processBuildOutput(grabOutput, grabError); |
|---|
| 1258 | | } |
|---|
| 1259 | | } |
|---|
| 1260 | | } |
|---|
| 1261 | | workspace.getErrorPane().refresh(); |
|---|
| | 1277 | // else |
|---|
| | 1278 | // { |
|---|
| | 1279 | // workspace.getSystemConsole().exec( |
|---|
| | 1280 | // getBaseDir(), |
|---|
| | 1281 | // buildCommand |
|---|
| | 1282 | // //grabOutput, grabError, exitStatus, null |
|---|
| | 1283 | // ); |
|---|
| | 1284 | // } |
|---|
| | 1285 | // |
|---|
| | 1286 | // //if ( exitStatus != 0 ) |
|---|
| | 1287 | // { |
|---|
| | 1288 | // processBuildOutput(grabOutput, grabError); |
|---|
| | 1289 | // } |
|---|
| | 1290 | // } |
|---|
| | 1291 | // } |
|---|
| | 1292 | // workspace.getErrorPane().refresh(); |
|---|