Skip to content

Commit a212019

Browse files
authored
Adjust log output variable to point to log file (#284)
1 parent 4f33d38 commit a212019

File tree

9 files changed

+37
-28
lines changed

9 files changed

+37
-28
lines changed

Tasks/UnityActivateLicense/UnityActivateLicenseV1/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.4]
9+
10+
### Changed
11+
12+
- The output variable `editorLogFilePath` now points directly to the genereated lot file instead of the folder containing it. This is to avoid uploading log files from previous runs if there happen to be multiple log files in the log directory
13+
814
## [1.2.3]
915

1016
### Fixed

Tasks/UnityActivateLicense/UnityActivateLicenseV1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dinomite-studios/unity-activate-license-task",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "Azure Pipelines task to activate a Unity Pro license prior to building a project.",
55
"main": "unity-activate-license.js",
66
"scripts": {

Tasks/UnityActivateLicense/UnityActivateLicenseV1/post-unity-activate-license.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@dinomite-studios/unity-azure-pipelines-tasks-lib';
99
import {
1010
customUnityEditorsPathInputVariableName,
11-
tempDirectoryInputVariableName,
11+
editorLogFilePathOutputVariableName,
1212
passwordInputVariableName,
1313
unityEditorsPathModeInputVariableName,
1414
usernameInputVariableName,
@@ -49,12 +49,12 @@ function run() {
4949
unityVersion = getUnityEditorVersion();
5050
}
5151

52-
const unityExecutablePath = UnityPathTools.getUnityExecutableFullPath(unityEditorsPath, unityVersion.info!);
53-
const logFilesDirectory = path.join(tl.getVariable(tempDirectoryInputVariableName)!, 'Logs');
52+
// Set output variable values.
53+
const logFilesDirectory = path.join(tl.getVariable('Agent.TempDirectory')!, 'Logs');
5454
const logFilePath = path.join(logFilesDirectory, `UnityReturnLicenseLog_${Utilities.getLogFileNameTimeStamp()}.log`);
55+
tl.setVariable(editorLogFilePathOutputVariableName, logFilePath);
5556

56-
// Set output variable values.
57-
tl.setVariable('logsOutputPath', logFilesDirectory);
57+
const unityExecutablePath = UnityPathTools.getUnityExecutableFullPath(unityEditorsPath, unityVersion.info!);
5858

5959
// Execute Unity command line.
6060
if (deactivateSeatOnComplete) {

Tasks/UnityActivateLicense/UnityActivateLicenseV1/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"version": {
1414
"Major": 1,
1515
"Minor": 2,
16-
"Patch": 3
16+
"Patch": 4
1717
},
1818
"releaseNotes": "[Full Changelog](https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/blob/master/Tasks/UnityActivateLicense/UnityActivateLicenseV1/CHANGELOG.md)",
1919
"minimumAgentVersion": "2.144.0",
@@ -111,8 +111,8 @@
111111
],
112112
"outputVariables": [
113113
{
114-
"name": "logsOutputPath",
115-
"description": "Path to the Unity editor log files generated."
114+
"name": "editorLogFilePath",
115+
"description": "Specifies the location of the editor log file generated."
116116
}
117117
],
118118
"execution": {

Tasks/UnityActivateLicense/UnityActivateLicenseV1/unity-activate-license.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export const versionSelectionModeVariableName = "versionSelectionMode";
1515
export const versionInputVariableName = 'version';
1616
export const unityEditorsPathModeInputVariableName = 'unityEditorsLocation';
1717
export const customUnityEditorsPathInputVariableName = 'customUnityEditorsLocation';
18-
export const tempDirectoryInputVariableName = 'Agent.TempDirectory';
18+
19+
// Output variables.
20+
export const editorLogFilePathOutputVariableName = 'editorLogFilePath';
1921

2022
function run() {
2123
try {
@@ -47,12 +49,12 @@ function run() {
4749
unityVersion = getUnityEditorVersion();
4850
}
4951

50-
const unityExecutablePath = UnityPathTools.getUnityExecutableFullPath(unityEditorsPath, unityVersion.info!);
51-
const logFilesDirectory = path.join(tl.getVariable(tempDirectoryInputVariableName)!, 'Logs');
52+
// Set output variable values.
53+
const logFilesDirectory = path.join(tl.getVariable('Agent.TempDirectory')!, 'Logs');
5254
const logFilePath = path.join(logFilesDirectory, `UnityActivationLog_${Utilities.getLogFileNameTimeStamp()}.log`);
55+
tl.setVariable(editorLogFilePathOutputVariableName, logFilePath);
5356

54-
// Set output variable values.
55-
tl.setVariable('logsOutputPath', logFilesDirectory);
57+
const unityExecutablePath = UnityPathTools.getUnityExecutableFullPath(unityEditorsPath, unityVersion.info!);
5658

5759
// Execute Unity command line.
5860
const unityCmd = tl.tool(unityExecutablePath)

Tasks/UnityTest/UnityTestV1/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.5.3]
9+
10+
### Changed
11+
12+
- The output variable `editorLogFilePath` now points directly to the genereated lot file instead of the folder containing it. This is to avoid uploading log files from previous runs if there happen to be multiple log files in the log directory
13+
814
## [1.5.2]
915

1016
### Fixed

Tasks/UnityTest/UnityTestV1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dinomite-studios/unity-test-task",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "An Azure Pipelines task to test a Unity project and produce the results in NUnit compatible files.",
55
"main": "unity-test.js",
66
"scripts": {

Tasks/UnityTest/UnityTestV1/task.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"version": {
1313
"Major": 1,
1414
"Minor": 5,
15-
"Patch": 2
15+
"Patch": 3
1616
},
1717
"releaseNotes": "[Full Changelog](https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/blob/master/Tasks/UnityTest/UnityTestV1/CHANGELOG.md)",
1818
"minimumAgentVersion": "2.144.0",
@@ -150,8 +150,8 @@
150150
"description": "Path and FileName of the results in XML format. Path is relative to repository root."
151151
},
152152
{
153-
"name": "logsOutputPath",
154-
"description": "Path to the Unity editor log files generated."
153+
"name": "editorLogFilePath",
154+
"description": "Specifies the location of the editor log file generated."
155155
},
156156
{
157157
"name": "testsFailed",
@@ -176,4 +176,4 @@
176176
"successGetUnityEditorVersion": "Success, Unity editor version found",
177177
"failGetUnityEditorVersion": "Fail, Unity editor version not found"
178178
}
179-
}
179+
}

Tasks/UnityTest/UnityTestV1/unity-test.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const batchModeInputVariableName = 'batchMode';
2626
const acceptApiUpdateInputVariableName = 'acceptApiUpdate';
2727
const noPackageManagerInputVariableName = 'noPackageManager';
2828
const testResultsPathInputVariableName = 'testResultsPath';
29-
const tempDirectoryInputVariableName = 'Agent.TempDirectory';
3029
const cleanBuildInputVariableName = 'Build.Repository.Clean';
3130
const additionalCmdArgsInputVariableName = 'additionalCmdArgs';
3231

@@ -37,13 +36,10 @@ const testSuccessNoTestsFailed = 0;
3736
const testSuccessTestsFailed = 2;
3837

3938
// Output variables.
40-
const logsOutputPathOutputVariableName = 'logsOutputPath';
39+
const editorLogFilePathOutputVariableName = 'editorLogFilePath';
4140
const testResultsOutputPathAndFileNameOutputVariableName = 'testResultsOutputPathAndFileName';
4241
const testsFailedOutputVariableName = 'testsFailed';
4342

44-
/**
45-
* Main task runner. Executes the task and sets the result status for the task.
46-
*/
4743
async function run() {
4844
try {
4945
// Setup and read inputs.
@@ -65,15 +61,14 @@ async function run() {
6561
const acceptApiUpdate = tl.getBoolInput(acceptApiUpdateInputVariableName);
6662
const noPackageManager = tl.getBoolInput(noPackageManagerInputVariableName);
6763
const additionalCmdArgs = tl.getInput(additionalCmdArgsInputVariableName) ?? '';
68-
const repositoryLocalPath = tl.getVariable(tempDirectoryInputVariableName)!;
6964
const testResultsFileName = testMode === UnityTestMode.editMode ? editModeResultsFileName : playModeResultsFileName;
7065
const testResultsPathAndFileName = path.join(`${testResultsPath}`, `${testResultsFileName}`);
71-
const logFilesDirectory = path.join(repositoryLocalPath, 'Logs');
72-
const logFilePath = path.join(logFilesDirectory, `UnityTestLog_${Utilities.getLogFileNameTimeStamp()}.log`);
7366

7467
// Set output variable values.
75-
tl.setVariable(logsOutputPathOutputVariableName, logFilesDirectory);
7668
tl.setVariable(testResultsOutputPathAndFileNameOutputVariableName, testResultsPathAndFileName);
69+
const logFilesDirectory = path.join(tl.getVariable('Agent.TempDirectory')!, 'Logs');
70+
const logFilePath = path.join(logFilesDirectory, `UnityTestLog_${Utilities.getLogFileNameTimeStamp()}.log`);
71+
tl.setVariable(editorLogFilePathOutputVariableName, logFilePath);
7772

7873
// If clean was specified by the user, delete the existing test results, if any exist.
7974
if (cleanBuild === 'true') {

0 commit comments

Comments
 (0)