Skip to content

Commit

Permalink
CHANGE: Move Unity min version up to 2019.4 LTS (Unity-Technologies#1168
Browse files Browse the repository at this point in the history
).
  • Loading branch information
Rene Damm authored Jun 17, 2020
1 parent 58a0e00 commit a8aee86
Show file tree
Hide file tree
Showing 45 changed files with 4,819 additions and 127 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ Temp/
*.DotSettings
*.userprefs
.idea/
upm-ci~/
obj/
.DS_Store
docerrors.log

Assets/**/*.api
Assets/**/*.api.meta

Packages/com.unity.inputsystem/artifacts/**
Packages/com.unity.inputsystem/build/**
Packages/com.unity.inputsystem/Documentation~/ApiDocs/**
Packages/com.unity.inputsystem/.DS_Store
Packages/com.unity.inputsystem/.npmrc
Packages/com.unity.inputsystem/**/*.api
Packages/com.unity.inputsystem/**/*.api.meta

Packages/com.unity.package-manager-ui/
Packages/com.unity.package-manager-doctools/

.Editor
.bin
.download
10 changes: 6 additions & 4 deletions .yamato/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ code_analyser:
- unzip Tools/CodeAnalyzerTestProject/Microsoft.CodeQuality.Analyzers/Microsoft.CodeQuality.Analyzers.zip -d Tools/CodeAnalyzerTestProject/Microsoft.CodeQuality.Analyzers
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
- upm-ci project test --project-path Tools/CodeAnalyzerTestProject -u 2019.1
- upm-ci project test --project-path Tools/CodeAnalyzerTestProject -u 2019.4
triggers:
branches:
only:
- "/.*/"
cancel_old_ci: true
pull_requests:
- targets:
only:
- "develop"
artifacts:
UTR_Output.zip:
paths:
Expand Down
3 changes: 2 additions & 1 deletion .yamato/config.metadata
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
editors:
- version: 2019.1
- version: 2019.4
- version: 2020.1
- version: trunk
platforms:
- name: win
type: Unity::VM
Expand Down
8 changes: 5 additions & 3 deletions .yamato/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ check_formatting:
- hg clone -b stable http://hg-mirror-slo.hq.unity3d.com/unity-extra/unity-meta
- perl unity-meta/Tools/Format/format.pl Assets Packages --dry-run
triggers:
branches:
only:
- "/.*/"
cancel_old_ci: true
pull_requests:
- targets:
only:
- "develop"
4 changes: 0 additions & 4 deletions .yamato/promotion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ promote:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
- upm-ci package promote --package-path ./Packages/com.unity.inputsystem/
triggers:
tags:
only:
- /^(r|R)elease-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/
artifacts:
artifacts:
paths:
Expand Down
2 changes: 1 addition & 1 deletion .yamato/publish-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test_sample_projects:
commands:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u 2019.1
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u 2019.4
- Editor=.Editor/Unity.app/Contents/MacOS/Unity Method=Publish sh ExternalSampleProjects/publish.sh
artifacts:
UTR_Output.zip:
Expand Down
8 changes: 5 additions & 3 deletions .yamato/test-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ test_sample_projects_{{ editor.version }}:
- upm-ci package test --package-path ./Packages/com.unity.inputsystem/ -u {{ editor.version }}
- Editor=.Editor/Unity.app/Contents/MacOS/Unity Method=DryRun sh ExternalSampleProjects/publish.sh
triggers:
branches:
only:
- "/.*/"
cancel_old_ci: true
pull_requests:
- targets:
only:
- "develop"
artifacts:
UTR_Output.zip:
paths:
Expand Down
15 changes: 6 additions & 9 deletions .yamato/upm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
- {{ platform.installscript }} {{ editor.version }}
{% endif %}
- upm-ci~/tools/utr/utr --testproject . --editor-location=.Editor --artifacts_path=upm-ci~/test-results/isolation-com.unity.inputsystem.tests --suite=playmode --api-profile=NET_4_6 --stdout-filter=minimal {% if platform.runtime %} --platform {{ platform.runtime }} {% endif %} {% if platform.scripting-backend %} --scripting-backend {{ platform.scripting-backend }} {% endif %}
triggers:
cancel_old_ci: true
branches:
only:
- "/.*/"
artifacts:
UTR_Output.zip:
paths:
Expand All @@ -39,6 +34,12 @@ all_tests:
- .yamato/upm-ci.yml#{{ platform.name }}_{{ editor.version }}
{% endfor %}
{% endfor %}
triggers:
cancel_old_ci: true
pull_requests:
- targets:
only:
- "develop"

publish:
name: Publish to Internal Registry
Expand All @@ -52,10 +53,6 @@ publish:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package pack --package-path ./Packages/com.unity.inputsystem/
- upm-ci package publish --package-path ./Packages/com.unity.inputsystem/
triggers:
tags:
only:
- /^(r|R)(c|C)-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/
artifacts:
artifacts:
paths:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.0.0.0
// version 1.1.0
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/SimpleDemo/SimpleControls.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.0.0.0
// version 1.1.0
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
191 changes: 191 additions & 0 deletions Assets/Tests/InputSystem/APIVerificationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using UnityEngine;
using Object = System.Object;
using TypeAttributes = Mono.Cecil.TypeAttributes;
using PropertyAttribute = NUnit.Framework.PropertyAttribute;

class APIVerificationTests
{
Expand Down Expand Up @@ -575,6 +576,196 @@ public void API_MonoBehavioursHaveHelpUrls()
Assert.That(brokenHelpUrls, Is.Empty);
}

private const string kAPIDirectory = "Tools/API";

////FIXME: The .api-based checks are temporary and don't account for platform-specific APIs. Nuke these tests as soon
//// as we can switch back to API validation performed by the Package Validation Suite (as soon as Adriano's fix
//// for the access modifier false positive has landed).

// The .api files are platform-specific so we can only compare on the platform
// they were built on.
#if UNITY_EDITOR_WIN

// We disable "API Verification" tests running as part of the validation suite as they give us
// false positives (specifically, for setters having changes accessibility from private to protected).
// Instead, we run our own check here which, instead of comparing to the previous artifact on the
// package repo (like the validation suite does), we keep a checked-in XML file with the public API
// that we compare against. This also makes it much easier to run this test locally (rather than
// having to install and run the package validation suite manually).
[Test]
[Category("API")]
// This is our whitelist for changes to existing APIs that we are fine with. Each exclusion
// starts with the version number of the API that was changed and then each line lists the API
// that is whitelisted for a change.
//
// NOTE: ATM we do not actually check for the right context of these definitions.
//
// The following properties have setters that changed from being private to being protected.
// This is not a breaking change as no existing code will fail to compile.
[Property("Exclusions", @"1.0.0
public UnityEngine.InputSystem.Controls.ButtonControl buttonEast { get; }
public UnityEngine.InputSystem.Controls.ButtonControl buttonNorth { get; }
public UnityEngine.InputSystem.Controls.ButtonControl buttonSouth { get; }
public UnityEngine.InputSystem.Controls.ButtonControl buttonWest { get; }
public UnityEngine.InputSystem.Controls.DpadControl dpad { get; }
public UnityEngine.InputSystem.Controls.ButtonControl leftShoulder { get; }
public UnityEngine.InputSystem.Controls.StickControl leftStick { get; }
public UnityEngine.InputSystem.Controls.ButtonControl leftStickButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl leftTrigger { get; }
public UnityEngine.InputSystem.Controls.ButtonControl rightShoulder { get; }
public UnityEngine.InputSystem.Controls.StickControl rightStick { get; }
public UnityEngine.InputSystem.Controls.ButtonControl rightStickButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl rightTrigger { get; }
public UnityEngine.InputSystem.Controls.ButtonControl selectButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl startButton { get; }
public UnityEngine.InputSystem.Controls.Vector2Control hatswitch { get; }
public UnityEngine.InputSystem.Controls.StickControl stick { get; }
public UnityEngine.InputSystem.Controls.ButtonControl trigger { get; }
public UnityEngine.InputSystem.Controls.AxisControl twist { get; }
public UnityEngine.InputSystem.Controls.ButtonControl altKey { get; }
public UnityEngine.InputSystem.Controls.AnyKeyControl anyKey { get; }
public UnityEngine.InputSystem.Controls.ButtonControl ctrlKey { get; }
public UnityEngine.InputSystem.Controls.ButtonControl imeSelected { get; }
public UnityEngine.InputSystem.Controls.ButtonControl shiftKey { get; }
public UnityEngine.InputSystem.Controls.ButtonControl backButton { get; }
public UnityEngine.InputSystem.Controls.IntegerControl clickCount { get; }
public static UnityEngine.InputSystem.Mouse current { get; }
public UnityEngine.InputSystem.Controls.ButtonControl forwardButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl leftButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl middleButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl rightButton { get; }
public UnityEngine.InputSystem.Controls.Vector2Control scroll { get; }
public UnityEngine.InputSystem.Controls.ButtonControl eraser { get; }
public UnityEngine.InputSystem.Controls.ButtonControl firstBarrelButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl fourthBarrelButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl inRange { get; }
public UnityEngine.InputSystem.Controls.ButtonControl secondBarrelButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl thirdBarrelButton { get; }
public UnityEngine.InputSystem.Controls.Vector2Control tilt { get; }
public UnityEngine.InputSystem.Controls.ButtonControl tip { get; }
public UnityEngine.InputSystem.Controls.AxisControl twist { get; }
public UnityEngine.InputSystem.Controls.Vector2Control delta { get; }
public UnityEngine.InputSystem.Controls.Vector2Control position { get; }
public UnityEngine.InputSystem.Controls.ButtonControl press { get; }
public UnityEngine.InputSystem.Controls.AxisControl pressure { get; }
public UnityEngine.InputSystem.Controls.Vector2Control radius { get; }
public UnityEngine.InputSystem.Controls.Vector2Control delta { get; }
public UnityEngine.InputSystem.Controls.ButtonControl indirectTouch { get; }
public UnityEngine.InputSystem.Controls.TouchPhaseControl phase { get; }
public UnityEngine.InputSystem.Controls.Vector2Control position { get; }
public UnityEngine.InputSystem.Controls.TouchPressControl press { get; }
public UnityEngine.InputSystem.Controls.AxisControl pressure { get; }
public UnityEngine.InputSystem.Controls.Vector2Control radius { get; }
public UnityEngine.InputSystem.Controls.Vector2Control startPosition { get; }
public UnityEngine.InputSystem.Controls.DoubleControl startTime { get; }
public UnityEngine.InputSystem.Controls.ButtonControl tap { get; }
public UnityEngine.InputSystem.Controls.IntegerControl tapCount { get; }
public UnityEngine.InputSystem.Controls.IntegerControl touchId { get; }
public UnityEngine.InputSystem.Controls.ButtonControl leftTriggerButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl playStationButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl rightTriggerButton { get; }
public UnityEngine.InputSystem.Controls.TouchControl primaryTouch { get; }
public UnityEngine.InputSystem.Controls.ButtonControl down { get; }
public UnityEngine.InputSystem.Controls.ButtonControl left { get; }
public UnityEngine.InputSystem.Controls.ButtonControl right { get; }
public UnityEngine.InputSystem.Controls.ButtonControl up { get; }
public UnityEngine.InputSystem.Controls.AxisControl x { get; }
public UnityEngine.InputSystem.Controls.AxisControl y { get; }
public UnityEngine.InputSystem.Controls.AxisControl z { get; }
public UnityEngine.InputSystem.Controls.ButtonControl L1 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl L2 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl L3 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl optionsButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl R1 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl R2 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl R3 { get; }
public UnityEngine.InputSystem.Controls.ButtonControl shareButton { get; }
public UnityEngine.InputSystem.Controls.ButtonControl touchpadButton { get; }
public UnityEngine.InputSystem.Utilities.ReadOnlyArray<UnityEngine.InputSystem.Controls.TouchControl> touches { get; }
")]
public void API_MinorVersionsHaveNoBreakingChanges()
{
var currentVersion = CoreTests.PackageJson.ReadVersion();
var apiVersions = Directory.GetDirectories(kAPIDirectory)
.Select(p => new Version(Path.GetFileName(p)))
.ToList();
apiVersions.Sort();

Assert.That(apiVersions, Has.Count.GreaterThanOrEqualTo(1), "Did not find a checked in .api version in " + kAPIDirectory);

var lastReleasedVersion = apiVersions[apiVersions.Count - 1];
Assert.That(currentVersion, Is.Not.EqualTo(lastReleasedVersion), "Must bump package version when making changes.");

var exclusions =
TestContext.CurrentContext.Test.Properties["Exclusions"].OfType<string>()
.Where(t => t.StartsWith(lastReleasedVersion.ToString())).SelectMany(t => t.Split(new[] { "\n", "\r\n", "\r" },
StringSplitOptions.None)).ToArray();

if (currentVersion.Major == lastReleasedVersion.Major)
{
Unity.Coding.Editor.ApiScraping.ApiScraping.Scrape();

var currentApiFiles = Directory.GetFiles("Packages/com.unity.inputsystem", "*.api", SearchOption.AllDirectories);
var lastPublicApiFiles = Directory.GetFiles(Path.Combine(kAPIDirectory, lastReleasedVersion.ToString()), "*.api");

Assert.That(lastPublicApiFiles.Where(p => !currentApiFiles.Any(x => Path.GetFileName(x) == Path.GetFileName(p))),
Is.Empty,
"Any API file existing for the last published release must also exist for the current one.");

var missingLines = lastPublicApiFiles.SelectMany(p => MissingLines(Path.GetFileName(p), currentApiFiles, lastPublicApiFiles, exclusions))
.ToList();
Assert.That(missingLines, Is.Empty);
}
}

private static IEnumerable<string> MissingLines(string apiFile, string[] currentApiFiles, string[] lastPublicApiFiles, string[] exclusions)
{
var oldApiFile = lastPublicApiFiles.First(p => Path.GetFileName(p) == apiFile);
var newApiFile = currentApiFiles.First(p => Path.GetFileName(p) == apiFile);

var oldApiContents = File.ReadAllLines(oldApiFile).Select(FilterIgnoredChanges).ToArray();
var newApiContents = File.ReadAllLines(newApiFile).Select(FilterIgnoredChanges).ToArray();

foreach (var line in oldApiContents)
{
if (!newApiContents.Contains(line) && !exclusions.Any(x => x.Trim() == line.Trim()))
yield return line;
}
}

private static string FilterIgnoredChanges(string line)
{
if (line.Length == 0)
return line;

var pos = 0;
while (true)
{
// Skip whitespace.
while (pos < line.Length && char.IsWhiteSpace(line[pos]))
++pos;

if (pos < line.Length && line[pos] != '[')
return line;

var startPos = pos;
++pos;
while (pos < line.Length + 1 && !(line[pos] == ']' && line[pos + 1] == ' '))
++pos;
++pos;

var length = pos - startPos - 2;
var attribute = line.Substring(startPos + 1, length);
if (!attribute.StartsWith("System.Obsolete"))
{
line = line.Substring(0, startPos) + line.Substring(pos + 1); // Snip space after ']'.
pos -= length + 2;
}
}
}

#endif // UNITY_EDITOR_WIN

////TODO: add verification of *online* links to this; probably prone to instability and maybe they shouldn't fail tests but would
//// be great to have some way of diagnosing links that have gone stale
[Test]
Expand Down
2 changes: 1 addition & 1 deletion Assets/Tests/InputSystem/CoreTests_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
partial class CoreTests
{
[Serializable]
private struct PackageJson
internal struct PackageJson
{
public string version;

Expand Down
6 changes: 4 additions & 2 deletions Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"Unity.ugui",
"Unity.PackageManagerDocTools.Editor",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
"UnityEditor.TestRunner",
"Unity.Coding.Editor"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -21,5 +22,6 @@
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": []
"versionDefines": [],
"noEngineReferences": false
}
2 changes: 2 additions & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ however, it has to be formatted properly to pass verification tests.

## [Unreleased]

>__The minimum version requirement for the Input System package has been moved up to 2019.4 LTS.__
### Changed

#### Actions
Expand Down
Loading

0 comments on commit a8aee86

Please sign in to comment.