Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bao-qian committed Apr 7, 2017
2 parents 9d9ab65 + d8f522c commit 137d290
Show file tree
Hide file tree
Showing 27 changed files with 326 additions and 266 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ paket-files/
Output/*
/Python.Runtime.dll
Thumbs.db
RELEASES


*.sublime-*
Expand Down
9 changes: 0 additions & 9 deletions Deploy/binary_zip.ps1

This file was deleted.

7 changes: 0 additions & 7 deletions Deploy/nuget.ps1

This file was deleted.

21 changes: 0 additions & 21 deletions Deploy/squirrel_installer.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Known problems for 1.3.183:

1. `System.NullReferenceException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.357
1. `System.NullReferenceException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.424
2. `System.UriFormatException`: delete your old theme file
3. `System.Threading.Tasks.TaskCanceledException`: 设置 http 代理
3. `System.Threading.Tasks.TaskCanceledException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.424


## English
Expand Down
47 changes: 37 additions & 10 deletions Plugins/Wox.Plugin.Program/Programs/UWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,20 @@ public static Application[] All()
var support = Environment.OSVersion.Version.Major >= windows10.Major;
if (support)
{
var applications = CurrentUserPackages().AsParallel().SelectMany(p => new UWP(p).Apps).ToArray();
var applications = CurrentUserPackages().AsParallel().SelectMany(p =>
{
UWP u;
try
{
u = new UWP(p);
}
catch (Exception e)
{
Log.Exception($"|UWP.All|Can't convert Package to UWP for <{p.Id.FullName}>:", e);
return new Application[] { };
}
return u.Apps;
}).ToArray();
return applications;
}
else
Expand All @@ -157,17 +170,31 @@ public static Application[] All()

private static IEnumerable<Package> CurrentUserPackages()
{
var user = WindowsIdentity.GetCurrent().User;
var u = WindowsIdentity.GetCurrent().User;

if (user != null)
if (u != null)
{
var userSecurityId = user.Value;
var packageManager = new PackageManager();
var packages = packageManager.FindPackagesForUser(userSecurityId);
packages =
packages.Where(
p => !p.IsFramework && !p.IsDevelopmentMode && !string.IsNullOrEmpty(p.InstalledLocation.Path));
return packages;
var id = u.Value;
var m = new PackageManager();
var ps = m.FindPackagesForUser(id);
ps = ps.Where(p =>
{
bool valid;
try
{
var f = p.IsFramework;
var d = p.IsDevelopmentMode;
var path = p.InstalledLocation.Path;
valid = !f && !d && !string.IsNullOrEmpty(path);
}
catch (Exception e)
{
Log.Exception($"|UWP.CurrentUserPackages|Can't get package info for <{p.Id.FullName}>", e);
valid = false;
}
return valid;
});
return ps;
}
else
{
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ Contribution
- I'd appreciate if you could solve [help_needed](https://github.com/Wox-launcher/Wox/issues?q=is%3Aopen+is%3Aissue+label%3Ahelp_needed) labeled issue
- Don't hesitate to ask questions in the [issues](https://github.com/Wox-launcher/Wox/issues)

Build
-----

1. Install Visual Studio 2015 and tick all Windows 10 sdk options
2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser`

Documentation
-------------
- [Wiki](https://github.com/Wox-launcher/Wox/wiki)
Expand Down
140 changes: 140 additions & 0 deletions Scripts/post_build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
param(
[string]$config = "Release",
[string]$solution
)
Write-Host "Config: $config"

function Build-Version {
if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_VERSION)) {
$v = "1.2.0"
} else {
$v = $env:APPVEYOR_BUILD_VERSION
}

Write-Host "Build Version: $v"
return $v
}

function Build-Path {
if (![string]::IsNullOrEmpty($env:APPVEYOR_BUILD_FOLDER)) {
$p = $env:APPVEYOR_BUILD_FOLDER
} elseif (![string]::IsNullOrEmpty($solution)) {
$p = $solution
} else {
$p = Get-Location
}

Write-Host "Build Folder: $p"
Set-Location $p

return $p
}

function Copy-Resources ($path, $config) {
$project = "$path\Wox"
$output = "$path\Output"
$target = "$output\$config"
Copy-Item -Recurse -Force $project\Themes\* $target\Themes\
Copy-Item -Recurse -Force $project\Images\* $target\Images\
Copy-Item -Recurse -Force $path\Plugins\HelloWorldPython $target\Plugins\HelloWorldPython
Copy-Item -Recurse -Force $path\JsonRPC $target\JsonRPC
Copy-Item -Force $path\packages\squirrel*\tools\Squirrel.exe $output\Update.exe
}

function Delete-Unused ($path, $config) {
$target = "$path\Output\$config"
$included = Get-ChildItem $target -Filter "*.dll"
foreach ($i in $included){
Remove-Item -Path $target\Plugins -Include $i -Recurse
Write-Host "Deleting duplicated $i"
}
Remove-Item -Path $target -Include "*.xml" -Recurse
}

function Validate-Directory ($output) {
New-Item $output -ItemType Directory -Force
}

function Pack-Nuget ($path, $version, $output) {
Write-Host "Begin build nuget library"

$spec = "$path\Scripts\wox.plugin.nuspec"
Write-Host "nuspec path: $spec"
Write-Host "Output path: $output"

Nuget pack $spec -Version $version -OutputDirectory $output

Write-Host "End build nuget library"
}

function Zip-Release ($path, $version, $output) {
Write-Host "Begin zip release"

$input = "$path\Output\Release"
Write-Host "Input path: $input"
$file = "$output\Wox-$version.zip"
Write-Host "Filename: $file"

[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
[System.IO.Compression.ZipFile]::CreateFromDirectory($input, $file)

Write-Host "End zip release"
}

function Pack-Squirrel-Installer ($path, $version, $output) {
# msbuild based installer generation is not working in appveyor, not sure why
Write-Host "Begin pack squirrel installer"

$spec = "$path\Scripts\wox.nuspec"
Write-Host "nuspec path: $spec"
$input = "$path\Output\Release"
Write-Host "Input path: $input"
Nuget pack $spec -Version $version -Properties Configuration=Release -BasePath $input -OutputDirectory $output

$nupkg = "$output\Wox.$version.nupkg"
Write-Host "nupkg path: $nupkg"
$icon = "$path\Wox\Resources\app.ico"
Write-Host "icon: $icon"
# Squirrel.com: https://github.com/Squirrel/Squirrel.Windows/issues/369
New-Alias Squirrel $path\packages\squirrel*\tools\Squirrel.exe -Force
# why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327
# directory of releaseDir in fucking squirrel can't be same as directory ($nupkg) in releasify
$temp = "$output\Temp"

Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $icon --no-msi | Write-Output
Move-Item $temp\* $output -Force
Remove-Item $temp

$file = "$output\Wox-$version.exe"
Write-Host "Filename: $file"

Move-Item "$output\Setup.exe" $file -Force

Write-Host "End pack squirrel installer"
}

function Main {
$p = Build-Path
$v = Build-Version
Copy-Resources $p $config

if ($config -eq "Release"){

Delete-Unused $p $config
$o = "$p\Output\Packages"
Validate-Directory $o
New-Alias Nuget $p\packages\NuGet.CommandLine.*\tools\NuGet.exe -Force
Pack-Squirrel-Installer $p $v $o

$isInCI = $env:APPVEYOR
if ($isInCI) {
Pack-Nuget $p $v $o
Zip-Release $p $v $o
}

Write-Host "List output directory"
Get-ChildItem $o
}
}

Main
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 137d290

Please sign in to comment.