Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Symmetry database is now shipped with nuget pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Eisele committed Oct 15, 2020
1 parent 78d46fb commit 20f6ca2
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 9 deletions.
14 changes: 14 additions & 0 deletions src/ModelBuilder/ICon.Framework.Symmetry/Mocassin.Symmetry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,22 @@
<ProjectReference Include="..\ICon.Framework.Shared\Mocassin.Framework.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Mocassin.Symmetry.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Target Name="NugetPackAutoVersioning" AfterTargets="Build" Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<Exec Command="dotnet pack -p:PackageVersion=$([System.DateTime]::Now.ToString(&quot;yyyy.MM.dd&quot;)) --no-build --configuration $(Configuration) --output &quot;$(SolutionDir)nuget" />
</Target>

<ItemGroup>
<Content Include="$(OutputPath)Data/Mocassin.Symmetry.db">
<Pack>true</Pack>
<PackagePath>contentFiles\any\any\Data</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Mocassin.Framework.SQLiteCore;
using System.IO;
using System.Reflection;
using Mocassin.Framework.SQLiteCore;

namespace Mocassin.Symmetry.SpaceGroups
{
Expand All @@ -8,12 +10,23 @@ namespace Mocassin.Symmetry.SpaceGroups
public class SpaceGroupContextSource : SqLiteContextSource<SpaceGroupContext>
{
/// <inheritdoc />
public override string DefaultFilepath { get; } = ".\\";
public override string DefaultFilepath { get; } = MakeDefaultFilepath();

/// <inheritdoc />
public SpaceGroupContextSource(string filepath)
: base(filepath)
{
}

/// <summary>
/// Creates the default filepath where to look for the symmetry database
/// </summary>
/// <returns></returns>
public static string MakeDefaultFilepath()
{
var assemblyDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location);
var filepath = assemblyDirectory + "/Data/Mocassin.Symmetry.db";
return filepath;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Runtime.Serialization;
using Mocassin.Symmetry.SpaceGroups;

namespace Mocassin.Model.ModelProject
{
Expand All @@ -13,7 +14,7 @@ public class MocassinSymmetrySettings
/// The full filepath to the space group database
/// </summary>
[DataMember]
public string SpaceGroupDbPath { get; set; } = ".\\Mocassin.Symmetry.db";
public string SpaceGroupDbPath { get; set; } = SpaceGroupContextSource.MakeDefaultFilepath();

/// <summary>
/// The tolerance value for equality comparisons of the vectors during wyckoff position extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>8</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!--<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>-->
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ICon.Framework.Mathematics\Mocassin.Mathematics.csproj" />
<ProjectReference Include="..\ICon.Framework.Shared\Mocassin.Framework.csproj" />
<ProjectReference Include="..\ICon.Framework.Symmetry\Mocassin.Symmetry.csproj" />
<ProjectReference Include="..\ICon.Model.Translator\Mocassin.Model.Translator.csproj" />
<ProjectReference Include="..\ICon.Model\Mocassin.Model.csproj" />
<ProjectReference Include="..\Mocassin.Tools.UAccess\Mocassin.Tools.UAccess.csproj" />
<ProjectReference Include="..\Mocassin.UI.Xml\Mocassin.UI.Data.csproj" />
<ProjectReference Include="..\ICon.Framework.Shared\Mocassin.Framework.csproj"/>
<ProjectReference Include="..\ICon.Framework.Symmetry\Mocassin.Symmetry.csproj"/>
<ProjectReference Include="..\ICon.Model.Translator\Mocassin.Model.Translator.csproj"/>
<ProjectReference Include="..\ICon.Model\Mocassin.Model.csproj"/>
<ProjectReference Include="..\Mocassin.Tools.UAccess\Mocassin.Tools.UAccess.csproj"/>
<ProjectReference Include="..\Mocassin.UI.Xml\Mocassin.UI.Data.csproj"/>
</ItemGroup>

<ItemGroup>
Expand All @@ -25,4 +26,57 @@
<Exec Command="dotnet pack -p:PackageVersion=$([System.DateTime]::Now.ToString(&quot;yyyy.MM.dd&quot;)) --no-build --configuration $(Configuration) --output &quot;$(SolutionDir)nuget" />
</Target>

<!--
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>
-->
<ItemGroup>
<!-- This is a workaround to ensure that the symmetry database is also copied to the output path if Mocassin.Symmetry is not added as a package reference -->
<Content Include="$(OutputPath)Data/Mocassin.Symmetry.db">
<Pack>true</Pack>
<PackagePath>contentFiles/any/any/Data</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<!--
<Content Include="$(OutputPath)Mocassin.Framework.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.Mathematics.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.Symmetry.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.Model.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.Model.Translator.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.Tools.UAccess.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
<Content Include="$(OutputPath)Mocassin.UI.Data.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
-->
</ItemGroup>

</Project>

0 comments on commit 20f6ca2

Please sign in to comment.