Skip to content

Commit

Permalink
Merge pull request #21 from golemcloud/remove-tier-1
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
vigoo authored Mar 29, 2024
2 parents 01b0353 + 7cc3da3 commit 493cbdb
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "golem-wit"]
path = golem-wit
url = https://github.com/golemcloud/golem-wit
123 changes: 123 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "Golem example templates"

[dependencies]
derive_more = "0.99.17"
golem-wit = { version = "0.2.3" }
include_dir = { version = "0.7.3" }
Inflector = { version = "0.11.4" }
once_cell = { version = "1.19.0" }
Expand All @@ -19,6 +20,10 @@ strum_macros = "0.26.1"

clap = { version = "4.4.17", features = ["derive"], optional = true }

[build-dependencies]
cargo_metadata = "0.18.1"
copy_dir = "0.1.3"

[features]
build-binary = ["clap"]

Expand Down
23 changes: 23 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use cargo_metadata::MetadataCommand;
use copy_dir::copy_dir;
use std::env;
use std::path::PathBuf;

fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let golem_wit_root = find_package_root("golem-wit");

println!("Output dir: {out_dir:?}");
println!("Golem WIT root: {golem_wit_root:?}");

copy_dir(golem_wit_root, out_dir.join("golem-wit")).unwrap();
}

fn find_package_root(name: &str) -> String {
let metadata = MetadataCommand::new()
.manifest_path("./Cargo.toml")
.exec()
.unwrap();
let package = metadata.packages.iter().find(|p| p.name == name).unwrap();
package.manifest_path.parent().unwrap().to_string()
}
1 change: 0 additions & 1 deletion golem-wit
Submodule golem-wit deleted from 776397
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub trait Examples {
pub struct GolemExamples {}

static EXAMPLES: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/examples");
static ADAPTERS: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/golem-wit/adapters");
static WIT: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/golem-wit/wit/deps");
static ADAPTERS: Dir<'_> = include_dir!("$OUT_DIR/golem-wit/adapters");
static WIT: Dir<'_> = include_dir!("$OUT_DIR/golem-wit/wit/deps");

impl Examples for GolemExamples {
fn list_all_examples() -> Vec<Example> {
Expand Down

0 comments on commit 493cbdb

Please sign in to comment.