Frequent merge conflicts in generated Articy content

Tue 10. Mar 2020, 08:54

Hi everybody,

we use Articy draft in all of our Unity projects. Unfortunately, there is one thing we constantly struggle with, which is the generated Articy content always causing merge conflicts between different developers. Even if the actual content is the same, there are always IDs that differ.
Those conflicts are a hassle most of the time, that's why it's "faster" for us to "clear generated files" and reexport and reimport the Articy draft export file, each time we do a merge. Still it takes a lot of time, all in all, which feels somewhat unnecessary, not even mentioning the times where things go wrong and Unity crashes while trying to automatically import the conflicted export-file.

I see this is not necessarily a problem on the side of Articy, but I wonder if anybody has found a good solution for this or got an idea for such? How do you deal with generated Articy content in git and resulting conflicts?
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Re: Frequent merge conflicts in generated Articy content

Tue 10. Mar 2020, 09:44

Hi Moritz,

because of exactly that reason, and because in general its considered good practice to not commit generated files: The plugin will ask if you want to put the generated folder in on the ignore list if you are using GIT. If you are SVN you have to do this manually but it is also quiet simple. Ofc the export file from articy:draft must be part of your Repository, that way everyone is able to rebuild the generated files. If the exported file is also prone to conflict, you could make a small update script(or on SVN using tortoise a hook) where you delete the export file and that way its always overwritten by the following update. Which should also be save, because in the worst case your articy:project can regenerated it.

Hope that helps!
Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Frequent merge conflicts in generated Articy content

Tue 10. Mar 2020, 11:23

Hi Nico,

thank you, yes, that's very helpful indeed! I cannot believe I didn't think of this. For some reason I wrongly assumed git-ignoring the Articy content would make it unavailable for other team members, but - yes of course - commiting just the export file solves that.

Thanks again & best regards,
Moritz
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Re: Frequent merge conflicts in generated Articy content

Wed 11. Mar 2020, 09:58

I was celebrating too early, unfortunately. We have a build pipeline for Unity using Jenkins. Jenkins automatically pulls the project's git repository and then runs Unity in "silent mode", that means without opening its Editor. That unfortunately means the build server never comes to parsing the Articy-export-file, so all builds fail for lack of the generated Articy files.

Do you perhaps know if there is another way to trigger the Articy-Importer for Unity, other than opening the Unity Editor? Some static method that I'm overlooking, perhaps?
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Re: Frequent merge conflicts in generated Articy content

Wed 11. Mar 2020, 11:42

Hi Moritz,

we haven’t tested it with Jenkins yet, but you can try to call the static method Articy.Unity.Editor.ArticyEditor.ImportArticyExport(bool allowOptimizedPath = true) via reflection. If allowOptimizedPath is false, a forced full reimport will be performed, which regenerates all C# files. That is what you need in your case.
During the import, two different lock files appear inside the root of your Unity project, which can be used to check when the import has finished or failed. They are called “ArticyImportRunning” and “ArticyImportFailed”.

We will add a public method for starting an import and we also have further testing for Jenkins and Unity Cloud Build on our roadmap.


Best regards,

Chris
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 62
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Re: Frequent merge conflicts in generated Articy content

Wed 11. Mar 2020, 13:15

Hi Chris,

thank you very much, I will try it as soon as possible!

Best regards,
Moritz
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Re: Frequent merge conflicts in generated Articy content

Wed 18. Mar 2020, 14:14

Hi,

I tried my best, unfortunately I'm not too knowledgable when it comes to reflection. So, I can access the assembly, I can access the ArticyEditor class, but I cannot get a method called ImportArticyExport(). When I print out all methods found on ArticyEditor-class there are methods called ImportArticyExportAction() and ImportArticyExportFullAction(). But both are unsatisfied with receiving a boolean-parameter.
This is the code I'm using:

Code: Select all
var assembly = Assembly.LoadFile(@"Assets/ArticyImporter/Plugin/Editor/ArticyImporter.Editor.dll");
var articyEditor = assembly.GetType("Articy.Unity.Editor.ArticyEditor");
articyEditor.GetMethods().ForEach(m => Debug.Log(m.Name));
var method = articyEditor.GetMethod("ImportArticyExport");
method.Invoke(null, new object[] {false});


Do you see anything I might have done wrong, or if not, what would be the correct parameters for ImportArticyExportAction() ?

Best regards,
Moritz
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Re: Frequent merge conflicts in generated Articy content

Wed 18. Mar 2020, 14:40

@Moritz

Had the same issue right now :D
ImportArticyExport is a private static method, you have to clarify the Bindingflags:
Code: Select all
Type.GetType("Articy.Unity.Editor.ArticyEditor, ArticyImporter.Editor").GetMethod("ImportArticyExport", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] {false});
User avatar
btsslawa
 
Posts: 17
Joined: Fri 21. Aug 2015, 10:14

Re: Frequent merge conflicts in generated Articy content

Wed 18. Mar 2020, 14:50

We also use a buildpipeline with TeamCity and now I don't know how to operate right now, we're setting up our project right now and as of now I don't know what to do with the generated content.

Should I add the generated content to git?
This may lead to merge conflicts as Moritz pointed out, although I don't think I will run into this very issue since there is only on Articy Project and only one person does any changes to that project - me. The only thing that will happen is, that I do changes in the Articy project and export them to the Unity project overwriting the previous generated content. Will this lead to any problems?

Should I ignore the generated content ?
Now when I ignore it, I have to hack a reimport when the buildserver pulls the project and starts Unity in batchmode.
Before the build begins I have to initiate the reimport, monitoring the two lock files “ArticyImportRunning” and “ArticyImportFailed”.
I did try to call the ImportArticyExport method via reflection which...works? The Progressbar pops up doing some articy related things and at the end I get the "ArticyImporter: Finished importing articy:draft data!" Debg Log in the Console.
But I always get the "ArticyImportFailed" file in the root folder. On top of that I tried to initiate a build right after that which...leads to a multitude of other problems:

This simple code here:
Code: Select all
        public void ImportArticyProject()
        {
            Type.GetType("Articy.Unity.Editor.ArticyEditor, ArticyImporter.Editor")
                .GetMethod("ImportArticyExport", BindingFlags.Static | BindingFlags.NonPublic)
                .Invoke(null, new object[] {false});

            BuildPipeline.BuildPlayer(levelNames, path, BuildTarget.StandaloneWindows64, BuildOptions.None);
        }


I execute this code through a button, want to build an empty scene in a basically empty project with only the articy export file in there. The import tries to do it's thing but ofc this doesn't work, since the BuildPipeline.BuildPlayer line of code doesn't wait for articy to be reimported and tries to build. Articy reimporting scripts and Unitys Build process trying to reimportant simultaneously is bad and throws a bunch of errors.

So in conclusion:

I need my script to reimport the Articyexport, monitoring the availability of one of the lock files (which at my end is always the "ArticyImportFailed" for some reason :( ) AND when successfully, only then I can initiate the build.

This seems quite cumbersome and I wished there wouldn't be the need for...at least half of that. Maybe for the time being:

- make the import function public to us (that's already on your roadmap afaik)
- instead of monitoring lock files, make some events: OnImportArticyExportRunning/OnImportArticyExportSuccessfull/OnImportArticyExportFailed

That would give us devs a bit more leeway :)
User avatar
btsslawa
 
Posts: 17
Joined: Fri 21. Aug 2015, 10:14

Re: Frequent merge conflicts in generated Articy content

Wed 18. Mar 2020, 15:30

Well, that's one hell of a coincidence with you having the same issue at the same day at the same time :D !!

I'm glad about it, since your reflection code for running ArticyEditor.ImportArticyExport() works right out of the box for me, as well. Thank you!! But now I am - again - in the same situation as you. Naturally, our build server does not wait for the ArticyImporter to finish importing, either. Builds still fail due to missing the generated Articy content..

Next, I too will try monitoring the lock-files, hoping to have more luck with that. But at the same time, I will keep watching this thread and I also hope and pray for a more convenient solution.

PS: Okay, unfortunately, I do not even get this far. Jenkins seems to abort the whole process prematurely due to compiler errors caused by all the missing references to not-yet-generated Articy files before I am even able to trigger the import. Looks like I need to learn more about Jenkins, as well..
Moritz
 
Posts: 12
Joined: Wed 23. Oct 2019, 14:26

Next

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 15 guests

Who We Are
Contact Us
Social Links