Skip to content

Commit

Permalink
remove internal dir
Browse files Browse the repository at this point in the history
  • Loading branch information
slandymani committed Jul 19, 2024
1 parent 85f4681 commit 5c23c91
Show file tree
Hide file tree
Showing 45 changed files with 36 additions and 36 deletions.
26 changes: 13 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
fi
- run:
# It is easy to update libwasmvm/bindings.h as part of the development but forget `make update-bindings`
name: Ensure internal/api/bindings.h is up to date
command: diff libwasmvm/bindings.h internal/api/bindings.h
name: Ensure api/bindings.h is up to date
command: diff libwasmvm/bindings.h api/bindings.h
- run:
name: Check Rust formatting
working_directory: libwasmvm
Expand Down Expand Up @@ -291,7 +291,7 @@ jobs:
name: Create release build of libwasmvm
command: make build-rust
- persist_to_workspace:
root: ./internal/api
root: ./api
paths:
- libwasmvm.x86_64.so
- save_cache:
Expand All @@ -318,7 +318,7 @@ jobs:
at: /tmp/builds
- run:
name: Copy .so build
command: cp /tmp/builds/libwasmvm.x86_64.so ./internal/api
command: cp /tmp/builds/libwasmvm.x86_64.so ./api
- run:
name: Build Go project
command: make build-go
Expand All @@ -340,7 +340,7 @@ jobs:
- run: make test-alpine
- run:
name: Debug build results
command: ls -l ./internal/api
command: ls -l ./api

deploy_to_git:
machine:
Expand Down Expand Up @@ -368,7 +368,7 @@ jobs:
# command: make release-build-windows
- run:
name: Debug build results
command: ls -l ./internal/api
command: ls -l ./api
- run:
name: Configure git user
# This is not a GitHub user and no permissions can be configured other than "push access", which
Expand All @@ -380,7 +380,7 @@ jobs:
name: Check-in and push new libraries
command: |
git status
git add ./internal/api
git add ./api
git commit --allow-empty -m '[skip ci] Built release libraries'
git push origin $CIRCLE_BRANCH
Expand All @@ -403,7 +403,7 @@ jobs:
command: make release-build-alpine
- run:
name: Debug build results
command: ls -l ./internal/api
command: ls -l ./api
# Deploy to GitHub releases on tag builds. At some point we might want to extract
# those steps into a separate job for better maintainability.
- when:
Expand All @@ -415,13 +415,13 @@ jobs:
mkdir artifacts
# Static (from build)
cp ./internal/api/libwasmvm_muslc.x86_64.a artifacts/
cp ./internal/api/libwasmvm_muslc.aarch64.a artifacts/
cp ./api/libwasmvm_muslc.x86_64.a artifacts/
cp ./api/libwasmvm_muslc.aarch64.a artifacts/
# Shared (from git)
cp ./internal/api/libwasmvm.aarch64.so artifacts/
cp ./internal/api/libwasmvm.x86_64.so artifacts/
cp ./internal/api/libwasmvm.dylib artifacts/
cp ./api/libwasmvm.aarch64.so artifacts/
cp ./api/libwasmvm.x86_64.so artifacts/
cp ./api/libwasmvm.dylib artifacts/
- run:
name: Create checksums
working_directory: artifacts
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.vscode

# no static libraries (35MB+)
/internal/api/lib*.a
/api/lib*.a

# artifacts from compile tests
/build/
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build-rust: build-rust-release
# In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default
build-rust-debug:
(cd libwasmvm && cargo build)
cp libwasmvm/target/debug/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST)
cp libwasmvm/target/debug/$(SHARED_LIB_SRC) api/$(SHARED_LIB_DST)
make update-bindings

# use release build to actually ship - smaller and much faster
Expand All @@ -49,7 +49,7 @@ build-rust-debug:
# enable stripping through cargo (if that is desired).
build-rust-release:
(cd libwasmvm && cargo build --release)
cp libwasmvm/target/release/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST)
cp libwasmvm/target/release/$(SHARED_LIB_SRC) api/$(SHARED_LIB_DST)
make update-bindings
@ #this pulls out ELF symbols, 80% size reduction!

Expand Down Expand Up @@ -77,8 +77,8 @@ release-build-alpine:
rm -rf libwasmvm/target/x86_64-unknown-linux-musl/release
# build the muslc *.a file
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-alpine
cp libwasmvm/artifacts/libwasmvm_muslc.x86_64.a internal/api
cp libwasmvm/artifacts/libwasmvm_muslc.aarch64.a internal/api
cp libwasmvm/artifacts/libwasmvm_muslc.x86_64.a api
cp libwasmvm/artifacts/libwasmvm_muslc.aarch64.a api
make update-bindings

# Creates a release build in a containerized build environment of the shared library for glibc Linux (.so)
Expand All @@ -87,8 +87,8 @@ release-build-linux:
rm -rf libwasmvm/target/x86_64-unknown-linux-gnu/release
rm -rf libwasmvm/target/aarch64-unknown-linux-gnu/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-centos7 build_linux.sh
cp libwasmvm/artifacts/libwasmvm.x86_64.so internal/api
cp libwasmvm/artifacts/libwasmvm.aarch64.so internal/api
cp libwasmvm/artifacts/libwasmvm.x86_64.so api
cp libwasmvm/artifacts/libwasmvm.aarch64.so api
make update-bindings

# Creates a release build in a containerized build environment of the shared library for macOS (.dylib)
Expand All @@ -97,7 +97,7 @@ release-build-macos:
rm -rf libwasmvm/target/x86_64-apple-darwin/release
rm -rf libwasmvm/target/aarch64-apple-darwin/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-cross build_macos.sh
cp libwasmvm/artifacts/libwasmvm.dylib internal/api
cp libwasmvm/artifacts/libwasmvm.dylib api
make update-bindings

# Creates a release build in a containerized build environment of the static library for macOS (.a)
Expand All @@ -106,21 +106,21 @@ release-build-macos-static:
rm -rf libwasmvm/target/x86_64-apple-darwin/release
rm -rf libwasmvm/target/aarch64-apple-darwin/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-cross build_macos_static.sh
cp libwasmvm/artifacts/libwasmvmstatic_darwin.a internal/api/libwasmvmstatic_darwin.a
cp libwasmvm/artifacts/libwasmvmstatic_darwin.a api/libwasmvmstatic_darwin.a
make update-bindings

# Creates a release build in a containerized build environment of the shared library for Windows (.dll)
release-build-windows:
# Builders should not write their target folder into the host file system (https://github.com/CosmWasm/wasmvm/issues/437)
rm -rf libwasmvm/target/x86_64-pc-windows-gnu/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX)-cross build_windows.sh
cp libwasmvm/target/x86_64-pc-windows-gnu/release/wasmvm.dll internal/api
cp libwasmvm/target/x86_64-pc-windows-gnu/release/wasmvm.dll api
make update-bindings

update-bindings:
# After we build libwasmvm, we have to copy the generated bindings for Go code to use.
# We cannot use symlinks as those are not reliably resolved by `go get` (https://github.com/CosmWasm/wasmvm/pull/235).
cp libwasmvm/bindings.h internal/api
cp libwasmvm/bindings.h api

release-build:
# Write like this because those must not run in parallel
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The Go code consistes of three packages:

1. The types (the `github.com/CosmWasm/wasmvm/types` import), using
`package types`
2. The internal package `internal/api`, using `package api`
2. The internal package `api`, using `package api`
3. This repo (the `github.com/CosmWasm/wasmvm` import), using `package cosmwasm`

The dependencies between them are as follows:
Expand Down Expand Up @@ -72,11 +72,11 @@ go build ./types
CGO_ENABLED=0 go build ./types
```

#### Package internal/api
#### Package api

This package contains the code binding the libwasmvm build to the Go code. All
low level FFI handling code belongs there. This package can only be built using
cgo. Uing the `internal/` convention makes this package fully private.
cgo.

#### Package github.com/CosmWasm/wasmvm

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/api/iterator_test.go → api/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api/testdb"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api/testdb"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/api/mocks.go → api/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api/testdb"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api/testdb"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ libs:
```

Then in the repo root, `make release-build` will use the above docker image and
copy the generated `{so,dylib}` files into `internal/api` directory to be
copy the generated `{so,dylib}` files into `api` directory to be
linked.

## Future Work
Expand Down
2 changes: 1 addition & 1 deletion ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
2 changes: 1 addition & 1 deletion lib_libwasmvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"encoding/json"
"fmt"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
2 changes: 1 addition & 1 deletion lib_libwasmvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
2 changes: 1 addition & 1 deletion oracle_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package cosmwasm

import (
"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
)

Expand Down
2 changes: 1 addition & 1 deletion oracle_lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package cosmwasm
import (
"testing"

"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/types"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion version_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package cosmwasm

import (
"github.com/ODIN-PROTOCOL/wasmvm/v2/internal/api"
"github.com/ODIN-PROTOCOL/wasmvm/v2/api"
)

func libwasmvmVersionImpl() (string, error) {
Expand Down

0 comments on commit 5c23c91

Please sign in to comment.