@@ -31,20 +31,20 @@ def compute(self) -> typing.Set:
3131 def __hash__ (self ) -> int :
3232 return hash (self .name )
3333
34- # Get path to directory that will store the build files
35- def get_build_dirpath (self ) -> str :
34+ def get_slug (self ) -> str :
3635 if self .isDependency :
37- slug = self .name
38- else :
39- slug = f"{ CFG ().make_slug ()} -{ self .name } "
36+ return self .name
4037
41- if ARG ("case_optimization" ):
42- m = hashlib .sha256 ()
43- m .update (input .load ().get_fpp (self ).encode ())
38+ m = hashlib .sha256 ()
39+ m .update (self .name .encode ())
40+ m .update (CFG ().make_slug ().encode ())
41+ m .update (input .load ({}).get_fpp (self ).encode ())
4442
45- slug = f" { slug } - { m .hexdigest ()[:6 ] } "
43+ return m .hexdigest ()[:10 ]
4644
47- return os .sep .join ([os .getcwd (), "build" , slug ])
45+ # Get path to directory that will store the build files
46+ def get_staging_dirpath (self ) -> str :
47+ return os .sep .join ([os .getcwd (), "build" , "staging" , self .get_slug () ])
4848
4949 # Get the directory that contains the target's CMakeLists.txt
5050 def get_cmake_dirpath (self ) -> str :
@@ -58,13 +58,13 @@ def get_cmake_dirpath(self) -> str:
5858
5959 def get_install_dirpath (self ) -> str :
6060 # The install directory is located:
61- # Regular: <root>/build/install/<configuration_slug >
61+ # Regular: <root>/build/install/<slug >
6262 # Dependency: <root>/build/install/dependencies (shared)
6363 return os .sep .join ([
6464 os .getcwd (),
6565 "build" ,
6666 "install" ,
67- 'dependencies' if self .isDependency else CFG (). make_slug ()
67+ 'dependencies' if self .isDependency else self . get_slug (),
6868 ])
6969
7070 def get_install_binpath (self ) -> str :
@@ -75,14 +75,14 @@ def is_configured(self) -> bool:
7575 # We assume that if the CMakeCache.txt file exists, then the target is
7676 # configured. (this isn't perfect, but it's good enough for now)
7777 return os .path .isfile (
78- os .sep .join ([self .get_build_dirpath (), "CMakeCache.txt" ])
78+ os .sep .join ([self .get_staging_dirpath (), "CMakeCache.txt" ])
7979 )
8080
8181 def get_configuration_txt (self ) -> typing .Optional [dict ]:
8282 if not self .is_configured ():
8383 return None
8484
85- configpath = os .path .join (self .get_build_dirpath (), "configuration.txt" )
85+ configpath = os .path .join (self .get_staging_dirpath (), "configuration.txt" )
8686 if not os .path .exists (configpath ):
8787 return None
8888
@@ -101,7 +101,7 @@ def is_buildable(self) -> bool:
101101 return True
102102
103103 def configure (self ):
104- build_dirpath = self .get_build_dirpath ()
104+ build_dirpath = self .get_staging_dirpath ()
105105 cmake_dirpath = self .get_cmake_dirpath ()
106106 install_dirpath = self .get_install_dirpath ()
107107
@@ -154,7 +154,7 @@ def configure(self):
154154 def build (self ):
155155 input .load ({}).generate_fpp (self )
156156
157- command = ["cmake" , "--build" , self .get_build_dirpath (),
157+ command = ["cmake" , "--build" , self .get_staging_dirpath (),
158158 "--target" , self .name ,
159159 "--parallel" , ARG ("jobs" ),
160160 "--config" , 'Debug' if ARG ('debug' ) else 'Release' ]
@@ -167,15 +167,15 @@ def build(self):
167167 cons .print (no_indent = True )
168168
169169 def install (self ):
170- command = ["cmake" , "--install" , self .get_build_dirpath ()]
170+ command = ["cmake" , "--install" , self .get_staging_dirpath ()]
171171
172172 if system (command ).returncode != 0 :
173173 raise MFCException (f"Failed to install the [bold magenta]{ self .name } [/bold magenta] target." )
174174
175175 cons .print (no_indent = True )
176176
177177 def clean (self ):
178- build_dirpath = self .get_build_dirpath ()
178+ build_dirpath = self .get_staging_dirpath ()
179179
180180 if not os .path .isdir (build_dirpath ):
181181 return
0 commit comments