Compare commits
57 Commits
Author | SHA1 | Date | |
---|---|---|---|
763c75c162 | |||
30b159c35c | |||
6063467e2d | |||
b4e881a1d7 | |||
332c3e1a7e | |||
a43b17511b | |||
b11529d9b9 | |||
96d29562af | |||
859c7d3c57 | |||
28bc6ffcfb | |||
22cb98ef63 | |||
3b72547621 | |||
e81a96180a | |||
997f096cc1 | |||
|
00000db63c | ||
|
000006654d | ||
08256f0abe | |||
59fa3ebc5a | |||
46ddd7ae54 | |||
b96d87ca33 | |||
4f59498482 | |||
ce023a7358 | |||
|
00000a2119 | ||
c2d6260d61 | |||
a361285d62 | |||
1032f14948 | |||
338535ebee | |||
6ae51f919a | |||
43504aebfc | |||
d764d0f018 | |||
|
3d5e661e6d | ||
|
3d92803cee | ||
0d761787d7 | |||
d39833ac9d | |||
e8182ff9b4 | |||
4358ec73db | |||
aed2e107b7 | |||
b3f71b7f37 | |||
eabfc260c3 | |||
429c42da51 | |||
bdd9fa0358 | |||
b7250bfa9e | |||
c1d586363d | |||
83b8cb81c1 | |||
71fcfde668 | |||
ce5f24f609 | |||
fbd5dd7f22 | |||
44731d85fb | |||
ba53e09a25 | |||
5d9331f88c | |||
d7bf8eea18 | |||
ee353d906f | |||
7fa7bfa53f | |||
25beab44e3 | |||
65a0081095 | |||
87f1d7fd4e | |||
4b2adabb24 |
8
.github/dependabot.yml
vendored
@ -1,8 +1,8 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: nuget
|
||||
directory: "/src/atlassian-downloader"
|
||||
- package-ecosystem: "nuget"
|
||||
directory: "/src"
|
||||
schedule:
|
||||
interval: daily
|
||||
interval: "daily"
|
||||
time: "02:00"
|
||||
open-pull-requests-limit: 10
|
||||
open-pull-requests-limit: 10
|
||||
|
BIN
.github/media/screenshot-01.png
vendored
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 127 KiB |
BIN
.github/media/screenshot-02.png
vendored
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 42 KiB |
BIN
.github/media/screenshot-03.png
vendored
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 56 KiB |
10
.github/workflows/dotnet-develop.yml
vendored
@ -13,14 +13,14 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
include-prerelease: true
|
||||
dotnet-version: 8
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
env:
|
||||
|
14
.github/workflows/dotnet-master.yml
vendored
@ -4,20 +4,22 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '00 00 * * 6' # At 12:00 AM, only on Saturday
|
||||
- cron: '02 00 * * 6' # At 02:00, only on Saturday
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
include-prerelease: true
|
||||
dotnet-version: 8
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
env:
|
||||
|
19
CHANGELOG.md
@ -1,6 +1,23 @@
|
||||
# Atlassian Downloader - Changelog
|
||||
|
||||
* `1.0.0.9` - switched to `dontet7.0`, updated deps.
|
||||
## 2.x
|
||||
* `2.0.0.2` - minor update:
|
||||
* Added `maxRetries (default: 5)` and `delayBetweenRetries (default: 2500, milliseconds)` args, to redownload file if connection will be reset.
|
||||
* Updated dependencies.
|
||||
* `2.0.0.1` - minor update:
|
||||
* Fix default output dir, enable nullables, fix compiler warnings #43
|
||||
* Remove redundant parameters from publish profiles #42
|
||||
* `2.0.0.0` - migrated to `dotnet8` and updated libs.
|
||||
* code optimized by [@kasthack](https://github.com/kasthack).
|
||||
* reworked build scripts via `cli` and `vs`.
|
||||
* added new dists - `osx-arm64`, `linux-bionic-x64`.
|
||||
* added support of custom useragent via flag
|
||||
* added suppor of skipping existing files via flag
|
||||
## 1.x
|
||||
* `1.1.0.0` - added automatic compare of local and remote file sizes. If they differ - the file will be re-downloaded.
|
||||
* `1.0.1.1` - minor update: added `UserAgent` to HTTP headers and added mirrors of json files.
|
||||
* `1.0.1.0` - added support of `Atlassian Bitbucket (Mesh)` product, updated deps, fixed `Chocolatey` support and start logic.
|
||||
* `1.0.0.9` - updated deps.
|
||||
* `1.0.0.8` - switched to `dontet6.0`, updated deps.
|
||||
* `1.0.0.7` - added `unofficial support` of `sourcetree` via automatic mirror [from github](https://github.com/EpicMorg/atlassian-json). fixed `logger` output, code improvments.
|
||||
* `1.0.0.6` - added support of `clover`. fixed broken json parsing. added new `logger`.
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2023 EpicMorg: Main
|
||||
Copyright (c) 2009 EpicMorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
95
README.md
@ -2,35 +2,49 @@
|
||||
|
||||
# Atlassian Downloader
|
||||
|
||||
Console app written with `c#` and `dotnet6` for downloading all avalible products from `Atlassian`. Why not?
|
||||
Console app written with `c#` and `dotnet8` for downloading all avalible products from `Atlassian`. Why not?
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Requerments
|
||||
1. Preinstalled`*` `dotnet6`. Download [here](https://dotnet.microsoft.com/download/dotnet/6.0).
|
||||
2. Supported OS: `win32/win64`, `linux`, `macosx`, `arm/arm64`
|
||||
# Supported OS:
|
||||
`win-x86`, `win-x64`, `win-arm64`, `linux-x86`, `linux-x64`, `linux-musl-x64`, `linux-arm`, `linux-arm64`, `linux-bionic-x64`, `osx-x64`, `osx-arm64`
|
||||
|
||||
`*` since version `1.0.0.4` application build asstandalone package and do not requre preinstalled `dotnet6`.
|
||||
-------------------
|
||||
|
||||
# How to...
|
||||
## ..bootstrap from scratch
|
||||
|
||||
## ..develop
|
||||
1. preinstall `dotnet8`. Download [here](https://dotnet.microsoft.com/download/dotnet/8.0).
|
||||
2. preinstall `VS2022`. Download [here](https://visualstudio.microsoft.com/vs/).
|
||||
3. `git clone` this repo.
|
||||
4. `cd` to `<repo>/src`.
|
||||
5. open `*.sln` file
|
||||
6. ...
|
||||
7. profit!
|
||||
|
||||
## ..build from scratch
|
||||
1. `git clone` this repo.
|
||||
2. `cd` to `<repo>/src`.
|
||||
3.1 execute `donten run` in `src` folder.
|
||||
or
|
||||
3.2 execute `build.bat(sh)` in `src` folder.
|
||||
4. by default all data will be downloaded to `src/atlassian` folder and subfolders.
|
||||
3. execute `build.bat(sh)` in `src` folder.
|
||||
4. by default all data will be downloaded to `src/Atlassian` folder and subfolders.
|
||||
|
||||
## ..install
|
||||
1. download latest [](https://github.com/EpicMorg/atlassian-downloader/releases) [](https://github.com/EpicMorg/atlassian-downloader/releases)
|
||||
## ..use binary versions
|
||||
1. just download latest [](https://github.com/EpicMorg/atlassian-downloader/releases) [](https://github.com/EpicMorg/atlassian-downloader/releases)
|
||||
2. ...
|
||||
3. profit!
|
||||
|
||||
## ..intall via Chocolatey
|
||||
| CLI | Version | Downloads
|
||||
| ------ | ------ | ------
|
||||
| :computer: `choco install atlassian-downloader` | [](https://chocolatey.org/packages/atlassian-downloader/) | [](https://chocolatey.org/packages/atlassian-downloader/)
|
||||
|
||||
-------------------
|
||||
|
||||
# Usage and settings
|
||||
## CLI args
|
||||
|
||||

|
||||

|
||||
|
||||
```
|
||||
atlassian-downloader:
|
||||
@ -40,13 +54,49 @@ Usage:
|
||||
atlassian-downloader [options]
|
||||
|
||||
Options:
|
||||
--output-dir <output-dir> Override output directory to download [default: atlassian]
|
||||
--custom-feed <custom-feed> Override URIs to import [default: ]
|
||||
--action <Download|ListURLs|ListVersions|ShowRawJson> Action to perform [default: Download]
|
||||
--version Show credits banner [default: False]
|
||||
-?, -h, --help Show help and usage information
|
||||
--output-dir <output-dir> Override output directory to download
|
||||
--custom-feed <custom-feed> Override URIs to import []
|
||||
--action <Download|ListURLs|ListVersions|ShowRawJson> Action to perform [default: Download]
|
||||
--about Show credits banner [default: False]
|
||||
--product-version <product-version> Override target version to download some product. Advice: Use
|
||||
it with "customFeed". []
|
||||
--skip-file-check Skip compare of file sizes if a local file already exists.
|
||||
Existing file will be skipped to check and redownload.
|
||||
[default: False]
|
||||
--user-agent <user-agent> Set custom user agent via this feature flag. [default:
|
||||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0)
|
||||
Gecko/20100101 Firefox/101.0]
|
||||
--version Show version information
|
||||
-?, -h, --help Show help and usage information
|
||||
```
|
||||
|
||||
## Example of usage:
|
||||
|
||||
### How to download it all at first time, or get update of local archive
|
||||
```
|
||||
PS> .\atlassian-downloader.exe --output-dir "P:\Atlassian"
|
||||
or
|
||||
bash# ./atlassian-downloader --output-dir "/mnt/nfs/atlassian"
|
||||
```
|
||||
If you already have some folders at output path - they will be ignored and not be downloaded again and skipped. Downloader will be download only new versions of files which not be present locally yet.
|
||||
|
||||
### Set only some url feed and dowload it:
|
||||
```
|
||||
PS> .\atlassian-downloader.exe --output-dir "P:\Atlassian" --custom-feed https://my.atlassian.com/download/feeds/current/bamboo.json
|
||||
or
|
||||
bash# ./atlassian-downloader --output-dir "/mnt/nfs/atlassian" --custom-feed https://my.atlassian.com/download/feeds/current/bamboo.json
|
||||
```
|
||||
|
||||
### cron or crontab example
|
||||
```
|
||||
0 0 * 1 0 /opt/epicmorg/atlassian-downloader/atlassian-downloader --output-dir "/mnt/nfs/atlassian"
|
||||
```
|
||||
### Show only urls from jsons
|
||||
```
|
||||
PS> .\atlassian-downloader.exe --action ListURLs
|
||||
or
|
||||
bash# ./atlassian-downloader --action ListURLs
|
||||
```
|
||||
|
||||
## Additional settings
|
||||
File `src/appSettings.json` contains additional settings, like [loglevel](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0#fields) and [console output theme](https://github.com/serilog/serilog-sinks-console). You can set it up via editing this file.
|
||||
@ -72,12 +122,15 @@ The following built-in themes are available, provided by `Serilog.Sinks.Console`
|
||||
* `AnsiConsoleTheme.Grayscale` - an ANSI 256-color version of the "grayscale" theme
|
||||
* `AnsiConsoleTheme.Code` - an ANSI 256-color Visual Studio Code-inspired theme
|
||||
|
||||
-------------------
|
||||
|
||||
# Supported products:
|
||||
|
||||
| Product | Current | Archive | EAP |
|
||||
|-------------|:-------------:|:-------------:|:-------------:|
|
||||
| [](https://www.atlassian.com/software/bamboo) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| [&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/bitbucket) | :white_check_mark: | :white_check_mark: | :interrobang: |
|
||||
| [&color=bright%20green&style=for-the-badge)](https://confluence.atlassian.com/bitbucketserver/bitbucket-mesh-compatibility-matrix-1127254859.html) | :white_check_mark: | :white_check_mark: | :interrobang: |
|
||||
| [](https://www.atlassian.com/software/clover) | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| [](https://www.atlassian.com/software/confluence) | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| [](https://www.atlassian.com/software/crowd) | :white_check_mark: | :white_check_mark: | :x: |
|
||||
@ -90,7 +143,7 @@ The following built-in themes are available, provided by `Serilog.Sinks.Console`
|
||||
|
||||
* Archive of `Atlassian` jsons available [here](https://github.com/EpicMorg/atlassian-json).
|
||||
|
||||
------
|
||||
-------------------
|
||||
|
||||
## Authors
|
||||
* [@kasthack](https://github.com/kasthack) - code
|
||||
|
BIN
docs/favicon.ico
Normal file
After Width: | Height: | Size: 107 KiB |
BIN
docs/favicon.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
docs/logging.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
docs/products.png
Normal file
After Width: | Height: | Size: 32 KiB |
121
src/Core/BellsAndWhistles.cs
Normal file
@ -0,0 +1,121 @@
|
||||
namespace EpicMorg.Atlassian.Downloader.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
internal class BellsAndWhistles
|
||||
{
|
||||
private static readonly string assemblyEnvironment = string.Format("[{1}, {0}]", RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(), RuntimeInformation.FrameworkDescription);
|
||||
|
||||
private static readonly Assembly entryAssembly = Assembly.GetEntryAssembly()!;
|
||||
|
||||
private static readonly string assemblyVersion = entryAssembly.GetName().Version!.ToString();
|
||||
|
||||
private static readonly string fileVersion = entryAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>()!.Version;
|
||||
|
||||
private static readonly string assemblyName = entryAssembly.GetCustomAttribute<AssemblyProductAttribute>()!.Product;
|
||||
const string assemblyBuildType =
|
||||
#if DEBUG
|
||||
"[Debug]"
|
||||
#else
|
||||
|
||||
"[Release]"
|
||||
#endif
|
||||
;
|
||||
|
||||
private const ConsoleColor DEFAULT = ConsoleColor.Blue;
|
||||
|
||||
public static void ShowVersionInfo(ILogger logger)
|
||||
{
|
||||
logger.LogInformation(
|
||||
"{assemblyName} {assemblyVersion} {assemblyEnvironment} {assemblyBuildType}",
|
||||
assemblyName,
|
||||
assemblyVersion,
|
||||
assemblyEnvironment,
|
||||
assemblyBuildType);
|
||||
Console.BackgroundColor = ConsoleColor.Black;
|
||||
WriteColorLine("%╔═╦═══════════════════════════════════════════════════════════════════════════════════════╦═╗");
|
||||
WriteColorLine("%╠═╝ .''. %╚═%╣");
|
||||
WriteColorLine("%║ .:cc;. %║");
|
||||
WriteColorLine("%║ .;cccc;. %║");
|
||||
WriteColorLine("%║ .;cccccc;. !╔══════════════════════════════════════════════╗ %║");
|
||||
WriteColorLine($"%║ .:ccccccc;. !║ {assemblyName} !║ %║");
|
||||
WriteColorLine("%║ 'ccccccccc;. !╠══════════════════════════════════════════════╣ %║");
|
||||
WriteColorLine("%║ ,cccccccccc;. !║ &Code: @kasthack !║ %║");
|
||||
WriteColorLine("%║ ,ccccccccccc;. !║ &GFX: @stam !║ %║");
|
||||
WriteColorLine("%║ .... .:ccccccccccc;. !╠══════════════════════════════════════════════╣ %║");
|
||||
WriteColorLine($"%║ .',,'..;cccccccccccc;. !║ &Version: {fileVersion} !║ %║");
|
||||
WriteColorLine("%║ .,,,,,'.';cccccccccccc;. !║ &GitHub: $EpicMorg/atlassian-downloader !║ %║");
|
||||
WriteColorLine("%║ .,;;;;;,'.':cccccccccccc;. !╚══════════════════════════════════════════════╝ %║");
|
||||
WriteColorLine("%║ .;:;;;;;;,...:cccccccccccc;. %║");
|
||||
WriteColorLine("%║ .;:::::;;;;'. .;:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .:cc::::::::,. ..:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .:cccccc:::::' .:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .;:::::::::::,. .;:::::::::::,. %║");
|
||||
WriteColorLine("%╠═╗ ............ ............ %╔═╣");
|
||||
WriteColorLine("%╚═╩═══════════════════════════════════════════════════════════════════════════════════════╩═╝");
|
||||
Console.ResetColor();
|
||||
}
|
||||
public static void SetConsoleTitle() => Console.Title = $@"{assemblyName} {assemblyVersion} {assemblyEnvironment} - {assemblyBuildType}";
|
||||
|
||||
private static void WriteColorLine(string text, params object[] args)
|
||||
{
|
||||
Dictionary<char, ConsoleColor> colors = new()
|
||||
{
|
||||
{ '!', ConsoleColor.Red },
|
||||
{ '@', ConsoleColor.Green },
|
||||
{ '#', ConsoleColor.Blue },
|
||||
{ '$', ConsoleColor.Magenta },
|
||||
{ '&', ConsoleColor.Yellow },
|
||||
{ '%', ConsoleColor.Cyan }
|
||||
};
|
||||
// TODO: word wrap, backslash escapes
|
||||
text = string.Format(text, args);
|
||||
var chunk = "";
|
||||
var paren = false;
|
||||
for (var i = 0; i < text.Length; i++)
|
||||
{
|
||||
var c = text[i];
|
||||
if (colors.ContainsKey(c) && StringNext(text, i) != ' ')
|
||||
{
|
||||
Console.Write(chunk);
|
||||
chunk = "";
|
||||
if (StringNext(text, i) == '(')
|
||||
{
|
||||
i++; // skip past the paren
|
||||
paren = true;
|
||||
}
|
||||
|
||||
Console.ForegroundColor = colors[c];
|
||||
}
|
||||
else if (paren && c == ')')
|
||||
{
|
||||
paren = false;
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
else if (Console.ForegroundColor != DEFAULT)
|
||||
{
|
||||
Console.Write(c);
|
||||
if (c == ' ' && !paren)
|
||||
{
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chunk += c;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine(chunk);
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
|
||||
private static char StringNext(string text, int index) => index < text.Length ? text[index + 1] : '\0';
|
||||
|
||||
}
|
||||
|
259
src/Core/DownloaderService.cs
Normal file
@ -0,0 +1,259 @@
|
||||
namespace EpicMorg.Atlassian.Downloader.Core;
|
||||
|
||||
using EpicMorg.Atlassian.Downloader.Models;
|
||||
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
internal class DownloaderService : IHostedService
|
||||
{
|
||||
private static readonly JsonSerializerOptions jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
private readonly ILogger<DownloaderService> logger;
|
||||
private readonly DownloaderOptions options;
|
||||
private readonly HttpClient client;
|
||||
private readonly IHostApplicationLifetime hostApplicationLifetime;
|
||||
|
||||
public DownloaderService(IHostApplicationLifetime hostApplicationLifetime, ILogger<DownloaderService> logger, HttpClient client, DownloaderOptions options)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.client = client;
|
||||
client.DefaultRequestHeaders.Add("User-Agent", options.UserAgent);
|
||||
this.options = options;
|
||||
this.hostApplicationLifetime = hostApplicationLifetime;
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
BellsAndWhistles.SetConsoleTitle();
|
||||
BellsAndWhistles.ShowVersionInfo(this.logger);
|
||||
|
||||
if (!this.options.Version && !string.IsNullOrWhiteSpace(this.options.OutputDir))
|
||||
{
|
||||
var feedUrls = this.GetFeedUrls();
|
||||
|
||||
this.logger.LogInformation($"Task started");
|
||||
foreach (var feedUrl in feedUrls)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var (json, versions) = await this.GetJson(feedUrl, this.options.ProductVersion, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
switch (this.options.Action)
|
||||
{
|
||||
case DownloadAction.ShowRawJson:
|
||||
Console.Out.WriteLine(json);
|
||||
break;
|
||||
case DownloadAction.Download:
|
||||
await this.DownloadFilesFromFeed(feedUrl, versions, cancellationToken).ConfigureAwait(false);
|
||||
break;
|
||||
case DownloadAction.ListURLs:
|
||||
foreach (var versionProg in versions)
|
||||
{
|
||||
foreach (var file in versionProg.Value)
|
||||
{
|
||||
Console.Out.WriteLine(file.ZipUrl);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DownloadAction.ListVersions:
|
||||
foreach (var versionProg in versions)
|
||||
{
|
||||
foreach (var file in versionProg.Value)
|
||||
{
|
||||
Console.Out.WriteLine(file.Version);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.LogInformation($"Complete");
|
||||
|
||||
this.hostApplicationLifetime.StopApplication();
|
||||
}
|
||||
|
||||
private async Task<(string json, IDictionary<string, ResponseItem[]> versions)> GetJson(string feedUrl, string? productVersion = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var atlassianJson = await this.client.GetStringAsync(feedUrl, cancellationToken).ConfigureAwait(false);
|
||||
var json = atlassianJson.Trim()["downloads(".Length..^1];
|
||||
this.logger.LogTrace("Downloaded json: {json}", json);
|
||||
var parsed = JsonSerializer.Deserialize<ResponseItem[]>(json, jsonOptions)!;
|
||||
this.logger.LogDebug("Found {releaseCount} releases", parsed.Length);
|
||||
var versions = parsed
|
||||
.GroupBy(a => a.Version)
|
||||
.Where(a => productVersion is null || a.Key == productVersion)
|
||||
.ToDictionary(a => a.Key, a => a.ToArray());
|
||||
this.logger.LogDebug("Found {releaseCount} releases", versions.Count);
|
||||
return (json, versions);
|
||||
}
|
||||
|
||||
private IReadOnlyList<string> GetFeedUrls() => this.options.CustomFeed != null
|
||||
? this.options.CustomFeed.Select(a => a.ToString()).ToArray()
|
||||
: SourceInformation.AtlassianSources;
|
||||
|
||||
private async Task DownloadFilesFromFeed(string feedUrl, IDictionary<string, ResponseItem[]> versions, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var feedDir = Path.Combine(this.options.OutputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..feedUrl.LastIndexOf('.')]);
|
||||
this.logger.LogInformation("Download from JSON \"{feedUrl}\" started", feedUrl);
|
||||
foreach (var version in versions)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var directory = Path.Combine(feedDir, version.Key);
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
foreach (var file in version.Value)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.ZipUrl == null)
|
||||
{
|
||||
this.logger.LogWarning("Empty ZipUrl found for version '{version}' in {feedUrl}", version.Key, feedUrl);
|
||||
continue;
|
||||
}
|
||||
|
||||
var serverPath = file.ZipUrl.PathAndQuery;
|
||||
var outputFile = Path.Combine(directory, serverPath[(serverPath.LastIndexOf('/') + 1)..]);
|
||||
if (!File.Exists(outputFile))
|
||||
{
|
||||
await this.DownloadFile(file, outputFile, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.options.SkipFileCheck == false)
|
||||
{
|
||||
this.logger.LogWarning("File \"{outputFile}\" already exists. File sizes will be compared.", outputFile);
|
||||
var localFileSize = new FileInfo(outputFile).Length;
|
||||
this.logger.LogInformation("Size of local file is {localFileSize} bytes.", localFileSize);
|
||||
try
|
||||
{
|
||||
var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Add("User-Agent", options.UserAgent);
|
||||
var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, file.ZipUrl), cancellationToken);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.Content.Headers.ContentLength.HasValue)
|
||||
{
|
||||
var remoteFileSize = response.Content.Headers.ContentLength.Value;
|
||||
this.logger.LogInformation("Size of remote file is \"{remoteFileSize}\" bytes.", remoteFileSize);
|
||||
|
||||
if (remoteFileSize == localFileSize)
|
||||
{
|
||||
this.logger.LogInformation(
|
||||
"Size of remote and local files and are same ({remoteFileSize} bytes and {localFileSize} bytes). Nothing to download. Operation skipped.",
|
||||
remoteFileSize,
|
||||
localFileSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logger.LogWarning(
|
||||
"Size of remote and local files and are not same ({remoteFileSize} bytes and {localFileSize} bytes). Download started.",
|
||||
remoteFileSize,
|
||||
localFileSize);
|
||||
File.Delete(outputFile);
|
||||
await this.DownloadFile(file, outputFile, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logger.LogWarning("Cant get size of remote file \"{uri}\". May be server not support it feature. Sorry.", file.ZipUrl);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logger.LogError("Request execution error for {uri}: \"{statusCode}\". Sorry.", file.ZipUrl, response.StatusCode);
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
this.logger.LogError(ex, "HTTP request error for {uri}: \"{message}\", \"{statusCode}\". Sorry.", file.ZipUrl, ex.Message, ex.StatusCode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning("File \"{outputFile}\" already exists. Download from \"{uri}\" skipped.", outputFile, file.ZipUrl);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.LogInformation("All files from \"{feedUrl}\" successfully downloaded.", feedUrl);
|
||||
|
||||
}
|
||||
|
||||
private async Task DownloadFile(ResponseItem file, string outputFile, CancellationToken cancellationToken)
|
||||
{
|
||||
for (int attempt = 1; attempt <= options.MaxRetries; attempt++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(file.Md5))
|
||||
{
|
||||
File.WriteAllText(outputFile + ".md5", file.Md5);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var outputStream = File.OpenWrite(outputFile);
|
||||
using var request = await this.client.GetStreamAsync(file.ZipUrl, cancellationToken).ConfigureAwait(false);
|
||||
await request.CopyToAsync(outputStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception downloadEx)
|
||||
{
|
||||
this.logger.LogError(downloadEx, "Attempt {attempt} failed to download file \"{uri}\" to \"{outputFile}\".", attempt, file.ZipUrl, outputFile);
|
||||
|
||||
if (attempt == options.MaxRetries)
|
||||
{
|
||||
this.logger.LogError(downloadEx, "Failed to download file \"{uri}\" to \"{outputFile}\".", file.ZipUrl, outputFile);
|
||||
try
|
||||
{
|
||||
File.Delete(outputFile);
|
||||
}
|
||||
catch (Exception removeEx)
|
||||
{
|
||||
this.logger.LogError(removeEx, "Failed to remove incomplete file \"{outputFile}\".", outputFile);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(options.DelayBetweenRetries, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
this.logger.LogInformation("File \"{uri}\" successfully downloaded to \"{outputFile}\".", file.ZipUrl, outputFile);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
public async Task StopAsync(CancellationToken cancellationToken) { }
|
||||
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
|
||||
}
|
@ -1,320 +0,0 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EpicMorg.Atlassian.Downloader
|
||||
{
|
||||
class DonloaderService : IHostedService
|
||||
{
|
||||
private readonly ILogger<DonloaderService> logger;
|
||||
private readonly DownloaderOptions options;
|
||||
private readonly HttpClient client;
|
||||
private readonly IHostApplicationLifetime hostApplicationLifetime;
|
||||
private readonly string assemblyEnvironment = string.Format("[{1}, {0}]",
|
||||
System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(),
|
||||
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
|
||||
private readonly string assemblyVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
|
||||
private readonly string assemblyName = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyProductAttribute>().Product;
|
||||
const string assemblyBuildType =
|
||||
#if DEBUG
|
||||
"[Debug]"
|
||||
#else
|
||||
|
||||
"[Release]"
|
||||
#endif
|
||||
;
|
||||
|
||||
public DonloaderService(IHostApplicationLifetime hostApplicationLifetime, ILogger<DonloaderService> logger, HttpClient client, DownloaderOptions options)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.client = client;
|
||||
this.options = options;
|
||||
this.hostApplicationLifetime = hostApplicationLifetime;
|
||||
}
|
||||
public const ConsoleColor DEFAULT = ConsoleColor.Blue;
|
||||
|
||||
public static void WriteColorLine(string text, params object[] args)
|
||||
{
|
||||
Dictionary<char, ConsoleColor> colors = new()
|
||||
{
|
||||
{ '!', ConsoleColor.Red },
|
||||
{ '@', ConsoleColor.Green },
|
||||
{ '#', ConsoleColor.Blue },
|
||||
{ '$', ConsoleColor.Magenta },
|
||||
{ '&', ConsoleColor.Yellow },
|
||||
{ '%', ConsoleColor.Cyan }
|
||||
};
|
||||
// TODO: word wrap, backslash escapes
|
||||
text = string.Format(text, args);
|
||||
string chunk = "";
|
||||
bool paren = false;
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
char c = text[i];
|
||||
if (colors.ContainsKey(c) && StringNext(text, i) != ' ')
|
||||
{
|
||||
Console.Write(chunk);
|
||||
chunk = "";
|
||||
if (StringNext(text, i) == '(')
|
||||
{
|
||||
i++; // skip past the paren
|
||||
paren = true;
|
||||
}
|
||||
Console.ForegroundColor = colors[c];
|
||||
}
|
||||
else if (paren && c == ')')
|
||||
{
|
||||
paren = false;
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
else if (Console.ForegroundColor != DEFAULT)
|
||||
{
|
||||
Console.Write(c);
|
||||
if (c == ' ' && !paren)
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
else
|
||||
chunk += c;
|
||||
}
|
||||
Console.WriteLine(chunk);
|
||||
Console.ForegroundColor = DEFAULT;
|
||||
}
|
||||
|
||||
public static char StringPrev(string text, int index)
|
||||
{
|
||||
return (index == 0 || text.Length == 0) ? '\0' : text[index - 1];
|
||||
}
|
||||
|
||||
public static char StringNext(string text, int index)
|
||||
{
|
||||
return (index < text.Length) ? text[index + 1] : '\0';
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
SetConsoleTitle();
|
||||
if (options.Version)
|
||||
{
|
||||
ShowVersionInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
var feedUrls = this.GetFeedUrls();
|
||||
|
||||
ShowVersionInfo();
|
||||
logger.LogInformation($"Task started");
|
||||
foreach (var feedUrl in feedUrls)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var (json, versions) = await this.GetJson(feedUrl, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
switch (options.Action)
|
||||
{
|
||||
case DownloadAction.ShowRawJson:
|
||||
Console.Out.WriteLine(json);
|
||||
break;
|
||||
case DownloadAction.Download:
|
||||
await this.DownloadFilesFromFeed(feedUrl, versions, cancellationToken).ConfigureAwait(false);
|
||||
break;
|
||||
case DownloadAction.ListURLs:
|
||||
foreach (var versionProg in versions)
|
||||
{
|
||||
foreach (var file in versionProg.Value)
|
||||
{
|
||||
Console.Out.WriteLine(file.ZipUrl);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DownloadAction.ListVersions:
|
||||
foreach (var versionProg in versions)
|
||||
{
|
||||
foreach (var file in versionProg.Value)
|
||||
{
|
||||
Console.Out.WriteLine(file.Version);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.LogInformation($"Complete");
|
||||
|
||||
this.hostApplicationLifetime.StopApplication();
|
||||
}
|
||||
|
||||
private void ShowVersionInfo()
|
||||
{
|
||||
logger.LogInformation($"{assemblyName} {assemblyVersion} {assemblyEnvironment} {assemblyBuildType}");
|
||||
Console.BackgroundColor = ConsoleColor.Black;
|
||||
WriteColorLine("%╔═╦═══════════════════════════════════════════════════════════════════════════════════════╦═╗");
|
||||
WriteColorLine("%╠═╝ .''. %╚═%╣");
|
||||
WriteColorLine("%║ .:cc;. %║");
|
||||
WriteColorLine("%║ .;cccc;. %║");
|
||||
WriteColorLine("%║ .;cccccc;. !╔══════════════════════════════════════════════╗ %║");
|
||||
WriteColorLine("%║ .:ccccccc;. !║ " + assemblyName + " !║ %║");
|
||||
WriteColorLine("%║ 'ccccccccc;. !╠══════════════════════════════════════════════╣ %║");
|
||||
WriteColorLine("%║ ,cccccccccc;. !║ &Code: @kasthack !║ %║");
|
||||
WriteColorLine("%║ ,ccccccccccc;. !║ &GFX: @stam !║ %║");
|
||||
WriteColorLine("%║ .... .:ccccccccccc;. !╠══════════════════════════════════════════════╣ %║");
|
||||
WriteColorLine("%║ .',,'..;cccccccccccc;. !║ &Version: " + assemblyVersion + " !║ %║");
|
||||
WriteColorLine("%║ .,,,,,'.';cccccccccccc;. !║ &GitHub: $EpicMorg/atlassian-downloader !║ %║");
|
||||
WriteColorLine("%║ .,;;;;;,'.':cccccccccccc;. !╚══════════════════════════════════════════════╝ %║");
|
||||
WriteColorLine("%║ .;:;;;;;;,...:cccccccccccc;. %║");
|
||||
WriteColorLine("%║ .;:::::;;;;'. .;:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .:cc::::::::,. ..:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .:cccccc:::::' .:ccccccccccc;. %║");
|
||||
WriteColorLine("%║ .;:::::::::::,. .;:::::::::::,. %║");
|
||||
WriteColorLine("%╠═╗ ............ ............ %╔═╣");
|
||||
WriteColorLine("%╚═╩═══════════════════════════════════════════════════════════════════════════════════════╩═╝");
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
private async Task<(string json, IDictionary<string, ResponseItem[]> versions)> GetJson(string feedUrl, CancellationToken cancellationToken)
|
||||
{
|
||||
var atlassianJson = await client.GetStringAsync(feedUrl, cancellationToken).ConfigureAwait(false);
|
||||
var json = atlassianJson.Trim()["downloads(".Length..^1];
|
||||
logger.LogTrace("Downloaded json: {0}", json);
|
||||
var parsed = JsonSerializer.Deserialize<ResponseItem[]>(json, new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
logger.LogDebug("Found {0} releases", parsed.Length);
|
||||
var versions = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray());
|
||||
logger.LogDebug("Found {0} releases", versions.Count);
|
||||
return (json, versions);
|
||||
}
|
||||
|
||||
private string[] GetFeedUrls() => options.CustomFeed != null
|
||||
? options.CustomFeed.Select(a => a.ToString()).ToArray()
|
||||
: new[] {
|
||||
"https://my.atlassian.com/download/feeds/archived/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/clover.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/crowd.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/crucible.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/fisheye.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-core.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-software.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/stash.json",
|
||||
|
||||
"https://my.atlassian.com/download/feeds/current/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/current/clover.json",
|
||||
"https://my.atlassian.com/download/feeds/current/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/current/crowd.json",
|
||||
"https://my.atlassian.com/download/feeds/current/crucible.json",
|
||||
"https://my.atlassian.com/download/feeds/current/fisheye.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-core.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-software.json",
|
||||
"https://my.atlassian.com/download/feeds/current/stash.json",
|
||||
|
||||
"https://my.atlassian.com/download/feeds/eap/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/jira.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/stash.json",
|
||||
|
||||
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json",
|
||||
|
||||
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json"
|
||||
|
||||
};
|
||||
|
||||
private void SetConsoleTitle()
|
||||
{
|
||||
Console.Title = $@"{assemblyName} {assemblyVersion} {assemblyEnvironment} - {assemblyBuildType}";
|
||||
}
|
||||
|
||||
private async Task DownloadFilesFromFeed(string feedUrl, IDictionary<string, ResponseItem[]> versions, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var feedDir = Path.Combine(options.OutputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..(feedUrl.LastIndexOf('.'))]);
|
||||
logger.LogInformation($"Download from JSON \"{feedUrl}\" started");
|
||||
foreach (var version in versions)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var directory = Path.Combine(feedDir, version.Key);
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
foreach (var file in version.Value)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (file.ZipUrl == null)
|
||||
{
|
||||
logger.LogWarning($"Empty ZipUrl found for version '{version.Key}' in {feedUrl}");
|
||||
continue;
|
||||
}
|
||||
var serverPath = file.ZipUrl.PathAndQuery;
|
||||
var outputFile = Path.Combine(directory, serverPath[(serverPath.LastIndexOf("/") + 1)..]);
|
||||
if (!File.Exists(outputFile))
|
||||
{
|
||||
await DownloadFile(file, outputFile, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning($"File \"{outputFile}\" already exists. Download from \"{file.ZipUrl}\" skipped.");
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.LogInformation($"All files from \"{feedUrl}\" successfully downloaded.");
|
||||
|
||||
}
|
||||
|
||||
private async Task DownloadFile(ResponseItem file, string outputFile, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(file.Md5))
|
||||
{
|
||||
File.WriteAllText(outputFile + ".md5", file.Md5);
|
||||
}
|
||||
try
|
||||
{
|
||||
using var outputStream = File.OpenWrite(outputFile);
|
||||
using var request = await client.GetStreamAsync(file.ZipUrl, cancellationToken).ConfigureAwait(false);
|
||||
await request.CopyToAsync(outputStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception downloadEx)
|
||||
{
|
||||
logger.LogError(downloadEx, $"Failed to download file {file.ZipUrl} to {outputFile}.");
|
||||
try
|
||||
{
|
||||
File.Delete(outputFile);
|
||||
}
|
||||
catch (Exception removeEx)
|
||||
{
|
||||
logger.LogError(removeEx, $"Failed to remove incomplete file {outputFile}.");
|
||||
}
|
||||
}
|
||||
logger.LogInformation($"File \"{file.ZipUrl}\" successfully downloaded to \"{outputFile}\".");
|
||||
}
|
||||
|
||||
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
public async Task StopAsync(CancellationToken cancellationToken) { }
|
||||
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
}
|
||||
}
|
@ -1,22 +1,21 @@
|
||||
namespace EpicMorg.Atlassian.Downloader
|
||||
{
|
||||
public enum DownloadAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Download application files
|
||||
/// </summary>
|
||||
Download,
|
||||
/// <summary>
|
||||
/// Print download URLs and exit
|
||||
/// </summary>
|
||||
ListURLs,
|
||||
/// <summary>
|
||||
/// Print available application versions and exit
|
||||
/// </summary>
|
||||
ListVersions,
|
||||
/// <summary>
|
||||
/// Print feed JSONs to stdout and exit
|
||||
/// </summary>
|
||||
ShowRawJson,
|
||||
}
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
|
||||
public enum DownloadAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Download application files
|
||||
/// </summary>
|
||||
Download,
|
||||
/// <summary>
|
||||
/// Print download URLs and exit
|
||||
/// </summary>
|
||||
ListURLs,
|
||||
/// <summary>
|
||||
/// Print available application versions and exit
|
||||
/// </summary>
|
||||
ListVersions,
|
||||
/// <summary>
|
||||
/// Print feed JSONs to stdout and exit
|
||||
/// </summary>
|
||||
ShowRawJson,
|
||||
}
|
@ -1,6 +1,14 @@
|
||||
using System;
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
using System;
|
||||
|
||||
namespace EpicMorg.Atlassian.Downloader
|
||||
{
|
||||
public record DownloaderOptions(string OutputDir, Uri[] CustomFeed, DownloadAction Action,bool Version) { }
|
||||
}
|
||||
public record DownloaderOptions(
|
||||
string OutputDir,
|
||||
Uri[]? CustomFeed,
|
||||
DownloadAction Action,
|
||||
bool Version,
|
||||
string? ProductVersion,
|
||||
bool SkipFileCheck,
|
||||
string UserAgent,
|
||||
int MaxRetries,
|
||||
int DelayBetweenRetries
|
||||
) { }
|
@ -1,31 +1,19 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EpicMorg.Atlassian.Downloader
|
||||
public partial class ResponseItem
|
||||
{
|
||||
|
||||
public partial class ResponseItem
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public string Edition { get; set; }
|
||||
public Uri ZipUrl { get; set; }
|
||||
public object TarUrl { get; set; }
|
||||
public string Md5 { get; set; }
|
||||
public string Size { get; set; }
|
||||
public string Released { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Platform { get; set; }
|
||||
public string Version { get; set; }
|
||||
public Uri ReleaseNotes { get; set; }
|
||||
public Uri UpgradeNotes { get; set; }
|
||||
}
|
||||
public string? Description { get; set; }
|
||||
public string? Edition { get; set; }
|
||||
public Uri? ZipUrl { get; set; }
|
||||
public object? TarUrl { get; set; }
|
||||
public string? Md5 { get; set; }
|
||||
public string? Size { get; set; }
|
||||
public string? Released { get; set; }
|
||||
public string? Type { get; set; }
|
||||
public string? Platform { get; set; }
|
||||
public required string Version { get; set; }
|
||||
public Uri? ReleaseNotes { get; set; }
|
||||
public Uri? UpgradeNotes { get; set; }
|
||||
}
|
85
src/Models/SourceInformation.cs
Normal file
@ -0,0 +1,85 @@
|
||||
namespace EpicMorg.Atlassian.Downloader.Models;
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal static class SourceInformation
|
||||
{
|
||||
public static IReadOnlyList<string> AtlassianSources { get; } = new[] {
|
||||
|
||||
//official links
|
||||
"https://my.atlassian.com/download/feeds/archived/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/clover.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/crowd.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/crucible.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/fisheye.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-core.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira-software.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/jira.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/stash.json",
|
||||
"https://my.atlassian.com/download/feeds/archived/mesh.json",
|
||||
|
||||
//cdn mirror of official links
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/bamboo.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/clover.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/confluence.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/crowd.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/crucible.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/fisheye.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-core.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-servicedesk.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-software.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/stash.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/mesh.json",
|
||||
|
||||
//official links
|
||||
"https://my.atlassian.com/download/feeds/current/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/current/clover.json",
|
||||
"https://my.atlassian.com/download/feeds/current/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/current/crowd.json",
|
||||
"https://my.atlassian.com/download/feeds/current/crucible.json",
|
||||
"https://my.atlassian.com/download/feeds/current/fisheye.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-core.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/current/jira-software.json",
|
||||
"https://my.atlassian.com/download/feeds/current/stash.json",
|
||||
"https://my.atlassian.com/download/feeds/current/mesh.json",
|
||||
|
||||
//cdn mirror of official links
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/bamboo.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/clover.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/confluence.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/crowd.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/crucible.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/fisheye.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-core.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-servicedesk.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-software.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/stash.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/mesh.json",
|
||||
|
||||
//official links
|
||||
"https://my.atlassian.com/download/feeds/eap/bamboo.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/confluence.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/jira.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/jira-servicedesk.json",
|
||||
"https://my.atlassian.com/download/feeds/eap/stash.json",
|
||||
//"https://my.atlassian.com/download/feeds/eap/mesh.json", //404
|
||||
|
||||
//cdn mirror of official links
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/bamboo.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/confluence.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/jira.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/jira-servicedesk.json",
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/stash.json",
|
||||
//"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/mesh.json", //404
|
||||
|
||||
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json //unstable link with r\l
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json",
|
||||
|
||||
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json //unstable link with r\l
|
||||
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json"
|
||||
|
||||
};
|
||||
}
|
100
src/Program.cs
@ -1,4 +1,8 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
|
||||
using EpicMorg.Atlassian.Downloader.Core;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -8,42 +12,62 @@ using Serilog;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EpicMorg.Atlassian.Downloader
|
||||
public class Program
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Atlassian archive downloader. See https://github.com/EpicMorg/atlassian-downloader for more info
|
||||
/// </summary>
|
||||
/// <param name="Action">Action to perform</param>
|
||||
/// <param name="OutputDir">Override output directory to download</param>
|
||||
/// <param name="customFeed">Override URIs to import</param>
|
||||
/// <param name="Version">Show credits banner</param>
|
||||
static async Task Main(string OutputDir = "atlassian", Uri[] customFeed = null, DownloadAction Action = DownloadAction.Download, bool Version = false) => await
|
||||
Host
|
||||
.CreateDefaultBuilder()
|
||||
.ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables())
|
||||
.ConfigureAppConfiguration((ctx, configuration) =>
|
||||
configuration
|
||||
.SetBasePath(Environment.CurrentDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true)
|
||||
.AddEnvironmentVariables())
|
||||
.ConfigureServices((ctx, services) => services
|
||||
.AddOptions()
|
||||
.AddLogging(builder =>
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(ctx.Configuration)
|
||||
.CreateLogger();
|
||||
builder
|
||||
.ClearProviders()
|
||||
.AddSerilog(dispose: true);
|
||||
})
|
||||
.AddHostedService<DonloaderService>()
|
||||
.AddSingleton(new DownloaderOptions(OutputDir, customFeed, Action, Version))
|
||||
.AddHttpClient())
|
||||
.RunConsoleAsync()
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Atlassian archive downloader. See https://github.com/EpicMorg/atlassian-downloader for more info
|
||||
/// </summary>
|
||||
/// <param name="action">Action to perform</param>
|
||||
/// <param name="outputDir">Override output directory to download</param>
|
||||
/// <param name="customFeed">Override URIs to import</param>
|
||||
/// <param name="about">Show credits banner</param>
|
||||
/// <param name="productVersion">Override target version to download some product. Advice: Use it with "customFeed".</param>
|
||||
/// <param name="skipFileCheck">Skip compare of file sizes if a local file already exists. Existing file will be skipped to check and redownload.</param>
|
||||
/// <param name="userAgent">Set custom user agent via this feature flag.</param>
|
||||
/// <param name="maxRetries">Set custom count of download retries.</param>
|
||||
/// <param name="delayBetweenRetries">Set custom delay between retries (in milliseconds).</param>
|
||||
static async Task Main(
|
||||
string? outputDir = default,
|
||||
Uri[]? customFeed = null,
|
||||
DownloadAction action = DownloadAction.Download,
|
||||
bool about = false,
|
||||
string? productVersion = null,
|
||||
bool skipFileCheck = false,
|
||||
int maxRetries = 5,
|
||||
int delayBetweenRetries = 2500,
|
||||
string userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0") => await
|
||||
Host
|
||||
.CreateDefaultBuilder()
|
||||
.ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables())
|
||||
.ConfigureAppConfiguration((ctx, configuration) =>
|
||||
configuration
|
||||
.SetBasePath(System.AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true)
|
||||
.AddEnvironmentVariables())
|
||||
.ConfigureServices((ctx, services) => services
|
||||
.AddOptions()
|
||||
.AddLogging(builder =>
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(ctx.Configuration)
|
||||
.CreateLogger();
|
||||
_ = builder
|
||||
.ClearProviders()
|
||||
.AddSerilog(dispose: true);
|
||||
})
|
||||
.AddHostedService<DownloaderService>()
|
||||
.AddSingleton(new DownloaderOptions(
|
||||
outputDir ?? Environment.CurrentDirectory,
|
||||
customFeed,
|
||||
action,
|
||||
about,
|
||||
productVersion,
|
||||
skipFileCheck,
|
||||
userAgent,
|
||||
maxRetries,
|
||||
delayBetweenRetries))
|
||||
.AddHttpClient())
|
||||
.RunConsoleAsync()
|
||||
.ConfigureAwait(false);
|
||||
}
|
11
src/Properties/PublishProfiles/linux-arm.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\linux-arm\publish\</PublishDir>
|
||||
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/linux-arm.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/linux-arm64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\linux-arm64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/linux-arm64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/linux-bionic-x64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\linux-bionic-x64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>linux-bionic-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/linux-bionic-x64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/linux-musl-x64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\linux-musl-x64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/linux-musl-x64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/linux-x64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\linux-x64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/linux-x64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/osx-arm64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\osx-arm64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/osx-arm64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/osx-x64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\osx-x64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/osx-x64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/win-arm64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\win-arm64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/win-arm64.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/win-x64.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\win-x64\publish\</PublishDir>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/win-x64.pubxml.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
11
src/Properties/PublishProfiles/win-x86.pubxml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
|
||||
<!--target runtime-->
|
||||
<PublishDir>bin\Release\net8.0\win-x86\publish\</PublishDir>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
src/Properties/PublishProfiles/win-x86.pubxml.user
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
</Project>
|
@ -2,7 +2,9 @@
|
||||
"profiles": {
|
||||
"atlassian-downloader": {
|
||||
"commandName": "Project",
|
||||
//"commandLineArgs": "--version"
|
||||
"commandLineArgs": "--help"
|
||||
// "commandLineArgs": "--action=ShowRawJson --output-dir=F:\\temp\\atlassian\\test1"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
|
||||
<!--publish config-->
|
||||
<PublishSingleFile>false</PublishSingleFile>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<PublishAot>false</PublishAot>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<!--build props-->
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
|
||||
<!--package metadata-->
|
||||
|
||||
<PackageId>EpicMorg.Atlassian.Downloader</PackageId>
|
||||
<Authors>EpicMorg, kasthack, stam</Authors>
|
||||
<Description>Atlassian Downloader by EpicMorg</Description>
|
||||
@ -17,41 +27,39 @@
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
|
||||
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
|
||||
<AssemblyVersion>1.0.0.9</AssemblyVersion>
|
||||
<FileVersion>1.0.0.9</FileVersion>
|
||||
<Version>1.0.0.9</Version>
|
||||
<Copyright>EpicMorg 2023</Copyright>
|
||||
<AssemblyVersion>2.0.0.2</AssemblyVersion>
|
||||
<FileVersion>2.0.0.2</FileVersion>
|
||||
<Version>2.0.0.2</Version>
|
||||
<Copyright>EpicMorg 2024</Copyright>
|
||||
<Product>Atlassian Downloader</Product>
|
||||
<IsPackable>true</IsPackable>
|
||||
<Company>EpicMorg</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RootNamespace>EpicMorg.Atlassian.Downloader</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.21216.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.4.0-alpha.22272.1" />
|
||||
<None Include="..\README.md">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
<None Include="favicon.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
<PackagePath>
|
||||
</PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
@ -1,10 +1,47 @@
|
||||
SET DOTNET_CLI_TELEMETRY_OPTOUT=true
|
||||
SET DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
|
||||
|
||||
dotnet.exe publish -r win7-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win7-x86 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win81-arm --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win10-arm64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r linux-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet.exe publish -r linux-musl-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet.exe publish -r osx-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet.exe publish -p:PublishProfile=win-x64 --force
|
||||
dotnet.exe publish -p:PublishProfile=win-x86 --force
|
||||
dotnet.exe publish -p:PublishProfile=win-arm64 --force
|
||||
dotnet.exe publish -p:PublishProfile=osx-x64 --force
|
||||
dotnet.exe publish -p:PublishProfile=osx-arm64 --force
|
||||
dotnet.exe publish -p:PublishProfile=linux-x64 --force
|
||||
dotnet.exe publish -p:PublishProfile=linux-musl-x64 --force
|
||||
dotnet.exe publish -p:PublishProfile=linux-arm --force
|
||||
dotnet.exe publish -p:PublishProfile=linux-arm64 --force
|
||||
dotnet.exe publish -p:PublishProfile=linux-bionic-x64 --force
|
||||
|
||||
del /F bin\\Release\\net8.0\\win-x64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\win-x86\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\win-arm64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\osx-x64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\osx-arm64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\linux-x64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\linux-musl-x64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\linux-arm\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\linux-arm64\\publish\\atlassian-downloader.pdb
|
||||
del /F bin\\Release\\net8.0\\linux-bionic-x64\\publish\\atlassian-downloader.pdb
|
||||
|
||||
type nul > bin/Release/net8.0/win-x64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/win-x86/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/win-arm64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/osx-x64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/osx-arm64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/linux-x64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/linux-musl-x64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/linux-arm/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/linux-arm64/publish/createdump.exe.ignore
|
||||
type nul > bin/Release/net8.0/linux-bionic-x64/publish/createdump.exe.ignore
|
||||
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x64.zip ./bin/Release/net8.0/win-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x86.zip ./bin/Release/net8.0/win-x86/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-arm64.zip ./bin/Release/net8.0/win-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-x64.zip ./bin/Release/net8.0/osx-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-arm64.zip ./bin/Release/net8.0/osx-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-x64.zip ./bin/Release/net8.0/linux-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-musl-x64.zip ./bin/Release/net8.0/linux-musl-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm.zip ./bin/Release/net8.0/linux-arm/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm64.zip ./bin/Release/net8.0/linux-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-bionic-x64.zip ./bin/Release/net8.0/linux-bionic-x64/publish/*
|
||||
|
||||
|
52
src/build.sh
@ -1,11 +1,47 @@
|
||||
#!/bin/bash
|
||||
#!/./bin/bash
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=true
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
|
||||
|
||||
dotnet publish -r win7-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win7-x86 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win81-arm --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win10-arm64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r linux-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r linux-musl-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r osx-x64 --self-contained true --framework net6.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -p:PublishProfile=win-x64 --force
|
||||
dotnet publish -p:PublishProfile=win-x86 --force
|
||||
dotnet publish -p:PublishProfile=win-arm64 --force
|
||||
dotnet publish -p:PublishProfile=osx-x64 --force
|
||||
dotnet publish -p:PublishProfile=osx-arm64 --force
|
||||
dotnet publish -p:PublishProfile=linux-x64 --force
|
||||
dotnet publish -p:PublishProfile=linux-musl-x64 --force
|
||||
dotnet publish -p:PublishProfile=linux-arm --force
|
||||
dotnet publish -p:PublishProfile=linux-arm64 --force
|
||||
dotnet publish -p:PublishProfile=linux-bionic-x64 --force
|
||||
|
||||
rm -rfv ./bin/Release/net8.0/win-x64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/win-x86/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/win-arm64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/osx-x64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/osx-arm64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/linux-x64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/linux-musl-x64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/linux-arm/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/linux-arm64/publish/atlassian-downloader.pdb
|
||||
rm -rfv ./bin/Release/net8.0/linux-bionic-x64/publish/atlassian-downloader.pdb
|
||||
|
||||
touch ./bin/Release/net8.0/win-x64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/win-x86/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/win-arm64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/osx-x64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/osx-arm64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/linux-x64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/linux-musl-x64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/linux-arm/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/linux-arm64/publish/createdump.exe.ignore
|
||||
touch ./bin/Release/net8.0/linux-bionic-x64/publish/createdump.exe.ignore
|
||||
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x64.zip ././bin/Release/net8.0/win-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x86.zip ././bin/Release/net8.0/win-x86/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-arm64.zip ././bin/Release/net8.0/win-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-x64.zip ././bin/Release/net8.0/osx-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-arm64.zip ././bin/Release/net8.0/osx-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-x64.zip ././bin/Release/net8.0/linux-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-musl-x64.zip ././bin/Release/net8.0/linu-musl-x64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm.zip ././bin/Release/net8.0/linux-arm/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm64.zip ././bin/Release/net8.0/linux-arm64/publish/*
|
||||
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-bionic-x64.zip ././bin/Release/net8.0/linu-bionic-x64/publish/*
|
||||
|
BIN
src/favicon.ico
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 107 KiB |