@@ -18,6 +18,7 @@ fn read_artifacts_file(artifacts_file_path: &Path) -> Vec<(String, String)> {
1818 lines
1919}
2020
21+ #[ cfg( feature = "decoding" ) ]
2122pub fn get_artifact ( artifact_name : & String , artifacts_file_path : & Path ) -> Option < String > {
2223 let artifacts = read_artifacts_file ( artifacts_file_path) ;
2324
@@ -30,6 +31,7 @@ pub fn get_artifact(artifact_name: &String, artifacts_file_path: &Path) -> Optio
3031 . map ( |artifact| artifact. 1 . clone ( ) )
3132}
3233
34+ #[ cfg( feature = "encoding" ) ]
3335pub fn add_artifact ( artifact_name : String , manifest_hash : String , artifacts_file_path : & Path ) {
3436 let mut artifacts: Vec < ( String , String ) > = read_artifacts_file ( & artifacts_file_path)
3537 . iter ( )
@@ -43,6 +45,7 @@ pub fn add_artifact(artifact_name: String, manifest_hash: String, artifacts_file
4345 . expect ( "Couldn't write artifacts file" ) ;
4446}
4547
48+ #[ cfg( feature = "encoding" ) ]
4649fn serialize_artifacts ( artifacts : Vec < ( String , String ) > ) -> String {
4750 let mut string = String :: new ( ) ;
4851
@@ -60,6 +63,7 @@ mod tests {
6063 use super :: * ;
6164
6265 #[ test]
66+ #[ cfg( all( feature = "encoding" , feature = "decoding" ) ) ]
6367 fn simple_all ( ) {
6468 let artifacts = vec ! [
6569 ( "test1" . to_string( ) , 1 . to_string( ) ) ,
@@ -86,6 +90,7 @@ mod tests {
8690 }
8791
8892 #[ test]
93+ #[ cfg( all( feature = "encoding" , feature = "decoding" ) ) ]
8994 fn get_artifact_not_found ( ) {
9095 let artifact_file_path = temp_dir ( ) . join ( "LCAS_test_artifact_not_found.test" ) ;
9196 // Ensure file is empty
@@ -97,6 +102,7 @@ mod tests {
97102 }
98103
99104 #[ test]
105+ #[ cfg( feature = "encoding" ) ]
100106 fn add_artifact_overwrites_existing ( ) {
101107 let artifact_file_path = temp_dir ( ) . join ( "LCAS_test_artifact_overwrite.test" ) ;
102108 add_artifact (
@@ -132,6 +138,7 @@ mod tests {
132138 }
133139
134140 #[ test]
141+ #[ cfg( feature = "encoding" ) ]
135142 fn simple_serialize_artifacts ( ) {
136143 let artifacts = vec ! [
137144 ( "test1" . to_string( ) , 1 . to_string( ) ) ,
0 commit comments