@@ -39,6 +39,8 @@ private class Settings {
39
39
internal bool patchAndroidManifest ;
40
40
internal bool patchMainTemplateGradle ;
41
41
internal bool patchPropertiesTemplateGradle ;
42
+ internal bool useFullCustomMavenRepoPathWhenExport ;
43
+ internal bool useFullCustomMavenRepoPathWhenNotExport ;
42
44
internal string localMavenRepoDir ;
43
45
internal bool useJetifier ;
44
46
internal bool verboseLogging ;
@@ -60,6 +62,8 @@ internal Settings() {
60
62
patchAndroidManifest = SettingsDialog . PatchAndroidManifest ;
61
63
patchMainTemplateGradle = SettingsDialog . PatchMainTemplateGradle ;
62
64
patchPropertiesTemplateGradle = SettingsDialog . PatchPropertiesTemplateGradle ;
65
+ useFullCustomMavenRepoPathWhenExport = SettingsDialog . UseFullCustomMavenRepoPathWhenExport ;
66
+ useFullCustomMavenRepoPathWhenNotExport = SettingsDialog . UseFullCustomMavenRepoPathWhenNotExport ;
63
67
localMavenRepoDir = SettingsDialog . LocalMavenRepoDir ;
64
68
useJetifier = SettingsDialog . UseJetifier ;
65
69
verboseLogging = SettingsDialog . VerboseLogging ;
@@ -82,6 +86,8 @@ internal void Save() {
82
86
SettingsDialog . PatchAndroidManifest = patchAndroidManifest ;
83
87
SettingsDialog . PatchMainTemplateGradle = patchMainTemplateGradle ;
84
88
SettingsDialog . PatchPropertiesTemplateGradle = patchPropertiesTemplateGradle ;
89
+ SettingsDialog . UseFullCustomMavenRepoPathWhenExport = useFullCustomMavenRepoPathWhenExport ;
90
+ SettingsDialog . UseFullCustomMavenRepoPathWhenNotExport = useFullCustomMavenRepoPathWhenNotExport ;
85
91
SettingsDialog . LocalMavenRepoDir = localMavenRepoDir ;
86
92
SettingsDialog . UseJetifier = useJetifier ;
87
93
SettingsDialog . VerboseLogging = verboseLogging ;
@@ -101,6 +107,8 @@ internal void Save() {
101
107
private const string PatchAndroidManifestKey = Namespace + "PatchAndroidManifest" ;
102
108
private const string PatchMainTemplateGradleKey = Namespace + "PatchMainTemplateGradle" ;
103
109
private const string PatchPropertiesTemplateGradleKey = Namespace + "PatchPropertiesTemplateGradle" ;
110
+ private const string UseFullCustomMavenRepoPathWhenExportKey = Namespace + "UseFullCustomMavenRepoPathWhenExport" ;
111
+ private const string UseFullCustomMavenRepoPathWhenNotExportKey = Namespace + "UseFullCustomMavenRepoPathWhenNotExport" ;
104
112
private const string LocalMavenRepoDirKey = Namespace + "LocalMavenRepoDir" ;
105
113
private const string UseJetifierKey = Namespace + "UseJetifier" ;
106
114
private const string VerboseLoggingKey = Namespace + "VerboseLogging" ;
@@ -120,6 +128,8 @@ internal void Save() {
120
128
PatchAndroidManifestKey ,
121
129
PatchMainTemplateGradleKey ,
122
130
PatchPropertiesTemplateGradleKey ,
131
+ UseFullCustomMavenRepoPathWhenExportKey ,
132
+ UseFullCustomMavenRepoPathWhenNotExportKey ,
123
133
LocalMavenRepoDirKey ,
124
134
UseJetifierKey ,
125
135
VerboseLoggingKey ,
@@ -245,6 +255,16 @@ internal static bool PatchPropertiesTemplateGradle {
245
255
get { return projectSettings . GetBool ( PatchPropertiesTemplateGradleKey , true ) ; }
246
256
}
247
257
258
+ internal static bool UseFullCustomMavenRepoPathWhenExport {
259
+ set { projectSettings . SetBool ( UseFullCustomMavenRepoPathWhenExportKey , value ) ; }
260
+ get { return projectSettings . GetBool ( UseFullCustomMavenRepoPathWhenExportKey , true ) ; }
261
+ }
262
+
263
+ internal static bool UseFullCustomMavenRepoPathWhenNotExport {
264
+ set { projectSettings . SetBool ( UseFullCustomMavenRepoPathWhenNotExportKey , value ) ; }
265
+ get { return projectSettings . GetBool ( UseFullCustomMavenRepoPathWhenNotExportKey , false ) ; }
266
+ }
267
+
248
268
internal static string LocalMavenRepoDir {
249
269
private set { projectSettings . SetString ( LocalMavenRepoDirKey , value ) ; }
250
270
get {
@@ -337,6 +357,8 @@ public void OnEnable() {
337
357
/// Called when the GUI should be rendered.
338
358
/// </summary>
339
359
public void OnGUI ( ) {
360
+ GUI . skin . label . wordWrap = true ;
361
+
340
362
GUILayout . BeginVertical ( ) ;
341
363
GUILayout . Label ( String . Format ( "Android Resolver (version {0}.{1}.{2})" ,
342
364
AndroidResolverVersionNumber . Value . Major ,
@@ -477,6 +499,44 @@ public void OnGUI() {
477
499
}
478
500
479
501
if ( settings . patchMainTemplateGradle ) {
502
+ GUILayout . Label ( "Use Full Custom Local Maven Repo Path" , EditorStyles . boldLabel ) ;
503
+ GUILayout . BeginHorizontal ( ) ;
504
+ GUILayout . Label ( " When building Android app through Unity" , EditorStyles . boldLabel ) ;
505
+ settings . useFullCustomMavenRepoPathWhenNotExport =
506
+ EditorGUILayout . Toggle ( settings . useFullCustomMavenRepoPathWhenNotExport ) ;
507
+ GUILayout . EndHorizontal ( ) ;
508
+ GUILayout . BeginHorizontal ( ) ;
509
+ GUILayout . Label ( " When exporting Android project" , EditorStyles . boldLabel ) ;
510
+ settings . useFullCustomMavenRepoPathWhenExport =
511
+ EditorGUILayout . Toggle ( settings . useFullCustomMavenRepoPathWhenExport ) ;
512
+ GUILayout . EndHorizontal ( ) ;
513
+
514
+ GUILayout . Label (
515
+ "EDM4U can inject custom local Maven repo to Gradle template files " +
516
+ "differnetly depending on whether 'Export Project' in Build Settings is " +
517
+ "enabled or not.\n " +
518
+ "If checked, custom local Maven repo path will look like the following. " +
519
+ "This is best if the Unity project is always under the same path, or when " +
520
+ "Unity editor has bugs which fail to resolve template variables like " +
521
+ "'**DIR_UNITYPROJECT**'" ) ;
522
+ GUILayout . Box (
523
+ " maven {\n " +
524
+ " url \" file:////path/to/myUnityProject/path/to/m2repository\" \n " +
525
+ " }" , EditorStyles . wordWrappedMiniLabel ) ;
526
+ GUILayout . Label (
527
+ "If unchecked, custom local Maven repo path will look like the following. " +
528
+ "This is best if the Unity projects locates in different folders on " +
529
+ "different workstations. 'unityProjectPath' will be resolved at build time " +
530
+ "using template variables like '**DIR_UNITYPROJECT**'" ) ;
531
+ GUILayout . Box (
532
+ " def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace(\" \\ \" , \" /\" )\n " +
533
+ " maven {\n " +
534
+ " url (unityProjectPath + \" /path/to/m2repository\" )\n " +
535
+ " }" , EditorStyles . wordWrappedMiniLabel ) ;
536
+ GUILayout . Label (
537
+ "Note that EDM4U always uses full path if the custom local Maven repo is NOT " +
538
+ "under Unity project folder." ) ;
539
+
480
540
GUILayout . BeginHorizontal ( ) ;
481
541
string previousDir = settings . localMavenRepoDir ;
482
542
GUILayout . Label ( "Local Maven Repo Directory" , EditorStyles . boldLabel ) ;
@@ -543,6 +603,10 @@ public void OnGUI() {
543
603
settings . useProjectSettings = EditorGUILayout . Toggle ( settings . useProjectSettings ) ;
544
604
GUILayout . EndHorizontal ( ) ;
545
605
606
+ GUILayout . EndVertical ( ) ;
607
+ EditorGUILayout . EndScrollView ( ) ;
608
+
609
+ GUILayout . BeginVertical ( ) ;
546
610
GUILayout . Space ( 10 ) ;
547
611
548
612
if ( GUILayout . Button ( "Reset to Defaults" ) ) {
@@ -581,6 +645,12 @@ public void OnGUI() {
581
645
new KeyValuePair < string , string > (
582
646
"patchAndroidManifest" ,
583
647
SettingsDialog . PatchAndroidManifest . ToString ( ) ) ,
648
+ new KeyValuePair < string , string > (
649
+ "UseFullCustomMavenRepoPathWhenNotExport" ,
650
+ SettingsDialog . UseFullCustomMavenRepoPathWhenNotExport . ToString ( ) ) ,
651
+ new KeyValuePair < string , string > (
652
+ "UseFullCustomMavenRepoPathWhenExport" ,
653
+ SettingsDialog . UseFullCustomMavenRepoPathWhenExport . ToString ( ) ) ,
584
654
new KeyValuePair < string , string > (
585
655
"localMavenRepoDir" ,
586
656
SettingsDialog . LocalMavenRepoDir . ToString ( ) ) ,
@@ -604,9 +674,8 @@ public void OnGUI() {
604
674
}
605
675
if ( closeWindow ) Close ( ) ;
606
676
GUILayout . EndHorizontal ( ) ;
607
-
608
677
GUILayout . EndVertical ( ) ;
609
- EditorGUILayout . EndScrollView ( ) ;
678
+
610
679
GUILayout . EndVertical ( ) ;
611
680
}
612
681
}
0 commit comments