예제 #1
0
    private static bool ProcessGradleProject()
    {
        DateTime syncStartTime = System.DateTime.Now;
        DateTime syncEndTime   = System.DateTime.MinValue;

        try
        {
            var ps = System.Text.RegularExpressions.Regex.Escape("" + Path.DirectorySeparatorChar);
            // ignore files .gradle/** build/** foo/.gradle/** and bar/build/**
            var ignorePattern = string.Format("^([^{0}]+{0})?(\\.gradle|build){0}", ps);

            var syncer = new DirectorySyncer(gradleTempExport,
                                             gradleExport, ignorePattern);

            syncCancelToken = new DirectorySyncer.CancellationTokenSource();
            var syncResult = syncer.Synchronize(syncCancelToken.Token);
            syncEndTime = System.DateTime.Now;
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log("OVRBuild: Processing gradle project failed with exception: " +
                                  e.Message);
            return(false);
        }

        if (syncCancelToken.IsCancellationRequested)
        {
            return(false);
        }

        return(true);
    }
예제 #2
0
    private static bool ProcessGradleProject()
    {
        DateTime syncStartTime = System.DateTime.Now;
        DateTime syncEndTime   = System.DateTime.MinValue;

        try
        {
            var ps = System.Text.RegularExpressions.Regex.Escape("" + Path.DirectorySeparatorChar);
            // ignore files .gradle/** build/** foo/.gradle/** and bar/build/**
            var ignorePattern = string.Format("^([^{0}]+{0})?(\\.gradle|build){0}", ps);

            var syncer = new DirectorySyncer(gradleTempExport,
                                             gradleExport, ignorePattern);

            syncCancelToken = new DirectorySyncer.CancellationTokenSource();
            var syncResult = syncer.Synchronize(syncCancelToken.Token);
            syncEndTime = System.DateTime.Now;
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log("OVRBuild: Processing gradle project failed with exception: " +
                                  e.Message);
            return(false);
        }

        if (syncCancelToken.IsCancellationRequested)
        {
            return(false);
        }

        // Record time it takes to sync gradle projects only if the sync was successful
        double syncTime = (syncEndTime - syncStartTime).TotalSeconds;

        if (syncTime > 0)
        {
            OVRPlugin.SendEvent("build_step_sync_gradle_project", syncTime.ToString(), "ovrbuild");
            totalBuildTime += syncTime;
        }

        return(true);
    }