Hello!
My team use Jenkins when build Ios / Android Platform.
But when started build, often occurred build error.
This is because the runtime code contains the editor code.
I want to check this just like when building android; without UNITY_EDTIOR constants and editor asmdef codes, cannot using UnityEditor namespace
Hey su-juhyuklee,
Hard to understand what you are asking. I build a lot using Jenkins both iOS and Android. It seems you have an editor script included as part of your build process.
You can mark your asmdef files, via the inspector, to include/exclude specific platforms/editor. It could be that this is your issue.
As part of a build script, I think in the player settings, you can feed in any symlinks you have in the code to be picked up here as well.
Hope that helps.
Thankās to reply
The scenario I want to prevent is Like this
asmdef name āB.Runtimeā (platforms Check āany platformā)
- To work somthing in unity editor, using editor method in B.Runtime
- Normally to use edtior code in runtime code, programmers should wrapping #UNITY_EDITOR
- But many programmers forget wrapping #UNITY_EDITOR. (obviously, Rider or visual studio not to say compile error)
- And then programmer push that code
- run build Android in Jenkins
- Build error message like error CS0246: The type or namespace name āFooEditorNamespaceā could not be found (are you missing a using directive or an assembly reference?)
Because Unity Android Build contain asset(obviously), to check buildable is too slow.
Unfortunately, thereās no good way to do this today - you can turn on the āNo Engine Referencesā checkbox for the asmdef, but this will prevent you from using both UnityEngine and UnityEditor APIs. We donāt have a good way to let you keep using UnityEngine while blocking UnityEditor.
The scripting team agree that the use case makes sense, they have added a task to their backlog to look into this.
@superpig Any news?
Itās taking too long, so Iām trying to implement it,
I am trying to implement the android/IOS build situation in the direction of modifying the csproj files. What should be deleted?
as far as i can figure out
- Read *.asmdef json and check whether it is runtime or editor, and delete the editor csproj file list from the sln file
- Delete contents including āEDITORā in in each runtime csproj file
- Delete editor dlls in in each runtime csproj file
I think itās like this, is it okay?