Makefile 1.53 KB
Newer Older
1
2
CWD := $(PWD)/

3
4
5
6
7
8
9
10
11
12
13
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
	OS_SPEC := linux
	WHEEL_SPEC := manylinux1_x86_64
else ifeq ($(UNAME_S), Darwin)
	OS_SPEC := darwin
	WHEEL_SPEC := macosx_10_9_x86_64
else 
	$(error platform $(UNAME_S) not supported)
endif

Gems Guo's avatar
Gems Guo committed
14
15
NNI_VERSION = $(shell git describe --tags)

16
17
.PHONY: build
build:
Gems Guo's avatar
Gems Guo committed
18
	python3 -m pip install --user --upgrade setuptools wheel
19
20
21
22
	wget https://aka.ms/nni/nodejs-download/$(OS_SPEC) -O $(CWD)node-$(OS_SPEC)-x64.tar.xz
	rm -rf $(CWD)node-$(OS_SPEC)-x64
	mkdir $(CWD)node-$(OS_SPEC)-x64
	tar xf $(CWD)node-$(OS_SPEC)-x64.tar.xz -C node-$(OS_SPEC)-x64 --strip-components 1
23
24
	cd $(CWD)../../src/nni_manager && yarn && yarn build
	cd $(CWD)../../src/webui && yarn && yarn build
25
26
27
28
	rm -rf $(CWD)nni
	cp -r $(CWD)../../src/nni_manager/dist $(CWD)nni
	cp -r $(CWD)../../src/webui/build $(CWD)nni/static
	cp $(CWD)../../src/nni_manager/package.json $(CWD)nni
Gems Guo's avatar
Gems Guo committed
29
	sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' $(CWD)nni/package.json
30
	cd $(CWD)nni && yarn --prod
Gems Guo's avatar
Gems Guo committed
31
32
	cd $(CWD) && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && python3 setup.py bdist_wheel -p $(WHEEL_SPEC)
	cd $(CWD)../../src/sdk/pynni && sed -ie 's/NNI_VERSION/$(NNI_VERSION)/' setup.py && python3 setup.py bdist_wheel
33
	cp -r $(CWD)../../src/sdk/pynni/dist/*.whl $(CWD)dist
34
	cd $(CWD)
35
36
37

.PHONY: upload
upload:
Gems Guo's avatar
Gems Guo committed
38
	python3 -m pip install --user --upgrade twine
39
40
41
42
	python3 -m twine upload dist/*

.PHONY: clean
clean:
Gems Guo's avatar
Gems Guo committed
43
44
45
46
47
48
	rm -rf $(CWD)../../src/sdk/pynni/dist
	rm -rf $(CWD)build
	rm -rf $(CWD)dist
	rm -rf $(CWD)nni
	rm -rf $(CWD)nni.egg-info
	rm -rf $(CWD)node-$(OS_SPEC)-x64