forked from ericsink/SQLitePCL.raw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_build.cs
4898 lines (4218 loc) · 181 KB
/
gen_build.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright 2014-2016 Zumero, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
public static class projects
{
// Each item in these Lists corresponds to a project file that will be
// generated.
//
public static List<config_sqlite3> items_sqlite3 = new List<config_sqlite3>();
public static List<config_cppinterop> items_cppinterop = new List<config_cppinterop>();
public static List<config_csproj> items_csproj = new List<config_csproj>();
public static List<config_csproj> items_test = new List<config_csproj>();
public static List<config_testapp> items_testapp = new List<config_testapp>();
public static List<config_esqlite3> items_esqlite3 = new List<config_esqlite3>();
// This function is called by Main to initialize the project lists.
//
public static void init()
{
init_sqlite3();
init_cppinterop();
init_csproj();
init_tests();
init_testapps();
init_esqlite3();
}
private static void init_sqlite3()
{
items_sqlite3.Add(new config_sqlite3 { toolset="v110_xp", cpu="x86" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110_xp", cpu="x64" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110", cpu="arm" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110", cpu="x64" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110", cpu="x86" });
items_sqlite3.Add(new config_sqlite3 { toolset="v120", cpu="arm" });
items_sqlite3.Add(new config_sqlite3 { toolset="v120", cpu="x64" });
items_sqlite3.Add(new config_sqlite3 { toolset="v120", cpu="x86" });
items_sqlite3.Add(new config_sqlite3 { toolset="v140", cpu="arm" });
items_sqlite3.Add(new config_sqlite3 { toolset="v140", cpu="x64" });
items_sqlite3.Add(new config_sqlite3 { toolset="v140", cpu="x86" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110_wp80", cpu="arm" });
items_sqlite3.Add(new config_sqlite3 { toolset="v110_wp80", cpu="x86" });
items_sqlite3.Add(new config_sqlite3 { toolset="v120_wp81", cpu="arm" });
items_sqlite3.Add(new config_sqlite3 { toolset="v120_wp81", cpu="x86" });
}
private static void init_cppinterop()
{
items_cppinterop.Add(new config_cppinterop { env="wp80", cpu="arm"});
items_cppinterop.Add(new config_cppinterop { env="wp80", cpu="x86"});
}
private static void init_bundles(int ver)
{
// bundle_winsqlite3
items_csproj.Add(config_csproj.create_batteries("batteries_winsqlite3", ver, "uwp10", "winsqlite3"));
// bundle_green
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"ios_unified", "sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"macos", "sqlite3"));
// TODO items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"watchos", "sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"tizen", "sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"android", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"win8", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"wpa81", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"win81", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"uwp10", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"net35", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"net40", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"net45", "e_sqlite3"));
items_csproj.Add(config_csproj.create_wp80_batteries("batteries_green", ver, "arm"));
items_csproj.Add(config_csproj.create_wp80_batteries("batteries_green", ver, "x86"));
// the following item builds for netstandard11
// but overrides the nuget target env to place it in netcoreapp
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"netstandard11", "e_sqlite3", "netcoreapp"));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"profile111", null));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"profile136", null));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"profile259", null));
items_csproj.Add(config_csproj.create_batteries("batteries_green", ver,"netstandard11", null));
// bundle_e_sqlite3
items_csproj.Add(config_csproj.create_internal_batteries("batteries_e_sqlite3", ver, "ios_unified", "e_sqlite3"));
// TODO items_csproj.Add(config_csproj.create_internal_batteries("batteries_e_sqlite3", "watchos", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "android", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "macos", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "win8", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "wpa81", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "win81", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "uwp10", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "net35", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "net40", "e_sqlite3"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "net45", "e_sqlite3"));
items_csproj.Add(config_csproj.create_wp80_batteries("batteries_e_sqlite3", ver, "arm"));
items_csproj.Add(config_csproj.create_wp80_batteries("batteries_e_sqlite3", ver, "x86"));
// the following item builds for netstandard11
// but overrides the nuget target env to place it in netcoreapp
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "netstandard11", "e_sqlite3", "netcoreapp"));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "profile111", null));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "profile136", null));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "profile259", null));
items_csproj.Add(config_csproj.create_batteries("batteries_e_sqlite3", ver, "netstandard11", null));
// bundle_sqlcipher
items_csproj.Add(config_csproj.create_internal_batteries("batteries_sqlcipher", ver, "ios_unified", "sqlcipher"));
// TODO items_csproj.Add(config_csproj.create_internal_batteries("batteries_sqlcipher", "watchos", "sqlcipher"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "macos", "sqlcipher"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "android", "sqlcipher"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "net35", "sqlcipher"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "net40", "sqlcipher"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "net45", "sqlcipher"));
// the following item builds for netstandard11
// but overrides the nuget target env to place it in netcoreapp
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "netstandard11", "sqlcipher", "netcoreapp"));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "profile111", null));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "profile136", null));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "profile259", null));
items_csproj.Add(config_csproj.create_batteries("batteries_sqlcipher", ver, "netstandard11", null));
}
private static void init_csproj()
{
items_csproj.Add(config_csproj.create_core("net35"));
items_csproj.Add(config_csproj.create_core("net40"));
items_csproj.Add(config_csproj.create_core("net45"));
items_csproj.Add(config_csproj.create_core("ios_unified"));
items_csproj.Add(config_csproj.create_core("macos"));
// TODO items_csproj.Add(config_csproj.create_core("watchos"));
items_csproj.Add(config_csproj.create_core("android"));
items_csproj.Add(config_csproj.create_core("win8"));
items_csproj.Add(config_csproj.create_core("win81"));
items_csproj.Add(config_csproj.create_core("wpa81"));
items_csproj.Add(config_csproj.create_core("uwp10"));
items_csproj.Add(config_csproj.create_core("tizen"));
items_csproj.Add(config_csproj.create_core("profile111"));
items_csproj.Add(config_csproj.create_core("profile136"));
items_csproj.Add(config_csproj.create_core("profile259"));
items_csproj.Add(config_csproj.create_core("netstandard10"));
items_csproj.Add(config_csproj.create_core("netstandard11"));
items_csproj.Add(config_csproj.create_provider("sqlite3_xamarin", "android"));
items_csproj.Add(config_csproj.create_provider("winsqlite3", "uwp10"));
items_csproj.Add(config_csproj.create_provider("winsqlite3", "net45"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "netstandard11"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "net35"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "net40"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "net45"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "ios_unified"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "macos"));
// TODO items_csproj.Add(config_csproj.create_provider("sqlite3", "watchos"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "android")); // bad idea
items_csproj.Add(config_csproj.create_provider("sqlite3", "win8"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "win81"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "wpa81"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "uwp10"));
items_csproj.Add(config_csproj.create_provider("sqlite3", "tizen"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "netstandard11"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "net35"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "net40"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "net45"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "android"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "win8"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "win81"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "wpa81"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "uwp10"));
items_csproj.Add(config_csproj.create_provider("e_sqlite3", "macos"));
// ios would only make sense here with dylibs
//items_csproj.Add(config_csproj.create_provider("e_sqlite3", "ios_unified"));
items_csproj.Add(config_csproj.create_provider("internal", "ios_unified"));
// TODO items_csproj.Add(config_csproj.create_provider("internal", "watchos"));
items_csproj.Add(config_csproj.create_embedded("e_sqlite3", "android"));
items_csproj.Add(config_csproj.create_embedded("e_sqlite3", "ios_unified"));
// TODO items_csproj.Add(config_csproj.create_embedded("e_sqlite3", "watchos"));
items_csproj.Add(config_csproj.create_embedded("sqlcipher", "android"));
items_csproj.Add(config_csproj.create_embedded("sqlcipher", "ios_unified"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "netstandard11"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "net35"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "net40"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "net45"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "android"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "win8"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "win81"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "wpa81"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "uwp10"));
items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "macos"));
// ios would only make sense here with dylibs
//items_csproj.Add(config_csproj.create_provider("custom_sqlite3", "ios_unified"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "netstandard11"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "net35"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "net40"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "net45"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "android"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "win8"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "win81"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "wpa81"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "uwp10"));
items_csproj.Add(config_csproj.create_provider("sqlcipher", "macos"));
// ios would only make sense here with dylibs
//items_csproj.Add(config_csproj.create_provider("sqlcipher", "ios_unified"));
items_csproj.Add(config_csproj.create_wp80_provider("arm"));
items_csproj.Add(config_csproj.create_wp80_provider("x86"));
items_csproj.Add(config_csproj.create_ugly("net35"));
items_csproj.Add(config_csproj.create_ugly("net40"));
items_csproj.Add(config_csproj.create_ugly("net45"));
items_csproj.Add(config_csproj.create_ugly("android"));
items_csproj.Add(config_csproj.create_ugly("ios_unified"));
items_csproj.Add(config_csproj.create_ugly("macos"));
// TODO items_csproj.Add(config_csproj.create_ugly("watchos"));
items_csproj.Add(config_csproj.create_ugly("win8"));
items_csproj.Add(config_csproj.create_ugly("win81"));
items_csproj.Add(config_csproj.create_ugly("wpa81"));
items_csproj.Add(config_csproj.create_ugly("uwp10"));
items_csproj.Add(config_csproj.create_ugly("tizen"));
items_csproj.Add(config_csproj.create_ugly("profile111"));
items_csproj.Add(config_csproj.create_ugly("profile136"));
items_csproj.Add(config_csproj.create_ugly("profile259"));
//items_csproj.Add(config_csproj.create_ugly("netstandard10"));
items_csproj.Add(config_csproj.create_ugly("netstandard11"));
init_bundles(1);
init_bundles(2);
}
private static void init_tests()
{
// using netstandard for the tests would require switching to the
// xunit pre
//items_test.Add(config_csproj.create_portable_test("netstandard11"));
items_test.Add(config_csproj.create_portable_test("profile259"));
items_test.Add(config_csproj.create_bundle_test("net45", "e_sqlite3"));
items_test.Add(config_csproj.create_bundle_test("net45", "green"));
// in main
//items_csproj.Add(config_csproj.create_portable_test_main("netstandard11"));
//xunit only supports 259
//items_csproj.Add(config_csproj.create_portable_test_main("profile111"));
//items_csproj.Add(config_csproj.create_portable_test_main("profile136"));
items_csproj.Add(config_csproj.create_portable_test_main("profile259"));
}
private static void init_testapps()
{
items_testapp.Add(new config_testapp {
env="android",
cpu="anycpu",
bundle="bundle_sqlcipher",
});
items_testapp.Add(new config_testapp {
env="android",
cpu="anycpu",
bundle="bundle_e_sqlite3",
});
items_testapp.Add(new config_testapp {
env="android",
cpu="anycpu",
bundle="bundle_green",
});
items_testapp.Add(new config_testapp {
env="wp81",
cpu="x86",
bundle="bundle_e_sqlite3",
});
items_testapp.Add(new config_testapp {
env="wp81",
cpu="x86",
bundle="bundle_green",
});
items_testapp.Add(new config_testapp {
env="uwp10",
cpu="x86",
bundle="bundle_green",
});
items_testapp.Add(new config_testapp {
env="uwp10",
cpu="x86",
bundle="bundle_e_sqlite3",
});
items_testapp.Add(new config_testapp {
env="uwp10",
cpu="x64",
bundle="bundle_winsqlite3",
});
}
private static void init_esqlite3()
{
items_esqlite3.Add(new config_esqlite3 { toolset="v110_xp" });
items_esqlite3.Add(new config_esqlite3 { toolset="v110" });
items_esqlite3.Add(new config_esqlite3 { toolset="v110_wp80" });
items_esqlite3.Add(new config_esqlite3 { toolset="v120" });
items_esqlite3.Add(new config_esqlite3 { toolset="v120_wp81" });
items_esqlite3.Add(new config_esqlite3 { toolset="v140" });
}
public static string get_nuget_target_path(string env)
{
if (config_cs.env_is_portable(env))
{
return string.Format("lib\\{0}\\", projects.get_portable_nuget_target_string(env));
}
else if (env == "wp80")
{
// this goes into build/wp80/cpu, but the cpu isn't
// a param to this function, so the wp80 case has to
// be handled another way
throw new NotImplementedException();
}
else
{
return string.Format("lib\\{0}\\", config_cs.get_nuget_framework_name(env));
}
}
public static string rid_front_half(string toolset)
{
switch (toolset)
{
case "v110_xp":
return "win7";
case "v110":
return "win8";
case "v110_wp80":
return "wp80";
case "v120":
return "win81";
case "v120_wp81":
return "wpa81";
case "v140":
return "win10";
default:
throw new Exception();
}
}
public static string cs_env_to_toolset(string env)
{
switch (env) {
case "net45":
return "v110_xp";
case "net40":
return "v110_xp";
case "net35":
return "v110_xp";
case "wp80":
return "v110_wp80";
case "wp81_sl":
return "v120";
case "wpa81":
return "v120_wp81";
case "uwp10":
return "v140";
case "win8":
return "v110";
case "win81":
return "v120";
default:
throw new Exception(env);
}
}
public static string get_portable_nuget_target_string(string env)
{
switch (env)
{
case "profile78":
return "portable-net45+netcore45+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10";
case "profile259":
return "portable-net45+netcore45+wpa81+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10";
case "profile111":
return "portable-net45+netcore45+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10";
case "profile158":
return "portable-net45+sl5+netcore45+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10";
case "profile136":
return "portable-net40+sl5+netcore45+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10";
default:
throw new Exception(env);
}
}
public static config_sqlite3 find_sqlite3(string toolset, string cpu)
{
foreach (config_sqlite3 cfg in projects.items_sqlite3)
{
if (
(cfg.toolset == toolset)
&& (cfg.cpu == cpu)
)
{
return cfg;
}
}
//throw new Exception();
return null;
}
public static List<config_sqlite3> find_sqlite3(string toolset)
{
var result = new List<config_sqlite3>();
foreach (config_sqlite3 cfg in projects.items_sqlite3)
{
if (
(cfg.toolset == toolset)
)
{
result.Add(cfg);
}
}
return result;
}
public static config_csproj find(string area, string env)
{
foreach (config_csproj cfg in projects.items_csproj)
{
if (cfg.area == area && cfg.env == env)
{
return cfg;
}
}
return null;
}
public static config_csproj find(string name)
{
foreach (config_csproj cfg in projects.items_csproj)
{
if (cfg.name == name)
{
return cfg;
}
}
return null;
}
public static config_csproj find(string area, string what, string env, string cpu)
{
foreach (config_csproj cfg in projects.items_csproj)
{
if (cfg.area == area && cfg.what == what && cfg.env == env && cfg.cpu == cpu)
{
return cfg;
}
}
return null;
}
public static config_csproj find_core(string env)
{
config_csproj cfg = find("core", env);
if (cfg == null)
{
// TODO need to find a core that is compatible with env
// TODO this should be smarter
switch (env)
{
case "net40":
cfg = find("core", "profile136");
break;
case "net45":
cfg = find("core", "profile111");
break;
case "win81":
cfg = find("core", "profile111");
break;
default:
cfg = find("core", "netstandard11");
//cfg = find("core", "profile259");
break;
}
}
if (cfg != null)
{
return cfg;
}
throw new Exception(string.Format("core not found for {0}", env));
}
public static config_csproj find_provider(string what, string env, string cpu)
{
config_csproj cfg = find("provider", what, env, cpu);
if (cfg == null)
{
switch (env)
{
default:
cfg = find("provider", what, "netstandard11", "anycpu");
//cfg = find("provider", what, "profile259", "anycpu");
break;
}
}
if (cfg != null)
{
return cfg;
}
throw new Exception(string.Format("provider not found for {0}/{1}", what, env));
}
public static config_csproj find_name(string name)
{
config_csproj cfg = find(name);
if (cfg != null)
{
return cfg;
}
throw new Exception(string.Format("csproj not found {0}", name));
}
public static config_csproj find_ugly(string env)
{
config_csproj cfg = find("ugly", env);
if (cfg == null)
{
// TODO need to find one that is compatible with env
// TODO this should be smarter
cfg = find("ugly", "netstandard11");
//cfg = find("ugly", "profile259");
}
if (cfg != null)
{
return cfg;
}
throw new Exception(string.Format("ugly not found for {0}", env));
}
}
public interface config_info
{
string get_project_filename();
string get_name();
}
public static class config_info_ext
{
public static string get_project_subdir(this config_info cfg, string top)
{
string subdir = Path.Combine(Path.Combine(top, cfg.get_name()));
Directory.CreateDirectory(subdir);
return subdir;
}
public static string get_project_path(this config_info cfg, string top)
{
string subdir = cfg.get_project_subdir(top);
string proj = Path.Combine(subdir, cfg.get_project_filename());
return proj;
}
}
public class config_sqlite3 : config_info
{
public string toolset;
public string cpu;
public string guid;
private void add_product(List<string> a, string s)
{
a.Add(Path.Combine(get_name(), "bin", "release", s));
}
public void get_products(List<string> a)
{
add_product(a, "e_sqlite3.dll");
}
private string area()
{
return "sqlite3";
}
string rid()
{
return string.Format("{0}-{1}", projects.rid_front_half(toolset), cpu);
}
public string get_nuget_target_path()
{
return string.Format("runtimes\\{0}\\native\\", rid());
}
public string get_name()
{
return string.Format("{0}.{1}.{2}", area(), toolset, cpu);
}
public string get_project_filename()
{
return string.Format("{0}.vcxproj", get_name());
}
public string fixed_cpu()
{
if (cpu == "x86")
{
return "Win32";
}
else
{
return cpu;
}
}
}
public class config_cppinterop : config_info
{
public string env;
public string cpu;
public string guid;
public config_sqlite3 get_sqlite3_item()
{
string toolset = projects.cs_env_to_toolset(env);
config_sqlite3 other = projects.find_sqlite3(toolset, cpu);
if (other == null)
{
throw new Exception(get_name());
}
return other;
}
private void add_product(List<string> a, string s)
{
a.Add(Path.Combine(get_name(), "bin", "release", s));
}
public void get_products(List<string> a)
{
add_product(a, "SQLitePCL.cppinterop.dll");
switch (env)
{
case "wp80":
add_product(a, "SQLitePCL.cppinterop.winmd");
break;
case "wp81_sl":
add_product(a, "SQLitePCL.cppinterop.pri");
add_product(a, "SQLitePCL.cppinterop.winmd");
break;
default:
throw new Exception("cppinterop invalid env");
}
}
private string area()
{
return "cppinterop";
}
public string get_name()
{
return string.Format("{0}.{1}.{2}.{3}", gen.ROOT_NAME, area(), env, cpu);
}
public string get_project_filename()
{
return string.Format("{0}.vcxproj", get_name());
}
public string fixed_cpu()
{
if (cpu == "x86")
{
return "Win32";
}
else
{
return cpu;
}
}
private string sqlite3_toolset()
{
return projects.cs_env_to_toolset(env);
}
}
public class config_esqlite3 : config_info
{
public string guid;
public string toolset;
public List<config_sqlite3> get_sqlite3_items()
{
List<config_sqlite3> other = projects.find_sqlite3(toolset);
if (other == null)
{
throw new Exception(get_name());
}
return other;
}
private void add_product(List<string> a, string s)
{
a.Add(Path.Combine(get_name(), "bin", "release", s));
}
public string get_name()
{
// TODO could include the word dynamic here
return string.Format("lib.e_sqlite3.{0}", toolset);
}
public string get_title()
{
return string.Format("Native code only (e_sqlite3, compiled with {0}) for SQLitePCLRaw", toolset);
}
public string get_id()
{
return string.Format("{0}.{1}", gen.ROOT_NAME, get_name());
}
public string get_project_filename()
{
throw new NotImplementedException();
}
}
public static class config_cs
{
public static bool env_is_portable(string env)
{
return env.StartsWith("profile");
}
public static bool env_is_netstandard(string env)
{
return env.StartsWith("netstandard");
}
public static string get_full_framework_name(string env)
{
// what this function really does is return whatever
// framework name is full enough for project.json/frameworks.
switch (env)
{
case "ios_classic":
return "MonoTouch,Version=v1.0";
case "ios_unified":
return "Xamarin.iOS10";
case "macos":
return "Xamarin.Mac20";
case "watchos":
return "Xamarin.WatchOS";
case "android":
return "MonoAndroid,Version=v2.3";
case "net45":
return "net45";
case "net40":
return "net40";
case "net35":
return "net35";
case "wp80":
return "wp8";
case "wp81_sl":
return "wp81";
case "wpa81":
return "wpa81";
case "uwp10":
return "uap10.0";
case "win8":
return ".NETCore,Version=4.5.1";
case "win81":
return ".NETCore,Version=4.5.1";
case "tizen":
return "tizen40";
case "profile111":
return ".NETPortable,Version=v4.5,Profile=profile111";
case "profile136":
return ".NETPortable,Version=v4.0,Profile=profile136";
case "profile259":
return ".NETPortable,Version=v4.5,Profile=profile259";
case "netstandard10":
return "netstandard1.0";
case "netstandard11":
return "netstandard1.1";
default:
throw new Exception(env);
}
}
public static string get_nuget_framework_name(string env)
{
switch (env)
{
case "ios_classic":
return "MonoTouch";
case "ios_unified":
return "Xamarin.iOS10";
case "macos":
return "Xamarin.Mac20";
case "watchos":
return "Xamarin.WatchOS";
case "android":
return "MonoAndroid";
case "net45":
return "net45";
case "net40":
return "net40";
case "net35":
return "net35";
case "wp80":
return "wp8";
case "wp81_sl":
return "wp81";
case "wpa81":
return "wpa81";
case "uwp10":
return "uap10.0";
case "win8":
return "win8";
case "win81":
return "win81";
case "tizen":
return "tizen40";
case "netstandard11":
return "netstandard1.1";
case "netstandard10":
return "netstandard1.0";
case "profile111":
case "profile136":
case "profile259":
return projects.get_portable_nuget_target_string(env);
case "netcoreapp":
return "netcoreapp";
default:
throw new Exception(env);
}
}
}
public class config_testapp
{
public string guid;
public string env;
public string cpu;
public string bundle;
public string pattern
{
get
{
switch (env)
{
case "wp81": return "Tests.WP81";
case "android": return "Tests.Android";
case "uwp10": return "Tests.UWP10";
default: throw new Exception();
}
}
}
public string name
{
get
{
return string.Format("tests_{0}_{1}_{2}", bundle, env, cpu);
}
}
}
public class config_csproj : config_info
{
public string area;
public string what; // TODO call this provider_name ?
public string name;
public string guid;
public string assemblyname;
public string env;
public string nuget_override_target_env;
public bool CopyNuGetImplementations;
public string cpu = "anycpu";
public List<string> csfiles_src = new List<string>();
public List<string> csfiles_bld = new List<string>();
public List<string> defines = new List<string>();
public List<string> runtimes = new List<string>();
public Dictionary<string,string> deps = new Dictionary<string,string>();
public bool ref_core;
public bool ref_ugly;
public string ref_provider;
public string ref_embedded;
public bool ref_cppinterop = false;
string root_name
{
get
{
return gen.ROOT_NAME;
}
}
public static config_csproj create_core(string env)
{
var cfg = new config_csproj();
cfg.area = "core";
cfg.name = string.Format("{0}.core.{1}", cfg.root_name, env);
cfg.assemblyname = string.Format("{0}.core", cfg.root_name);
cfg.env = env;
cfg.csfiles_src.Add("raw.cs");
cfg.csfiles_src.Add("intptrs.cs");
cfg.csfiles_src.Add("isqlite3.cs");
cfg.csfiles_src.Add("sqlite3_bait.cs");
return cfg;
}
public static config_csproj create_embedded(string what, string env)
{
var cfg = new config_csproj();
cfg.area = "lib";
switch (env)
{
case "ios_unified":
case "ios_classic":
case "watchos":
cfg.name = string.Format("{0}.lib.{1}.{2}.{3}", cfg.root_name, what, env, "static");
break;
default:
cfg.name = string.Format("{0}.lib.{1}.{2}", cfg.root_name, what, env);
break;
}
cfg.what = what;
cfg.assemblyname = string.Format("{0}.lib.{1}", cfg.root_name, what);
cfg.env = env;
switch (cfg.env)
{
case "ios_classic":
case "ios_unified":
case "watchos":
switch (what)
{
case "custom_sqlite3":
cfg.defines.Add("IOS_PACKAGED_CUSTOM_SQLITE3");
break;
case "e_sqlite3":
cfg.defines.Add("IOS_PACKAGED_E_SQLITE3");
break;
case "sqlcipher":
cfg.defines.Add("IOS_PACKAGED_SQLCIPHER");
break;
default:
throw new Exception(what);
}
break;