From fe3d23b0c74a540b56f3a4e3e0d39d7e58bfc9fe Mon Sep 17 00:00:00 2001 From: David Maas Date: Wed, 1 Sep 2021 03:13:44 -0500 Subject: [PATCH] Revamped package versioning, added NuGet.org publishing, did general cleanup. * Added .editorconfig * Added publishing to NuGet.org * Completely tore out "smart" versioning system (it was more trouble than it was wroth.) * Enabled using the informational version for the package version now that GitHub Packages doesn't choke on build metadata. * Removed x64 restrictions from ClangSharp.Pathogen (the assemblies aren't really x64-specific, the runtime is.) * Removed VersionPrefix from both projects. (We don't really support them shipping separately.) * Added Directory.Build.* protection to the LLVM Visual Studio CMake output folder * Modified Directory.Build.* pattern to match Biohazrd. * Enabled embedding untracked sources (this is required for NuGet Package Explorer determinism checks to be happy.) * Added building to central bin/obj folders. * Enabled error if there's no NuGet packages to upload. * Changed the BuildOutput artifact to be less aggressive and to upload even when building failed. * Added disclaimer to NuGet package description that ClangSharp.Pathogen is primarily intended to support Biohazrd. Fixes https://github.com/InfectedLibraries/ClangSharp.Pathogen/issues/3 Contributes to https://github.com/InfectedLibraries/Biohazrd/issues/214 --- .editorconfig | 259 ++++++++++++++++++ .github/workflows/ClangSharp.Pathogen.yml | 113 ++++++-- .github/workflows/configure-build.md | 37 --- .github/workflows/configure-build.py | 78 ++---- .../ClangSharp.Pathogen.Runtime.csproj | 5 - .../ClangSharp.Pathogen.csproj | 10 +- Directory.Build.props | 32 +-- Directory.Build.rsp | 1 + Directory.Build.targets | 6 +- create-llvm-vs-solution.cmd | 6 +- tooling/Common.csproj.props | 32 +++ tooling/Common.csproj.targets | 22 ++ tooling/Common.props | 31 +++ tooling/Common.targets | 18 ++ tooling/Versioning.props | 106 ------- tooling/Versioning.targets | 64 ----- 16 files changed, 490 insertions(+), 330 deletions(-) create mode 100644 .editorconfig delete mode 100644 .github/workflows/configure-build.md create mode 100644 Directory.Build.rsp create mode 100644 tooling/Common.csproj.props create mode 100644 tooling/Common.csproj.targets create mode 100644 tooling/Common.props create mode 100644 tooling/Common.targets delete mode 100644 tooling/Versioning.props delete mode 100644 tooling/Versioning.targets diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0e79e41 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,259 @@ +root = true + +[*] +indent_style = space + +#-------------------------------------------------------------------------------------------------- +# XML and JSON files +#-------------------------------------------------------------------------------------------------- +[*.{xml,csproj,vcxproj,vcxproj.filters,proj,projitems,shproj,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +[*.json] +indent_size = 2 + +#-------------------------------------------------------------------------------------------------- +# C++ +#-------------------------------------------------------------------------------------------------- +[*.{c,cpp,h,hpp,ixx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +#-------------------------------------------------------------------------------------------------- +# C# +#-------------------------------------------------------------------------------------------------- +# See the following documentation for the C#/.NET-specific rules to follow: +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options +[*.{cs,csx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +#------------------------------------------------------------------------------ +# Code style rules +#------------------------------------------------------------------------------ +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ + +#---------------------------------------------------------- +# Language Rules +#---------------------------------------------------------- + +# Self access qualification +dotnet_style_qualification_for_field = false:none +dotnet_style_qualification_for_property = false:none +dotnet_style_qualification_for_method = false:none +dotnet_style_qualification_for_event = false:none + +# Language keyword vs full type name +# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters. +dotnet_style_predefined_type_for_locals_parameters_members = true:none +dotnet_style_predefined_type_for_member_access = false:suggestion + +# Modifiers +# csharp_preferred_modifier_order = # Default is fine. It isn't expected this would be overriden in the IDE. +# We'd like this to be a warning, but it complains on partials in non-primary files. +dotnet_style_require_accessibility_modifiers = always:none +dotnet_style_readonly_field = true:suggestion +csharp_prefer_static_local_function = true:suggestion + +# Parentheses +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +# This is not enforced because there's too many situations where this hides the variable declaration in a way that harms understanding of the code. +csharp_style_inlined_variable_declaration = true:none +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:none +dotnet_style_explicit_tuple_names = true:warning +csharp_prefer_simple_default_expression = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:none +dotnet_style_prefer_inferred_anonymous_type_member_names = true:none +csharp_style_pattern_local_over_anonymous_function = true:warning +csharp_style_deconstructed_variable_declaration = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:none +dotnet_style_prefer_conditional_expression_over_return = true:none +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:none +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion + +# Null checking +csharp_style_throw_expression = true:none +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +# Not using safe navigation for event invocation has thread safety problems. +csharp_style_conditional_delegate_call = true:warning + +# Use of `var` +csharp_style_var_for_built_in_types = false:warning +# Use target-typed new instead. +csharp_style_var_when_type_is_apparent = false:warning +csharp_style_var_elsewhere = false:warning + +# Expression-bodied members +csharp_style_expression_bodied_constructors = true:suggestion +csharp_style_expression_bodied_methods = true:suggestion +csharp_style_expression_bodied_operators = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion + +# Pattern matching +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_pattern_matching = true:none +csharp_style_prefer_not_pattern = true:suggestion + +# Code block preferences +csharp_prefer_braces = true:warning +csharp_prefer_simple_using_statement = true:none + +# Using directive placement +csharp_using_directive_placement = outside_namespace:warning + +# File header +file_header_template = unset + +#---------------------------------------------------------- +# Unnecessary code rules +#---------------------------------------------------------- +# Simplify member access -- These tend to be more annoying than anything +dotnet_diagnostic.IDE0002.severity = none +# Remove unnecessary cast -- Sometimes these clarify the intent of the code. +dotnet_diagnostic.IDE0004.severity = suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable +csharp_style_unused_value_assignment_preference = discard_variable +dotnet_code_quality_unused_parameters = all +# Remove unnecessary equality operator -- This covers things like `x == true`, sometimes these clarify the intent of the code. +dotnet_diagnostic.IDE0100.severity = none + +#---------------------------------------------------------- +# Formatting rules +#---------------------------------------------------------- +# (These are mostly Visual Studio defaults, and are simply here to enforce consistency.) +dotnet_sort_system_directives_first = false +dotnet_separate_import_directive_groups = false + +# Newlines +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents_when_block = false + +# Spacing +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_parentheses = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_after_comma = true +csharp_space_before_comma = false +csharp_space_after_dot = false +csharp_space_before_dot = false +csharp_space_after_semicolon_in_for_statement = true +csharp_space_before_semicolon_in_for_statement = false +csharp_space_around_declaration_statements = false +csharp_space_before_open_square_brackets = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_square_brackets = false + +# Wrapping +csharp_preserve_single_line_statements = false +csharp_preserve_single_line_blocks = true + +#------------------------------------------------------------------------------ +# Naming Conventions +#------------------------------------------------------------------------------ +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules + +#---------------------------------------------------------- +# Interfaces +#---------------------------------------------------------- +dotnet_naming_style.interface_style.capitalization = pascal_case +dotnet_naming_style.interface_style.required_prefix = I + +dotnet_naming_symbols.interface_symbols.applicable_kinds = interface +dotnet_naming_symbols.interface_symbols.applicable_accessibilities = * + +dotnet_naming_rule.interface_rule.symbols = interface_symbols +dotnet_naming_rule.interface_rule.style = interface_style +dotnet_naming_rule.interface_rule.severity = suggestion + +#---------------------------------------------------------- +# Type Parameters +#---------------------------------------------------------- +dotnet_naming_style.type_parameter_style.capitalization = pascal_case +dotnet_naming_style.type_parameter_style.required_prefix = T + +dotnet_naming_symbols.type_parameter_symbols.applicable_kinds = type_parameter +dotnet_naming_symbols.type_parameter_symbols.applicable_accessibilities = * + +dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_symbols +dotnet_naming_rule.type_parameter_rule.style = type_parameter_style +dotnet_naming_rule.type_parameter_rule.severity = suggestion + +#---------------------------------------------------------- +# Async Methods +#---------------------------------------------------------- +dotnet_naming_style.async_method_style.capitalization = pascal_case +dotnet_naming_style.async_method_style.required_suffix = Async + +dotnet_naming_symbols.async_method_symbols.applicable_kinds = method, local_function +dotnet_naming_symbols.async_method_symbols.applicable_accessibilities = * +dotnet_naming_symbols.async_method_symbols.required_modifiers = async + +dotnet_naming_rule.async_method_rule.symbols = async_method_symbols +dotnet_naming_rule.async_method_rule.style = async_method_style +dotnet_naming_rule.async_method_rule.severity = suggestion + +#---------------------------------------------------------- +# General PascalCase Symbols +#---------------------------------------------------------- +dotnet_naming_style.pascal_style.capitalization = pascal_case + +dotnet_naming_symbols.pascal_symbols.applicable_kinds = namespace, class, struct, interface, enum, property, method, field, event, delegate, type_parameter, local_function +dotnet_naming_symbols.pascal_symbols.applicable_accessibilities = * + +dotnet_naming_rule.pascal_rule.symbols = pascal_symbols +dotnet_naming_rule.pascal_rule.style = pascal_style +dotnet_naming_rule.pascal_rule.severity = suggestion + +#---------------------------------------------------------- +# General camelCase Symbols +#---------------------------------------------------------- +dotnet_naming_style.camel_style.capitalization = camel_case + +dotnet_naming_symbols.camel_symbols.applicable_kinds = parameter, local +dotnet_naming_symbols.camel_symbols.applicable_accessibilities = * + +dotnet_naming_rule.camel_rule.symbols = camel_symbols +dotnet_naming_rule.camel_rule.style = camel_style +dotnet_naming_rule.camel_rule.severity = suggestion diff --git a/.github/workflows/ClangSharp.Pathogen.yml b/.github/workflows/ClangSharp.Pathogen.yml index fc4df2f..db10343 100644 --- a/.github/workflows/ClangSharp.Pathogen.yml +++ b/.github/workflows/ClangSharp.Pathogen.yml @@ -3,21 +3,21 @@ on: push: branches: ['*'] pull_request: + release: + types: [published] workflow_dispatch: inputs: + version: + description: "Version" + default: "" will_publish_packages: description: "Publish packages?" default: "false" - preview_release_version: - description: "Preview release version" - default: "" - do_full_release: - description: "Full release?" - default: "false" env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_GENERATE_ASPNET_CERTIFICATE: false + ContinuousIntegrationBuild: true jobs: build-llvm: strategy: @@ -168,20 +168,15 @@ jobs: run: python .github/workflows/configure-build.py env: github_event_name: ${{github.event_name}} - github_repository_owner: ${{github.repository_owner}} github_run_number: ${{github.run_number}} - github_ref: ${{github.ref}} - is_official_source: ${{secrets.is_official_source}} - input_will_publish_packages: ${{github.event.inputs.will_publish_packages}} - input_preview_release_version: ${{github.event.inputs.preview_release_version}} - input_do_full_release: ${{github.event.inputs.do_full_release}} + release_version: ${{github.event.release.tag_name}} + workflow_dispatch_version: ${{github.event.inputs.version}} # ----------------------------------------------------------------------- Build ClangSharp.Pathogen - name: Restore run: dotnet restore - name: Build - id: build run: dotnet build --no-restore - name: Pack @@ -191,13 +186,16 @@ jobs: # ----------------------------------------------------------------------- Collect Artifacts - name: Collect Build Outputs uses: actions/upload-artifact@v2 - # We always want to collect build outputs when they were produced - if: steps.build.outcome == 'success' && always() + # We always want to collect any build outputs that were created even if building failed + if: always() with: name: BuildOutputs + # The build* folders is fine here because LLVM was built in another job so these will just be the stuff required to build path: | - **/bin/** - **/obj/** + bin/** + obj/** + build*/** + !build-*.* - name: Collect NuGet Packages uses: actions/upload-artifact@v2 @@ -205,13 +203,80 @@ jobs: if: steps.pack.outcome == 'success' && always() with: name: Packages + if-no-files-found: error path: packages/** - publish-packages: - name: Publish ClangSharp.Pathogen + publish-packages-github: + name: Publish to GitHub + runs-on: ubuntu-latest + needs: build-dotnet + # Pushes to main always publish CI packages + # Published releases always publish packages + # A manual workflow only publishes patches if explicitly enabled + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.will_publish_packages == 'true') + steps: + # ----------------------------------------------------------------------- Setup .NET + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + # ----------------------------------------------------------------------- Download built packages + - name: Download built packages + uses: actions/download-artifact@v2 + with: + name: Packages + + # ----------------------------------------------------------------------- Upload release assets + - name: Upload release assets + if: github.event_name == 'release' + uses: actions/github-script@v4 + with: + user-agent: actions/github-script for ${{github.repository}} + script: | + const fs = require('fs').promises; + const path = require('path'); + const upload_url = context.payload.release.upload_url; + + if (!upload_url) { + throw "Missing release asset upload URL!"; + } + + for (let filePath of await fs.readdir('.')) { + const fileExtension = path.extname(filePath); + if (fileExtension != '.nupkg' && fileExtension != '.snupkg') { + continue; + } + + console.log(`Uploading '${filePath}'`); + const contentLength = (await fs.stat(filePath)).size; + const fileContents = await fs.readFile(filePath); + await github.repos.uploadReleaseAsset({ + url: upload_url, + headers: { + 'content-type': 'application/octet-stream', + 'content-length': contentLength + }, + name: path.basename(filePath), + data: fileContents + }); + } + + # ----------------------------------------------------------------------- Push to GitHub Packages + - name: Push to GitHub Packages + run: dotnet nuget push "*.nupkg" --skip-duplicate --no-symbols true --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}} + env: + # This is a workaround for https://github.com/NuGet/Home/issues/9775 + DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 + + publish-packages-nuget-org: + name: Publish to NuGet.org runs-on: ubuntu-latest needs: build-dotnet - if: needs.build-dotnet.outputs.publish-to-github == 'true' + environment: NuGet.org + # Release builds always publish packages to NuGet.org + # Workflow dispatch builds will only publish packages if enabled and an explicit version number is given + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.will_publish_packages == 'true' && github.event.inputs.version != '') steps: # ----------------------------------------------------------------------- Setup .NET - name: Setup .NET @@ -225,16 +290,16 @@ jobs: with: name: Packages - # ----------------------------------------------------------------------- Publish ClangSharp.Pathogen - - name: Push packages - run: dotnet nuget push "*.nupkg" --no-symbols true --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}} + # ----------------------------------------------------------------------- Push to NuGet.org + - name: Push to NuGet.org + run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{secrets.NUGET_API_URL}} env: # This is a workaround for https://github.com/NuGet/Home/issues/9775 DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 send-ci-failure-notification: name: Send CI Failure Notification - needs: [build-llvm, build-dotnet, publish-packages] + needs: [build-llvm, build-dotnet, publish-packages-github, publish-packages-nuget-org] if: failure() && github.event_name != 'pull_request' continue-on-error: true runs-on: ubuntu-latest diff --git a/.github/workflows/configure-build.md b/.github/workflows/configure-build.md deleted file mode 100644 index 651edc7..0000000 --- a/.github/workflows/configure-build.md +++ /dev/null @@ -1,37 +0,0 @@ -# ClangSharp.Pathogen CI Configuration Script - -This script is responsible for configuring the environment to build a specific configuration of ClangSharp.Pathogen and to push packages to NuGet (if applicable) - -## Inputs - -Inputs are provided via environment variables. All environment variables are expected to be present. - -Variable | Description ---------------------------------|-------------------------------------------------------------- -`github_event_name` | `github.event_name` -`github_repository_owner` | `github.repository_owner` -`github_run_number` | `github.run_number` -`github_ref` | `github.ref` -`is_official_source` | `secrets.is_official_source` -`input_will_publish_packages` | `github.event.inputs.will_publish_packages` -`input_preview_release_version` | `github.event.inputs.preview_release_version` -`input_do_full_release` | `github.event.inputs.do_full_release` - -## Outputs - -### MSBuild Properties - -The following environment variables will bet set for use by MSBuild (see `versioning.props` for details): - -Variable | Description ----------|------------ -`Configuration` | The project configuration that will be built. -`ContinuousIntegrationBuild` | `true` -`ContinuousIntegrationBuildKind` | The kind of build to be produced by this run. -`PreviewReleaseVersion` | The preview release version to use, if applicable. - -### GitHub Step Outputs - -Variable | Description ----------|------------ -`publish-to-github` | `true` if packages will be published. diff --git a/.github/workflows/configure-build.py b/.github/workflows/configure-build.py index 69a8a4a..f94ad1b 100644 --- a/.github/workflows/configure-build.py +++ b/.github/workflows/configure-build.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 -import hashlib import os import re -import sys import gha @@ -21,73 +19,41 @@ def get_environment_variable(name): return ret github_event_name = get_environment_variable('github_event_name') -github_repository_owner = get_environment_variable('github_repository_owner') github_run_number = get_environment_variable('github_run_number') -github_ref = get_environment_variable('github_ref') -# This is obtuse because you shouldn't be trying to set this for forks of this repository! -is_official_source = get_environment_variable('is_official_source') or '' -is_official_source_hash = hashlib.sha256(is_official_source.encode()).hexdigest() -is_official_source = is_official_source_hash == '2979f945cc91048fcc6a18abfb47b95727b32ca688371882f5b900f55f2bf87a' +#================================================================================================== +# Determine build settings +#================================================================================================== -will_publish_packages = False -is_preview_release = False -preview_release_version = f"invalid{github_run_number}" -is_full_release = False +version = f'0.0.0-ci{github_run_number}' +configuration = 'Debug' -if github_event_name == 'push': - # Publish packages if the push is to the main branch - will_publish_packages = github_ref == 'refs/heads/main' -elif github_event_name == 'pull_request': - # Never publish packages for pull requests - will_publish_packages = False +if github_event_name == 'release': + version = get_environment_variable('release_version') + configuration = 'Release' elif github_event_name == 'workflow_dispatch': - # Publish packages if enabled by the user - will_publish_packages = get_environment_variable('input_will_publish_packages') == 'true' - - preview_release_version = get_environment_variable('input_preview_release_version') - is_preview_release = preview_release_version != None + workflow_dispatch_version = get_environment_variable('workflow_dispatch_version') + if workflow_dispatch_version is not None: + version = workflow_dispatch_version + configuration = 'Release' - is_full_release = get_environment_variable('input_do_full_release') == 'true' +# Trim leading v off of version if present +if version.startswith('v'): + version = version[1:] - if is_preview_release and re.match('^[0-9a-zA-Z.-]+$', preview_release_version) is None: - gha.print_error(f"'{preview_release_version}' is not a valid preview release identifier.") - - if is_full_release and is_preview_release: - gha.print_error(f"A release cannot be both a full release and a preview release.") - - if is_full_release and not is_official_source: - gha.print_warning("Full release should probably not be created by third parties.") -else: - gha.print_warning(f"Unexpected GitHub event '{github_event_name}'") +# Validate the version number +if not re.match('^\d+\.\d+\.\d+(-[0-9a-zA-Z.-]+)?$', version): + gha.print_error(f"'{version}' is not a valid semver version!") # If there are any errors at this point, make sure we exit with an error code gha.fail_if_errors() #================================================================================================== -# Emit MSBuild Properties -#================================================================================================== -gha.set_environment_variable('ContinuousIntegrationBuild', 'true') - -if is_preview_release: - gha.set_environment_variable('Configuration', 'Release') - gha.set_environment_variable('ContinuousIntegrationBuildKind', 'PreviewRelease') - gha.set_environment_variable('PreviewReleaseVersion', preview_release_version) -elif is_full_release: - gha.set_environment_variable('Configuration', 'Release') - gha.set_environment_variable('ContinuousIntegrationBuildKind', 'FullRelease') -else: - gha.set_environment_variable('Configuration', 'Debug') - gha.set_environment_variable('ContinousIntegrationRunNumber', github_run_number) - -# If this build is happening outside of InfectedLibraries, add a fork name -if not is_official_source: - gha.set_environment_variable('ForkName', github_repository_owner) - -#================================================================================================== -# Emit step outputs +# Emit MSBuild properties #================================================================================================== -gha.set_output('publish-to-github', will_publish_packages) +print(f"Configuraing build environment to build {configuration.lower()} @ {version}") +gha.set_environment_variable('Configuration', configuration) +gha.set_environment_variable('CiBuildVersion', version) #================================================================================================== # Final check to exit with an error code if any errors were printed diff --git a/ClangSharp.Pathogen.Runtime/ClangSharp.Pathogen.Runtime.csproj b/ClangSharp.Pathogen.Runtime/ClangSharp.Pathogen.Runtime.csproj index 4b8f0c2..5954003 100644 --- a/ClangSharp.Pathogen.Runtime/ClangSharp.Pathogen.Runtime.csproj +++ b/ClangSharp.Pathogen.Runtime/ClangSharp.Pathogen.Runtime.csproj @@ -1,9 +1,6 @@  netstandard2.0 - x64 - x64 - win-x64 $(MSBuildThisFileDirectory)../build/bin/libclang.dll @@ -20,8 +17,6 @@ (Apache-2.0 WITH LLVM-exception) OR NCSA --> LICENSE.txt - 0.0.0 - true Runtime package for ClangSharp.Pathogen, not intended for direct consumption. LLVM Team and David Maas diff --git a/ClangSharp.Pathogen/ClangSharp.Pathogen.csproj b/ClangSharp.Pathogen/ClangSharp.Pathogen.csproj index 7ff5494..078316f 100644 --- a/ClangSharp.Pathogen/ClangSharp.Pathogen.csproj +++ b/ClangSharp.Pathogen/ClangSharp.Pathogen.csproj @@ -1,14 +1,14 @@  net5.0 - x64 - x64 - win-x64 MIT - 0.0.0 - C# bindings for libclang Pathogen Extensions and other utilities for working with ClangSharp. + + This package exists primarily to support Biohazrd and is not intended for direct consumption. + + C# bindings for libclang Pathogen Extensions and other utilities for working with ClangSharp. + David Maas and Contributors Copyright David Maas and Contributors true diff --git a/Directory.Build.props b/Directory.Build.props index aede803..c7b9048 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,30 +1,4 @@ - - - true - strict - - - true - https://github.com/InfectedLibraries - true - $(MSBuildThisFileDirectory)packages/ - - - $(NoWarn);NU5104 - - - snupkg - - - - - - - - - - + + + \ No newline at end of file diff --git a/Directory.Build.rsp b/Directory.Build.rsp new file mode 100644 index 0000000..17ab7c1 --- /dev/null +++ b/Directory.Build.rsp @@ -0,0 +1 @@ +# This file intentionally left blank. \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets index 9107d11..99800ae 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/create-llvm-vs-solution.cmd b/create-llvm-vs-solution.cmd index 28fb72b..de83fab 100644 --- a/create-llvm-vs-solution.cmd +++ b/create-llvm-vs-solution.cmd @@ -1 +1,5 @@ -@cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 -S external/llvm-project/llvm/ -B build-llvm-vs -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_PROJECTS=clang -DLLVM_INCLUDE_TESTS=off -DLLVM_INCLUDE_BENCHMARKS=off +@echo off +cmake -G "Visual Studio 16 2019" -A x64 -Thost=x64 -S external/llvm-project/llvm/ -B build-llvm-vs -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_PROJECTS=clang -DLLVM_INCLUDE_TESTS=off -DLLVM_INCLUDE_BENCHMARKS=off +echo ^^ > build-llvm-vs/Directory.Build.props +echo ^^ > build-llvm-vs/Directory.Build.targets +echo # > build-llvm-vs/Directory.Build.rsp diff --git a/tooling/Common.csproj.props b/tooling/Common.csproj.props new file mode 100644 index 0000000..662400a --- /dev/null +++ b/tooling/Common.csproj.props @@ -0,0 +1,32 @@ + + + + true + strict + 5.0 + + https://api.nuget.org/v3/index.json + + + true + https://github.com/InfectedLibraries + true + + + $(NoWarn);NU5104 + + + snupkg + + + true + + + + + + + \ No newline at end of file diff --git a/tooling/Common.csproj.targets b/tooling/Common.csproj.targets new file mode 100644 index 0000000..6ee8b4a --- /dev/null +++ b/tooling/Common.csproj.targets @@ -0,0 +1,22 @@ + + + + 0 + 0.0.0-dev$(DevVersion) + + + $(CiBuildVersion) + + + + + + + + + + + $(InformationalVersion) + + + \ No newline at end of file diff --git a/tooling/Common.props b/tooling/Common.props new file mode 100644 index 0000000..b13ce48 --- /dev/null +++ b/tooling/Common.props @@ -0,0 +1,31 @@ + + + + Debug + AnyCPU + + + + + + $(MSBuildProjectFile) + $(MSBuildProjectName) + $(MSBuildProjectName) + + <_ProjectTreeRoot>$(MSBuildThisFileDirectory)../ + + $(_ProjectTreeRoot)bin/$(Configuration)-$(Platform)/ + $(BaseOutputPath)$(ThisProjectOutputSubdirectory)/ + $(OutputPath) + + $(_ProjectTreeRoot)obj/$(ThisProjectOutputSubdirectory)/ + $(BaseIntermediateOutputPath)$(Configuration)-$(Platform)/ + + $(_ProjectTreeRoot)packages/ + + false + false + + \ No newline at end of file diff --git a/tooling/Common.targets b/tooling/Common.targets new file mode 100644 index 0000000..f2a3fe8 --- /dev/null +++ b/tooling/Common.targets @@ -0,0 +1,18 @@ + + + + <_RelativeProjectPathFilePath>$(BaseIntermediateOutputPath)RelativeProjectPath.txt + <_ProjectPathRelativeToIntermediateDirectory>$([MSBuild]::MakeRelative($(BaseIntermediateOutputPath), $(MSBuildProjectFullPath))) + + + + + + + + + + + + \ No newline at end of file diff --git a/tooling/Versioning.props b/tooling/Versioning.props deleted file mode 100644 index 7af1e40..0000000 --- a/tooling/Versioning.props +++ /dev/null @@ -1,106 +0,0 @@ - - - - - 0.0.0 - - - false - - - Development - CiBuild - PreviewRelease - FullRelease - - - <_ForkNameWithDot> - <_ForkNameWithDot Condition="'$(ForkName)' != ''">.$(ForkName) - - - - $(PreviewReleaseVersion)$(_ForkNameWithDot) - ci$(ContinousIntegrationRunNumber)$(_ForkNameWithDot) - - - - $(MSBuildProjectDirectory)/obj/DevelopmentVersionNumber - - - $([System.IO.File]::ReadAllText(`$(DevelopmentVersionCacheFilePath)`).Trim()) - - - true - $([MSBuild]::Divide($([System.DateTime]::UtcNow.Ticks), $([System.TimeSpan]::TicksPerSecond)).ToString(`X`)) - - - - - - dev$(DevelopmentVersionNumber)$(_ForkNameWithDot) - - - - - $(MSBuildThisFileDirectory)../external/llvm-project/Version.props - - - - - - diff --git a/tooling/Versioning.targets b/tooling/Versioning.targets deleted file mode 100644 index 0ee86cf..0000000 --- a/tooling/Versioning.targets +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - %(SourceRoot.RevisionId) - - - - - - - - - - - - - - - - - - - - <_LlvmVersionSuffix>LLVM-$(LlvmBaseVersion) - <_LlvmVersionSuffix Condition="'$(IncludeLlvmSourceRevisionInVersion)' == 'true'">$(_LlvmVersionSuffix).$(LlvmSourceRevision) - - $(Version)+$(SourceRevisionId).$(_LlvmVersionSuffix) - - - $(InformationalVersion).$(ForkName) - - - - - - - - - - - - - - - - - -