Skip to content

Commit

Permalink
Use scoop for build tool installation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTiedemann committed Mar 25, 2019
1 parent 7bda9ec commit ca0e5b6
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 51 deletions.
5 changes: 2 additions & 3 deletions .azure-pipelines.yml
@@ -1,6 +1,5 @@
pool:
vmImage: windows-2019
steps:
- powershell: .\env.ps1
- powershell: iwr ftp://ftp.equation.com/make/64/make.exe -out make.exe
- script: .\make.exe test
- powershell: .\setup.ps1
- script: make test
4 changes: 0 additions & 4 deletions env.ps1

This file was deleted.

11 changes: 11 additions & 0 deletions setup.ps1
@@ -0,0 +1,11 @@
$ErrorActionPreference = 'Stop'

write-host BuildLabEx: (gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').BuildLabEx
write-host InstallationType: (gp 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').InstallationType
write-host ProductType: (Get-WMIObject Win32_OperatingSystem ProductType).ProductType
write-host PSVersion: $PSVersionTable.PSVersion

if (!(gcm scoop -ea:SilentlyContinue)) {
iex (new-object Net.WebClient).DownloadString('https://get.scoop.sh') -ea:SilentlyContinue
}
scoop install make curl touch
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -27,7 +27,7 @@ $(foreach arch,$(NODE_ARCHS),$(eval $(call build_arch,$(arch))))
define copy_version_arch
addon_napi_v$(1)_$(2).node: build_$(2)
copy /y build_$(2)\Release\addon_napi_v$(1).node $$@
..\tools\node_v11_$(2).exe touch.js $$@
touch $$@
endef

$(foreach napi_version,$(NAPI_VERSIONS),\
Expand Down
3 changes: 0 additions & 3 deletions src/touch.js

This file was deleted.

34 changes: 16 additions & 18 deletions tools/Makefile
Expand Up @@ -13,14 +13,11 @@ MSVS_RELEASE := 15
target_files := \
$(foreach version,$(NODE_VERSIONS),$(foreach arch,$(NODE_ARCHS),node_v$(version)_$(arch).exe )) \
node-addon-api.zip node-gyp.zip npm.zip \
python.msi \
vs_buildtools.zip
python.msi vs_buildtools.zip

target_dirs := \
node-addon-api node-gyp npm \
node-gyp\node_modules \
python \
vs_buildtools
node-addon-api node-gyp npm node-gyp\node_modules \
python vs_buildtools

pf := powershell -f
pc := powershell -c
Expand All @@ -29,38 +26,38 @@ all: $(target_files) $(target_dirs)

define download_version_arch
node_v$(1)_$(2).exe:
$(pf) .\iwr.ps1 https://nodejs.org/dist/latest-v$(1).x/win-$(if $(findstring ia32,$(2)),x86,x64)/node.exe $$@
curl -fsSLo $$@ https://nodejs.org/dist/latest-v$(1).x/win-$(if $(findstring ia32,$(2)),x86,x64)/node.exe
endef

$(foreach version,$(NODE_VERSIONS),\
$(foreach arch,$(NODE_ARCHS),\
$(eval $(call download_version_arch,$(version),$(arch)))))

node-addon-api.zip:
$(pf) .\iwr.ps1 https://github.com/nodejs/node-addon-api/archive/$(NODE_ADDON_API_VERSION).zip $@
curl -fsSLo $@ https://github.com/nodejs/node-addon-api/archive/$(NODE_ADDON_API_VERSION).zip
node-gyp.zip:
$(pf) .\iwr.ps1 https://github.com/nodejs/node-gyp/archive/v$(NODE_GYP_VERSION).zip $@
curl -fsSLo $@ https://github.com/nodejs/node-gyp/archive/v$(NODE_GYP_VERSION).zip
npm.zip:
$(pf) .\iwr.ps1 https://github.com/npm/cli/archive/v$(NPM_VERSION).zip $@
curl -fsSLo $@ https://github.com/npm/cli/archive/v$(NPM_VERSION).zip

node-addon-api: node-addon-api.zip
$(pf) .\unzip.ps1 $< .
7z x $< -y
$(pc) mv node-addon-api-$(NODE_ADDON_API_VERSION) $@
node-gyp: node-gyp.zip
$(pf) .\unzip.ps1 $< .
7z x $< -y
$(pc) mv node-gyp-$(NODE_GYP_VERSION) $@
npm: npm.zip
$(pf) .\unzip.ps1 $< .
7z x $< -y
$(pc) mv cli-$(NPM_VERSION) $@

python.msi:
$(pf) .\iwr.ps1 https://www.python.org/ftp/python/$(PYTHON_VERSION)/python-$(PYTHON_VERSION).amd64.msi $@
curl -fsSLo $@ https://www.python.org/ftp/python/$(PYTHON_VERSION)/python-$(PYTHON_VERSION).amd64.msi

python: python.msi
$(pf) .\install_python.ps1

# vs_buildtools.exe:
# $(pf) .\iwr.ps1 https://aka.ms/vs/$(MSVS_RELEASE)/release/$@ $@
# curl -fsSLo $@ https://aka.ms/vs/$(MSVS_RELEASE)/release/$@

# vs_buildtools: vs_buildtools.exe
# $(pf) .\install_vs_buildtools.ps1
Expand All @@ -75,12 +72,13 @@ vs_buildtools.zip: vs_buildtools.zip.8.part
$(pf) .\unpart.ps1 $@

vs_buildtools: vs_buildtools.zip
$(pf) .\unzip.ps1 $< .
7z x $< -y

node-gyp\node_modules: node_v11_x64.exe node-gyp npm
cd node-gyp && \
..\node_v11_x64.exe ..\npm\bin\npm-cli.js install --production --no-package-lock && \
$(pf) ..\touch.ps1 node_modules
touch node_modules

clean:
$(pc) "'$(target_dirs) $(target_files)' -split ' ' | rm -r -fo -ea:silentlycontinue; true"
@del /q /f $(target_files) 2> nul || true
@rmdir /q /s $(target_dirs) build 2> nul || true
5 changes: 0 additions & 5 deletions tools/iwr.ps1

This file was deleted.

9 changes: 0 additions & 9 deletions tools/touch.ps1

This file was deleted.

4 changes: 0 additions & 4 deletions tools/unzip.ps1

This file was deleted.

4 changes: 0 additions & 4 deletions tools/zip.ps1

This file was deleted.

0 comments on commit ca0e5b6

Please sign in to comment.