1#!/usr/local/bin/python3.8
2# -*- coding: utf-8 -*-
3
4# Copyright: (c) 2015, Peter Mounce <public@neverrunwithscissors.com>
5# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7DOCUMENTATION = r'''
8---
9module: win_dotnet_ngen
10short_description: Runs ngen to recompile DLLs after .NET  updates
11description:
12    - After .NET framework is installed/updated, Windows will probably want to recompile things to optimise for the host.
13    - This happens via scheduled task, usually at some inopportune time.
14    - This module allows you to run this task on your own schedule, so you incur the CPU hit at some more convenient and controlled time.
15    - U(https://docs.microsoft.com/en-us/dotnet/framework/tools/ngen-exe-native-image-generator#native-image-service)
16    - U(http://blogs.msdn.com/b/dotnet/archive/2013/08/06/wondering-why-mscorsvw-exe-has-high-cpu-usage-you-can-speed-it-up.aspx)
17options: {}
18notes:
19    - There are in fact two scheduled tasks for ngen but they have no triggers so aren't a problem.
20    - There's no way to test if they've been completed.
21    - The stdout is quite likely to be several megabytes.
22author:
23- Peter Mounce (@petemounce)
24'''
25
26EXAMPLES = r'''
27- name: Run ngen tasks
28  community.windows.win_dotnet_ngen:
29'''
30
31RETURN = r'''
32dotnet_ngen_update_exit_code:
33  description: The exit code after running the 32-bit ngen.exe update /force
34    command.
35  returned: 32-bit ngen executable exists
36  type: int
37  sample: 0
38dotnet_ngen_update_output:
39  description: The stdout after running the 32-bit ngen.exe update /force
40    command.
41  returned: 32-bit ngen executable exists
42  type: str
43  sample: sample output
44dotnet_ngen_eqi_exit_code:
45  description: The exit code after running the 32-bit ngen.exe
46    executeQueuedItems command.
47  returned: 32-bit ngen executable exists
48  type: int
49  sample: 0
50dotnet_ngen_eqi_output:
51  description: The stdout after running the 32-bit ngen.exe executeQueuedItems
52    command.
53  returned: 32-bit ngen executable exists
54  type: str
55  sample: sample output
56dotnet_ngen64_update_exit_code:
57  description: The exit code after running the 64-bit ngen.exe update /force
58    command.
59  returned: 64-bit ngen executable exists
60  type: int
61  sample: 0
62dotnet_ngen64_update_output:
63  description: The stdout after running the 64-bit ngen.exe update /force
64    command.
65  returned: 64-bit ngen executable exists
66  type: str
67  sample: sample output
68dotnet_ngen64_eqi_exit_code:
69  description: The exit code after running the 64-bit ngen.exe
70    executeQueuedItems command.
71  returned: 64-bit ngen executable exists
72  type: int
73  sample: 0
74dotnet_ngen64_eqi_output:
75  description: The stdout after running the 64-bit ngen.exe executeQueuedItems
76    command.
77  returned: 64-bit ngen executable exists
78  type: str
79  sample: sample output
80'''
81