Skip to content
Snippets Groups Projects
Commit 26a99e11 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] New release tool

parent 12176b7d
No related branches found
No related tags found
No related merge requests found
Showing
with 279 additions and 769 deletions
......@@ -20,3 +20,9 @@ yarn.lock
.vagrant/
vagrant/*.log
vagrant/duniter
# Releases
*.deb
*.tar.gz
*.log
*.exe
......@@ -24,22 +24,7 @@ after_success:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- rm -Rf ./coverage
before_deploy:
# Download & embed Nodejs binary
- ci/travis/before_deploy.sh
deploy:
- provider: releases
# prerelease: true
skip_cleanup: true
api-key:
secure: h+GgYhh8/I/l5EWdI1+bDQYtN57jvDf0xhiwcxlfm/AvaJWOZa+q81HsXdHqtwgmsCoRklKtOqTM/nqgSOcWPXsAditRjEXOui2FjZiJCosDjDPMnN6HKzw6XVLtSOx7CeCX/xFmoNTIdsAuC+HUfDWCUFgrsMj9F0V9J3U1nDs=
file:
- /home/travis/build/duniter-desktop-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.deb
- /home/travis/build/duniter-desktop-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.tar.gz
- /home/travis/build/duniter-server-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.deb
on:
repo: duniter/duniter
tags: true
- provider: npm
email: cem.moreau@gmail.com
skip_cleanup: true
......
......@@ -13,72 +13,3 @@ install:
- npm install -g npm
- npm install -g nw-gyp node-pre-gyp
- npm install
build: off
after_test:
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm prune --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install duniter-bma --save --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install duniter-crawler --save --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install duniter-keypair --save --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install duniter-prover --save --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] powershell .\\ci\\appveyor\\inno_setup.ps1
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] rd /s /q %APPDATA%\..\Local\NuGet\Cache
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set SRC=%cd%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] echo %SRC%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] copy misc\MSVSVersion.py %APPDATA%\npm\node_modules\nw-gyp\gyp\pylib\gyp\MSVSVersion.py
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set NW_VERSION=0.17.6
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set NW_RELEASE=v0.17.6
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] echo %NW_RELEASE%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd node_modules/wotb
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install --build-from-source
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\wotb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\wotb.node /Y
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd ../naclb
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install --build-from-source
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\naclb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\naclb.node /Y
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd ../scryptb
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install --build-from-source
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\scryptb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\scryptb.node /Y
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd ../sqlite3
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install --build-from-source
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] copy %cd%\lib\binding\node-webkit-%NW_RELEASE%-win32-x64\node_sqlite3.node %cd%\lib\binding\node-v%ADDON_VERSION%-win32-x64\node_sqlite3.node /Y
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd ../..
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] npm install duniter-ui --save --production
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] rd /s /q %cd%\node_modules\duniter-ui\node_modules
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] cd ..
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] mkdir duniter_release
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set NW=nwjs-%NW_RELEASE%-win-x64
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] echo %NW%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] set NW_GZ=%NW%.zip
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] echo %NW_GZ%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] appveyor DownloadFile https://dl.nwjs.io/%NW_RELEASE%/nwjs-%NW_RELEASE%-win-x64.zip %NW_GZ%
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] 7z x %NW_GZ% 1> null
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] move %NW% %cd%\duniter_release\nw
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] mkdir %cd%\duniter_release\sources
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] xcopy %SRC%\gui\* %cd%\duniter_release\nw\ /s /e
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] xcopy %SRC%\* %cd%\duniter_release\sources\ /s /e
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] iscc %cd%\duniter_release\sources\duniter.iss /DROOT_PATH=%cd%\duniter_release
- if [%APPVEYOR_REPO_TAG_NAME%] neq [] move %cd%\duniter_release\Duniter.exe %cd%\duniter\duniter-desktop-%APPVEYOR_REPO_TAG_NAME%-windows-x64.exe
artifacts:
- path: duniter*.exe
name: Duniter
deploy:
release: v1.2.2
provider: GitHub
auth_token:
secure: Vp/M0r0i1yhGR2nhrPWEbTiDIF6r0cmwbNDFZUzdFe5clWxPXtuC0lgIpOQI78zt
artifact: /Duniter/
# prerelease: true
on:
appveyor_repo_tag: true
#!/bin/bash
case "$1" in
make)
case "$2" in
deb)
cd vagrant/ubuntu
[[ $? -eq 0 ]] && echo ">> Starting Vagrant Ubuntu VM..."
[[ $? -eq 0 ]] && vagrant up
[[ $? -eq 0 ]] && echo ">> VM: building Duniter..."
[[ $? -eq 0 ]] && vagrant ssh -- 'bash -s' < ./build-deb.sh
if [ ! $? -eq 0 ]; then
echo ">> Something went wrong. Stopping build."
else
echo ">> Tests succeed! Continuing build."
fi
;;
*)
echo "Unknown binary « $2 »."
;;
esac
;;
*)
echo "Unknown task « $1 »."
;;
esac
$exePath = "$env:USERPROFILE\innosetup-5.5.9-unicode.exe"
Write-Host "Downloading InnoSetup 5.5.9..."
(New-Object Net.WebClient).DownloadFile('http://files.jrsoftware.org/is/5/innosetup-5.5.9-unicode.exe', $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /silent
Write-Host "Installed InnoSetup 5.5.9" -ForegroundColor Green
\ No newline at end of file
#!/usr/bin/env bash
if [[ ! -f before_deploy ]]; then
# Process this only once
touch before_deploy
# Prepare
NVER=`node -v`
DUNITER_VER=1.2.2
DUNITER_DEB_VER=" $DUNITER_VER"
ADDON_VERSION=48
NW_VERSION=0.17.6
NW_RELEASE="v${NW_VERSION}"
NW="nwjs-${NW_RELEASE}-linux-x64"
NW_GZ="${NW}.tar.gz"
# Clean test and UI packages
npm prune --production
npm install duniter-ui --save --production
npm install duniter-bma --save --production
npm install duniter-crawler --save --production
npm install duniter-keypair --save --production
npm install duniter-prover --save --production
rm -Rf node_modules/duniter-ui/node_modules
SRC=`pwd`
cd ..
cp -r $SRC desktop_
# Remove git files
rm -Rf .git "$SRC/.git"
# -------------------------------------------------
# Build Desktop version (Nw.js is embedded)
# -------------------------------------------------
cd desktop_
SRC=`pwd`
echo $SRC
echo $NW_RELEASE
npm install -g nw-gyp node-pre-gyp
cd node_modules/wotb
npm install --build-from-source
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION configure
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION build
cp lib/binding/Release/node-webkit-$NW_RELEASE-linux-x64/wotb.node lib/binding/Release/node-v$ADDON_VERSION-linux-x64/wotb.node
cd ../..
cd node_modules/naclb
npm install --build-from-source
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION configure
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION build
cp lib/binding/Release/node-webkit-$NW_RELEASE-linux-x64/naclb.node lib/binding/Release/node-v$ADDON_VERSION-linux-x64/naclb.node
cd ../..
cd node_modules/scryptb
npm install --build-from-source
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION configure
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION build
cp lib/binding/Release/node-webkit-$NW_RELEASE-linux-x64/scryptb.node lib/binding/Release/node-v$ADDON_VERSION-linux-x64/scryptb.node
cd ../..
cd node_modules/sqlite3
npm install --build-from-source
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION configure
node-pre-gyp --runtime=node-webkit --target=$NW_VERSION build
cp lib/binding/node-webkit-$NW_RELEASE-linux-x64/node_sqlite3.node lib/binding/node-v$ADDON_VERSION-linux-x64/node_sqlite3.node
cd ../..
cd ..
# Install Nw.js
mkdir desktop_release
PWD=`pwd`
SRC="$PWD/desktop_"
wget https://dl.nwjs.io/${NW_RELEASE}/${NW_GZ}
tar xvzf ${NW_GZ}
mv ${NW} desktop_release/nw
cp ${SRC}/gui/* desktop_release/nw/
cp -R ${SRC}/ desktop_release/sources/
cd desktop_release
tar czf ../../duniter-desktop-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.tar.gz * --exclude ".git" --exclude "coverage" --exclude "test"
cd ..
# -------------------------------------------------
# Build Desktop version (Nw.js is embedded)
# -------------------------------------------------
# Create .deb tree + package it
mv desktop_release/sources/ci/travis/debian duniter-x64
mkdir -p duniter-x64/opt/duniter/
chmod 755 duniter-x64/DEBIAN/post*
chmod 755 duniter-x64/DEBIAN/pre*
sed -i "s/Version:.*/Version:$DUNITER_DEB_VER/g" duniter-x64/DEBIAN/control
cd desktop_release/sources
zip -qr ../duniter-desktop.nw *
cd ../nw
zip -qr ../nw.nwb *
cd ../..
mv desktop_release/duniter-desktop.nw duniter-x64/opt/duniter/
mv desktop_release/nw.nwb duniter-x64/opt/duniter/
# Server TGZ release
sed -i "s/Package: .*/Package: duniter-desktop/g" duniter-x64/DEBIAN/control
fakeroot dpkg-deb --build duniter-x64
mv duniter-x64.deb ../duniter-desktop-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.deb
# -------------------------------------------------
# Build Server version (Node.js is embedded, not Nw.js)
# -------------------------------------------------
# Remove Nw.js
rm -rf duniter-x64/opt/duniter/nw*
# Rebuild node addons
cd desktop_release/sources/
rm -rf node_modules
npm install --production
npm install duniter-ui --production
# Download Node.js and package it with the sources
wget http://nodejs.org/dist/${NVER}/node-${NVER}-linux-x64.tar.gz
tar xzf node-${NVER}-linux-x64.tar.gz
mv node-${NVER}-linux-x64 node
rm node-${NVER}-linux-x64.tar.gz
rm -rf ../duniter-desktop.nw
zip -qr ../duniter-desktop.nw *
cd ../..
rm -rf duniter-x64/opt/duniter/duniter-desktop.nw
mv desktop_release/duniter-desktop.nw duniter-x64/opt/duniter/
sed -i "s/Package: .*/Package: duniter/g" duniter-x64/DEBIAN/control
rm -rf duniter-x64/DEBIAN/usr
fakeroot dpkg-deb --build duniter-x64
mv duniter-x64.deb ../duniter-server-${TRAVIS_TAG}-${TRAVIS_OS_NAME}-x64.deb
pwd
ls -al
###### NPM release
cd duniter
fi
{
"appenders": [
{
"type": "console"
}
]
}
\ No newline at end of file
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Handle version information related to Visual Stuio."""
import errno
import os
import re
import subprocess
import sys
import gyp
import glob
class VisualStudioVersion(object):
"""Information regarding a version of Visual Studio."""
def __init__(self, short_name, description,
solution_version, project_version, flat_sln, uses_vcxproj,
path, sdk_based, default_toolset=None):
self.short_name = short_name
self.description = description
self.solution_version = solution_version
self.project_version = project_version
self.flat_sln = flat_sln
self.uses_vcxproj = uses_vcxproj
self.path = path
self.sdk_based = sdk_based
self.default_toolset = default_toolset
def ShortName(self):
return self.short_name
def Description(self):
"""Get the full description of the version."""
return self.description
def SolutionVersion(self):
"""Get the version number of the sln files."""
return self.solution_version
def ProjectVersion(self):
"""Get the version number of the vcproj or vcxproj files."""
return self.project_version
def FlatSolution(self):
return self.flat_sln
def UsesVcxproj(self):
"""Returns true if this version uses a vcxproj file."""
return self.uses_vcxproj
def ProjectExtension(self):
"""Returns the file extension for the project."""
return self.uses_vcxproj and '.vcxproj' or '.vcproj'
def Path(self):
"""Returns the path to Visual Studio installation."""
return self.path
def ToolPath(self, tool):
"""Returns the path to a given compiler tool. """
return os.path.normpath(os.path.join(self.path, "VC/bin", tool))
def DefaultToolset(self):
"""Returns the msbuild toolset version that will be used in the absence
of a user override."""
return self.default_toolset
def SetupScript(self, target_arch):
"""Returns a command (with arguments) to be used to set up the
environment."""
# Check if we are running in the SDK command line environment and use
# the setup script from the SDK if so. |target_arch| should be either
# 'x86' or 'x64'.
assert target_arch in ('x86', 'x64')
sdk_dir = os.environ.get('WindowsSDKDir')
if self.sdk_based and sdk_dir:
return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')),
'/' + target_arch]
else:
# We don't use VC/vcvarsall.bat for x86 because vcvarsall calls
# vcvars32, which it can only find if VS??COMNTOOLS is set, which it
# isn't always.
if target_arch == 'x86':
if self.short_name == '2013' and (
os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'):
# VS2013 non-Express has a x64-x86 cross that we want to prefer.
return [os.path.normpath(
os.path.join(self.path, 'VC/vcvarsall.bat')), 'amd64_x86']
# Otherwise, the standard x86 compiler.
return [os.path.normpath(
os.path.join(self.path, 'Common7/Tools/vsvars32.bat'))]
else:
assert target_arch == 'x64'
arg = 'x86_amd64'
if (os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64'):
# Use the 64-on-64 compiler if we can.
arg = 'amd64'
return [os.path.normpath(
os.path.join(self.path, 'VC/vcvarsall.bat')), arg]
def _RegistryQueryBase(sysdir, key, value):
"""Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key: The registry key to read from.
value: The particular value to read.
Return:
stdout from reg.exe, or None for failure.
"""
# Skip if not on Windows or Python Win32 setup issue
if sys.platform not in ('win32', 'cygwin'):
return None
# Setup params to pass to and attempt to launch reg.exe
cmd = [os.path.join(os.environ.get('WINDIR', ''), sysdir, 'reg.exe'),
'query', key]
if value:
cmd.extend(['/v', value])
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Obtain the stdout from reg.exe, reading to the end so p.returncode is valid
# Note that the error text may be in [1] in some cases
text = p.communicate()[0]
# Check return code from reg.exe; officially 0==success and 1==error
if p.returncode:
return None
return text
def _RegistryQuery(key, value=None):
"""Use reg.exe to read a particular key through _RegistryQueryBase.
First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
that fails, it falls back to System32. Sysnative is available on Vista and
up and available on Windows Server 2003 and XP through KB patch 942589. Note
that Sysnative will always fail if using 64-bit python due to it being a
virtual directory and System32 will work correctly in the first place.
KB 942589 - http://support.microsoft.com/kb/942589/en-us.
Arguments:
key: The registry key.
value: The particular registry value to read (optional).
Return:
stdout from reg.exe, or None for failure.
"""
text = None
try:
text = _RegistryQueryBase('Sysnative', key, value)
except OSError, e:
if e.errno == errno.ENOENT:
text = _RegistryQueryBase('System32', key, value)
else:
raise
return text
def _RegistryGetValue(key, value):
"""Use reg.exe to obtain the value of a registry key.
Args:
key: The registry key.
value: The particular registry value to read.
Return:
contents of the registry key's value, or None on failure.
"""
text = _RegistryQuery(key, value)
if not text:
return None
# Extract value.
match = re.search(r'REG_\w+\s+([^\r]+)\r\n', text)
if not match:
return None
return match.group(1)
def _RegistryKeyExists(key):
"""Use reg.exe to see if a key exists.
Args:
key: The registry key to check.
Return:
True if the key exists
"""
if not _RegistryQuery(key):
return False
return True
def _CreateVersion(name, path, sdk_based=False):
"""Sets up MSVS project generation.
Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is
passed in that doesn't match a value in versions python will throw a error.
"""
if path:
path = os.path.normpath(path)
versions = {
'2015': VisualStudioVersion('2015',
'Visual Studio 2015',
solution_version='12.00',
project_version='14.0',
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v140'),
'2015e': VisualStudioVersion('2015e',
'Visual Studio 2015',
solution_version='12.00',
project_version='14.0',
flat_sln=True,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v140'),
'2013': VisualStudioVersion('2013',
'Visual Studio 2013',
solution_version='13.00',
project_version='12.0',
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v120'),
'2013e': VisualStudioVersion('2013e',
'Visual Studio 2013',
solution_version='13.00',
project_version='12.0',
flat_sln=True,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v120'),
'2012': VisualStudioVersion('2012',
'Visual Studio 2012',
solution_version='12.00',
project_version='4.0',
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v110'),
'2012e': VisualStudioVersion('2012e',
'Visual Studio 2012',
solution_version='12.00',
project_version='4.0',
flat_sln=True,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v110'),
'2010': VisualStudioVersion('2010',
'Visual Studio 2010',
solution_version='11.00',
project_version='4.0',
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based),
'2010e': VisualStudioVersion('2010e',
'Visual C++ Express 2010',
solution_version='11.00',
project_version='4.0',
flat_sln=True,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based),
'2008': VisualStudioVersion('2008',
'Visual Studio 2008',
solution_version='10.00',
project_version='9.00',
flat_sln=False,
uses_vcxproj=False,
path=path,
sdk_based=sdk_based),
'2008e': VisualStudioVersion('2008e',
'Visual Studio 2008',
solution_version='10.00',
project_version='9.00',
flat_sln=True,
uses_vcxproj=False,
path=path,
sdk_based=sdk_based),
'2005': VisualStudioVersion('2005',
'Visual Studio 2005',
solution_version='9.00',
project_version='8.00',
flat_sln=False,
uses_vcxproj=False,
path=path,
sdk_based=sdk_based),
'2005e': VisualStudioVersion('2005e',
'Visual Studio 2005',
solution_version='9.00',
project_version='8.00',
flat_sln=True,
uses_vcxproj=False,
path=path,
sdk_based=sdk_based),
}
return versions[str(name)]
def _ConvertToCygpath(path):
"""Convert to cygwin path if we are using cygwin."""
if sys.platform == 'cygwin':
p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE)
path = p.communicate()[0].strip()
return path
def _DetectVisualStudioVersions(versions_to_check, force_express):
"""Collect the list of installed visual studio versions.
Returns:
A list of visual studio versions installed in descending order of
usage preference.
Base this on the registry and a quick check if devenv.exe exists.
Only versions 8-10 are considered.
Possibilities are:
2005(e) - Visual Studio 2005 (8)
2008(e) - Visual Studio 2008 (9)
2010(e) - Visual Studio 2010 (10)
2012(e) - Visual Studio 2012 (11)
2013(e) - Visual Studio 2013 (11)
2015(e) - Visual Studio 2015 (14)
Where (e) is e for express editions of MSVS and blank otherwise.
"""
version_to_year = {
'8.0': '2005',
'9.0': '2008',
'10.0': '2010',
'11.0': '2012',
'12.0': '2013',
'14.0': '2015',
}
versions = []
for version in versions_to_check:
# Old method of searching for which VS version is installed
# We don't use the 2010-encouraged-way because we also want to get the
# path to the binaries, which it doesn't offer.
keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version,
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version,
r'HKLM\Software\Microsoft\VCExpress\%s' % version,
r'HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s' % version]
for index in range(len(keys)):
path = _RegistryGetValue(keys[index], 'InstallDir')
if not path:
continue
path = _ConvertToCygpath(path)
# Check for full.
full_path = os.path.join(path, 'devenv.exe')
express_path = os.path.join(path, '*express.exe')
if not force_express and os.path.exists(full_path):
# Add this one.
versions.append(_CreateVersion(version_to_year[version],
os.path.join(path, '..', '..')))
# Check for express.
elif glob.glob(express_path):
# Add this one.
versions.append(_CreateVersion(version_to_year[version] + 'e',
os.path.join(path, '..', '..')))
# The old method above does not work when only SDK is installed.
keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7',
r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7']
for index in range(len(keys)):
path = _RegistryGetValue(keys[index], version)
if not path:
continue
path = _ConvertToCygpath(path)
versions.append(_CreateVersion(version_to_year[version] + 'e',
os.path.join(path, '..'), sdk_based=True))
return versions
def SelectVisualStudioVersion(version='auto'):
"""Select which version of Visual Studio projects to generate.
Arguments:
version: Hook to allow caller to force a particular version (vs auto).
Returns:
An object representing a visual studio project format version.
"""
# In auto mode, check environment variable for override.
if version == 'auto':
version = os.environ.get('GYP_MSVS_VERSION', 'auto')
version_map = {
'auto': ('14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
'2005': ('8.0',),
'2005e': ('8.0',),
'2008': ('9.0',),
'2008e': ('9.0',),
'2010': ('10.0',),
'2010e': ('10.0',),
'2012': ('11.0',),
'2012e': ('11.0',),
'2013': ('12.0',),
'2013e': ('12.0',),
'2015': ('14.0',),
'2015e': ('14.0',),
}
override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH')
if override_path:
msvs_version = os.environ.get('GYP_MSVS_VERSION')
if not msvs_version:
raise ValueError('GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be '
'set to a particular version (e.g. 2010e).')
return _CreateVersion(msvs_version, override_path, sdk_based=True)
version = str(version)
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
if not versions:
if version == 'auto':
# Default to 2005 if we couldn't find anything
return _CreateVersion('2005', None)
else:
return _CreateVersion(version, None)
return versions[0]
#!/bin/bash
### Control that the script is run on `dev` branch
branch=`git rev-parse --abbrev-ref HEAD`
if [[ ! "$branch" = "dev" ]];
then
echo ">> This script must be run under \`dev\` branch"
exit
fi
### Releasing
current=`grep -P "version\": \"\d+.\d+.\d+(\w*)" package.json | grep -oP "\d+.\d+.\d+(\w*)"`
echo "Current version: $current"
if [[ $2 =~ ^[0-9]+.[0-9]+.[0-9]+((a|b)[0-9]+)?$ ]]; then
echo "build $2"
case "$1" in
rel|pre)
# Change the version in package.json and test file
sed -i "s/version\": .*/version\": \"$2\",/g" package.json
sed -i "s/Version: .*/Version: $2/g" ci/travis/debian/DEBIAN/control
sed -i "s/version').equal('.*/version').equal('$2');/g" test/integration/branches.js
sed -i "s/ release: .*/ release: v$2/g" appveyor.yml
# GUI containers version
sed -i "s/name\": .*/name\": \"v$2\",/g" gui/package.json
sed -i "s/title\": .*/title\": \"v$2\",/g" gui/package.json
sed -i "s/<title>Duniter.*<\/title>/<title>Duniter $2<\/title>/g" gui/index.html
# Bump the before_deploy.sh
sed -i "s/DUNITER_VER=.*/DUNITER_VER=$2/g" ci/travis/before_deploy.sh
# Bump the install.sh
sed -i "s/echo \"v.*\"/echo \"v$2\"/g" install.sh
# (pre)-release management
if [[ "$1" =~ ^rel$ ]]; then
# This is RELEASE: change the version in public installer + add the RELEASE flag
sed -i "s/echo \"v.*\"/echo \"v$2\"/g" install.sh
sed -i "s/.*prerelease: true/# prerelease: true/g" .travis.yml
sed -i "s/.*prerelease: true/# prerelease: true/g" appveyor.yml
fi
if [[ "$1" =~ ^pre$ ]]; then
# This is PRE-RELEASE: just change the RELEASE flag to PRERELEASE
sed -i "s/.*prerelease: true/ prerelease: true/g" .travis.yml
sed -i "s/.*prerelease: true/ prerelease: true/g" appveyor.yml
fi
;;
*)
echo "No task given"
;;
esac
# Commit
git reset HEAD
case "$1" in
rel)
git add install.sh package.json .travis.yml appveyor.yml test/integration/branches.js gui/package.json gui/index.html ci/travis/before_deploy.sh ci/travis/debian/DEBIAN/control install.sh
;;
pre)
git add install.sh package.json .travis.yml appveyor.yml test/integration/branches.js gui/package.json gui/index.html ci/travis/before_deploy.sh ci/travis/debian/DEBIAN/control
;;
esac
git commit -m "v$2"
git tag "v$2"
else
echo "Wrong version format"
fi
#!/bin/bash
ARCH=$1
DUNITER_VER=$2
NVER="v6.9.4"
DUNITER_DEB_VER=" $DUNITER_VER"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Prepare
ARCH="armv7l"
NVER="v6.10.2"
# Folders
INITIAL_DIRECTORY=`pwd`
ROOT="/tmp/build_duniter"
DOWNLOADS="$ROOT/downloads"
RELEASES="$ROOT/releases"
# -----------
# Clean sources + releases
# -----------
rm -rf "$ROOT"
mkdir -p "$DOWNLOADS"
# -----------
# Downloads
# -----------
cd "$DOWNLOADS"
if [ ! -d "$DOWNLOADS/duniter" ]; then
git clone https://github.com/duniter/duniter.git
cd duniter
COMMIT=`git rev-list --tags --max-count=1`
DUNITER_TAG=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
git checkout "v${DUNITER_TAG}"
cd ..
fi
DUNITER_VER="$DUNITER_TAG"
DUNITER_DEB_VER=" $DUNITER_TAG"
DUNITER_TAG="v$DUNITER_TAG"
echo "$ARCH"
echo "$NVER"
echo "$DUNITER_VER"
echo "$DUNITER_DEB_VER"
echo "Downloading Nodejs"
if [ ! -f "$DOWNLOADS/node-${NVER}-linux-${ARCH}.tar.gz" ]; then
# Download Node.js and package it with the sources
wget http://nodejs.org/dist/${NVER}/node-${NVER}-linux-${ARCH}.tar.gz
echo "Extracting Nodejs"
tar xzf node-${NVER}-linux-${ARCH}.tar.gz
mv node-${NVER}-linux-${ARCH} node
rm node-${NVER}-linux-${ARCH}.tar.gz
fi
rm -rf "$RELEASES"
mkdir -p "$RELEASES"
cp -r "$DOWNLOADS/duniter" "$RELEASES/duniter"
cd ${RELEASES}/duniter
echo "Copying Nodejs"
cp -R "$DOWNLOADS/node-${NVER}-linux-${ARCH}" node
echo "npm install"
node/bin/npm install --production
......@@ -27,14 +71,22 @@ node/bin/npm install duniter-crawler --save --production
node/bin/npm install duniter-keypair --save --production
node/bin/npm install duniter-prover --save --production
node/bin/npm install duniter-ui --production --save
# Clean unused UI modules
rm -Rf node_modules/duniter-ui/node_modules
# Because we are building in a VM, Node.js could not detect that the target is ARM. So we move the modules' binaries accordingly.
#mv node_modules/naclb/lib/binding/Release/node-v48-linux-x64 node_modules/naclb/lib/binding/Release/node-v48-linux-arm
#mv node_modules/wotb/lib/binding/Release/node-v48-linux-x64 node_modules/wotb/lib/binding/Release/node-v48-linux-arm
#mv node_modules/scryptb/lib/binding/Release/node-v48-linux-x64 node_modules/scryptb/lib/binding/Release/node-v48-linux-arm
#mv node_modules/sqlite3/lib/binding/Release/node-v48-linux-x64 node_modules/sqlite3/lib/binding/Release/node-v48-linux-arm
cd ..
mkdir -p duniter_release/sources
cp -R ${SRC}/* duniter_release/sources/
# Creating DEB packaging
mv duniter_release/sources/ci/travis/debian duniter-${ARCH}
mv duniter_release/sources/release/arch/debian/package duniter-${ARCH}
mkdir -p duniter-${ARCH}/opt/duniter/
chmod 755 duniter-${ARCH}/DEBIAN/post*
chmod 755 duniter-${ARCH}/DEBIAN/pre*
......@@ -46,8 +98,6 @@ echo "Zipping..."
zip -qr ../duniter-desktop.nw *
cd ../..
mv duniter_release/duniter-desktop.nw duniter-${ARCH}/opt/duniter/
echo "Making deb package"
echo "Making package package"
fakeroot dpkg-deb --build duniter-${ARCH}
mv duniter-${ARCH}.deb duniter-server-v${DUNITER_VER}-linux-${ARCH}.deb
echo "Uploading release..."
./github-release upload -u duniter -r duniter --tag v${DUNITER_VER} --name duniter-server-v${DUNITER_VER}-linux-${ARCH}.deb --file ./duniter-server-v${DUNITER_VER}-linux-${ARCH}.deb
mv duniter-${ARCH}.deb "$INITIAL_DIRECTORY/duniter-server-v${DUNITER_VER}-linux-${ARCH}.deb"
\ No newline at end of file
......@@ -12,7 +12,7 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/xenial64"
config.vm.box = "https://s3.eu-central-1.amazonaws.com/duniter/vagrant/duniter_ubuntu.box"
config.vm.provision :shell, path: "bootstrap.sh"
# Disable automatic box update checking. If you disable this, then
......
File moved
......@@ -6,8 +6,7 @@ export NVM_DIR="$HOME/.nvm"
# Prepare
NVER=`node -v`
DUNITER_VER=1.2.2
DUNITER_DEB_VER=" $DUNITER_VER"
DUNITER_TAG=
ADDON_VERSION=48
NW_VERSION=0.17.6
NW_RELEASE="v${NW_VERSION}"
......@@ -21,6 +20,14 @@ RELEASES="$ROOT/releases"
mkdir -p "$DOWNLOADS"
# -----------
# Clean sources + releases
# -----------
rm -rf "$DOWNLOADS/duniter"
rm -rf "$RELEASES"
rm -rf /vagrant/*.deb
rm -rf /vagrant/*.tar.gz
# -----------
# Downloads
# -----------
......@@ -30,10 +37,15 @@ cd "$DOWNLOADS"
if [ ! -d "$DOWNLOADS/duniter" ]; then
git clone https://github.com/duniter/duniter.git
cd duniter
git checkout dev # TODO: remove dev
COMMIT=`git rev-list --tags --max-count=1`
DUNITER_TAG=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
git checkout "v${DUNITER_TAG}"
cd ..
fi
DUNITER_DEB_VER=" $DUNITER_TAG"
DUNITER_TAG="v$DUNITER_TAG"
if [ ! -f "$DOWNLOADS/$NW_GZ" ]; then
wget https://dl.nwjs.io/${NW_RELEASE}/${NW_GZ}
tar xvzf ${NW_GZ}
......@@ -136,7 +148,7 @@ cp -R "$RELEASES/desktop_release" "$RELEASES/desktop_release_tgz"
#rm -rf node_modules/naclb/lib/binding/Release/node-webkit-$NW_RELEASE-linux-x64
#rm -rf node_modules/scryptb/lib/binding/Release/node-webkit-$NW_RELEASE-linux-x64
cd "$RELEASES/desktop_release_tgz"
tar czf /vagrant/duniter-desktop-${DUNITER_VER}-linux-x64.tar.gz * --exclude ".git" --exclude "coverage" --exclude "test"
tar czf /vagrant/duniter-desktop-${DUNITER_TAG}-linux-x64.tar.gz * --exclude ".git" --exclude "coverage" --exclude "test"
# -------------------------------------------------
# Build Desktop version .deb
......@@ -164,7 +176,7 @@ zip -qr ${RELEASES}/duniter-x64/opt/duniter/nw.nwb *
sed -i "s/Package: .*/Package: duniter-desktop/g" ${RELEASES}/duniter-x64/DEBIAN/control
cd ${RELEASES}/
fakeroot dpkg-deb --build duniter-x64
mv duniter-x64.deb /vagrant/duniter-desktop-${DUNITER_VER}-linux-x64.deb
mv duniter-x64.deb /vagrant/duniter-desktop-${DUNITER_TAG}-linux-x64.deb
# -------------------------------------------------
# Build Server version (Node.js is embedded, not Nw.js)
......@@ -184,4 +196,4 @@ cd ${RELEASES}
sed -i "s/Package: .*/Package: duniter/g" ${RELEASES}/duniter-server-x64/DEBIAN/control
rm -rf ${RELEASES}/duniter-server-x64/usr
fakeroot dpkg-deb --build duniter-server-x64
mv duniter-server-x64.deb /vagrant/duniter-server-${DUNITER_VER}-linux-x64.deb
mv duniter-server-x64.deb /vagrant/duniter-server-${DUNITER_TAG}-linux-x64.deb
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "https://s3.eu-central-1.amazonaws.com/duniter/vagrant/duniter_win7.box"
config.vm.provision :shell, path: "build.bat", run: 'always'
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
#vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "4096"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
set ADDON_VERSION=48
set NW_VERSION=0.17.6
set NW_RELEASE=v0.17.6
set NW=nwjs-%NW_RELEASE%-win-x64
set NW_GZ=%NW%.zip
echo %NW%
echo %NW_GZ%
echo %NW_RELEASE%
node -v
REM NPM
set PATH="C:\Users\vagrant\AppData\Roaming\npm";%PATH%
REM InnoSetup
set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
cd C:\Users\vagrant
echo "Suppression des anciennes sources..."
rd /s /q duniter
rd /s /q duniter_release
rd /s /q %NW%
echo "Clonage de Duniter..."
git clone https://github.com/duniter/duniter.git
cd duniter
for /f "delims=" %%a in ('git rev-list --tags --max-count=1') do @set DUNITER_REV=%%a
for /f "delims=" %%a in ('git describe --tags %DUNITER_REV%') do @set DUNITER_TAG=%%a
echo %DUNITER_TAG%
git checkout %DUNITER_TAG%
call npm install
REM call npm test
echo "Retrait des modules 'dev'..."
call npm prune --production
echo "Ajout du module 1/4..."
call npm install duniter-bma --save --production
echo "Ajout du module 2/4..."
call npm install duniter-crawler --save --production
echo "Ajout du module 3/4..."
call npm install duniter-keypair --save --production
echo "Ajout du module 4/4..."
call npm install duniter-prover --save --production
set SRC=%cd%
echo %SRC%
cd node_modules/wotb
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\wotb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\wotb.node /Y
cd ../naclb
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\naclb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\naclb.node /Y
cd ../scryptb
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\Release\node-webkit-%NW_RELEASE%-win32-x64\scryptb.node %cd%\lib\binding\Release\node-v%ADDON_VERSION%-win32-x64\scryptb.node /Y
cd ../sqlite3
call npm install --build-from-source
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 configure
call node-pre-gyp --runtime=node-webkit --target=%NW_VERSION% --msvs_version=2015 build
copy %cd%\lib\binding\node-webkit-%NW_RELEASE%-win32-x64\node_sqlite3.node %cd%\lib\binding\node-v%ADDON_VERSION%-win32-x64\node_sqlite3.node /Y
cd ../..
call npm install duniter-ui --save --production
rd /s /q %cd%\node_modules\duniter-ui\node_modules
cd ..
mkdir duniter_release
call 7z x %NW_GZ%
move %NW% %cd%\duniter_release\nw
mkdir %cd%\duniter_release\sources
xcopy %SRC%\gui\* %cd%\duniter_release\nw\ /s /e
xcopy %SRC%\* %cd%\duniter_release\sources\ /s /e
iscc %cd%\duniter_release\sources\release\arch\windows\duniter.iss /DROOT_PATH=%cd%\duniter_release
move %cd%\duniter_release\Duniter.exe C:\vagrant\duniter-desktop-%DUNITER_TAG%-windows-x64.exe
echo "Build done: binary available at duniter-desktop-%DUNITER_TAG%-windows-x64.exe"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment