Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit dfab6d4e authored by Michael KRISPER's avatar Michael KRISPER
Browse files

added project for adding licence headers to all cs files

parent 67dc1157
No related branches found
Tags milestones/1.1-beta4
No related merge requests found
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E8B0B447-1A54-4BEC-A160-AF0017000781}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LicenceHeader</RootNamespace>
<AssemblyName>LicenceHeader</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="header.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace LicenceHeader
{
/// <summary>
/// Updates/Adds the EUPL license header to every .cs file in the projects: VectoCore, VectoConsole, VectoCoreTest
/// </summary>
internal class Program
{
private const string SolutionRootDirectory = @"..\\..\\..";
private static readonly string[] ProjectDirectories = { "VectoCore", "VectoConsole", "VectoCoreTest" };
private static void Main()
{
var licence = File.ReadAllText("header.txt");
foreach (var dir in ProjectDirectories) {
foreach (
var file in Directory.GetFiles(Path.Combine(SolutionRootDirectory, dir), "*.cs", SearchOption.AllDirectories)) {
if (file.Contains("\\obj\\") || file.Contains("\\bin\\")) {
continue;
}
var re = new Regex("^.*?(?=using|namespace)");
var content = File.ReadAllText(file);
var updatedContent = re.Replace(content, licence);
if (updatedContent != content) {
File.WriteAllText(file, updatedContent);
}
Console.WriteLine(file);
}
}
}
}
}
\ No newline at end of file
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("LicenceHeader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LicenceHeader")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("90e6bcfe-f3da-4689-b4cd-b191771f1d1b")]
// 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")]
/*
* Copyright 2015 European Union
*
* Licensed under the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl5
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
......@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphDrawer", "GraphDrawer\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeclarationCycleZip", "DeclarationCycleZip\DeclarationCycleZip.csproj", "{2320CD6F-FE7B-4341-A9BB-3ABCA7EF18F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LicenceHeader", "LicenceHeader\LicenceHeader.csproj", "{E8B0B447-1A54-4BEC-A160-AF0017000781}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -93,6 +95,14 @@ Global
{2320CD6F-FE7B-4341-A9BB-3ABCA7EF18F6}.Release|Any CPU.Build.0 = Release|Any CPU
{2320CD6F-FE7B-4341-A9BB-3ABCA7EF18F6}.Release|x64.ActiveCfg = Release|Any CPU
{2320CD6F-FE7B-4341-A9BB-3ABCA7EF18F6}.Release|x86.ActiveCfg = Release|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Debug|x64.ActiveCfg = Debug|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Debug|x86.ActiveCfg = Debug|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Release|Any CPU.Build.0 = Release|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Release|x64.ActiveCfg = Release|Any CPU
{E8B0B447-1A54-4BEC-A160-AF0017000781}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment