github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/perf/smallbank_workload/build.rs (about)

     1  /*
     2   * Copyright 2018 Intel Corporation
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   * ------------------------------------------------------------------------------
    16   */
    17  
    18  extern crate glob;
    19  extern crate protoc_rust;
    20  
    21  use protoc_rust::Customize;
    22  
    23  fn main() {
    24      let proto_src_files = glob_simple("../../families/smallbank/protos/*.proto");
    25      println!("{:?}", proto_src_files);
    26  
    27      protoc_rust::run(protoc_rust::Args {
    28          out_dir: "./src",
    29          input: &proto_src_files
    30              .iter()
    31              .map(|a| a.as_ref())
    32              .collect::<Vec<&str>>(),
    33          includes: &["../../families/smallbank/protos"],
    34          customize: Customize {
    35              ..Default::default()
    36          },
    37      }).expect("Error generating rust files from smallbank protos");
    38  }
    39  
    40  fn glob_simple(pattern: &str) -> Vec<String> {
    41      glob::glob(pattern)
    42          .expect("glob")
    43          .map(|g| {
    44              g.expect("item")
    45                  .as_path()
    46                  .to_str()
    47                  .expect("utf-8")
    48                  .to_owned()
    49          })
    50          .collect()
    51  }