public static void UpdatePackage()
        {
            float progress = 0F;

            PackageInfo info = PackageInfo.FindForAssembly(typeof(NativePackageUpdate).Assembly);

            RemoveRequest removeRequest = Client.Remove(info.packageId);

            while (!removeRequest.IsCompleted)
            {
                EditorUtility.DisplayProgressBar(_titleLabel, _infoLabel, Mathf.Clamp(progress += 0.01F, 0F, .5F));
                Thread.Sleep(100);
            }
            EditorUtility.DisplayProgressBar(_titleLabel, _infoLabel, .5F);

            AddRequest addRequest = Client.Add(info.packageId);

            while (!addRequest.IsCompleted)
            {
                EditorUtility.DisplayProgressBar(_titleLabel, _infoLabel, Mathf.Clamp(progress += 0.01F, .5F, 1F));
                Thread.Sleep(100);
            }
            EditorUtility.DisplayProgressBar(_titleLabel, _infoLabel, 1F);
            Thread.Sleep(100);

            EditorUtility.ClearProgressBar();
        }
    public void PlayerSettingsMatchPackageInfo()
    {
        var packagePath     = PackageInfo.FindForAssembly(Assembly.GetExecutingAssembly()).assetPath;
        var packageInfoPath = $"{packagePath}/package.json";

        var packageInfo = JsonUtility.FromJson <PkgInfo>(File.ReadAllText(packageInfoPath));

        // TODO upm-ci doesn't support running tests for WebGL or mobile builds yet so this is not run in
        // the correct environment using CI.
        // NOTE Template Isolation Test overwrites Application.identifier with "com.Company.ProductName"

        using (var so = new SerializedObject(m_ProjectSettings))
        {
            Assert.AreEqual(
                so.FindProperty("applicationIdentifier.Array.data[0].second")?.stringValue, packageInfo.name,
                "ProjectSettings' applicationIdentifier doesn't have the package name set."
                );

            Assert.AreEqual(
                packageInfo.version, Application.version,
                "PackageInfo.version and Application.version do not match."
                );
        }
    }
Example #3
0
        static bool IsTypeDefinedInPackage(Type type, PackageInfo packageInfo)
        {
            var packageInfoFromAssembly = PackageInfo.FindForAssembly(type.Assembly);

            return(ArePackageInfosEqual(packageInfoFromAssembly, packageInfo));
        }