Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 24a5dc8

Browse files
authored
Use SqlToolsService built on .NET Core 2.0 and a build script updates (#131)
* Bump version to 1.0.0a19 * Use .NET Core 2.0 RTM built sqltoolsservice * Add build script to upload to azure blob storage * Upgrade to VS 2017 * Remove 3.3 as supported Python version
1 parent ca49239 commit 24a5dc8

File tree

15 files changed

+178
-42
lines changed

15 files changed

+178
-42
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.0a18
2+
current_version = 1.0.0a19
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>.*))(?P<release_version>\d+)
44
serialize =
55
{major}.{minor}.{patch}{release}{release_version}

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ matrix:
1010
env: TOXENV=py27
1111
- os: linux
1212
python: "2.7"
13-
- os: linux
14-
python: "3.3"
1513
- os: linux
1614
python: "3.4"
1715
- os: linux

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ environment:
33
matrix:
44
- TOXENV: "py27"
55
PYTHON: "C:\\Python27"
6-
- TOXENV: "py33"
7-
PYTHON: "C:\\Python33"
86
- TOXENV: "py34"
97
PYTHON: "C:\\Python34"
108
- TOXENV: "py35"

build.py

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env python
2+
3+
# --------------------------------------------------------------------------------------------
4+
# Copyright (c) Microsoft Corporation. All rights reserved.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# --------------------------------------------------------------------------------------------
7+
8+
from __future__ import print_function
9+
import os
10+
import re
11+
import sys
12+
import tempfile
13+
import utility
14+
from azure.storage.blob import BlockBlobService, ContentSettings
15+
16+
AZURE_STORAGE_CONNECTION_STRING = os.environ.get('AZURE_STORAGE_CONNECTION_STRING')
17+
BLOB_CONTAINER_NAME = 'simple'
18+
UPLOADED_PACKAGE_LINKS = []
19+
20+
21+
def print_heading(heading, f=None):
22+
print('{0}\n{1}\n{0}'.format('=' * len(heading), heading), file=f)
23+
24+
25+
def upload_index_file(service, blob_name, title, links):
26+
print('Uploading index file {}'.format(blob_name))
27+
service.create_blob_from_text(
28+
container_name=BLOB_CONTAINER_NAME,
29+
blob_name=blob_name,
30+
text="<html><head><title>{0}</title></head><body><h1>{0}</h1>{1}</body></html>"
31+
.format(title, '\n'.join(
32+
['<a href="{0}">{0}</a><br/>'.format(link) for link in links])),
33+
content_settings=ContentSettings(
34+
content_type='text/html',
35+
content_disposition=None,
36+
content_encoding=None,
37+
content_language=None,
38+
content_md5=None,
39+
cache_control=None
40+
)
41+
)
42+
43+
44+
def gen_pkg_index_html(service, pkg_name):
45+
links = []
46+
index_file_name = pkg_name+'/'
47+
for blob in list(service.list_blobs(BLOB_CONTAINER_NAME, prefix=index_file_name)):
48+
if blob.name == index_file_name:
49+
# Exclude the index file from being added to the list
50+
continue
51+
links.append(blob.name.replace(index_file_name, ''))
52+
upload_index_file(service, index_file_name, 'Links for {}'.format(pkg_name), links)
53+
UPLOADED_PACKAGE_LINKS.append(index_file_name)
54+
55+
56+
def upload_package(service, file_path, pkg_name):
57+
print('Uploading {}'.format(file_path))
58+
file_name = os.path.basename(file_path)
59+
blob_name = '{}/{}'.format(pkg_name, file_name)
60+
service.create_blob_from_path(
61+
container_name=BLOB_CONTAINER_NAME,
62+
blob_name=blob_name,
63+
file_path=file_path
64+
)
65+
gen_pkg_index_html(service, pkg_name)
66+
67+
68+
def build(options):
69+
70+
supported_actions = ['nightly']
71+
action = None
72+
73+
if len(options) >= 1:
74+
if options[0] not in supported_actions:
75+
print('Please provide a supported action {}.'.format(supported_actions))
76+
return
77+
action = options[0]
78+
79+
if action == 'nightly':
80+
assert AZURE_STORAGE_CONNECTION_STRING, 'Set AZURE_STORAGE_CONNECTION_STRING environment variable'
81+
82+
print_heading('Cleanup')
83+
84+
# clean
85+
utility.clean_up(utility.MSSQLSCRIPTER_DIST_DIRECTORY)
86+
utility.clean_up(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY)
87+
utility.cleaun_up_egg_info_sub_directories(utility.ROOT_DIR)
88+
utility.cleaun_up_egg_info_sub_directories(utility.MSSQLTOOLSSERVICE_DIRECTORY)
89+
90+
print_heading('Running setup')
91+
92+
# install general requirements.
93+
utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR)
94+
95+
print_heading('Running mssql-scripter tests')
96+
utility.exec_command('tox', utility.ROOT_DIR, continue_on_error = False)
97+
98+
print_heading('Building mssql-scripter pip package')
99+
utility.exec_command('python setup.py check -r -s sdist', utility.ROOT_DIR, continue_on_error = False)
100+
101+
print_heading('Building mssqltoolsservice pip package')
102+
utility.exec_command('python buildwheels.py', utility.MSSQLTOOLSSERVICE_DIRECTORY, continue_on_error = False)
103+
104+
if action == 'nightly':
105+
blob_service = BlockBlobService(connection_string=AZURE_STORAGE_CONNECTION_STRING)
106+
107+
print_heading('Uploading packages to blob storage ')
108+
for pkg in os.listdir(utility.MSSQLSCRIPTER_DIST_DIRECTORY):
109+
pkg_path = os.path.join(utility.MSSQLSCRIPTER_DIST_DIRECTORY, pkg)
110+
print('Uploading package {}'.format(pkg_path))
111+
upload_package(blob_service, pkg_path, 'mssql-scripter')
112+
113+
for pkg in os.listdir(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY):
114+
pkg_path = os.path.join(utility.MSSQLTOOLSSERVICE_DIST_DIRECTORY, pkg)
115+
pkg_name = os.path.basename(pkg_path).split('-')[0].replace('_', '-').lower()
116+
print('Uploading package {}'.format(pkg_name))
117+
upload_package(blob_service, pkg_path, pkg_name)
118+
119+
# Upload the final index file
120+
upload_index_file(blob_service, 'index.html', 'Simple Index', UPLOADED_PACKAGE_LINKS)
121+
122+
123+
if __name__ == '__main__':
124+
build(sys.argv[1:])

dev_requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ flake8 >= 3.3.0
1111
pytest >= 3.0.7
1212
pytest-cov >= 2.5.1
1313
readme_renderer >= 17.2
14-
docutils >= 0.13.1
14+
docutils >= 0.13.1
15+
azure-storage >= 0.33.0

dev_setup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@
1212
import setup
1313
import utility
1414

15-
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
16-
1715
print('Running dev setup...')
18-
print('Root directory \'{}\'\n'.format(root_dir))
16+
print('Root directory \'{}\'\n'.format(utility.ROOT_DIR))
1917

2018
# install general requirements.
21-
utility.exec_command('pip install -r dev_requirements.txt', root_dir)
19+
utility.exec_command('pip install -r dev_requirements.txt', utility.ROOT_DIR)
2220

2321
# install mssqltoolsservice if this platform supports it.
2422
mssqltoolsservice_package_name = os.environ['MSSQLTOOLSSERVICE_PACKAGE_NAME']
2523
print('Installing {}...'.format(mssqltoolsservice_package_name))
2624
# mssqltoolsservice package name is retrieved from environment variable set by setup.py.
27-
utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), root_dir)
25+
utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), utility.ROOT_DIR)
2826

2927
print('Finished dev setup.')

mssqlscripter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
__version__ = '1.0.0a18'
6+
__version__ = '1.0.0a19'

mssqlscripter/jsonrpc/contracts/tests/test_scripting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def generate_new_baseline(self, file_name):
362362
# Point sqltoolsservice output to file.
363363
with io.open(file_name, 'wb') as baseline:
364364
tools_service_process = subprocess.Popen(
365-
'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp1.0\\win7-x64\\Microsoft.SqlTools.ServiceLayer.exe',
365+
'D:\\GitHub\\sqltoolsservice\\src\\Microsoft.SqlTools.ServiceLayer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\MicrosoftSqlToolsServiceLayer.exe',
366366
bufsize=0,
367367
stdin=subprocess.PIPE,
368368
stdout=baseline)

mssqltoolsservice/buildwheels.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
from urllib.request import urlopen
1818

1919

20-
DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-01-2017/'
20+
DOWNLOAD_URL_BASE = 'https://mssqlscripter.blob.core.windows.net/sqltoolsservice-08-16-2017/'
2121

2222
# Supported platform key's must match those in mssqlscript's setup.py.
2323
SUPPORTED_PLATFORMS = {
24-
'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp1.0.tar.gz',
25-
'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp1.0.tar.gz',
26-
'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp1.0.tar.gz',
27-
'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp1.0.tar.gz',
28-
'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp1.0.tar.gz',
29-
'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp1.0.tar.gz',
30-
'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp1.0.tar.gz',
31-
'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp1.0.tar.gz',
32-
'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp1.0.zip',
33-
'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp1.0.zip',
24+
'CentOS_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-centos-x64-netcoreapp2.0.tar.gz',
25+
'Debian_8': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-debian-x64-netcoreapp2.0.tar.gz',
26+
'Fedora_23': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-fedora-x64-netcoreapp2.0.tar.gz',
27+
'openSUSE_13_2': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-opensuse-x64-netcoreapp2.0.tar.gz',
28+
'OSX_10_11_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-osx-x64-netcoreapp2.0.tar.gz',
29+
'RHEL_7': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-rhel-x64-netcoreapp2.0.tar.gz',
30+
'Ubuntu_14': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu14-x64-netcoreapp2.0.tar.gz',
31+
'Ubuntu_16': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-ubuntu16-x64-netcoreapp2.0.tar.gz',
32+
'Windows_7_64': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x64-netcoreapp2.0.zip',
33+
'Windows_7_86': DOWNLOAD_URL_BASE + 'microsoft.sqltools.servicelayer-win-x86-netcoreapp2.0.zip'
3434
}
3535

3636
CURRENT_DIRECTORY = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))

mssqltoolsservice/mssqltoolsservice/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import platform
1111

12-
__version__ = '1.0.0a18'
12+
__version__ = '1.0.0a19'
1313

1414

1515
def get_executable_path():
@@ -28,7 +28,7 @@ def get_executable_path():
2828
'bin'))
2929

3030
# Format name based on platform.
31-
mssqltoolsservice_name = u'Microsoft.SqlTools.ServiceLayer{}'.format(
31+
mssqltoolsservice_name = u'MicrosoftSqlToolsServiceLayer{}'.format(
3232
u'.exe' if (platform.system() == u'Windows') else u'')
3333

3434
mssqltoolsservice_full_path = os.path.abspath(os.path.join(mssqltoolsservice_base_path, mssqltoolsservice_name))

0 commit comments

Comments
 (0)