1
1
import 'dart:io' ;
2
2
3
3
import 'package:collection/collection.dart' ;
4
+ import 'package:native_assets_cli/native_assets_cli.dart' ;
4
5
import 'package:native_toolchain_rust/rustup.dart' ;
5
6
import 'package:native_toolchain_rust/src/android_linker_wrapper.dart' ;
6
7
import 'package:path/path.dart' as path;
@@ -86,8 +87,6 @@ class AndroidEnvironment {
86
87
Future <Map <String , String >> buildEnvironment () async {
87
88
final toolchainPath = ndkInfo.toolchainPath;
88
89
89
- final exe = Platform .isWindows ? '.exe' : '' ;
90
-
91
90
final arKey = 'AR_${target .triple }' ;
92
91
final arValue = ['${target .triple }-ar' , 'llvm-ar' , 'llvm-ar.exe' ]
93
92
.map ((e) => path.join (toolchainPath, e))
@@ -99,12 +98,18 @@ class AndroidEnvironment {
99
98
final targetArg = '--target=${target .triple }$minSdkVersion ' ;
100
99
101
100
final ccKey = 'CC_${target .triple }' ;
102
- final ccValue = path.join (toolchainPath, 'clang$exe ' );
101
+ final ccValue = path.join (
102
+ toolchainPath,
103
+ OS .current.executableFileName ('clang' ),
104
+ );
103
105
final cfFlagsKey = 'CFLAGS_${target .triple }' ;
104
106
final cFlagsValue = targetArg;
105
107
106
108
final cxxKey = 'CXX_${target .triple }' ;
107
- final cxxValue = path.join (toolchainPath, 'clang++$exe ' );
109
+ final cxxValue = path.join (
110
+ toolchainPath,
111
+ OS .current.executableFileName ('clang++' ),
112
+ );
108
113
final cxxFlagsKey = 'CXXFLAGS_${target .triple }' ;
109
114
final cxxFlagsValue = targetArg;
110
115
@@ -113,7 +118,10 @@ class AndroidEnvironment {
113
118
.toUpperCase ();
114
119
115
120
final ranlibKey = 'RANLIB_${target .triple }' ;
116
- final ranlibValue = path.join (toolchainPath, 'llvm-ranlib$exe ' );
121
+ final ranlibValue = path.join (
122
+ toolchainPath,
123
+ OS .current.executableFileName ('llvm-ranlib' ),
124
+ );
117
125
118
126
final rustFlagsKey = 'CARGO_ENCODED_RUSTFLAGS' ;
119
127
final rustFlagsValue = _libGccWorkaround (targetTempDir, ndkInfo.ndkVersion);
0 commit comments