diff --git a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart index bb394eac4..745efbcfa 100644 --- a/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart +++ b/pkgs/native_assets_builder/lib/src/build_runner/build_runner.dart @@ -434,7 +434,6 @@ class NativeAssetsBuildRunner { null, hookKernelFile, packageLayout!, - _filteredEnvironment(_environmentVariablesFilter), ), ); if (buildOutput == null) return null; @@ -490,7 +489,6 @@ class NativeAssetsBuildRunner { final environmentFile = File.fromUri( config.outputDirectory.resolve('../environment.json'), ); - final environment = _filteredEnvironment(_environmentVariablesFilter); if (buildOutputFile.existsSync() && dependenciesHashFile.existsSync() && environmentFile.existsSync()) { @@ -514,7 +512,7 @@ ${e.message} !const MapEquality().equals( (json.decode(await environmentFile.readAsString()) as Map) .cast(), - environment); + Platform.environment); if (!dependenciesOutdated && !environmentChanged) { logger.info( [ @@ -537,7 +535,6 @@ ${e.message} resources, hookKernelFile, packageLayout, - environment, ); if (result == null) { if (await dependenciesHashFile.exists()) { @@ -545,7 +542,7 @@ ${e.message} } } else { await environmentFile.writeAsString( - json.encode(environment), + json.encode(Platform.environment), ); final modifiedDuringBuild = await dependenciesHashes.hashFiles( [ @@ -564,18 +561,6 @@ ${e.message} ); } - /// Limit the environment that hook invocations get to see. - /// - /// This allowlist lists environment variables needed to run mainstream - /// compilers. - static const _environmentVariablesFilter = { - 'ANDROID_HOME', - 'PATH', - 'SYSTEMROOT', - 'TEMP', - 'TMP', - }; - Future _runHookForPackage( Hook hook, HookConfig config, @@ -585,7 +570,6 @@ ${e.message} Uri? resources, File hookKernelFile, PackageLayout packageLayout, - Map environment, ) async { final configFile = config.outputDirectory.resolve('../config.json'); final configFileContents = @@ -610,8 +594,6 @@ ${e.message} executable: dartExecutable, arguments: arguments, logger: logger, - includeParentEnvironment: false, - environment: environment, ); var deleteOutputIfExists = false; @@ -668,12 +650,6 @@ ${e.message} } } - Map _filteredEnvironment(Set allowList) => { - for (final entry in Platform.environment.entries) - if (allowList.contains(entry.key.toUpperCase())) - entry.key: entry.value, - }; - /// Compiles the hook to kernel and caches the kernel. /// /// If any of the Dart source files, or the package config changed after @@ -776,8 +752,6 @@ ${e.message} executable: dartExecutable, arguments: compileArguments, logger: logger, - includeParentEnvironment: false, - environment: _filteredEnvironment({'HOME', 'PUB_CACHE'}), ); var success = true; if (compileResult.exitCode != 0) {