jenkinsci / unity3d-plugin

Jenkins Unity3d plugin
https://plugins.jenkins.io/unity3d-plugin/
MIT License
95 stars 54 forks source link

How to run this plugin from the new Pipeline script in Jenkins v2? #8

Open strich opened 8 years ago

strich commented 8 years ago

As the title says - Would be good to see an example of how to run this plugin from the Pipeline script.

JohannSig commented 7 years ago

Seconded

brockhjones commented 7 years ago

It seems like this plugin may be abandoned - no commits in 2 years. Without proper pipeline support it's not really very useful any more.

JohannSig commented 7 years ago

I went full command line (sh/bat) instead. Works, but doesn't pipe the log file into the results like the plugin did. Ah, well

garyritchie commented 6 years ago

Looks like efforts are being focused on https://github.com/DragonBox/u3d

The-Arrival commented 6 years ago

@johannsig is it possible to get some of you bash commands as an example? I´m struggeling finding info on how to execute Buildscripts via pipeline build files

JohannSig commented 6 years ago

@The-Arrival - It's been a while now, and I've basically moved us away from an all-in-one pipeline script to one that calls parameterized sub-tasks, like so:

stage('Compile Client') {
            steps {
                lock("Unity3d2017") {
                    build(job : "Compile Client", parameters: [
                        string(name: "BRANCH_NAME", value: env.BRANCH_NAME),
                        string(name: "BUILD_TARGET", value: env.BUILD_TARGET)
                        ] );
                }
            }
        }

.. where Compile Client is a Jenkins Task utilizing the Unity3D plugin. This introduced other complications at the time (possible executor deadlocks) but today I find this setup much cleaner and more appealing to the rest of the team than the groovy porridge I kept trying to force-feed them 8-)

JohannSig commented 6 years ago

.. for the sake of complete info though, here are the arguments used by my "Invoke Unity3D Editor" build step when running my "Compile Client" build task:

Unity3D.exe -buildTarget Win -projectPath ${WORKSPACE} -quit -batchmode -executeMethod CommandLineHelper.GenerateCSharpProjects -logFile ${WORKSPACE}\Unity3dLog.txt

.. where CommandLineHelper's humble purpose is to make Unity spit out new .csproj files:

using UnityEditor;

public class CommandLineHelper
{

    public static void GenerateCSharpProjects()
    {
        EditorApplication.ExecuteMenuItem("Assets/Open C# Project");
    }

}

I'm fairly sure you can copy these steps with ease if you need them.

rysenko commented 6 years ago

@johannsig @The-Arrival If you want to redirect editor output to STDOUT, just specify empty -logFile. This works perfectly for me: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath $WORKSPACE -executeMethod BuildClass.BuildMethod -logFile.

leechunkit commented 6 years ago

@rysenko yup, it works for OSX and Linux. not for Windows though.

https://docs.unity3d.com/Manual/CommandLineArguments.html

yuchting commented 3 years ago

Leaving a empty "-logfile" doesn't work now, the official document writes:

-logFile Specify where Unity writes the Editor or Windows/Linux/OSX standalone log file. To output to the console, specify - for the path name. On Windows, specify - option to make the output go to stdout, which is not the console by default.

so you need to append a minus sign after "-logfile": "-logfile -"

haiya512 commented 2 years ago

image how can i rewrite this unity3d plugin job with pipeline ?