forked from Sitefinity/Telerik.Sitefinity.Samples.Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenAccessNuGet.targets
158 lines (140 loc) · 9.35 KB
/
OpenAccessNuGet.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!--
*************************************************************************************************
This file is added by the Telerik.DataAccess.Fluent NuGet package.
Telerik Data Access uses post compile steps achieved by build extensions providing the change
tracking and lazy loading runtime functionalities. Using this approach less code is written, the
domain model is cleaner and the data access classes are more simple reducing the development and
testing time.
For detailed information about the file, the used project settings, how their default values are
chosen, when they need to be customized and where is the proper place for this customization,
please visit the following documentation section:
http://documentation.telerik.com/openaccess-orm/targets-files
Copyright (C) 2007-2015 Telerik AD. All rights reserved.
*************************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Default values of the Project Settings used in the enhancement process -->
<PropertyGroup>
<UseXmlMapping Condition="'$(UseXmlMapping)'==''">false</UseXmlMapping>
<UseAttributeMapping Condition="'$(UseAttributeMapping)'==''">false</UseAttributeMapping>
<UseFluentMapping Condition="'$(UseFluentMapping)'==''">true</UseFluentMapping>
<EnhancerAssembly Condition="'$(EnhancerAssembly)'==''">enhancer.exe</EnhancerAssembly>
<EnhancerVerboseMode Condition="'$(EnhancerVerboseMode)'==''">3</EnhancerVerboseMode>
<Use64BitEnhancer Condition="'$(Use64BitEnhancer)'=='' And '$(PlatformTarget)'=='x64'">true</Use64BitEnhancer>
<ValidateMapping Condition="'$(ValidateMapping)'==''">false</ValidateMapping>
<EnhancerDoNotCheckVersionOfReferencedAssemblies Condition="'$(EnhancerDoNotCheckVersionOfReferencedAssemblies)'==''">false</EnhancerDoNotCheckVersionOfReferencedAssemblies>
</PropertyGroup>
<!-- Register the enhancement tasks from the enhancer assembly -->
<UsingTask TaskName="OpenAccessDeploy" AssemblyFile="$(EnhancerAssembly)" Condition="'$(UseXmlMapping)'=='true'"/>
<UsingTask TaskName="OpenAccessClean" AssemblyFile="$(EnhancerAssembly)" Condition="Exists('$(EnhancerAssembly)')" />
<UsingTask TaskName="OpenAccessEnhancer" AssemblyFile="$(EnhancerAssembly)" Condition="'$(Use64BitEnhancer)'!='true'"/>
<UsingTask TaskName="OpenAccessValidateMapping" AssemblyFile="$(EnhancerAssembly)" Condition="'$(ValidateMapping)'=='true'"/>
<ItemGroup>
<!-- Include a flag for checking if enhancement is needed -->
<EnhancementFlagFile Include="$(IntermediateOutputPath)$(TargetName).oa" />
</ItemGroup>
<ItemGroup Condition="'$(UseXmlMapping)'=='true'">
<!-- Ensure "OpenAccessDeploy" is available in the Visual Studio Build Action dropdown -->
<AvailableItemName Include="OpenAccessDeploy" />
</ItemGroup>
<!-- Include the OpenAccess ORM tasks in the build process -->
<PropertyGroup>
<OpenAccessDeployDependsOn>
OpenAccessEnhancerCheck;
</OpenAccessDeployDependsOn>
<BuildDependsOn Condition="'$(UseXmlMapping)'=='true'">
OpenAccessDeploy;
$(BuildDependsOn)
</BuildDependsOn>
<OpenAccessCleanDependsOn>
OpenAccessEnhancerCheck;
</OpenAccessCleanDependsOn>
<CleanDependsOn>
$(CleanDependsOn);
DeleteEnhancementFlag;
</CleanDependsOn>
<CleanDependsOn Condition="Exists('$(EnhancerAssembly)')">
$(CleanDependsOn);
OpenAccessClean;
</CleanDependsOn>
<OpenAccessEnhancerDependsOn>
OpenAccessEnhancerCheck;
</OpenAccessEnhancerDependsOn>
<CompileDependsOn>
$(CompileDependsOn);
OpenAccessEnhancer;
</CompileDependsOn>
<OpenAccessValidateMappingDependsOn>
ValidateMappingCheck;
</OpenAccessValidateMappingDependsOn>
<CompileDependsOn Condition="'$(ValidateMapping)'=='true'">
$(CompileDependsOn);
OpenAccessValidateMapping;
</CompileDependsOn>
</PropertyGroup>
<!-- The OpenAccessDeploy task prepares the RLINQ files (if any) from the current project for the enhancement process -->
<Target Name="OpenAccessDeploy" DependsOnTargets="$(OpenAccessDeployDependsOn)">
<OpenAccessDeploy Sources="@(OpenAccessDeploy)" OutputPath="$(OutputPath)">
<Output TaskParameter="OpenAccessEmbeddedResources" ItemName="OpenAccessEmbeddedResource" />
<Output TaskParameter="OpenAccessEmbeddedResources" ItemName="EmbeddedResource" />
</OpenAccessDeploy>
</Target>
<!-- The command line arguments of the enhancer.exe used for enhancing 64 bit assemblies -->
<PropertyGroup Condition="'$(Use64BitEnhancer)'=='true'">
<XmlMappingResourcesArg Condition="'$(UseXmlMapping)'=='true'"> -xmlMapping:"@(OpenAccessEmbeddedResource,'" -xmlMapping:"')"</XmlMappingResourcesArg>
<AttributesMappingArg Condition="'$(UseAttributeMapping)'=='true'"> -attributeMapping</AttributesMappingArg>
<FluentMappingArg Condition="'$(UseFluentMapping)'=='true'"> -fluentMapping</FluentMappingArg>
<EnhancerMappingArgs Condition="'$(EnhancerMappingArgs)'==''">$(XmlMappingResourcesArg)$(AttributesMappingArg)$(FluentMappingArg)</EnhancerMappingArgs>
<KeyFileArg Condition="'$(AssemblyOriginatorKeyFile)'!=''"> -keyFile:"$(AssemblyOriginatorKeyFile)"</KeyFileArg>
<KeyContainerArg Condition="'$(KeyContainerName)'!=''"> -keyContainer:"$(KeyContainerName)"</KeyContainerArg>
<ReferencesArgs Condition="'$(ReferencesArgs)'==''"> -reference:"@(ReferencePath,'" -reference:"')"</ReferencesArgs>
<DoNotCheckVersionOfReferencedAssembliesArgs Condition="'$(EnhancerDoNotCheckVersionOfReferencedAssembliesArgs)'=='true'"> -DoNotCheckVersionOfReferencedAssembliesArgs+</DoNotCheckVersionOfReferencedAssembliesArgs>
<AdditionalEnhancerArgs Condition="'$(AdditionalEnhancerArgs)'==''">$(EnhancerMappingArgs)$(KeyFileArg)$(KeyContainerArg)$(ReferencesArgs)$(DoNotCheckVersionOfReferencedAssembliesArgs)</AdditionalEnhancerArgs>
</PropertyGroup>
<!-- The OpenAccessEnhancer task enhances the project assembly with the OpenAccess ORM specific code -->
<Target Name="OpenAccessEnhancer" DependsOnTargets="$(OpenAccessEnhancerDependsOn)" Inputs="@(IntermediateAssembly->'%(FullPath)')" Outputs="@(EnhancementFlagFile)">
<Exec Condition="'$(Use64BitEnhancer)'=='true'" IgnoreExitCode="false"
Command=""$(EnhancerAssembly)" -verboseMode:$(EnhancerVerboseMode) -assembly:"@(IntermediateAssembly->'%(FullPath)')"$(AdditionalEnhancerArgs)" />
<OpenAccessEnhancer Condition="'$(Use64BitEnhancer)'!='true'"
VerboseMode="$(EnhancerVerboseMode)"
Assembly="@(IntermediateAssembly->'%(FullPath)')"
XmlMapping="@(OpenAccessEmbeddedResource)"
AttributeMapping="$(UseAttributeMapping)"
FluentMapping="$(UseFluentMapping)"
KeyFile="$(AssemblyOriginatorKeyFile)"
KeyContainer="$(KeyContainerName)"
References="@(ReferencePath)"
TargetFramework="$(TargetFrameworkVersion)"
DoNotCheckVersionOfReferencedAssemblies="$(EnhancerDoNotCheckVersionOfReferencedAssemblies)">
<Output TaskParameter="Version" ItemName="EnhancerVersion" />
</OpenAccessEnhancer>
<Touch AlwaysCreate="true" Files="@(EnhancementFlagFile)" Time="%(IntermediateAssembly.ModifiedTime)" />
<Message Text="The project was successfully enhanced by Telerik OpenAccess ORM Enhancer @(EnhancerVersion)" />
</Target>
<!-- The OpenAccessClean task deletes OpenAccess related files if any -->
<Target Name="OpenAccessClean" DependsOnTargets="$(OpenAccessCleanDependsOn)">
<OpenAccessClean Sources="@(OpenAccessDeploy)" OutputPath="$(OutputPath)" />
</Target>
<!-- Deletes the enhancement flag file if exists -->
<Target Name="DeleteEnhancementFlag">
<Delete Condition="Exists(@(EnhancementFlagFile))" Files="@(EnhancementFlagFile)" />
</Target>
<!-- The OpenAccessValidateMapping task executes a compile time validation of the mapping of your model -->
<Target Name="OpenAccessValidateMapping" DependsOnTargets="$(OpenAccessValidateMappingDependsOn)">
<OpenAccessValidateMapping
Assembly="@(IntermediateAssembly->'%(FullPath)')"
References="@(ReferencePath)"/>
</Target>
<!-- Check if the OpenAccessValidateMapping task can be executed. -->
<Target Name="ValidateMappingCheck">
<Message Text="Validating if the OpenAccessValidateMapping task can be executed." Importance="normal" />
<Error Text="The OpenAccessValidateMapping task cannot be executed because the OpenAccess ORM model is in 64 bit assembly. Please change the platform target of the assembly or disable the ValidateMapping property located top in your '$(MSBuildProjectFullPath)' project file and restart Visual Studio."
Condition="'$(ValidateMapping)'=='true' And '$(Use64BitEnhancer)'=='true'" />
</Target>
<!-- Check if the OpenAccess ORM enhancer assembly can be found at the specified location -->
<Target Name="OpenAccessEnhancerCheck">
<Message Text="Validating the existence of the OpenAccess ORM enhancer assembly." Importance="normal" />
<Error Text="OpenAccessNuget.targets file points to a wrong enhancer location ($(EnhancerAssembly)). Please set a proper value of the 'EnhancerAssembly' property located top in your '$(MSBuildProjectFullPath)' project file and restart Visual Studio."
Condition="!Exists('$(EnhancerAssembly)') AND !Exists('$(MSBuildThisFileDirectory)\$(EnhancerAssembly)') AND '$(MSBuildThisFileDirectory)' != ''" />
</Target>
</Project>