private void LoadProjectInfo() { string projectType = _metadataDocument.GetScalarValue(new[] { "project_type" }); switch (projectType) { case "app": Type = DartProjectType.App; break; case "module": Type = DartProjectType.Module; break; case "package": Type = DartProjectType.Package; break; default: throw new ArgumentException($"Unknown Dart project type: {projectType}"); } ValidatePubspecFile(); Name = _pubspecDocument.GetScalarValue(new[] { NameYamlNode }); Description = _pubspecDocument.GetScalarValue(new[] { DescriptionYamlNode }); Author = _pubspecDocument.GetScalarValue(new[] { AuthorYamlNode }); Homepage = _pubspecDocument.GetScalarValue(new[] { HomepageYamlNode }); Version = _pubspecDocument.GetScalarValue(new[] { VersionYamlNode }); Sdk = _pubspecDocument.GetScalarValue(new[] { EnvironmentYamlNode, SdkYamlNode }); }
/// <summary> /// Returns the path of the Android AAR created when building a Flutter module. /// </summary> public static string GetAndroidArchivePath(string flutterFolder, YamlDocument pubspecFile, FlutterModuleBuildConfig buildConfig) { // Please consider a Flutter module created with the following command: // // flutter create -t module --org com.example hello_world // // Now, build the module for Android integration: // // flutter build aar // // The output AAR for Debug configuration is located under: // // <MODULE_FOLDER>\build\host\outputs\repo\com\example\hello_world\flutter_debug\1.0\flutter_debug-1.0.aar // <MODULE_FOLDER>\build\host\outputs\repo\ string repoRootFolder = Path.Combine(flutterFolder, "build", "host", "outputs", "repo"); // Find the 'androidPackage' info from the pubspec.yaml file string package = pubspecFile.GetScalarValue(new [] { "flutter", "module", "androidPackage" }); // <MODULE_FOLDER>\build\host\outputs\repo\com\example\hello_world\ string packageRootFolder = repoRootFolder; string[] packageFolders = string.IsNullOrEmpty(package) ? new string[0] : package.Split("."); foreach (string folder in packageFolders) { packageRootFolder = Path.Combine(packageRootFolder, folder); } string version = "1.0"; string build; switch (buildConfig) { case FlutterModuleBuildConfig.Debug: build = "debug"; break; case FlutterModuleBuildConfig.Profile: build = "profile"; break; case FlutterModuleBuildConfig.Release: build = "release"; break; default: throw new ArgumentOutOfRangeException(nameof(buildConfig), buildConfig, null); } // <MODULE_FOLDER>\build\host\outputs\repo\com\example\hello_world\flutter_debug\1.0\flutter_debug-1.0.aar string path = Path.Combine(packageRootFolder, $"flutter_{build}", version, $"flutter_{build}-{version}.aar"); return(path); }
private static string GetIosFrameworkPathCore(string flutterFolder, YamlDocument pubspecFile, FlutterModuleBuildConfig buildConfig, bool xcframework) { // Please consider a Flutter module created with the following command: // // flutter create -t module --org com.example hello_world // // Now, build the module for iOS integration: // // flutter build ios-framework // // The output framework for Debug configuration is located under: // // <MODULE_FOLDER>\build\ios\Debug\App.xcframework (Flutter 2.*) // // or // // <MODULE_FOLDER>\build\ios\Debug\App.framework (Flutter 1.*) // <MODULE_FOLDER>\build\ios\framework\ string frameworkRootFolder = Path.Combine(flutterFolder, "build", "ios", "framework"); // Find the 'iosBundleIdentifier' info from the pubspec.yaml file string bundle = pubspecFile.GetScalarValue(new [] { "flutter", "module", "iosBundleIdentifier" }); string build; switch (buildConfig) { case FlutterModuleBuildConfig.Debug: build = "Debug"; break; case FlutterModuleBuildConfig.Profile: build = "Profile"; break; case FlutterModuleBuildConfig.Release: build = "Release"; break; default: throw new ArgumentOutOfRangeException(nameof(buildConfig), buildConfig, null); } // <MODULE_FOLDER>\build\ios\Debug\App.framework string path = Path.Combine(frameworkRootFolder, build, xcframework ? "App.xcframework" : "App.framework"); return(path); }