Updated csproj and CI

This commit is contained in:
amevarashi 2024-05-22 22:22:15 +05:00
parent a3055eb6ec
commit d1603e0e4b
3 changed files with 68 additions and 84 deletions

View file

@ -1,44 +1,20 @@
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET-Core.gitlab-ci.yml
# ### Specify the Docker image
image: mcr.microsoft.com/dotnet/sdk:latest
image: mcr.microsoft.com/dotnet/sdk:8.0-alpine
# ### Define variables
#
variables:
# 1) Name of directory where restore and build objects are stored.
OBJECTS_DIRECTORY: 'IdeologyAddon/obj'
# 2) Name of directory used for keeping restored dependencies.
NUGET_PACKAGES_DIRECTORY: '.nuget'
# 3) A relative path to the source code from project repository root.
# NOTE: Please edit this path so it matches the structure of your project!
SOURCE_CODE_PATH: 'Source/'
# ### Define global cache rule
#
# Before building the project, all dependencies (e.g. third-party NuGet packages)
# must be restored. Jobs on GitLab.com's Shared Runners are executed on autoscaled machines.
#
# Each machine is used only once (for security reasons) and after that is removed.
# This means that, before every job, a dependency restore must be performed
# because restored dependencies are removed along with machines. Fortunately,
# GitLab provides cache mechanism with the aim of keeping restored dependencies
# for other jobs.
#
# This example shows how to configure cache to pass over restored
# dependencies for re-use.
#
# With global cache rule, cached dependencies will be downloaded before every job
# and then unpacked to the paths as specified below.
cache:
# Per-stage and per-branch caching.
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
paths:
# Specify three paths that should be cached:
#
# 1) Main JSON file holding information about package dependency tree, packages versions,
# frameworks etc. It also holds information where to the dependencies were restored.
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
@ -46,18 +22,7 @@ cache:
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
# 3) Path to the directory where restored dependencies are kept.
- '$NUGET_PACKAGES_DIRECTORY'
#
# 'pull-push' policy means that latest cache will be downloaded (if it exists)
# before executing the job, and a newer version will be uploaded afterwards.
# Such a setting saves time when there are no changes in referenced third-party
# packages.
#
# For example, if you run a pipeline with changes in your code,
# but with no changes within third-party packages which your project is using,
# then project restore will happen quickly as all required dependencies
# will already be there — unzipped from cache.
# 'pull-push' policy is the default cache policy, you do not have to specify it explicitly.
policy: pull-push
# ### Restore project dependencies
@ -76,13 +41,15 @@ cache:
build:
stage: build
rules:
- if: $CI_COMMIT_BRANCH != "master"
# ### Build all projects discovered from solution file.
script:
- 'mv -f About/RealAbout.xml About/About.xml'
- 'cd $SOURCE_CODE_PATH'
- 'dotnet restore --packages ../$NUGET_PACKAGES_DIRECTORY'
- 'curl -s --create-dirs "$RJW_DLL_URL" -o ../../rjw/1.5/Assemblies/RJW.dll'
- 'dotnet build --no-restore'
- 'dotnet build -c Release --no-restore'
- 'cd $CI_PROJECT_DIR/About'
- 'mv -f RealAbout.xml About.xml'
artifacts:
untracked: false
when: on_success
@ -94,16 +61,8 @@ build:
- ".*/**/*" # Exclude everything in the dot folders
- "Source/**/*" # Exclude everything in the Source folder
#tests:
# stage: test
# ### Run the tests
# script:
# - 'dotnet test --no-restore'
release_dev:
stage: deploy
# image: registry.gitlab.com/gitlab-org/release-cli:latest # this image currently is amd64 only
image: alpine:latest
rules:
- if: $CI_COMMIT_TAG
when: never # Do not run this job when a tag is created manually
@ -112,14 +71,7 @@ release_dev:
GIT_STRATEGY: none # Do not clone repo and skip 'before_script'
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/rsi/test"
script:
# - 'apk add gitlab-release-cli'
- apk add zip curl
- 'zip -rq rsi.zip ./'
- apk add zip
- zip -rq mod.zip ./
- echo "${PACKAGE_REGISTRY_URL}"
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file rsi.zip "${PACKAGE_REGISTRY_URL}/rjw_sexperience_ideology.zip"
# release:
# tag_name: '$CI_COMMIT_BRANCH-$CI_PIPELINE_IID' # The version is incremented per pipeline.
# description: 'Automated release based on commit $CI_COMMIT_SHORT_SHA $CI_COMMIT_TAG'
# ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA.
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file mod.zip "${PACKAGE_REGISTRY_URL}/rjw_sexperience_ideology.zip"'

View file

@ -1,29 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<TargetGameVersion>1.5</TargetGameVersion>
<InternalModVersion>1.0</InternalModVersion>
<Version>$(TargetGameVersion).$(InternalModVersion)</Version>
<ProjectGuid>{B4481C38-31B1-422D-B5AA-0059FE7CCA1C}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>RJWSexperience.Ideology</RootNamespace>
<AssemblyName>RJWSexperience.Ideology</AssemblyName>
<TargetFramework>net48</TargetFramework>
<Optimize>true</Optimize>
<OutputPath>..\..\1.5\Assemblies\</OutputPath>
<OutputPath>..\..\$(TargetGameVersion)\Assemblies\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Deterministic>false</Deterministic>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="RJW">
<HintPath>..\..\..\rjw\1.5\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.5.*</Version>
<Version>$(TargetGameVersion).*</Version>
</PackageReference>
<PackageReference Include="Lib.Harmony">
<Version>2.*</Version>
@ -31,4 +29,41 @@
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Choose>
<When Condition=" '$(Configuration)' == 'Release' ">
<ItemGroup>
<Reference Include="RJW">
<HintPath>obj\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<PropertyGroup>
<RjwUrl>https://gitgud.io/Ed86/rjw/-/raw/master/$(TargetGameVersion)/Assemblies/RJW.dll</RjwUrl>
</PropertyGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="RJW">
<HintPath>..\..\..\rjw\$(TargetGameVersion)\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<Target Name="DownloadRJW" BeforeTargets="BeforeBuild" Condition=" '$(Configuration)' == 'Release' ">
<DownloadFile
SourceUrl="$(RjwUrl)"
DestinationFolder="obj"
DestinationFileName="RJW.dll">
</DownloadFile>
</Target>
<Target Name="PostBuildAction" AfterTargets="Build">
<XmlPoke XmlInputPath="..\..\About\RealAbout.xml" Query="//ModMetaData/modVersion" Value="$(Version)" />
<XmlPoke XmlInputPath="..\..\About\Manifest.xml" Query="//Manifest/version" Value="$(Version)" />
</Target>
</Project>

View file

@ -1,10 +1,9 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("IdeologyAddon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -14,23 +13,21 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("b4481c38-31b1-422d-b5aa-0059fe7cca1c")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
// Version information for an assembly consists of the following four values:
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// Major Version
// Minor Version
// Build Number
// Revision
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.5.*")]