Skip to content

Commit 7463162

Browse files
committed
Merge branch 'hotfix/0.13.2'
* hotfix/0.13.2: (#64) Allow different usage of EazFusactor
2 parents 22c2fb1 + d64264d commit 7463162

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

Chocolatey.Cake.Recipe/Content/eazfuscator.cake

+41-25
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,57 @@ BuildParameters.Tasks.ObfuscateAssembliesTask = Task("Obfuscate-Assemblies")
44
{
55
if (BuildParameters.GetFilesToObfuscate != null)
66
{
7-
foreach (var file in BuildParameters.GetFilesToObfuscate())
7+
var settings = new EazfuscatorNetSettings();
8+
9+
if (BuildParameters.ShouldStrongNameOutputAssemblies)
810
{
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+
}
1113

12-
var settings = new EazfuscatorNetSettings();
14+
var eazfuscatorToolLocation = Context.Tools.Resolve("Eazfuscator.NET.exe");
1315

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+
}
1830

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...");
2035

21-
if (eazfuscatorToolLocation == null)
36+
foreach (var file in BuildParameters.GetFilesToObfuscate())
2237
{
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));
3040

31-
if (FileExists(msbuildPathFilePath))
32-
{
33-
settings.MSBuildProjectPath = msbuildPathFilePath;
34-
}
41+
if (FileExists(msbuildPathFilePath))
42+
{
43+
settings.MSBuildProjectPath = msbuildPathFilePath;
44+
}
3545

36-
if (Context.Log.Verbosity == Verbosity.Verbose || Context.Log.Verbosity == Verbosity.Diagnostic)
37-
{
38-
settings.Statistics = true;
46+
EazfuscatorNet(file, settings);
3947
}
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...");
4056

41-
EazfuscatorNet(file, settings);
57+
EazfuscatorNet(BuildParameters.GetFilesToObfuscate(), settings);
4258
}
4359
}
4460
else

0 commit comments

Comments
 (0)