Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5c3e3ec8
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5c3e3ec8
编写于
11月 08, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
snap updates
上级
e1f56eec
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
51 deletion
+39
-51
resources/linux/snap/snapUpdate.sh
resources/linux/snap/snapUpdate.sh
+3
-2
resources/linux/snap/snapcraft.yaml
resources/linux/snap/snapcraft.yaml
+1
-6
src/vs/platform/update/electron-main/updateService.snap.ts
src/vs/platform/update/electron-main/updateService.snap.ts
+35
-43
未找到文件。
resources/linux/snap/snapUpdate.sh
浏览文件 @
5c3e3ec8
sleep
5
code-insiders /Users/daimms/dev/Microsoft/vscode/OSSREADME.json
\ No newline at end of file
#!/bin/sh
sleep
2
@@NAME@@
\ No newline at end of file
resources/linux/snap/snapcraft.yaml
浏览文件 @
5c3e3ec8
...
...
@@ -37,13 +37,8 @@ parts:
# - libgtk2.0-bin
prime
:
-
-usr/share/dh-python
electron-launch
:
plugin
:
dump
source
:
.
organize
:
electron-launch
:
bin/electron-launch
apps
:
@@
NAME@@
:
command
:
bin/
electron-launch ${SNAP}/usr/share/@@NAME@@/bin/@@NAME@@
command
:
electron-launch ${SNAP}/usr/share/@@NAME@@/bin/@@NAME@@
desktop
:
usr/share/applications/@@NAME@@.desktop
\ No newline at end of file
src/vs/platform/update/electron-main/updateService.snap.ts
浏览文件 @
5c3e3ec8
...
...
@@ -3,18 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Event
,
Emitter
,
fromNodeEventEmitter
,
filterEvent
,
debounceEvent
}
from
'
vs/base/common/event
'
;
import
{
Throttler
,
timeout
}
from
'
vs/base/common/async
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/electron-main/lifecycleMain
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IUpdateService
,
State
,
StateType
,
AvailableForDownload
,
UpdateType
}
from
'
vs/platform/update/common/update
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IRequestService
}
from
'
vs/platform/request/node/request
'
;
import
*
as
path
from
'
path
'
;
import
{
realpath
}
from
'
fs
'
;
import
{
realpath
,
watch
}
from
'
fs
'
;
import
{
spawn
}
from
'
child_process
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -40,24 +38,10 @@ abstract class AbstractUpdateService2 implements IUpdateService {
constructor
(
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
protected
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IRequestService
protected
requestService
:
IRequestService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
ILogService
protected
logService
:
ILogService
,
)
{
if
(
this
.
environmentService
.
disableUpdates
)
{
this
.
logService
.
info
(
'
update#ctor - updates are disabled
'
);
return
;
}
if
(
!
product
.
updateUrl
||
!
product
.
commit
)
{
this
.
logService
.
info
(
'
update#ctor - updates are disabled
'
);
return
;
}
const
quality
=
this
.
getProductQuality
();
if
(
!
quality
)
{
if
(
environmentService
.
disableUpdates
)
{
this
.
logService
.
info
(
'
update#ctor - updates are disabled
'
);
return
;
}
...
...
@@ -68,11 +52,6 @@ abstract class AbstractUpdateService2 implements IUpdateService {
this
.
scheduleCheckForUpdates
(
30
*
1000
).
then
(
undefined
,
err
=>
this
.
logService
.
error
(
err
));
}
private
getProductQuality
():
string
|
undefined
{
const
quality
=
this
.
configurationService
.
getValue
<
string
>
(
'
update.channel
'
);
return
quality
===
'
none
'
?
undefined
:
product
.
quality
;
}
private
scheduleCheckForUpdates
(
delay
=
60
*
60
*
1000
):
Thenable
<
void
>
{
return
timeout
(
delay
)
.
then
(()
=>
this
.
checkForUpdates
(
null
))
...
...
@@ -161,30 +140,39 @@ export class SnapUpdateService extends AbstractUpdateService2 {
constructor
(
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
,
@
IRequestService
requestService
:
IRequestService
,
@
ILogService
logService
:
ILogService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
super
(
lifecycleService
,
configurationService
,
environmentService
,
requestService
,
logService
);
super
(
lifecycleService
,
environmentService
,
logService
);
const
watcher
=
watch
(
path
.
dirname
(
process
.
env
.
SNAP
));
const
onChange
=
fromNodeEventEmitter
(
watcher
,
'
change
'
,
(
_
,
fileName
:
string
)
=>
fileName
);
const
onCurrentChange
=
filterEvent
(
onChange
,
n
=>
n
===
'
current
'
);
const
onDebouncedCurrentChange
=
debounceEvent
(
onCurrentChange
,
(
_
,
e
)
=>
e
,
2000
);
const
listener
=
onDebouncedCurrentChange
(
this
.
checkForUpdates
,
this
);
lifecycleService
.
onShutdown
(()
=>
{
listener
.
dispose
();
watcher
.
close
();
});
}
protected
doCheckForUpdates
(
context
:
any
):
void
{
this
.
setState
(
State
.
CheckingForUpdates
(
context
));
this
.
isLatestVersion
().
then
(
result
=>
{
if
(
!
result
)
{
this
.
isUpdateAvailable
().
then
(
result
=>
{
if
(
result
)
{
this
.
setState
(
State
.
Ready
({
version
:
'
something
'
,
productVersion
:
'
someting
'
}));
}
else
{
/* __GDPR__
"update:notAvailable" : {
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
"update:notAvailable" : {
"explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
}
*/
this
.
telemetryService
.
publicLog
(
'
update:notAvailable
'
,
{
explicit
:
!!
context
});
this
.
setState
(
State
.
Idle
(
UpdateType
.
Snap
));
}
else
{
this
.
setState
(
State
.
Ready
({
version
:
'
something
'
,
productVersion
:
'
someting
'
}));
}
},
err
=>
{
this
.
logService
.
error
(
err
);
...
...
@@ -209,17 +197,21 @@ export class SnapUpdateService extends AbstractUpdateService2 {
});
}
isLatestVersion
():
TPromise
<
boolean
|
undefined
>
{
return
new
TPromise
(
c
=>
{
private
isUpdateAvailable
():
TPromise
<
boolean
>
{
return
new
TPromise
(
(
c
,
e
)
=>
{
realpath
(
`/snap/
${
product
.
applicationName
}
/current`
,
(
err
,
resolvedCurrentSnapPath
)
=>
{
if
(
err
)
{
this
.
logService
.
error
(
'
update#checkForSnapUpdate(): Could not get realpath of application.
'
);
return
c
(
undefined
);
}
if
(
err
)
{
return
e
(
err
);
}
const
currentRevision
=
path
.
basename
(
resolvedCurrentSnapPath
);
return
process
.
env
.
SNAP_REVISION
===
currentRevision
;
c
(
process
.
env
.
SNAP_REVISION
!==
currentRevision
)
;
});
});
}
isLatestVersion
():
TPromise
<
boolean
|
undefined
>
{
return
this
.
isUpdateAvailable
().
then
(
null
,
err
=>
{
this
.
logService
.
error
(
'
update#checkForSnapUpdate(): Could not get realpath of application.
'
);
return
undefined
;
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录