Makefile 1.62 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

chicm-ms's avatar
chicm-ms committed
14
15
16
17
18
19
20
21
TIME_STAMP = $(shell date "+%y%m%d%H%M")
NNI_VERSION_VALUE = $(shell git describe --tags --abbrev=0)

# To include time stamp in version value, run:
# make version_ts=true build
ifeq ($(version_ts), true)
	NNI_VERSION_VALUE := $(NNI_VERSION_VALUE).$(TIME_STAMP)
endif
goooxu's avatar
goooxu committed
22
NNI_VERSION_TEMPLATE = 999.0.0-developing
Gems Guo's avatar
Gems Guo committed
23

24
25
.PHONY: build
build:
Gems Guo's avatar
Gems Guo committed
26
	python3 -m pip install --user --upgrade setuptools wheel
27
28
29
30
	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
31
32
	cd $(CWD)../../src/nni_manager && yarn && yarn build
	cd $(CWD)../../src/webui && yarn && yarn build
33
34
35
36
	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
goooxu's avatar
goooxu committed
37
	sed -ie 's/$(NNI_VERSION_TEMPLATE)/$(NNI_VERSION_VALUE)/' $(CWD)nni/package.json
38
	cd $(CWD)nni && yarn --prod
goooxu's avatar
goooxu committed
39
	cd $(CWD) && sed -ie 's/$(NNI_VERSION_TEMPLATE)/$(NNI_VERSION_VALUE)/' setup.py && python3 setup.py bdist_wheel -p $(WHEEL_SPEC)
40
	cd $(CWD)
41
42
43

.PHONY: upload
upload:
Gems Guo's avatar
Gems Guo committed
44
	python3 -m pip install --user --upgrade twine
45
46
47
48
	python3 -m twine upload dist/*

.PHONY: clean
clean:
Gems Guo's avatar
Gems Guo committed
49
50
51
52
53
	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