mirror of
https://github.com/ganelson/inform.git
synced 2024-06-26 04:00:43 +03:00
Skills
This commit is contained in:
parent
9206d88dbb
commit
695721dcee
|
@ -35,12 +35,13 @@ int main(int argc, char **argv) {
|
|||
@<Read the command line@>;
|
||||
|
||||
path_to_inbuild = Pathnames::installation_path("INBUILD_PATH", I"inbuild");
|
||||
if (Str::len(unit_test) > 0) dry_run_mode = TRUE;
|
||||
int use = SHELL_METHODOLOGY;
|
||||
if (dry_run_mode) use = DRY_RUN_METHODOLOGY;
|
||||
build_methodology *BM;
|
||||
if (path_to_tools) BM = BuildMethodology::new(path_to_tools, FALSE);
|
||||
else BM = BuildMethodology::new(Pathnames::up(path_to_inbuild), TRUE);
|
||||
if (dry_run_mode == FALSE) BM->methodology = SHELL_METHODOLOGY;
|
||||
if (path_to_tools) BM = BuildMethodology::new(path_to_tools, FALSE, use);
|
||||
else BM = BuildMethodology::new(Pathnames::up(path_to_inbuild), TRUE, use);
|
||||
if (Str::len(unit_test) > 0) {
|
||||
BM->methodology = DRY_RUN_METHODOLOGY;
|
||||
if (Str::eq(unit_test, I"compatibility")) Compatibility::test(STDOUT);
|
||||
else Errors::with_text("no such unit test: %S", unit_test);
|
||||
} else {
|
||||
|
@ -137,7 +138,7 @@ int main(int argc, char **argv) {
|
|||
else proj = C;
|
||||
}
|
||||
|
||||
proj = Inbuild::optioneering_complete(proj);
|
||||
proj = Inbuild::optioneering_complete(proj, FALSE);
|
||||
if (proj) {
|
||||
int found = FALSE;
|
||||
LOOP_OVER_LINKED_LIST(C, inbuild_copy, targets)
|
||||
|
|
|
@ -116,7 +116,7 @@ extensions, and so on, which are needed by that project.
|
|||
|
||||
=
|
||||
target_vm *current_target_VM = NULL;
|
||||
inbuild_copy *Inbuild::optioneering_complete(inbuild_copy *C) {
|
||||
inbuild_copy *Inbuild::optioneering_complete(inbuild_copy *C, int compile_only) {
|
||||
RUN_ONLY_IN_PHASE(CONFIGURATION_INBUILD_PHASE)
|
||||
|
||||
target_vm *VM = NULL;
|
||||
|
@ -137,7 +137,7 @@ inbuild_copy *Inbuild::optioneering_complete(inbuild_copy *C) {
|
|||
inbuild_phase = PROJECTED_INBUILD_PHASE;
|
||||
|
||||
if (project) {
|
||||
Projects::construct_build_target(project, VM, this_is_a_release_compile);
|
||||
Projects::construct_build_target(project, VM, this_is_a_release_compile, compile_only);
|
||||
current_target_VM = VM;
|
||||
return project->as_copy;
|
||||
} else {
|
||||
|
|
|
@ -33,6 +33,7 @@ Setting up the use of this module.
|
|||
@e copy_error_MT
|
||||
@e extension_dictionary_entry_MT
|
||||
@e known_extension_clash_MT
|
||||
@e build_skill_MT
|
||||
|
||||
=
|
||||
ALLOCATE_INDIVIDUALLY(inform_kit)
|
||||
|
@ -59,6 +60,7 @@ ALLOCATE_INDIVIDUALLY(inform_pipeline)
|
|||
ALLOCATE_INDIVIDUALLY(copy_error)
|
||||
ALLOCATE_INDIVIDUALLY(extension_dictionary_entry)
|
||||
ALLOCATE_INDIVIDUALLY(known_extension_clash)
|
||||
ALLOCATE_INDIVIDUALLY(build_skill)
|
||||
|
||||
ALLOCATE_IN_ARRAYS(inbuild_work_database_entry, 100)
|
||||
|
||||
|
@ -78,6 +80,10 @@ void InbuildModule::start(void) {
|
|||
ProjectBundleManager::start();
|
||||
ProjectFileManager::start();
|
||||
PipelineManager::start();
|
||||
InterSkill::create();
|
||||
Inform7Skill::create();
|
||||
Inform6Skill::create();
|
||||
InblorbSkill::create();
|
||||
}
|
||||
|
||||
@
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef struct build_vertex {
|
|||
struct build_script *script;
|
||||
int last_described;
|
||||
int built;
|
||||
int force_this;
|
||||
MEMORY_MANAGEMENT
|
||||
} build_vertex;
|
||||
|
||||
|
@ -44,6 +45,7 @@ build_vertex *Graphs::file_vertex(filename *F) {
|
|||
V->read_as = NULL;
|
||||
V->last_described = 0;
|
||||
V->built = FALSE;
|
||||
V->force_this = FALSE;
|
||||
return V;
|
||||
}
|
||||
|
||||
|
@ -211,7 +213,7 @@ int Graphs::build_r(OUTPUT_STREAM, int gb, build_vertex *V, build_methodology *m
|
|||
STREAM_OUTDENT(STDOUT);
|
||||
if (rv) {
|
||||
int needs_building = FALSE;
|
||||
if (gb & FORCE_GB) needs_building = TRUE;
|
||||
if ((gb & FORCE_GB) || (V->force_this)) needs_building = TRUE;
|
||||
else @<Decide based on timestamps@>;
|
||||
|
||||
if (needs_building) {
|
||||
|
|
|
@ -19,32 +19,32 @@ typedef struct build_methodology {
|
|||
MEMORY_MANAGEMENT
|
||||
} build_methodology;
|
||||
|
||||
build_methodology *BuildMethodology::new(pathname *tools_path, int dev) {
|
||||
build_methodology *meth = CREATE(build_methodology);
|
||||
meth->methodology = DRY_RUN_METHODOLOGY;
|
||||
build_methodology *BuildMethodology::new(pathname *tools_path, int dev, int meth) {
|
||||
build_methodology *BM = CREATE(build_methodology);
|
||||
BM->methodology = meth;
|
||||
pathname *inter_path = tools_path;
|
||||
if (dev) {
|
||||
inter_path = Pathnames::subfolder(inter_path, I"inter");
|
||||
inter_path = Pathnames::subfolder(inter_path, I"Tangled");
|
||||
}
|
||||
meth->to_inter = Filenames::in_folder(inter_path, I"inter");
|
||||
BM->to_inter = Filenames::in_folder(inter_path, I"inter");
|
||||
pathname *inform6_path = tools_path;
|
||||
if (dev) {
|
||||
inform6_path = Pathnames::subfolder(inform6_path, I"inform6");
|
||||
inform6_path = Pathnames::subfolder(inform6_path, I"Tangled");
|
||||
}
|
||||
meth->to_inform6 = Filenames::in_folder(inform6_path, I"inform6");
|
||||
BM->to_inform6 = Filenames::in_folder(inform6_path, I"inform6");
|
||||
pathname *inform7_path = tools_path;
|
||||
if (dev) {
|
||||
inform7_path = Pathnames::subfolder(inform7_path, I"inform7");
|
||||
inform7_path = Pathnames::subfolder(inform7_path, I"Tangled");
|
||||
}
|
||||
meth->to_inform7 = Filenames::in_folder(inform7_path, I"inform7");
|
||||
BM->to_inform7 = Filenames::in_folder(inform7_path, I"inform7");
|
||||
pathname *inblorb_path = tools_path;
|
||||
if (dev) {
|
||||
inblorb_path = Pathnames::subfolder(inblorb_path, I"inblorb");
|
||||
inblorb_path = Pathnames::subfolder(inblorb_path, I"Tangled");
|
||||
}
|
||||
meth->to_inblorb = Filenames::in_folder(inblorb_path, I"inblorb");
|
||||
return meth;
|
||||
BM->to_inblorb = Filenames::in_folder(inblorb_path, I"inblorb");
|
||||
return BM;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,39 @@
|
|||
[BuildSteps::] Build Steps.
|
||||
|
||||
A build step is a task such as running inform7 or inblorb on some file.
|
||||
A build step is a task which exercises one of the build skills.
|
||||
|
||||
@h Build skills.
|
||||
|
||||
=
|
||||
typedef struct build_skill {
|
||||
struct text_stream *name;
|
||||
METHOD_CALLS
|
||||
MEMORY_MANAGEMENT
|
||||
} build_skill;
|
||||
|
||||
build_skill *BuildSteps::new_skill(text_stream *name) {
|
||||
build_skill *S = CREATE(build_skill);
|
||||
S->name = Str::duplicate(name);
|
||||
ENABLE_METHOD_CALLS(S);
|
||||
return S;
|
||||
}
|
||||
|
||||
@
|
||||
|
||||
@e BUILD_SKILL_COMMAND_MTID
|
||||
@e BUILD_SKILL_INTERNAL_MTID
|
||||
|
||||
=
|
||||
VMETHOD_TYPE(BUILD_SKILL_COMMAND_MTID,
|
||||
build_skill *S, build_step *BS, text_stream *command, build_methodology *meth)
|
||||
IMETHOD_TYPE(BUILD_SKILL_INTERNAL_MTID,
|
||||
build_skill *S, build_step *BS, build_methodology *meth)
|
||||
|
||||
@h Build steps.
|
||||
|
||||
@e ASSIMILATE_BSTEP from 1
|
||||
@e COMPILE_I7_TO_GEN_BSTEP
|
||||
@e COMPILE_GEN_TO_STORY_FILE_BSTEP
|
||||
@e BLORB_STORY_FILE_BSTEP
|
||||
|
||||
=
|
||||
typedef struct build_step {
|
||||
int what_to_do;
|
||||
struct build_skill *what_to_do;
|
||||
struct build_vertex *vertex;
|
||||
struct linked_list *search_path; /* of |inbuild_nest| */
|
||||
struct target_vm *for_vm;
|
||||
|
@ -24,7 +46,7 @@ typedef struct build_step {
|
|||
@
|
||||
|
||||
=
|
||||
build_step *BuildSteps::attach(build_vertex *vertex, int to_do, linked_list *search,
|
||||
build_step *BuildSteps::attach(build_vertex *vertex, build_skill *to_do, linked_list *search,
|
||||
int rel, target_vm *VM, inter_architecture *arch, inbuild_copy *assoc) {
|
||||
build_step *S = CREATE(build_step);
|
||||
S->vertex = vertex;
|
||||
|
@ -42,98 +64,22 @@ build_step *BuildSteps::attach(build_vertex *vertex, int to_do, linked_list *sea
|
|||
int BuildSteps::execute(build_vertex *V, build_step *S, build_methodology *meth) {
|
||||
int rv = TRUE;
|
||||
TEMPORARY_TEXT(command);
|
||||
@<Write a shell command for the step@>;
|
||||
VMETHOD_CALL(S->what_to_do, BUILD_SKILL_COMMAND_MTID, S, command, meth);
|
||||
if (Str::len(command) == 0) rv = FALSE;
|
||||
if (rv) rv = BuildSteps::shell(command, meth);
|
||||
if ((rv) && (meth->methodology == INTERNAL_METHODOLOGY)) {
|
||||
int returned = 0;
|
||||
IMETHOD_CALL(returned, S->what_to_do, BUILD_SKILL_INTERNAL_MTID, S, meth);
|
||||
if (returned != TRUE) rv = FALSE;
|
||||
}
|
||||
if (rv == FALSE) WRITE_TO(STDERR, "Build failed at '%S'\n", command);
|
||||
DISCARD_TEXT(command);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@<Write a shell command for the step@> =
|
||||
switch (S->what_to_do) {
|
||||
case ASSIMILATE_BSTEP: rv = BuildSteps::use_inter(S, command, meth); break;
|
||||
case COMPILE_I7_TO_GEN_BSTEP: rv = BuildSteps::use_inform7(S, command, meth); break;
|
||||
case COMPILE_GEN_TO_STORY_FILE_BSTEP: rv = BuildSteps::use_inform6(S, command, meth); break;
|
||||
case BLORB_STORY_FILE_BSTEP: rv = BuildSteps::use_inblorb(S, command, meth); break;
|
||||
default: rv = FALSE; Errors::nowhere("unimplemented build step"); break;
|
||||
}
|
||||
|
||||
@ =
|
||||
int BuildSteps::shell(text_stream *command, build_methodology *meth) {
|
||||
int rv = TRUE;
|
||||
WRITE_TO(STDOUT, "%S\n", command);
|
||||
if (meth->methodology == SHELL_METHODOLOGY) rv = (Shell::run(command) == 0)?TRUE:FALSE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ =
|
||||
int BuildSteps::use_inter(build_step *S, text_stream *command, build_methodology *meth) {
|
||||
if (command == NULL) internal_error("not available in-app");
|
||||
Shell::quote_file(command, meth->to_inter);
|
||||
WRITE_TO(command, "-architecture %S ", Architectures::to_codename(S->for_arch));
|
||||
WRITE_TO(command, "-assimilate ");
|
||||
Shell::quote_path(command, S->associated_copy->location_if_path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ =
|
||||
int BuildSteps::use_inform7(build_step *S, text_stream *command, build_methodology *meth) {
|
||||
if (command == NULL) internal_error("not available in-app");
|
||||
Shell::quote_file(command, meth->to_inform7);
|
||||
|
||||
inform_project *project = ProjectBundleManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) project = ProjectFileManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) internal_error("no project");
|
||||
|
||||
inform_kit *K;
|
||||
LOOP_OVER_LINKED_LIST(K, inform_kit, project->kits_to_include) {
|
||||
WRITE_TO(command, "-kit %S ", K->as_copy->edition->work->title);
|
||||
}
|
||||
WRITE_TO(command, "-format=%S ", TargetVMs::get_unblorbed_extension(S->for_vm));
|
||||
|
||||
inbuild_nest *N;
|
||||
LOOP_OVER_LINKED_LIST(N, inbuild_nest, S->search_path) {
|
||||
switch (Nests::get_tag(N)) {
|
||||
case MATERIALS_NEST_TAG: continue;
|
||||
case EXTERNAL_NEST_TAG: WRITE_TO(command, "-external "); break;
|
||||
case GENERIC_NEST_TAG: WRITE_TO(command, "-nest "); break;
|
||||
case INTERNAL_NEST_TAG: WRITE_TO(command, "-internal "); break;
|
||||
default: internal_error("mystery nest");
|
||||
}
|
||||
Shell::quote_path(command, N->location);
|
||||
}
|
||||
|
||||
WRITE_TO(command, "-project ");
|
||||
Shell::quote_path(command, S->associated_copy->location_if_path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ =
|
||||
int BuildSteps::use_inform6(build_step *S, text_stream *command, build_methodology *meth) {
|
||||
if (command == NULL) internal_error("not available in-app");
|
||||
Shell::quote_file(command, meth->to_inform6);
|
||||
|
||||
inform_project *project = ProjectBundleManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) project = ProjectFileManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) internal_error("no project");
|
||||
|
||||
pathname *build_folder = Pathnames::subfolder(project->as_copy->location_if_path, I"Build");
|
||||
filename *inf_F = Filenames::in_folder(build_folder, I"auto.inf");
|
||||
|
||||
WRITE_TO(command, "-kE2S");
|
||||
if (TargetVMs::debug_enabled((S->for_vm))) WRITE_TO(command, "D");
|
||||
text_stream *ext = TargetVMs::get_unblorbed_extension(S->for_vm);
|
||||
if (Str::eq(ext, I"ulx")) ext = I"G";
|
||||
WRITE_TO(command, "w%S ", ext);
|
||||
|
||||
Shell::quote_file(command, inf_F);
|
||||
Shell::quote_file(command, S->vertex->buildable_if_internal_file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ =
|
||||
int BuildSteps::use_inblorb(build_step *S, text_stream *command, build_methodology *meth) {
|
||||
if (command == NULL) internal_error("not available in-app");
|
||||
WRITE_TO(command, "echo 'Not done yet'");
|
||||
return TRUE;
|
||||
}
|
||||
|
|
17
inbuild/inbuild-module/Chapter 3/Inblorb Skill.w
Normal file
17
inbuild/inbuild-module/Chapter 3/Inblorb Skill.w
Normal file
|
@ -0,0 +1,17 @@
|
|||
[InblorbSkill::] Inblorb Skill.
|
||||
|
||||
A build step is a task such as running inform7 or inblorb on some file.
|
||||
|
||||
@ =
|
||||
build_skill *package_using_inblorb_skill = NULL;
|
||||
|
||||
void InblorbSkill::create(void) {
|
||||
package_using_inblorb_skill = BuildSteps::new_skill(I"package using inblorb");
|
||||
METHOD_ADD(package_using_inblorb_skill, BUILD_SKILL_COMMAND_MTID, InblorbSkill::inblorb_via_shell);
|
||||
}
|
||||
|
||||
int InblorbSkill::inblorb_via_shell(build_skill *skill, build_step *S, text_stream *command, build_methodology *meth) {
|
||||
if (command == NULL) internal_error("not available in-app");
|
||||
WRITE_TO(command, "echo 'Not done yet'");
|
||||
return TRUE;
|
||||
}
|
32
inbuild/inbuild-module/Chapter 3/Inform6 Skill.w
Normal file
32
inbuild/inbuild-module/Chapter 3/Inform6 Skill.w
Normal file
|
@ -0,0 +1,32 @@
|
|||
[Inform6Skill::] Inform6 Skill.
|
||||
|
||||
A build step is a task such as running inform7 or inblorb on some file.
|
||||
|
||||
@ =
|
||||
build_skill *compile_using_inform6_skill = NULL;
|
||||
|
||||
void Inform6Skill::create(void) {
|
||||
compile_using_inform6_skill = BuildSteps::new_skill(I"compile using inform6");
|
||||
METHOD_ADD(compile_using_inform6_skill, BUILD_SKILL_COMMAND_MTID, Inform6Skill::inform6_via_shell);
|
||||
}
|
||||
|
||||
int Inform6Skill::inform6_via_shell(build_skill *skill, build_step *S, text_stream *command, build_methodology *meth) {
|
||||
Shell::quote_file(command, meth->to_inform6);
|
||||
|
||||
inform_project *project = ProjectBundleManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) project = ProjectFileManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) internal_error("no project");
|
||||
|
||||
pathname *build_folder = Pathnames::subfolder(project->as_copy->location_if_path, I"Build");
|
||||
filename *inf_F = Filenames::in_folder(build_folder, I"auto.inf");
|
||||
|
||||
WRITE_TO(command, "-kE2S");
|
||||
if (TargetVMs::debug_enabled((S->for_vm))) WRITE_TO(command, "D");
|
||||
text_stream *ext = TargetVMs::get_unblorbed_extension(S->for_vm);
|
||||
if (Str::eq(ext, I"ulx")) ext = I"G";
|
||||
WRITE_TO(command, "w%S ", ext);
|
||||
|
||||
Shell::quote_file(command, inf_F);
|
||||
Shell::quote_file(command, S->vertex->buildable_if_internal_file);
|
||||
return TRUE;
|
||||
}
|
49
inbuild/inbuild-module/Chapter 3/Inform7 Skill.w
Normal file
49
inbuild/inbuild-module/Chapter 3/Inform7 Skill.w
Normal file
|
@ -0,0 +1,49 @@
|
|||
[Inform7Skill::] Inform7 Skill.
|
||||
|
||||
A build step is a task such as running inform7 or inblorb on some file.
|
||||
|
||||
@ =
|
||||
build_skill *compile_using_inform7_skill = NULL;
|
||||
|
||||
void Inform7Skill::create(void) {
|
||||
compile_using_inform7_skill = BuildSteps::new_skill(I"compile using inform7");
|
||||
METHOD_ADD(compile_using_inform7_skill, BUILD_SKILL_COMMAND_MTID, Inform7Skill::inform7_via_shell);
|
||||
METHOD_ADD(compile_using_inform7_skill, BUILD_SKILL_INTERNAL_MTID, Inform7Skill::inform7_internally);
|
||||
}
|
||||
|
||||
int Inform7Skill::inform7_via_shell(build_skill *skill, build_step *S, text_stream *command, build_methodology *meth) {
|
||||
inform_project *project = ProjectBundleManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) project = ProjectFileManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) internal_error("no project");
|
||||
|
||||
Shell::quote_file(command, meth->to_inform7);
|
||||
|
||||
inform_kit *K;
|
||||
LOOP_OVER_LINKED_LIST(K, inform_kit, project->kits_to_include) {
|
||||
WRITE_TO(command, "-kit %S ", K->as_copy->edition->work->title);
|
||||
}
|
||||
WRITE_TO(command, "-format=%S ", TargetVMs::get_unblorbed_extension(S->for_vm));
|
||||
|
||||
inbuild_nest *N;
|
||||
LOOP_OVER_LINKED_LIST(N, inbuild_nest, S->search_path) {
|
||||
switch (Nests::get_tag(N)) {
|
||||
case MATERIALS_NEST_TAG: continue;
|
||||
case EXTERNAL_NEST_TAG: WRITE_TO(command, "-external "); break;
|
||||
case GENERIC_NEST_TAG: WRITE_TO(command, "-nest "); break;
|
||||
case INTERNAL_NEST_TAG: WRITE_TO(command, "-internal "); break;
|
||||
default: internal_error("mystery nest");
|
||||
}
|
||||
Shell::quote_path(command, N->location);
|
||||
}
|
||||
|
||||
WRITE_TO(command, "-project ");
|
||||
Shell::quote_path(command, S->associated_copy->location_if_path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int Inform7Skill::inform7_internally(build_skill *skill, build_step *S, build_methodology *meth) {
|
||||
#ifdef CORE_MODULE
|
||||
return CoreMain::task(S);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
72
inbuild/inbuild-module/Chapter 3/Inter Skill.w
Normal file
72
inbuild/inbuild-module/Chapter 3/Inter Skill.w
Normal file
|
@ -0,0 +1,72 @@
|
|||
[InterSkill::] Inter Skill.
|
||||
|
||||
A build step is a task such as running inform7 or inblorb on some file.
|
||||
|
||||
@ =
|
||||
build_skill *assimilate_using_inter_skill = NULL;
|
||||
|
||||
void InterSkill::create(void) {
|
||||
assimilate_using_inter_skill = BuildSteps::new_skill(I"assimilate using inter");
|
||||
METHOD_ADD(assimilate_using_inter_skill, BUILD_SKILL_COMMAND_MTID, InterSkill::assimilate_via_shell);
|
||||
METHOD_ADD(assimilate_using_inter_skill, BUILD_SKILL_INTERNAL_MTID, InterSkill::assimilate_internally);
|
||||
}
|
||||
|
||||
int InterSkill::assimilate_via_shell(build_skill *skill, build_step *S, text_stream *command, build_methodology *meth) {
|
||||
inter_architecture *A = S->for_arch;
|
||||
if (A == NULL) internal_error("no architecture given");
|
||||
pathname *kit_path = S->associated_copy->location_if_path;
|
||||
Shell::quote_file(command, meth->to_inter);
|
||||
WRITE_TO(command, "-architecture %S ", Architectures::to_codename(A));
|
||||
WRITE_TO(command, "-assimilate ");
|
||||
Shell::quote_path(command, kit_path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int InterSkill::assimilate_internally(build_skill *skill, build_step *S, build_methodology *meth) {
|
||||
#ifdef CODEGEN_MODULE
|
||||
inter_architecture *A = S->for_arch;
|
||||
if (A == NULL) internal_error("no architecture given");
|
||||
|
||||
pathname *kit_path = S->associated_copy->location_if_path;
|
||||
dictionary *pipeline_vars = CodeGen::Pipeline::basic_dictionary(I"output.i6");
|
||||
|
||||
inbuild_requirement *req =
|
||||
Requirements::any_version_of(Works::new(pipeline_genre, I"assimilate.interpipeline", NULL));
|
||||
linked_list *L = NEW_LINKED_LIST(inbuild_search_result);
|
||||
Nests::search_for(req, Inbuild::nest_list(), L);
|
||||
filename *pipeline_as_file = NULL;
|
||||
inbuild_search_result *R;
|
||||
LOOP_OVER_LINKED_LIST(R, inbuild_search_result, L) {
|
||||
pipeline_as_file = R->copy->location_if_file;
|
||||
break;
|
||||
}
|
||||
if (pipeline_as_file == NULL) {
|
||||
Errors::nowhere("assimilate pipeline could not be found");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
filename *assim = Architectures::canonical_binary(kit_path, A);
|
||||
filename *assim_t = Architectures::canonical_textual(kit_path, A);
|
||||
TEMPORARY_TEXT(fullname);
|
||||
WRITE_TO(fullname, "%f", assim);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*out"), fullname);
|
||||
Str::clear(fullname);
|
||||
WRITE_TO(fullname, "%f", assim_t);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*outt"), fullname);
|
||||
DISCARD_TEXT(fullname);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*attach"), Pathnames::directory_name(kit_path));
|
||||
|
||||
linked_list *inter_paths = NEW_LINKED_LIST(pathname);
|
||||
ADD_TO_LINKED_LIST(S->associated_copy->location_if_path, pathname, inter_paths);
|
||||
codegen_pipeline *SS = CodeGen::Pipeline::parse_from_file(pipeline_as_file, pipeline_vars);
|
||||
if (SS) {
|
||||
linked_list *requirements_list = NEW_LINKED_LIST(inter_library);
|
||||
CodeGen::Pipeline::run(NULL, SS, inter_paths, requirements_list);
|
||||
return TRUE;
|
||||
} else {
|
||||
Errors::nowhere("assimilate pipeline could not be parsed");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
|
@ -175,6 +175,7 @@ void Extensions::Dictionary::new_dictionary_entry_raw(text_stream *category,
|
|||
text_stream *author, text_stream *title, text_stream *headword) {
|
||||
extension_dictionary_entry *ede = CREATE(extension_dictionary_entry);
|
||||
ede->ede_work = Works::new(extension_genre, title, author);
|
||||
LOGIF(EXTENSIONS_CENSUS, "NDER %X\n", ede->ede_work);
|
||||
Works::add_to_database(ede->ede_work, DICTIONARY_REFERRED_WDBC);
|
||||
ede->entry_text = Str::duplicate(headword);
|
||||
ede->type = Str::duplicate(category);
|
||||
|
|
|
@ -135,6 +135,7 @@ calls.
|
|||
Feeds::feed_text(L"This sentence provides a firebreak, no more. ");
|
||||
E = Extensions::Documentation::load(work);
|
||||
if (E == NULL) return 0; /* shouldn't happen: it was there only moments ago */
|
||||
WRITE_TO(STDOUT, "Wel well %X\n", work);
|
||||
Copies::read_source_text_for(E->as_copy);
|
||||
Extensions::Documentation::write_extension_documentation(NULL, E, census_mode);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ void Kits::construct_graph(inform_kit *K) {
|
|||
LOOP_OVER(A, inter_architecture) {
|
||||
build_vertex *BV = Graphs::file_vertex(Architectures::canonical_binary(P, A));
|
||||
Graphs::need_this_to_build(KV, BV);
|
||||
BuildSteps::attach(BV, ASSIMILATE_BSTEP,
|
||||
BuildSteps::attach(BV, assimilate_using_inter_skill,
|
||||
Inbuild::nest_list(), FALSE, NULL, A, K->as_copy);
|
||||
ADD_TO_LINKED_LIST(BV, build_vertex, BVL);
|
||||
}
|
||||
|
|
|
@ -248,7 +248,8 @@ linked_list *Projects::list_of_inter_libraries(inform_project *project) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void Projects::construct_build_target(inform_project *project, target_vm *VM, int releasing) {
|
||||
void Projects::construct_build_target(inform_project *project, target_vm *VM,
|
||||
int releasing, int compile_only) {
|
||||
pathname *proj = project->as_copy->location_if_path;
|
||||
pathname *build_folder = NULL;
|
||||
if (proj) build_folder = Pathnames::subfolder(proj, I"Build");
|
||||
|
@ -256,7 +257,7 @@ void Projects::construct_build_target(inform_project *project, target_vm *VM, in
|
|||
filename *inf_F = Filenames::in_folder(build_folder, I"auto.inf");
|
||||
build_vertex *inf_V = Graphs::file_vertex(inf_F);
|
||||
Graphs::need_this_to_build(inf_V, project->as_copy->vertex);
|
||||
BuildSteps::attach(inf_V, COMPILE_I7_TO_GEN_BSTEP,
|
||||
BuildSteps::attach(inf_V, compile_using_inform7_skill,
|
||||
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
|
||||
|
||||
TEMPORARY_TEXT(story_file_leafname);
|
||||
|
@ -265,7 +266,7 @@ void Projects::construct_build_target(inform_project *project, target_vm *VM, in
|
|||
DISCARD_TEXT(story_file_leafname);
|
||||
build_vertex *unblorbed_V = Graphs::file_vertex(unblorbed_F);
|
||||
Graphs::need_this_to_build(unblorbed_V, inf_V);
|
||||
BuildSteps::attach(unblorbed_V, COMPILE_GEN_TO_STORY_FILE_BSTEP,
|
||||
BuildSteps::attach(unblorbed_V, compile_using_inform6_skill,
|
||||
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
|
||||
|
||||
if (releasing) {
|
||||
|
@ -275,12 +276,13 @@ void Projects::construct_build_target(inform_project *project, target_vm *VM, in
|
|||
DISCARD_TEXT(story_file_leafname);
|
||||
build_vertex *blorbed_V = Graphs::file_vertex(blorbed_F);
|
||||
Graphs::need_this_to_build(unblorbed_V, inf_V);
|
||||
BuildSteps::attach(blorbed_V, BLORB_STORY_FILE_BSTEP,
|
||||
BuildSteps::attach(blorbed_V, package_using_inblorb_skill,
|
||||
Inbuild::nest_list(), releasing, VM, NULL, project->as_copy);
|
||||
|
||||
project->chosen_build_target = blorbed_V;
|
||||
} else {
|
||||
project->chosen_build_target = unblorbed_V;
|
||||
} else project->chosen_build_target = unblorbed_V;
|
||||
if (compile_only) {
|
||||
project->chosen_build_target = inf_V;
|
||||
inf_V->force_this = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@ Chapter 3: Incremental Builds
|
|||
Build Methodology
|
||||
Build Scripts
|
||||
Build Steps
|
||||
Inter Skill
|
||||
Inform7 Skill
|
||||
Inform6 Skill
|
||||
Inblorb Skill
|
||||
|
||||
Chapter 4: Managing Genres of Work
|
||||
Kit Manager
|
||||
|
|
7
inform7/Internal/Pipelines/assimilate.interpipeline
Normal file
7
inform7/Internal/Pipelines/assimilate.interpipeline
Normal file
|
@ -0,0 +1,7 @@
|
|||
prepare <- *attach
|
||||
merge-template <- all
|
||||
parse-linked-matter
|
||||
resolve-conditional-compilation
|
||||
assimilate
|
||||
resolve-external-symbols
|
||||
generate binary -> *out
|
|
@ -56,7 +56,10 @@ int CoreMain::main(int argc, char *argv[]) {
|
|||
@<Boot up the compiler@>;
|
||||
Inbuild::go_operational();
|
||||
inform_project *project = Inbuild::project();
|
||||
if (project) CoreMain::task(project);
|
||||
if (project) {
|
||||
Copies::build(STDOUT, project->as_copy,
|
||||
BuildMethodology::new(NULL, FALSE, INTERNAL_METHODOLOGY));
|
||||
}
|
||||
}
|
||||
@<Shutdown and rennab@>;
|
||||
if (problem_count > 0) Problems::Fatal::exit(1);
|
||||
|
@ -119,7 +122,7 @@ list is not exhaustive.
|
|||
path_to_inform7 = Pathnames::installation_path("INFORM7_PATH", I"inform7");
|
||||
|
||||
@<With that done, configure all other settings@> =
|
||||
Inbuild::optioneering_complete(NULL);
|
||||
Inbuild::optioneering_complete(NULL, TRUE);
|
||||
if (Locations::set_defaults() == FALSE)
|
||||
Problems::Fatal::issue("Unable to create folders in local file system");
|
||||
Log::set_debug_log_filename(filename_of_debugging_log);
|
||||
|
@ -134,7 +137,11 @@ list is not exhaustive.
|
|||
Problems::Issue::start_problems_report();
|
||||
|
||||
@ =
|
||||
void CoreMain::task(inform_project *project) {
|
||||
int CoreMain::task(build_step *S) {
|
||||
inform_project *project = ProjectBundleManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) project = ProjectFileManager::from_copy(S->associated_copy);
|
||||
if (project == NULL) internal_error("no project");
|
||||
|
||||
clock_t start = clock();
|
||||
@<Perform lexical analysis@>;
|
||||
@<Perform semantic analysis@>;
|
||||
|
@ -149,6 +156,8 @@ void CoreMain::task(inform_project *project) {
|
|||
clock_t end = clock();
|
||||
int cpu_time_used = ((int) (end - start)) / (CLOCKS_PER_SEC/100);
|
||||
LOG("CPU time: %d centiseconds\n", cpu_time_used);
|
||||
if (problem_count > 0) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@
|
||||
|
|
|
@ -130,6 +130,7 @@ the following routine, which combines them into one.
|
|||
|
||||
=
|
||||
int TextFromFiles::total_word_count(source_file *sf) {
|
||||
if (sf == NULL) return 0;
|
||||
return sf->words_of_source + sf->words_of_quoted_text;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,9 +83,7 @@ int main(int argc, char **argv) {
|
|||
WRITE_TO(fullname, "%f", assim_t);
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*outt"), fullname);
|
||||
DISCARD_TEXT(fullname);
|
||||
match_results mr = Regexp::create_mr();
|
||||
Str::copy(Dictionaries::create_text(pipeline_vars, I"*attach"), Pathnames::directory_name(template_path));
|
||||
Regexp::dispose_of(&mr);
|
||||
}
|
||||
|
||||
Main::act();
|
||||
|
|
Loading…
Reference in a new issue