Skip to content

Commit

Permalink
fix doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
iboss-ptk committed Sep 23, 2022
1 parent d042b8f commit 90fabac
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
debug/
target/
artifacts/
!packages/osmosis-testing/libosmosistesting/artifacts

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand Down
19 changes: 17 additions & 2 deletions packages/osmosis-testing/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ fn main() {

let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

let header = out_dir.join(format!("lib{}.h", lib_name));
let header = if std::env::var("DOCS_RS").is_ok() {
manifest_dir
.join("libosmosistesting")
.join("artifacts")
.join("libosmosistesting.docrs.h")
} else {
out_dir.join(format!("lib{}.h", lib_name))
};
// rerun when go code is updated
println!("cargo:rerun-if-changed=./libosmosistesting");

Expand Down Expand Up @@ -39,7 +46,11 @@ fn main() {
"cargo:rustc-link-search=native={}",
out_dir.to_str().unwrap()
);
println!("cargo:rustc-link-lib=dylib={}", lib_name);

// disable linking if docrs
if std::env::var("DOCS_RS").is_err() {
println!("cargo:rustc-link-lib=dylib={}", lib_name);
}

// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
Expand All @@ -64,6 +75,10 @@ fn main() {
}

fn build_libosmosistesting(out: PathBuf) {
// skip if doc_rs build
if std::env::var("DOCS_RS").is_ok() {
return;
}
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let exit_status = Command::new("go")
.current_dir(manifest_dir.join("libosmosistesting"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package command-line-arguments */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h>

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments. */




/* End of preamble from import "C" comments. */


/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif

/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue. */

#ifdef __cplusplus
extern "C" {
#endif

extern GoUint64 InitTestEnv();
extern char* InitAccount(GoUint64 envId, GoString coinsJson);
extern void BeginBlock(GoUint64 envId);
extern void EndBlock(GoUint64 envId);
extern char* Execute(GoUint64 envId, GoString base64ReqDeliverTx);
extern char* Query(GoUint64 envId, GoString path, GoString base64QueryMsgBytes);
extern GoUint64 AccountSequence(GoUint64 envId, GoString bech32Address);
extern GoUint64 AccountNumber(GoUint64 envId, GoString bech32Address);
extern char* Simulate(GoUint64 envId, GoString base64TxBytes);

#ifdef __cplusplus
}
#endif

0 comments on commit 90fabac

Please sign in to comment.