bt2qbt/Makefile
Alexey Kostin cca7869d2a
Full refactor. Introduce tests (#35)
* start refactor

* default golang loyaout
separate qbittorrent and torrent structures

* stage

* move flags handle to module and cover it with tests
change handle sep with path.join

* ugly remove unneeded fields from resume.dat

* use path joing
prepare for resume structs

* Introduce subtests

* fix behavior

* Move to structures instead of using interfaces

* Make main cmd clean, decomposite functions

* Make main cmd clean, decomposite functions

* Detect torrents functions and tests

* Fixes

* Fixes

* New tests for content layout and file paths
reformat code for project
change libtorrent version
append torrent v2 schema in torrent structs

* filepath helper module
fix some tests

* fileHelpers new functions and tests

* new function with cut last part with tests

* function description and small fix

* rename some variables and structures

* beautiful tests handle for savePaths
starting refactor savepaths

* Refactor HandleSavePath func. Cover with tests
Move replace field creation to handle and assign pointer, instead of generate each time with handle resumeItem.
Moved opts to transferStructure.

* fix some tests

* HandleSavePaths covered with tests and little bit fixed

* Another one additional test for fully function cover

* check for tests

* Remove PiecePriority

* Refactored HandlePieces functions
Removed unused functions

* Rename variables. Introduced new tests

* Append tests

* Rename test funcs

* New tests

* New tests

* move modules

* introduce Makefile

* Adapt fileHelpers for both windows and linux. Linux tests passed
Use slashed paths for search torrents

* remove test template

* test fileset

* Makefile. Version introduce

* Fix darwin i386 version build

* Bug fix with mappedfiles
Need more tests and append new functionality.

* tests for HandleSavePaths with absoulte paths in mapped files

* additional tests with fileshare

* all tests OK

* Fix torrent state. Added tests

* fixes after code inspection

* Magnet link support. Tests

* README.md update

Co-authored-by: Alexey Kostin <a.kostin@corp.mail.ru>
2022-03-30 02:30:29 +03:00

39 lines
1.9 KiB
Makefile

#GOOS=windows GOACH=amd64 go build -o bt2qbt_v${1}_amd64.exe -tags forceposix
#GOOS=windows GOARCH=386 go build -o bt2qbt_v${1}_i386.exe -tags forceposix
#GOOS=linux GOARCH=amd64 go build -o bt2qbt_v${1}_amd64_linux -tags forceposix
#GOOS=linux GOARCH=386 go build -o bt2qbt_v${1}_i386_linux -tags forceposix
#GOOS=darwin GOARCH=amd64 go build -o bt2qbt_v${1}_amd64_macos -tags forceposix
#GOOS=darwin GOARCH=386 go build -o bt2qbt_v${1}_i386_macos -tags forceposix
gotag=1.18.0-bullseye
oldgotag=1.14.15-buster
commit=$(shell git rev-parse HEAD)
dockercmd=docker run --rm -v $(CURDIR):/usr/src/bt2qbt -w /usr/src/bt2qbt
buildtags = -tags forceposix
buildenvs = -e CGO_ENABLED=0
version = 1.999
ldflags = -ldflags="-X 'main.version=$(version)' -X 'main.commit=$(commit)' -X 'main.buildImage=golang:$(gotag)'"
all: tests build
tests:
$(dockercmd) golang:$(gotag) go test $(buildtags) ./...
build: | tests windows linux darwin
windows:
$(dockercmd) $(buildenvs) -e GOOS=windows -e GOARCH=amd64 golang:$(gotag) go build -v $(buildtags) $(ldflags) -o bt2qbt_v$(version)_amd64.exe
$(dockercmd) $(buildenvs) -e GOOS=windows -e GOARCH=386 golang:$(gotag) go build -v $(buildtags) $(ldflags) -o bt2qbt_v$(version)_i386.exe
linux:
$(dockercmd) $(buildenvs) -e GOOS=linux -e GOARCH=amd64 golang:$(gotag) go build -v $(buildtags) $(ldflags) -o bt2qbt_v$(version)_amd64_linux
$(dockercmd) $(buildenvs) -e GOOS=linux -e GOARCH=386 golang:$(gotag) go build -v $(buildtags) $(ldflags) -o bt2qbt_v$(version)_i386_linux
darwin:
$(dockercmd) $(buildenvs) -e GOOS=darwin -e GOARCH=amd64 golang:$(gotag) go build -v $(buildtags) $(ldflags) -o bt2qbt_v$(version)_amd64_macos
$(dockercmd) $(buildenvs) -e GOOS=darwin -e GOARCH=386 -e GO111MODULE=off golang:$(oldgotag) bash -c "go get -v && go build -v $(buildtags) -ldflags="-X 'main.version=$(version)' -X 'main.commit=$(commit)' -X 'main.buildImage=golang:$(oldgotag)'" -o bt2qbt_v$(version)_i386_macos"