@@ -4,41 +4,57 @@ BuildParameters.Tasks.ObfuscateAssembliesTask = Task("Obfuscate-Assemblies")
4
4
{
5
5
if ( BuildParameters . GetFilesToObfuscate != null )
6
6
{
7
- foreach ( var file in BuildParameters . GetFilesToObfuscate ( ) )
7
+ var settings = new EazfuscatorNetSettings ( ) ;
8
+
9
+ if ( BuildParameters . ShouldStrongNameOutputAssemblies )
8
10
{
9
- var fileName = file . GetFilenameWithoutExtension ( ) ;
10
- var msbuildPathFilePath = new FilePath ( string . Format ( "{0}/{1}/{1}.csproj" , BuildParameters . SourceDirectoryPath . FullPath , fileName ) ) ;
11
+ settings . KeyFile = BuildParameters . StrongNameKeyPath ;
12
+ }
11
13
12
- var settings = new EazfuscatorNetSettings ( ) ;
14
+ var eazfuscatorToolLocation = Context . Tools . Resolve ( "Eazfuscator.NET.exe" ) ;
13
15
14
- if ( BuildParameters . ShouldStrongNameOutputAssemblies )
15
- {
16
- settings . KeyFile = BuildParameters . StrongNameKeyPath ;
17
- }
16
+ if ( eazfuscatorToolLocation == null )
17
+ {
18
+ Warning ( "Couldn't resolve EazFuscator.NET.Exe tool, so using value from ToolSettings: {0}" , ToolSettings . EazfuscatorToolLocation ) ;
19
+ Context . Tools . RegisterFile ( ToolSettings . EazfuscatorToolLocation ) ;
20
+ }
21
+ else
22
+ {
23
+ Information ( "Using EazFuscator from: {0}" , eazfuscatorToolLocation ) ;
24
+ }
25
+
26
+ if ( Context . Log . Verbosity == Verbosity . Verbose || Context . Log . Verbosity == Verbosity . Diagnostic )
27
+ {
28
+ settings . Statistics = true ;
29
+ }
18
30
19
- var eazfuscatorToolLocation = Context . Tools . Resolve ( "Eazfuscator.NET.exe" ) ;
31
+ if ( BuildParameters . IsDotNetBuild )
32
+ {
33
+ // Then run Eazfuscator once per file, since there is no ILMerge happening
34
+ Information ( "Running EazFuscator once for each file..." ) ;
20
35
21
- if ( eazfuscatorToolLocation == null )
36
+ foreach ( var file in BuildParameters . GetFilesToObfuscate ( ) )
22
37
{
23
- Warning ( "Couldn't resolve EazFuscator.NET.Exe tool, so using value from ToolSettings: {0}" , ToolSettings . EazfuscatorToolLocation ) ;
24
- Context . Tools . RegisterFile ( ToolSettings . EazfuscatorToolLocation ) ;
25
- }
26
- else
27
- {
28
- Information ( "Using EazFuscator from: {0}" , eazfuscatorToolLocation ) ;
29
- }
38
+ var fileName = file . GetFilenameWithoutExtension ( ) ;
39
+ var msbuildPathFilePath = new FilePath ( string . Format ( "{0}/{1}/{1}.csproj" , BuildParameters . SourceDirectoryPath . FullPath , fileName ) ) ;
30
40
31
- if ( FileExists ( msbuildPathFilePath ) )
32
- {
33
- settings . MSBuildProjectPath = msbuildPathFilePath ;
34
- }
41
+ if ( FileExists ( msbuildPathFilePath ) )
42
+ {
43
+ settings . MSBuildProjectPath = msbuildPathFilePath ;
44
+ }
35
45
36
- if ( Context . Log . Verbosity == Verbosity . Verbose || Context . Log . Verbosity == Verbosity . Diagnostic )
37
- {
38
- settings . Statistics = true ;
46
+ EazfuscatorNet ( file , settings ) ;
39
47
}
48
+ }
49
+ else
50
+ {
51
+ // Then run Eazfuscator once, for all files
52
+ // This is due to the fact we are ILmerge'ing at teh same time, and all assets need
53
+ // to be obfuscated, prior to teh merge happening. We could try and do this ourselves
54
+ // however, Eazfuscator already knows how to do it, so let it take care of it.
55
+ Information ( "Running EazFuscator once for all files..." ) ;
40
56
41
- EazfuscatorNet ( file , settings ) ;
57
+ EazfuscatorNet ( BuildParameters . GetFilesToObfuscate ( ) , settings ) ;
42
58
}
43
59
}
44
60
else
0 commit comments