Skip to content

Commit

Permalink
[skyapi] refs #7 Update v0.25.1 wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevMac committed Jun 26, 2019
1 parent a6a8285 commit 6633baa
Show file tree
Hide file tree
Showing 95 changed files with 21,979 additions and 33 deletions.
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
language: csharp
solution: LibskycoinNet.sln
mono:
- latest
#
#solution: LibskycoinNet.sln
sudo: required

install:
- eval "$(gimme 1.10)"
- eval "$(gimme 1.11)"
- go version
- mkdir swig_build && cd swig_build && wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar -zxf swig-3.0.12.tar.gz && cd swig-3.0.12 && sudo ./configure --prefix=/usr && sudo make && sudo make install && cd ../../ && sudo rm -rf swig_build

- python --version
- go get github.com/gz-c/gox
- mkdir swig_build && cd swig_build && wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz && tar -zxf swig-3.0.12.tar.gz && cd swig-3.0.12 && sudo ./configure --prefix=/usr && sudo make && sudo make install && cd ../../ && sudo rm -rf swig_build

script:
- make test

- make test-libsky
- make test-skyapi

notifications:
email: false
webhooks: https://fathomless-fjord-24024.herokuapp.com/notify
Expand Down
68 changes: 41 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,68 +1,82 @@
PWD = $(shell pwd)
GOPATH_DIR = $(PWD)/gopath
SKYCOIN_DIR = gopath/src/github.com/skycoin/skycoin
SKYCOIN_DIR = gopath/src/github.com/skycoin/libskycoin
SKYBUILD_DIR = $(SKYCOIN_DIR)/build
BUILDLIBC_DIR = $(SKYBUILD_DIR)/libskycoin
LIBC_DIR = $(SKYCOIN_DIR)/lib/cgo
LIBSWIG_DIR = swig
LIBSWIG_DIR = lib/swig
BUILD_DIR = build
BIN_DIR = $(SKYCOIN_DIR)/bin
INCLUDE_DIR = $(SKYCOIN_DIR)/include
FULL_PATH_LIB = $(PWD)/$(BUILDLIBC_DIR)

LIB_FILES = $(shell find $(SKYCOIN_DIR)/lib/cgo -type f -name "*.go")
SRC_FILES = $(shell find $(SKYCOIN_DIR)/src -type f -name "*.go")
SWIG_FILES = $(shell find $(LIBSWIG_DIR) -type f -name "*.i")
HEADER_FILES = $(shell find $(SKYCOIN_DIR)/include -type f -name "*.h")

# Added by Swagger
LIB_SKYCOIN_DIR = gopath/src/github.com/skycoin/libskycoin
SWAGGER_SPEC_DIR = $(LIB_SKYCOIN_DIR)/lib/swagger/skycoin.v0.25.1.openapi.v2.yml
CSHARP_CLIENT_DIR = lib/skyapi

CSHARP_SWIG_DIR = lib/swig

configure: ## Setup build environment
mkdir -p $(BUILD_DIR)/usr/tmp $(BUILD_DIR)/usr/lib $(BUILD_DIR)/usr/include
mkdir -p $(BUILDLIBC_DIR) $(BIN_DIR) $(INCLUDE_DIR)

$(BUILDLIBC_DIR)/libskycoin.a: $(LIB_FILES) $(SRC_FILES) $(HEADER_FILES)
rm -f $(BUILDLIBC_DIR)/libskycoin.a
GOPATH="$(GOPATH_DIR)" make -C $(SKYCOIN_DIR) build-libc-static
GOPATH="$(GOPATH_DIR)" make -C $(LIB_SKYCOIN_DIR) build-libc-static
ls $(BUILDLIBC_DIR)
rm -f swig/include/libskycoin.h
mkdir -p swig/include
grep -v "_Complex" $(INCLUDE_DIR)/libskycoin.h > swig/include/libskycoin.h
rm -f lib/swig/swig/include/libskycoin.h
mkdir -p lib/swig/swig/include
grep -v "_Complex" $(INCLUDE_DIR)/libskycoin.h > lib/swig/swig/include/libskycoin.h

build-libc: configure $(BUILDLIBC_DIR)/libskycoin.a ## Build libskycoin static C client library

build-swig: ## Generate csharp source code from SWIG interface definitions
#Generate structs.i from skytypes.gen.h
rm -f $(LIBSWIG_DIR)/structs.i
cp $(INCLUDE_DIR)/skytypes.gen.h $(LIBSWIG_DIR)/structs.i
rm -f $(LIBSWIG_DIR)/swig/structs.i
cp $(INCLUDE_DIR)/skytypes.gen.h $(LIBSWIG_DIR)/swig/structs.i
#sed -i 's/#/%/g' $(LIBSWIG_DIR)/structs.i
{ \
if [[ "$$(uname -s)" == "Darwin" ]]; then \
sed -i '.kbk' 's/#/%/g' $(LIBSWIG_DIR)/structs.i ;\
sed -i '.kbk' 's/#/%/g' $(LIBSWIG_DIR)/swig/structs.i ;\
else \
sed -i 's/#/%/g' $(LIBSWIG_DIR)/structs.i ;\
sed -i 's/#/%/g' $(LIBSWIG_DIR)/swig/structs.i ;\
fi \
}
mkdir -p ./LibskycoinNet/skycoin
rm -f swig/include/swig.h
rm -f LibskycoinNet/skycoin/skycoinnet_wrap.c
swig -csharp -oldvarnames -v -namespace skycoin -Iswig/include -I$(INCLUDE_DIR) -outdir LibskycoinNet/skycoin -o LibskycoinNet/skycoin/skycoinnet_wrap.c $(LIBSWIG_DIR)/libdotnet.i
build-libskycoin-net: build-swig build-libc ## Build shared library including SWIG wrappers
gcc -c -fpic -ILibskycoinNet/swig/include -I$(INCLUDE_DIR) LibskycoinNet/skycoin/skycoinnet_wrap.c
mkdir -p $(CSHARP_SWIG_DIR)/LibskycoinNet/skycoin
rm -f $(LIBSWIG_DIR)/swig/include/swig.h
rm -f $(CSHARP_SWIG_DIR)/LibskycoinNet/skycoin/skycoinnet_wrap.c
swig -csharp -v -namespace skycoin -Iswig/include -I$(INCLUDE_DIR) -outdir $(CSHARP_SWIG_DIR)/LibskycoinNet/skycoin -o $(CSHARP_SWIG_DIR)/LibskycoinNet/skycoin/skycoinnet_wrap.c $(LIBSWIG_DIR)/swig/libdotnet.i

build-libsky-shared: build-swig build-libc ## Build shared library including SWIG wrappers
gcc -c -fpic -ILibskycoinNet/swig/include -I$(INCLUDE_DIR) $(CSHARP_SWIG_DIR)/LibskycoinNet/skycoin/skycoinnet_wrap.c
gcc -shared skycoinnet_wrap.o $(BUILDLIBC_DIR)/libskycoin.a -o libskycoin.so
mv libskycoin.so LibskycoinNetTest/bin/Release
mv libskycoin.so $(CSHARP_SWIG_DIR)/LibskycoinNetTest/bin/Release

install-deps: ## Install development dependencies
nuget restore LibskycoinNet.sln
install-deps-libsky: ## Install development dependencies for LibSkycoinNet
nuget restore $(CSHARP_SWIG_DIR)/LibskycoinNet.sln
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner

build-sln: install-deps build-libc build-swig
msbuild /p:Configuration=Release LibskycoinNet.sln
msbuild /p:Configuration=Debug LibskycoinNet.sln
build-libsky-sln: install-deps-libsky build-libc build-swig
msbuild /p:Configuration=Release $(CSHARP_SWIG_DIR)/LibskycoinNet.sln
msbuild /p:Configuration=Debug $(CSHARP_SWIG_DIR)/LibskycoinNet.sln

build-libsky: build-libsky-sln build-libsky-shared ## Build LibSkycoinNet Assembly

build-skyapi: ## Build SkyApi Assembly
(cd $(CSHARP_CLIENT_DIR) && /bin/sh build.sh)

test-libsky: build-libsky ## Run LibSkycoinNet test suite
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe $(CSHARP_SWIG_DIR)/LibskycoinNetTest/bin/Release/LibskycoinNetTest.dll -labels

build: build-sln build-libskycoin-net ## Build LibSkycoinNet Assembly
test-skyapi: ## Run SkyApi test suite
(cd $(CSHARP_CLIENT_DIR) && /bin/sh mono_nunit_test.sh)

test: build ## Run LibSkycoinNet test suite
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./LibskycoinNetTest/bin/Release/LibskycoinNetTest.dll -labels
test: build test-libsky test-skyapi ## Run all tests

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
186 changes: 186 additions & 0 deletions lib/skyapi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Ref: https://gist.github.com/kmorcinek/2710267
# Download this file using PowerShell v3 under Windows with the following comand
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore

# User-specific files
*.suo
*.user
*.sln.docstates
./nuget

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# OS generated files #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
modulesbin/
tempbin/

# EPiServer Site file (VPP)
AppData/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# vim
*.txt~
*.swp
*.swo

# svn
.svn

# SQL Server files
**/App_Data/*.mdf
**/App_Data/*.ldf
**/App_Data/*.sdf


#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac desktop service store files
.DS_Store

# SASS Compiler cache
.sass-cache

# Visual Studio 2014 CTP
**/*.sln.ide
23 changes: 23 additions & 0 deletions lib/skyapi/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions lib/skyapi/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.1
23 changes: 23 additions & 0 deletions lib/skyapi/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions lib/skyapi/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.5
9 changes: 9 additions & 0 deletions lib/skyapi/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
language: csharp
mono:
- latest
solution: IO.Swagger.sln
script:
- /bin/sh ./mono_nunit_test.sh
Loading

0 comments on commit 6633baa

Please sign in to comment.