Compare commits
108 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 | |||
08314b9509 | |||
4b3ad68bf4 | |||
4869e99798 | |||
5ef7b83974 | |||
9285ee9eb8 | |||
|
99baf3ba5a | ||
b945d410ac | |||
2979a1e97d | |||
1dc3c00741 | |||
9fce04c196 | |||
738d657061 | |||
ec70cdec85 | |||
38dfee1469 | |||
6e9ae31f33 | |||
e16f768c6b | |||
8989cb80c1 | |||
35644076a7 | |||
8a97800982 | |||
0ab86f6cbd | |||
5bc23cad6e | |||
9c9963a7ab | |||
b04b2aae73 | |||
0edafc8d9a | |||
b004782670 | |||
|
5330ef0655 | ||
|
ce22f43b1f | ||
145c8f3286 | |||
4d16f25ec8 | |||
74889a1b5c | |||
bca4a1aa29 | |||
90cc59f61a | |||
23f092db9c | |||
9840991639 | |||
0c9ce49dbe | |||
0b95530eed | |||
f57c6e3986 | |||
42aec2a48c | |||
0c8b25734c | |||
2faffc2d32 | |||
480b43a3c8 | |||
acbbfa2fb0 | |||
e68f68d792 | |||
|
83980e6c77 | ||
c42b0f7626 | |||
5e0b74d89f | |||
e0f4bde3e5 | |||
|
b36a7c10b8 | ||
|
fbd0d48729 | ||
|
37dfc25963 | ||
1f7bf6b9ab | |||
5428e862ca |
4
.github/FUNDING.yml
vendored
@ -1,7 +1,9 @@
|
||||
# These are supported funding model platforms
|
||||
patreon: epicmorg
|
||||
patreon: kasthack
|
||||
custom: https://www.patreon.com/epicmorg
|
||||
ko_fi: epicmorg
|
||||
|
||||
|
||||
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
#open_collective: # Replace with a single Open Collective username
|
||||
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
|
20
.github/config.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
|
||||
|
||||
# Comment to be posted to on first time issues
|
||||
newIssueWelcomeComment: >
|
||||
:wave: Thank you for opening your first issue. I'm just an automated bot that's here to help you get the information you need quicker, so please ignore this message if it doesn't apply to your issue.
|
||||
|
||||
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
|
||||
|
||||
# Comment to be posted to on PRs from first time contributors in your repository
|
||||
newPRWelcomeComment: >
|
||||
Congratulations on opening your first Pull Request, this is a momentous day for you and us! :sparkles:
|
||||
|
||||
|
||||
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
|
||||
|
||||
# Comment to be posted to on pull requests merged by a first time user
|
||||
firstPRMergeComment: >
|
||||
Hooray! Your first Pull Request was merged, here's to many more :rocket:
|
||||
|
||||
# It is recommend to include as many gifs and emojis as possible
|
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/repo-logo.png
vendored
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
.github/media/screenshot-01.png
vendored
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
.github/media/screenshot-02.png
vendored
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
.github/media/screenshot-03.png
vendored
Normal file
After Width: | Height: | Size: 56 KiB |
13
.github/no-response.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Configuration for probot-no-response - https://github.com/probot/no-response
|
||||
|
||||
# Number of days of inactivity before an Issue is closed for lack of response
|
||||
daysUntilClose: 7
|
||||
# Label requiring a response
|
||||
responseRequiredLabel: more-information-needed
|
||||
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
||||
closeComment: >
|
||||
This issue has been automatically closed because there has been no response
|
||||
to our request for more information from the original author. With only the
|
||||
information that is currently in the issue, we don't have enough information
|
||||
to take action. Please reach out if you have or find the answers we need so
|
||||
that we can investigate further.
|
BIN
.github/screenshot-1.png
vendored
Before Width: | Height: | Size: 34 KiB |
8
.github/workflows/dotnet-develop.yml
vendored
@ -13,10 +13,14 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 8
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
env:
|
||||
|
12
.github/workflows/dotnet-master.yml
vendored
@ -4,16 +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/checkout@v4
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 8
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Restore
|
||||
env:
|
||||
|
22
CHANGELOG.md
@ -1,6 +1,26 @@
|
||||
# Atlassian Downloader - Changelog
|
||||
|
||||
* `1.0.0.6` - added supoprt of `clover`. fixed broken json parsing. added new logger.
|
||||
## 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.0.0.5` - added support for `EAP` releases.
|
||||
* `1.0.0.4` - bump version. rewrited build scripts. added support of `arm` and `arm64`.
|
||||
* `1.0.0.3` - some cosmetics improvements.
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2021 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
|
||||
|
131
README.md
@ -1,41 +1,136 @@
|
||||
# [](https://github.com/EpicMorg/atlassian-downloader/commits) [](https://github.com/EpicMorg/atlassian-downloader/issues) [](https://github.com/EpicMorg/atlassian-downloader/network) [](https://github.com/EpicMorg/atlassian-downloader/stargazers) [](https://github.com/EpicMorg/atlassian-downloader/archive/master.zip) [](https://github.com/EpicMorg/atlassian-downloader/releases) [](LICENSE.md) [](CHANGELOG.md)
|
||||
# [](https://github.com/EpicMorg/atlassian-downloader/commits) [](https://github.com/EpicMorg/atlassian-downloader/issues) [](https://github.com/EpicMorg/atlassian-downloader/network) [](https://github.com/EpicMorg/atlassian-downloader/stargazers) [](https://github.com/EpicMorg/atlassian-downloader/archive/master.zip) [](https://github.com/EpicMorg/atlassian-downloader/releases) [](https://github.com/EpicMorg/atlassian-downloader/releases) [](LICENSE.md) [](CHANGELOG.md)
|
||||
|
||||
# Atlassian Downloader
|
||||
|
||||
Console app written with `c#` and `dotnet5` 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 `dotnet5`. Download [here](https://dotnet.microsoft.com/download/dotnet/5.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`
|
||||
|
||||
## How to
|
||||
-------------------
|
||||
|
||||
# How to...
|
||||
|
||||
## ..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. execute `donten run` 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.
|
||||
|
||||
## Usage
|
||||
## ..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:
|
||||
Atlassian archive downloader. See https://github.com/EpicMorg/atlassian-downloader for more info
|
||||
|
||||
Usage:
|
||||
atlassian-downloader [options]
|
||||
|
||||
Options:
|
||||
--output-dir <output-dir> Override output directory to download [default: atlassian]
|
||||
--list Show all download links from feed without downloading [default: False]
|
||||
--custom-feed <custom-feed> Override URIs to import. [default: ]
|
||||
--version Show version information
|
||||
-?, -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
|
||||
```
|
||||
|
||||
## Supported products:
|
||||
## 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.
|
||||
|
||||
### Supported log levels
|
||||
| Level | Enum | Description
|
||||
|-------------|:-------------:|-------------|
|
||||
| `Critical` | `5` | Logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention.
|
||||
| `Debug` | `1` | Logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value.
|
||||
| `Error` | `4` | Logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.
|
||||
| `Information` | `2` | Logs that track the general flow of the application. These logs should have long-term value.
|
||||
| `None` | `6` | Not used for writing log messages. Specifies that a logging category should not write any messages.
|
||||
| `Trace` | `0` | Logs that contain the most detailed messages. These messages may contain sensitive application data. These messages are disabled by default and should never be enabled in a production environment.
|
||||
| `Warning` | `3` | Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.
|
||||
|
||||
### Supported console themes
|
||||
The following built-in themes are available, provided by `Serilog.Sinks.Console` package:
|
||||
|
||||
* `ConsoleTheme.None` - no styling
|
||||
* `SystemConsoleTheme.Literate` - styled to replicate _Serilog.Sinks.Literate_, using the `System.Console` coloring modes supported on all Windows/.NET targets; **this is the default when no theme is specified**
|
||||
* `SystemConsoleTheme.Grayscale` - a theme using only shades of gray, white, and black
|
||||
* `AnsiConsoleTheme.Literate` - an ANSI 16-color version of the "literate" theme; we expect to update this to use 256-colors for a more refined look in future
|
||||
* `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: |
|
||||
@ -44,11 +139,11 @@ Options:
|
||||
| [](https://www.atlassian.com/software/jira/core) | :white_check_mark: | :white_check_mark: | :x: |
|
||||
| [](https://www.atlassian.com/software/jira) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| [](https://www.atlassian.com/software/jira/service-management) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| [](https://www.atlassian.com/software/sourcetree) | :x: | :x: | :x: |
|
||||
| [](https://www.atlassian.com/software/sourcetree) | :white_check_mark: | :white_check_mark: | :x: |
|
||||
|
||||
* 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
|
||||
|
||||
}
|
21
src/Models/DownloadAction.cs
Normal file
@ -0,0 +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,
|
||||
}
|
14
src/Models/DownloaderOptions.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
using System;
|
||||
|
||||
public record DownloaderOptions(
|
||||
string OutputDir,
|
||||
Uri[]? CustomFeed,
|
||||
DownloadAction Action,
|
||||
bool Version,
|
||||
string? ProductVersion,
|
||||
bool SkipFileCheck,
|
||||
string UserAgent,
|
||||
int MaxRetries,
|
||||
int DelayBetweenRetries
|
||||
) { }
|
19
src/Models/ResponseItem.cs
Normal file
@ -0,0 +1,19 @@
|
||||
namespace EpicMorg.Atlassian.Downloader;
|
||||
|
||||
using System;
|
||||
|
||||
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 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"
|
||||
|
||||
};
|
||||
}
|
251
src/Program.cs
@ -1,180 +1,73 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using System;
|
||||
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 {
|
||||
class Program : IHostedService {
|
||||
|
||||
private readonly ILogger<Program> logger;
|
||||
private readonly Arguments arguments;
|
||||
|
||||
public Program(ILogger<Program> logger,Arguments arguments) {
|
||||
this.logger = logger;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="outputDir">Override output directory to download</param>
|
||||
/// <param name="list">Show all download links from feed without downloading</param>
|
||||
/// <param name="customFeed">Override URIs to import.</param>
|
||||
/// <returns></returns>
|
||||
static async Task Main(string outputDir = "atlassian", bool list = false, Uri[] customFeed = null) => 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 => {
|
||||
builder.ClearProviders();
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(ctx.Configuration)
|
||||
.CreateLogger();
|
||||
builder.AddSerilog(dispose: true);
|
||||
});
|
||||
services.AddHostedService<Program>();
|
||||
services.AddSingleton(new Arguments(outputDir, list, customFeed));
|
||||
})
|
||||
.RunConsoleAsync();
|
||||
|
||||
public record Arguments(string outputDir = "atlassian", bool list = false, Uri[] customFeed = null);
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken) {
|
||||
|
||||
var appTitle = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
var appStartupDate = DateTime.Now;
|
||||
var appBuildType = "[Release]";
|
||||
#if DEBUG
|
||||
appBuildType = "[Debug]";
|
||||
#endif
|
||||
|
||||
var feedUrls = arguments.customFeed != null
|
||||
? arguments.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"
|
||||
};
|
||||
|
||||
Console.Title = $"{appTitle} {appVersion} {appBuildType}";
|
||||
logger.LogTrace($"Task started at {appStartupDate}.");
|
||||
|
||||
var client = new HttpClient();
|
||||
|
||||
foreach (var feedUrl in feedUrls) {
|
||||
var feedDir = Path.Combine(arguments.outputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..(feedUrl.LastIndexOf('.'))]);
|
||||
var atlassianJson = await client.GetStringAsync(feedUrl);
|
||||
var callString = "downloads(";
|
||||
var json = atlassianJson[callString.Length..^1];
|
||||
var parsed = JsonSerializer.Deserialize<ResponseArray[]>(json, new JsonSerializerOptions {
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
});
|
||||
var versionsProg = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray());
|
||||
if (arguments.list) {
|
||||
foreach (var versionProg in versionsProg) {
|
||||
foreach (var file in versionProg.Value) {
|
||||
Console.WriteLine(file.ZipUrl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.LogInformation($"Download from JSON \"{feedUrl}\" started at {appStartupDate}.");
|
||||
foreach (var versionProg in versionsProg) {
|
||||
var directory = Path.Combine(feedDir, versionProg.Key);
|
||||
if (!Directory.Exists(directory)) {
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
foreach (var file in versionProg.Value) {
|
||||
if (file.ZipUrl == null) { continue; }
|
||||
var serverPath = file.ZipUrl.PathAndQuery;
|
||||
var outputFile = Path.Combine(directory, serverPath[(serverPath.LastIndexOf("/") + 1)..]);
|
||||
if (!File.Exists(outputFile)) {
|
||||
if (!string.IsNullOrEmpty(file.Md5)) {
|
||||
File.WriteAllText(outputFile + ".md5", file.Md5);
|
||||
}
|
||||
using var outputStream = File.OpenWrite(outputFile);
|
||||
using var request = await client.GetStreamAsync(file.ZipUrl).ConfigureAwait(false);
|
||||
await request.CopyToAsync(outputStream).ConfigureAwait(false);
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
logger.LogInformation($"File \"{file.ZipUrl}\" successfully downloaded to \"{outputFile}\".");
|
||||
// Console.ResetColor();
|
||||
} else {
|
||||
// Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
logger.LogWarning($"File \"{outputFile}\" already exists. Download from \"{file.ZipUrl}\" skipped.");
|
||||
// Console.ResetColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.LogTrace($"All files from \"{feedUrl}\" successfully downloaded.");
|
||||
}
|
||||
}
|
||||
|
||||
logger.LogTrace($"Download complete at {appStartupDate}.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ResponseArray {
|
||||
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; }
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
using Serilog;
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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="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>
|
10
src/Properties/launchSettings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"profiles": {
|
||||
"atlassian-downloader": {
|
||||
"commandName": "Project",
|
||||
//"commandLineArgs": "--version"
|
||||
"commandLineArgs": "--help"
|
||||
// "commandLineArgs": "--action=ShowRawJson --output-dir=F:\\temp\\atlassian\\test1"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": "Verbose",
|
||||
"MinimumLevel": "Information",
|
||||
"WriteTo": [
|
||||
"Console",
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console"
|
||||
}
|
||||
}
|
||||
,
|
||||
{
|
||||
"Name": "Logger",
|
||||
"Args": {
|
||||
@ -21,4 +27,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,50 +1,65 @@
|
||||
<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>net5.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>Atlassian Downloader</Authors>
|
||||
<Description>Atlassian Downloader by EpicMorg, code by kasthack</Description>
|
||||
<Authors>EpicMorg, kasthack, stam</Authors>
|
||||
<Description>Atlassian Downloader by EpicMorg</Description>
|
||||
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
|
||||
<PackageIcon>favicon.png</PackageIcon>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
|
||||
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
|
||||
<AssemblyVersion>1.0.0.6</AssemblyVersion>
|
||||
<FileVersion>1.0.0.6</FileVersion>
|
||||
<Version>1.0.0.6</Version>
|
||||
<Copyright>EpicMorg 2021</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.DependencyInjection" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.2-dev-10284" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.2.0-dev-00264" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00839" />
|
||||
<PackageReference Include="Serilog" Version="2.10.1-dev-01265" />
|
||||
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.20574.7" />
|
||||
<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">
|
||||
<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 net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win7-x86 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win81-arm --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r win10-arm64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=true
|
||||
dotnet.exe publish -r linux-x64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet.exe publish -r linux-musl-x64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet.exe publish -r osx-x64 --self-contained true --framework net5.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 net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win7-x86 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win81-arm --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r win10-arm64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=true -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r linux-x64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r linux-musl-x64 --self-contained true --framework net5.0 --configuration Release -p:PublishTrimmed=false -p:PublishSingleFile=false -p:PublishReadyToRun=false
|
||||
dotnet publish -r osx-x64 --self-contained true --framework net5.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 |