@@ -31,6 +31,12 @@ func androidSubcommand() *cobra.Command {
31
31
Use : "gomobile" ,
32
32
Short : "Builds oonimkall for android using gomobile" ,
33
33
Run : func (cmd * cobra.Command , args []string ) {
34
+ // Implementation note: perform the check here such that we can
35
+ // run unit test for the building code from any system
36
+ runtimex .Assert (
37
+ runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
38
+ "this command requires darwin or linux" ,
39
+ )
34
40
androidBuildGomobile (& buildDeps {})
35
41
},
36
42
})
@@ -39,6 +45,12 @@ func androidSubcommand() *cobra.Command {
39
45
Use : "cli" ,
40
46
Short : "Builds ooniprobe and miniooni for usage within termux" ,
41
47
Run : func (cmd * cobra.Command , args []string ) {
48
+ // Implementation note: perform the check here such that we can
49
+ // run unit test for the building code from any system
50
+ runtimex .Assert (
51
+ runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
52
+ "this command requires darwin or linux" ,
53
+ )
42
54
androidBuildCLIAll (& buildDeps {})
43
55
},
44
56
})
@@ -48,6 +60,12 @@ func androidSubcommand() *cobra.Command {
48
60
Short : "Cross compiles C dependencies for Android" ,
49
61
Run : func (cmd * cobra.Command , args []string ) {
50
62
for _ , arg := range args {
63
+ // Implementation note: perform the check here such that we can
64
+ // run unit test for the building code from any system
65
+ runtimex .Assert (
66
+ runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
67
+ "this command requires darwin or linux" ,
68
+ )
51
69
androidCdepsBuildMain (arg , & buildDeps {})
52
70
}
53
71
},
@@ -59,11 +77,6 @@ func androidSubcommand() *cobra.Command {
59
77
60
78
// androidBuildGomobile invokes the gomobile build.
61
79
func androidBuildGomobile (deps buildtoolmodel.Dependencies ) {
62
- runtimex .Assert (
63
- runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
64
- "this command requires darwin or linux" ,
65
- )
66
-
67
80
deps .PsiphonMaybeCopyConfigFiles ()
68
81
deps .GolangCheck ()
69
82
@@ -132,11 +145,6 @@ func androidNDKCheck(androidHome string) string {
132
145
133
146
// androidBuildCLIAll builds all products in CLI mode for Android
134
147
func androidBuildCLIAll (deps buildtoolmodel.Dependencies ) {
135
- runtimex .Assert (
136
- runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
137
- "this command requires darwin or linux" ,
138
- )
139
-
140
148
deps .PsiphonMaybeCopyConfigFiles ()
141
149
deps .GolangCheck ()
142
150
@@ -379,10 +387,6 @@ func androidNDKBinPath(ndkDir string) string {
379
387
380
388
// androidCdepsBuildMain builds C dependencies for android.
381
389
func androidCdepsBuildMain (name string , deps buildtoolmodel.Dependencies ) {
382
- runtimex .Assert (
383
- runtime .GOOS == "darwin" || runtime .GOOS == "linux" ,
384
- "this command requires darwin or linux" ,
385
- )
386
390
androidHome := deps .AndroidSDKCheck ()
387
391
ndkDir := deps .AndroidNDKCheck (androidHome )
388
392
archs := []string {"arm" , "arm64" , "386" , "amd64" }
0 commit comments