Adjusted Mason to work with the new library locations and code.
This commit is contained in:
parent
168d704273
commit
059f2a2630
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,4 +14,4 @@
|
|||||||
# Remove Cargo.lock from gitignore if creating an executable,
|
# Remove Cargo.lock from gitignore if creating an executable,
|
||||||
# leave it for libraries.
|
# leave it for libraries.
|
||||||
# More information here: http://doc.crates.io/guide.html#cargotoml-vs-cargolock
|
# More information here: http://doc.crates.io/guide.html#cargotoml-vs-cargolock
|
||||||
#Cargo.lock
|
Cargo.lock
|
||||||
|
27
Cargo.lock
generated
27
Cargo.lock
generated
@ -1,27 +0,0 @@
|
|||||||
[root]
|
|
||||||
name = "mason"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"alchemy 0.1.0 (git+https://gitlab.com/CyberMages/alchemy.git)",
|
|
||||||
"scribe 0.1.0 (git+https://gitlab.com/CyberMages/scribe.git)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "alchemy"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://gitlab.com/CyberMages/alchemy.git#26080427c02c99b172cd34ed32b5a31684e59694"
|
|
||||||
dependencies = [
|
|
||||||
"scribe 0.1.0 (git+https://gitlab.com/CyberMages/scribe.git)",
|
|
||||||
"sigils 0.1.0 (git+https://gitlab.com/CyberMages/sigils.git)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scribe"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://gitlab.com/CyberMages/scribe.git#e52418d3bfc28cd1f03cc7f31af06fce2e03f844"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sigils"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://gitlab.com/CyberMages/sigils.git#e64c3b0fbecca351e0a078fefc4273a0f0b8e6ad"
|
|
||||||
|
|
@ -10,7 +10,7 @@ keywords = ["mason", "build"]
|
|||||||
|
|
||||||
|
|
||||||
[dependencies.scribe]
|
[dependencies.scribe]
|
||||||
git = "https://gitlab.com/CyberMages/scribe.git"
|
git = "ssh://git@gitlab.com/CyberMages/Core/scribe.git"
|
||||||
|
|
||||||
[dependencies.alchemy]
|
[dependencies.alchemy]
|
||||||
git = "https://gitlab.com/CyberMages/alchemy.git"
|
git = "ssh://git@gitlab.com/CyberMages/Core/alchemy.git"
|
||||||
|
@ -76,24 +76,7 @@ impl Entry
|
|||||||
|
|
||||||
impl Transmutable for Entry
|
impl Transmutable for Entry
|
||||||
{
|
{
|
||||||
fn to_bytes(&self, endianess: Endianess) -> Vec<u8>
|
fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self
|
||||||
{
|
|
||||||
let mut buffer: Vec<u8>;
|
|
||||||
|
|
||||||
// Create the new buffer to hold the data from this type.
|
|
||||||
buffer = Vec::new();
|
|
||||||
|
|
||||||
// Add the buffer data of the three paths to the data buffer.
|
|
||||||
buffer.append(&mut self.name.to_bytes(endianess));
|
|
||||||
buffer.append(&mut self.type_hint.to_bytes(endianess));
|
|
||||||
buffer.append(&mut self.path.to_bytes(endianess));
|
|
||||||
|
|
||||||
// Return the data buffer.
|
|
||||||
buffer.shrink_to_fit();
|
|
||||||
buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
fn from_bytes(buffer: &[u8], endianess: Endianess) -> Entry
|
|
||||||
{
|
{
|
||||||
let buffer_size: usize;
|
let buffer_size: usize;
|
||||||
let name: String;
|
let name: String;
|
||||||
@ -104,18 +87,37 @@ impl Transmutable for Entry
|
|||||||
buffer_size = buffer.len() - 1;
|
buffer_size = buffer.len() - 1;
|
||||||
|
|
||||||
skip_size = 0;
|
skip_size = 0;
|
||||||
name = String::from_bytes(&buffer[skip_size..buffer_size], endianess);
|
name = String::from_endian_bytes(&buffer[skip_size..buffer_size],
|
||||||
|
endianess);
|
||||||
|
|
||||||
skip_size = skip_size + get_byte_size_of_string(&name);
|
skip_size = skip_size + get_byte_size_of_string(&name);
|
||||||
type_hint = String::from_bytes(&buffer[skip_size..buffer_size],
|
type_hint = String::from_endian_bytes(&buffer[skip_size..buffer_size],
|
||||||
endianess);
|
endianess);
|
||||||
|
|
||||||
skip_size = skip_size + get_byte_size_of_string(&type_hint);
|
skip_size = skip_size + get_byte_size_of_string(&type_hint);
|
||||||
path = String::from_bytes(&buffer[skip_size..buffer_size], endianess);
|
path = String::from_endian_bytes(&buffer[skip_size..buffer_size],
|
||||||
|
endianess);
|
||||||
|
|
||||||
Entry::new(name, type_hint, path)
|
Entry::new(name, type_hint, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn as_endian_bytes(&self, endianess: Endianess) -> Vec<u8>
|
||||||
|
{
|
||||||
|
let mut buffer: Vec<u8>;
|
||||||
|
|
||||||
|
// Create the new buffer to hold the data from this type.
|
||||||
|
buffer = Vec::new();
|
||||||
|
|
||||||
|
// Add the buffer data of the three paths to the data buffer.
|
||||||
|
buffer.append(&mut self.name.as_endian_bytes(endianess));
|
||||||
|
buffer.append(&mut self.type_hint.as_endian_bytes(endianess));
|
||||||
|
buffer.append(&mut self.path.as_endian_bytes(endianess));
|
||||||
|
|
||||||
|
// Return the data buffer.
|
||||||
|
buffer.shrink_to_fit();
|
||||||
|
buffer
|
||||||
|
}
|
||||||
|
|
||||||
fn determine_byte_size(&self) -> usize
|
fn determine_byte_size(&self) -> usize
|
||||||
{
|
{
|
||||||
get_byte_size_of_string(&self.name) +
|
get_byte_size_of_string(&self.name) +
|
||||||
@ -193,13 +195,13 @@ impl Loader
|
|||||||
|
|
||||||
// Write the header of the file.
|
// Write the header of the file.
|
||||||
data.extend_from_slice(MAGIC_NUMBER.as_bytes());
|
data.extend_from_slice(MAGIC_NUMBER.as_bytes());
|
||||||
data.append(&mut LOADER_MAJOR_VERSION.to_bytes(Endianess::Little));
|
data.append(&mut LOADER_MAJOR_VERSION.as_endian_bytes(Endianess::Little));
|
||||||
data.append(&mut LOADER_MINOR_VERSION.to_bytes(Endianess::Little));
|
data.append(&mut LOADER_MINOR_VERSION.as_endian_bytes(Endianess::Little));
|
||||||
|
|
||||||
// Write all the entries of the file.
|
// Write all the entries of the file.
|
||||||
for entry in self.entries.iter()
|
for entry in self.entries.iter()
|
||||||
{
|
{
|
||||||
data.append(&mut entry.to_bytes(Endianess::Little));
|
data.append(&mut entry.as_endian_bytes(Endianess::Little));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to write all the data to the file.
|
// Try to write all the data to the file.
|
||||||
@ -237,8 +239,8 @@ impl Loader
|
|||||||
while pos <= data_size
|
while pos <= data_size
|
||||||
{
|
{
|
||||||
debug!("\tParsing entry.");
|
debug!("\tParsing entry.");
|
||||||
entry = Entry::from_bytes(&data_slice[pos..data_size],
|
entry = Entry::from_endian_bytes(&data_slice[pos..data_size],
|
||||||
Endianess::Little);
|
Endianess::Little);
|
||||||
pos = pos + entry.determine_byte_size();
|
pos = pos + entry.determine_byte_size();
|
||||||
|
|
||||||
self.entries.push(entry);
|
self.entries.push(entry);
|
||||||
|
@ -461,7 +461,7 @@ impl Processor
|
|||||||
// Create a new command to call the compiler to compile this
|
// Create a new command to call the compiler to compile this
|
||||||
// Section's resource.
|
// Section's resource.
|
||||||
compiler = Command::new(section.compiler.clone());
|
compiler = Command::new(section.compiler.clone());
|
||||||
arg_compiler = compiler.args(&args);
|
arg_compiler = compiler.args(args.clone());
|
||||||
|
|
||||||
// Execute the compiler command.
|
// Execute the compiler command.
|
||||||
println!("Running command: {:?}", arg_compiler);
|
println!("Running command: {:?}", arg_compiler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user