Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko committed Oct 3, 2024
1 parent cc72ab4 commit 313ef43
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions lib/vector-vrl/web-playground/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cargo_lock::Lockfile;
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fs, io};

use cargo_lock::{package::SourceKind, Lockfile};

fn get_vector_lock_path() -> PathBuf {
let path = fs::canonicalize(env::var("CARGO_MANIFEST_DIR").unwrap()).unwrap();

Expand Down Expand Up @@ -52,18 +53,30 @@ fn write_vrl_constants(lockfile: &Lockfile, output_file: &mut File) {
.packages
.iter()
.find(|&package| package.name.as_str() == "vrl")
.expect("missing VRL dependency")
.source
.clone()
.expect("missing VRL source id");
.expect("missing VRL dependency");

let vrl_source = vrl_dep.source.clone().expect("missing VRL source id");

let version = match vrl_source.kind() {
SourceKind::Git(_) => vrl_source
.precise()
.expect("git reference should have precise")
.to_string(),
SourceKind::Path
| SourceKind::Registry
| SourceKind::SparseRegistry
| SourceKind::LocalRegistry
| SourceKind::Directory => vrl_dep.version.to_string(),
_ => String::from("unknown source kind"),
};
println!("cargo:warning={:?}", version);

let version = &vrl_dep
.git_reference()
.expect("expecting VRL to be installed from git")
.pretty_ref()
.unwrap()
.to_string();
let link = vrl_dep.url().to_string();
//.git_reference()
//.expect("expecting VRL to be installed from git")
//.pretty_ref()
//.unwrap()
//.to_string();
let link = vrl_source.url().to_string();

Check warning

Code scanning / check-spelling

Candidate Pattern Warning

Line matches candidate pattern "\burl\([^\)]*\)" (candidate-pattern)
//{
//None => {
//let repo = vrl_dep
Expand Down

0 comments on commit 313ef43

Please sign in to comment.