Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Mar 28, 2024
0 parents commit de3375d
Show file tree
Hide file tree
Showing 43 changed files with 3,892 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
keep_existing_linebreaks = true
max_line_length = off

[*.md]
trim_trailing_whitespace = false

[*.{json,xml,yml,yaml}]
indent_size = 2

[*.{bat,cmd}]
charset = latin1
end_of_line = crlf

[*.{ps1,psd1}]
end_of_line = crlf

[*.sln]
end_of_line = crlf
indent_style = tab

[*.{*proj,config,manifest,props,targets,nuspec}]
end_of_line = crlf
indent_size = 2

[*.resx]
indent_size = 2
end_of_line = crlf
trim_trailing_whitespace = false
insert_final_newline = false

[*.*.resx]
end_of_line = lf

[*.Designer.cs]
trim_trailing_whitespace = false

[*.cs]
end_of_line = crlf

# Indentation
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_outdent_binary_ops = true
csharp_outdent_dots = true
csharp_align_linq_query = true
csharp_align_multiline_parameter = true
csharp_align_multiline_calls_chain = true
csharp_align_multiline_binary_expressions_chain = true
csharp_align_multiline_array_and_object_initializer = false

# Line breaks
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = all
csharp_blank_lines_around_single_line_field = 0
csharp_blank_lines_inside_region = 0
csharp_blank_lines_around_region = 0
csharp_blank_lines_after_block_statements = 0
csharp_empty_block_style = together
csharp_place_simple_blocks_on_single_line = true
csharp_place_simple_initializer_on_single_line = true
csharp_place_attribute_on_same_line = if_owner_is_single_line
csharp_place_expr_method_on_single_line = true
csharp_place_constructor_initializer_on_same_line = false
csharp_wrap_object_and_collection_initializer_style = chop_if_long
csharp_wrap_array_initializer_style = chop_if_long
csharp_wrap_parameters_style = chop_if_long
csharp_preserve_single_line_blocks = true
csharp_keep_existing_arrangement = true

# Spacing
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_square_brackets = false
csharp_space_within_empty_braces = false

# Style
csharp_parentheses_redundancy_style = remove_if_not_clarifies_precedence
csharp_allow_comment_after_lbrace = true
csharp_braces_for_ifelse = required_for_multiline
csharp_braces_for_for = required_for_multiline
csharp_braces_for_foreach = required_for_multiline
csharp_braces_for_while = required_for_multiline
csharp_braces_for_using = required_for_multiline
csharp_braces_for_lock = required_for_multiline
csharp_braces_for_fixed = required_for_multiline
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_methods = true
csharp_style_expression_bodied_properties = true
csharp_local_function_body = expression_body
csharp_style_qualification_for_event = false
csharp_style_qualification_for_field = false
csharp_style_qualification_for_method = false
csharp_style_qualification_for_property = false
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_object_initializer = true
csharp_style_collection_initializer = true
csharp_style_explicit_tuple_names = true
csharp_style_null_propagation = true
csharp_style_coalesce_expression = true
csharp_style_conditional_delegate_call = true
csharp_style_throw_expression = true
csharp_style_predefined_type_for_locals_parameters_members = true
csharp_style_predefined_type_for_member_access = true
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable linebreak normalization
* -text

# Language-aware diff
*.cs diff=csharp
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on: [push, pull_request]

jobs:
build:
runs-on: windows-latest
steps:
# Prepare
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.12.x'
- uses: gittools/actions/gitversion/[email protected]
id: gitversion

# Build
- name: Build
run: .\build.ps1 ${{steps.gitversion.outputs.nuGetVersion}}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: 0boostrap-dotnet-${{steps.gitversion.outputs.nuGetVersion}}.*

# Release
- name: Create GitHub Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
with:
files: |
0boostrap-dotnet-${{steps.gitversion.outputs.legacySemVer}}.xml
0boostrap-dotnet-${{steps.gitversion.outputs.legacySemVer}}.tar.zst
body: |
**[Documentation and download instructions](https://docs.0install.net/tools/0boostrap/)**
Based on [Zero Install .NET ${{steps.gitversion.outputs.nuGetVersion}}](https://github.com/0install/0install-dotnet/releases/${{steps.gitversion.outputs.nuGetVersion}}).
- name: Publish feed
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{secrets.PERSONAL_TOKEN}}
run: >
gh workflow run --repo=0install/apps Incoming
-f feed_url=https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/0boostrap-dotnet-${{steps.gitversion.outputs.nuGetVersion}}.xml
-f archive_url=https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/0boostrap-dotnet-${{steps.gitversion.outputs.nuGetVersion}}.tar.zst
51 changes: 51 additions & 0 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Translate
on:
workflow_dispatch: {}
schedule:
- cron: '0 7 15 * *'
push:
branches: [master]
paths:
- '**/*.resx'
- '!**/*.*.resx' # Don't trigger again for updated translations

jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false

- name: Transifex Push
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} push --source
- name: Transifex Pull (fully translated)
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} pull --translations --mode translator --all --minimum-perc 100
- name: Transifex Pull (partially translated) # Only languages that can be completed with Machine Translation
run: ./0install.sh run https://apps.0install.net/devel/transifex-cli.xml --token ${{secrets.TRANSIFEX_API_KEY}} pull --translations --mode translator --languages cs,el,es,fr,id,it,ja,ko,nl,pl,pt_PT,ro,ru,zh

- name: DeepL Cache
uses: actions/cache@v4
with:
path: '**/*.a.resx'
key: deepl
- name: DeepL Translate
uses: Yeah69/MrMeeseeks.ResXTranslationCombinator@main
env:
GITHUB_TOKEN: ${{github.token}}
with:
auth: ${{secrets.DEEPL_API_KEY}}
source-lang: en
localization-filter: cs;el;es;fr;id;it;ja;ko;nl;pl;pt-PT;ro;ru;zh
glossary-name: Zero Install
context: User interface for editor with menus and buttons.
excludes-regex: .*ImageResources.*

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: translate
commit-message: Update translations
title: Update translations
body: Translations downloaded from Transifex and generated with DeepL
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.user
*.bak
*.a.resx
*.o.resx

# Caches
/src/.vs/
/src/.idea/
/src/_ReSharper.*/
/src/obj/
/src/bin/

# Output
/artifacts/
/0bootstrap-dotnet-*.xml
/0bootstrap-dotnet-*.tar.zst
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
type = RESX
source_lang = en
lang_map = pt_PT: pt-PT, pt_BR: pt-BR

[o:eicher:p:0install-win:r:bootstrap-cli]
source_file = src/Properties/Resources.resx
file_filter = src/Properties/Resources.<lang>.o.resx
19 changes: 19 additions & 0 deletions 0bootstrap-dotnet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>0bootstrap - .NET version</name>
<summary>generates executable that installs 0install itself along with launcher for a 0install app</summary>
<description>0bootstrap generates a executable that installs 0install itself along with a launcher for a 0install app.</description>
<homepage>https://docs.0install.net/tools/0bootstrap/</homepage>
<needs-terminal/>

<feed-for interface="https://apps.0install.net/0install/0bootstrap-dotnet.xml"/>

<group license="LGPL v3 (GNU Lesser General Public License)">
<command name="run" path="0bootstrap.exe">
<runner command="run" interface="https://apps.0install.net/dotnet/clr.xml" version="4.7.2.."/>
</command>

<!-- Use very high version number to treat local build as newer than any public version. -->
<implementation id="local" version="100-pre" stability="developer" local-path="artifacts/Release/net472"/>
</group>
</interface>
21 changes: 21 additions & 0 deletions 0bootstrap-dotnet.xml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>0bootstrap - .NET version</name>
<summary>generates executable that installs 0install itself along with launcher for a 0install app</summary>
<description>0bootstrap generates a executable that installs 0install itself along with a launcher for a 0install app.</description>
<homepage>https://docs.0install.net/tools/0bootstrap/</homepage>
<needs-terminal/>

<feed-for interface="https://apps.0install.net/0install/0bootstrap-dotnet.xml"/>

<group license="LGPL v3 (GNU Lesser General Public License)">
<command name="run" path="0bootstrap.exe">
<runner command="run" interface="https://apps.0install.net/dotnet/clr.xml" version="4.7.2.."/>
</command>

<implementation version="{version}" local-path="artifacts/Release/net472">
<manifest-digest/>
<archive href="0bootstrap-dotnet-{version}.tar.zst"/>
</implementation>
</group>
</interface>
35 changes: 35 additions & 0 deletions 0install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
$ErrorActionPreference = "Stop"

function Download-ZeroInstall {
$dir = "$env:LOCALAPPDATA\0install.net\bootstrapper"
$file = "$dir\0install.exe"
if (!(Test-Path $file)) {
mkdir -Force $dir | Out-Null
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'
Invoke-WebRequest "https://get.0install.net/0install.exe" -OutFile $file
}
return $file
}

function Run-ZeroInstall {
if (Get-Command 0install -ErrorAction SilentlyContinue) {
0install @args
} else {
. $(Download-ZeroInstall) @args
}
}

if ($args.Count -eq 0) {
echo "This script runs 0install from your PATH or downloads it on-demand."
echo ""
echo "To run 0install commands without adding 0install to your PATH:"
echo ".\0install.ps1 COMMAND [OPTIONS]"
echo ""
echo "To deploy 0install to your user profile:"
echo ".\0install.ps1 self deploy"
echo ""
echo "To deploy 0install to your machine:"
echo ".\0install.ps1 self deploy --machine"
} else {
Run-ZeroInstall @args
}
42 changes: 42 additions & 0 deletions 0install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
set -e

if [ "$#" -eq 0 ]; then
echo "This script runs 0install from your PATH or downloads it on-demand."
echo ""
echo "To run 0install commands without adding 0install to your PATH:"
echo "./0install.sh --help"
echo "./0install.sh COMMAND [OPTIONS]"
echo ""
echo "To install to /usr/local:"
echo "sudo ./0install.sh install local"
echo ""
echo "To install to your home directory:"
echo "./0install.sh install home"
exit 1
fi

download() {
zeroinstall_release=0install-$(uname | tr '[:upper:]' '[:lower:]')-$(uname -m)-${ZEROINSTALL_VERSION:-latest}
download_dir=~/.cache/0install.net/$zeroinstall_release

if [ ! -f $download_dir/files/0install ]; then
echo "Downloading 0install..." >&2
rm -rf $download_dir
mkdir -p $download_dir
curl -sSL https://get.0install.net/$zeroinstall_release.tar.bz2 | tar xj --strip-components 1 --directory $download_dir
fi
}

if [ "$1" = "install" ]; then
download
shift 1
$download_dir/install.sh "$@"
else
if command -v 0install > /dev/null 2> /dev/null; then
0install "$@"
else
download
$download_dir/files/0install "$@"
fi
fi
Loading

0 comments on commit de3375d

Please sign in to comment.