Skip to content
Snippets Groups Projects
Select Git revision
  • Topic/1125-apiTokens
  • master default protected
  • dev protected
  • Issue/3003-stsInstitute
  • gitkeep
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/2309-docs
  • Fix/xxxx-updateDependencies
  • Issue/2364-testingKpiParser
  • Issue/2287-guestRole
  • Test/xxxx-pipelineTriggers
  • Issue/2102-gitLabResTypeRCV
  • Issue/2278-gitlabToS
  • Issue/2101-gitLabResTypeUi
  • Issue/1788-extractionCronjob
  • Issue/2183-kpiGeneratorResource
  • Issue/2222-resourceDateCreated
  • Issue/2221-projectDateCreated
  • Issue/1321-pidEnquiryOverhaul
  • Issue/1999-gitlabResourcesLib
  • Issue/1951-quotaImplementation
  • v2.22.0
  • v2.20.0
  • v2.19.1
  • v2.19.0
  • v2.18.0
  • v2.17.0
  • v2.16.2
  • v2.16.1
  • v2.16.0
  • v2.15.0
  • v2.14.0
  • v2.13.0
  • v2.12.1
  • v2.12.0
  • v2.11.1
  • v2.11.0
  • v2.10.1
  • v2.10.0
  • v2.9.1
  • v2.9.0
41 results

build.cake

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    build.cake 10.50 KiB
    #tool nuget:?package=NUnit.ConsoleRunner&version=3.10.0
    #tool nuget:?package=vswhere&version=2.8.4
    #tool nuget:?package=GitVersion.CommandLine&version=5.1.3
    
    #addin nuget:https://api.nuget.org/v3/index.json?package=Cake.Json&version=4.0.0
    #addin nuget:https://api.nuget.org/v3/index.json?package=Newtonsoft.Json&version=11.0.2
    #addin nuget:https://api.nuget.org/v3/index.json?package=Cake.FileHelpers&version=3.2.1
    
    using System.Net;
    using System.Net.Http;
    
    // Commandline arguments
    var target = Argument("target", "Default");
    var configuration = Argument("configuration", "Release");
    var nugetApiKey = Argument<string>("nugetApiKey", null);
    var version = Argument("nugetVersion", "");
    var gitlabProjectPath = Argument("gitlabProjectPath", "");
    var gitlabProjectId = Argument("gitlabProjectId", "");
    var gitlabToken = Argument("gitlabToken", "");
    
    // Define directories
    var projects = GetFiles("./**/*.csproj");
    var artifactsDir = Directory("./Artifacts");
    string nupkgDir;
    var solutionFile = GetFiles("./**/*.sln").First();
    var projectName = solutionFile.GetFilenameWithoutExtension().ToString();
    var nugetSource = "https://api.nuget.org/v3/index.json";
    var assemblyInfoSubPath = "Properties/AssemblyInfo.cs";
    var semanticVersion = "";
    string localNugetFeed;
    
    // get latest MSBuild version
    var vsLatest  = VSWhereLatest();	
    var msBuildPathX64 = (vsLatest == null) ? null : vsLatest.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
    
    Setup(context =>{
    	nupkgDir = $"{artifactsDir.ToString()}/nupkg";
    	var branch = GitVersion(new GitVersionSettings {
    			UpdateAssemblyInfo = false
    		}).BranchName.Replace("/", "-");
    
    	localNugetFeed = $"C:\\coscine\\LocalNugetFeeds\\{branch}";
    	Information("{0}", branch);
    	Information("Started at {0}", DateTime.Now);
    });
    
    Teardown(context =>{
    	Information("Finished at {0}", DateTime.Now);
    });
    
    Task("Clean")
    .Description("Cleans all build and artifacts directories")
    .Does(() =>{
    	var settings = new DeleteDirectorySettings {
    		Recursive = true,
    		Force = true
    	};
    	
    	var directoriesToClean = new List<DirectoryPath>();
    	
    	foreach(var project in projects) {
    		directoriesToClean.Add(Directory($"{project.GetDirectory()}/obj"));
    		directoriesToClean.Add(Directory($"{project.GetDirectory()}/bin"));
    	}
    	
    	directoriesToClean.Add(artifactsDir);
    
    	foreach(var dir in directoriesToClean) {
    		Information("Cleaning {0}", dir.ToString());
    		if (DirectoryExists(dir)) {