diff --git a/scriptsharp/ScriptSharp/CacheCreation.cs b/scriptsharp/ScriptSharp/CacheCreation.cs index 197ce28..a61c27c 100644 --- a/scriptsharp/ScriptSharp/CacheCreation.cs +++ b/scriptsharp/ScriptSharp/CacheCreation.cs @@ -8,7 +8,27 @@ namespace ScriptSharp; public class CacheCreation { - + /** + * 2 ensembles de sdk / .gradle pour android studio kotlin ET android studio flutter + * + * Une fois une version de Android Studio, on va + * - créer un projet avec le wizard + * - le partir sur un émulateur + * - quand tout est beau on ferme Android Studio et on supprime le .gradle puis le Sdk + * - on ouvre le projet et on crée un émulateur avec la version Android de notre choix + * - on laisse le SDK et le .gradle se remplir en sync compile execute + * - on fait le .gradle.7z et le Sdk.7z + * - on dépose le tout sur ##ed5depinfo + * + * Pour Flutter: + * - on crée un projet et on l'exécute + * - on ferme l'IDE + * - on supprime le .gradle + * - on ouvre le projet et on laisse flutter run + * - on fait .gradle-flutter.7z et Sdk-Android-Flutter.7z + * - hop sur \\ed5depinfo + * + */ public static async Task HandleCache() { Utils.LogAndWriteLine("Creation de la cache ..."); diff --git a/scriptsharp/ScriptSharp/Program.cs b/scriptsharp/ScriptSharp/Program.cs index e05fb84..e63cddb 100644 --- a/scriptsharp/ScriptSharp/Program.cs +++ b/scriptsharp/ScriptSharp/Program.cs @@ -129,8 +129,9 @@ await Utils.CopyFileFromNetworkShareAsync( DirectoryInfo jdkDirectory = new DirectoryInfo(jdkPath); string jdkVersion = jdkDirectory.GetDirectories()[0].Name; string javaHome = Path.Combine(jdkPath, jdkVersion); - Environment.SetEnvironmentVariable("JAVA_HOME", javaHome, EnvironmentVariableTarget.User); Utils.AddToPath(Path.Combine(javaHome, "bin")); + Environment.SetEnvironmentVariable("JAVA_HOME", javaHome, EnvironmentVariableTarget.User); + Utils.LogAndWriteLine(" FAIT Installation Java"); } @@ -153,17 +154,18 @@ public static async Task InstallAndroidSDK() // fix ANDROID_SDK_ROOT and ANDROID_HOME with GetSDKPath Utils.LogAndWriteLine("Installation Android SDK démarré"); string sdkPath = Utils.GetSDKPath(); + string androidSdkRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Android", "Sdk"); + Utils.AddToPath(Path.Combine(androidSdkRoot, "cmdline-tools", "latest", "bin")); + Utils.AddToPath(Path.Combine(androidSdkRoot, "emulator")); // get the parent directory of the SDK path string sdkParentPath = Directory.GetParent(sdkPath).FullName; await Utils.Unzip7zFileAsync(Path.Combine(Config.localTemp,"Sdk.7z"), sdkParentPath); // Add environment variables - string androidSdkRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Android", "Sdk"); SetEnvironmentVariable("ANDROID_SDK_ROOT", androidSdkRoot); SetEnvironmentVariable("ANDROID_HOME", androidSdkRoot); // Append to PATH - Utils.AddToPath(Path.Combine(androidSdkRoot, "cmdline-tools", "latest", "bin")); - Utils.AddToPath(Path.Combine(androidSdkRoot, "emulator")); + Utils.LogAndWriteLine(" FAIT Installation Android SDK complet"); } @@ -171,10 +173,11 @@ public static async Task InstallAndroidStudio() { Utils.LogAndWriteLine("Installation Android Studio démarré"); string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + Utils.AddToPath(Path.Combine(desktopPath, "android-studio", "bin")); string destinationFolder = Path.Combine(desktopPath); await Utils.Unzip7zFileAsync(Path.Combine(Config.localTemp,"android-studio.7z"), destinationFolder); // TODO add shortcut - Utils.AddToPath(Path.Combine(desktopPath, "android-studio", "bin")); + Utils.LogAndWriteLine(" FAIT Installation Android Studio fini"); } diff --git a/scriptsharp/ScriptSharp/Script3N5.cs b/scriptsharp/ScriptSharp/Script3N5.cs index a86a38d..e70b66b 100644 --- a/scriptsharp/ScriptSharp/Script3N5.cs +++ b/scriptsharp/ScriptSharp/Script3N5.cs @@ -57,6 +57,7 @@ public static async Task DownloadRepo3N5() public static async Task Handle3N5KotlinConsoleAsync() { Utils.LogAndWriteLine("Installation de kotlin (console) 3N5..."); + Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); await Task.WhenAll( Utils.CopyFileFromNetworkShareAsync( Path.Combine(Config.localCache, "idea.7z"), @@ -70,7 +71,6 @@ await Task.WhenAll( "idea") ), Program.InstallJava() ); - Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); Utils.LogAndWriteLine("Premier gradle build pour constituer le .gradle"); // install plugins TODO ? one day? // Utils.RunCommand("idea64.exe installPlugins io.flutter"); diff --git a/scriptsharp/ScriptSharp/Script4N6.cs b/scriptsharp/ScriptSharp/Script4N6.cs index 5f1443f..9b4e7bf 100644 --- a/scriptsharp/ScriptSharp/Script4N6.cs +++ b/scriptsharp/ScriptSharp/Script4N6.cs @@ -9,6 +9,7 @@ public class Script4N6 public static async Task Handle4N6AndroidSpringAsync() { Utils.LogAndWriteLine("Installation pour 4N6 Android + serveur Spring ..."); + Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); await Utils.CopyFileFromNetworkShareAsync( Path.Combine(Config.localCache, "Sdk.7z"), Path.Combine(Config.localTemp,"Sdk.7z")); @@ -36,8 +37,7 @@ await Task.WhenAll( DownloadRepo4N6()); // start android studio Utils.CreateDesktopShortcut("IntelliJ", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin", "idea64.exe")); - Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); - + await Utils.StartAndroidStudio(); Utils.StartKMB(); Utils.LogAndWriteLine(" FAIT Installation 4N6 Android + serveur Spring "); diff --git a/scriptsharp/ScriptSharp/Script5N6.cs b/scriptsharp/ScriptSharp/Script5N6.cs index 3f0719b..4d94d5f 100644 --- a/scriptsharp/ScriptSharp/Script5N6.cs +++ b/scriptsharp/ScriptSharp/Script5N6.cs @@ -9,13 +9,14 @@ public class Script5N6 public static async Task Handle5N6FlutterAsync() { Utils.LogAndWriteLine("Installation de 5N6 flutter (et Android Studio plus Intellij)..."); + Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); await Utils.CopyFileFromNetworkShareAsync( Path.Combine(Config.localCache, "Sdk-Android-Flutter.7z"), Path.Combine(Config.localTemp, "Sdk.7z") ); await Task.WhenAll( Program.InstallAndroidSDK(), Utils.CopyFileFromNetworkShareAsync( - Path.Combine(Config.localCache, ".gradle.7z"), + Path.Combine(Config.localCache, ".gradle-Android-Flutter.7z"), Path.Combine(Config.localTemp, ".gradle.7z")), Program.InstallJava(), Utils.CopyFileFromNetworkShareAsync( @@ -34,20 +35,22 @@ await Task.WhenAll( Program.InstallAndroidStudio(), Program.DownloadRepoKMB(), DownloadRepo5N6()); - Utils.CreateDesktopShortcut("IntelliJ", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin", "idea64.exe")); - Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin")); + Utils.RunCommand("studio64.exe installPlugins io.flutter"); Utils.RunCommand("studio64.exe installPlugins com.github.copilot"); Utils.RunCommand("studio64.exe installPlugins com.localizely.flutter-intl"); await InstallFlutter(); Utils.StartKMB(); await Utils.StartAndroidStudio(); + Utils.CreateDesktopShortcut("IntelliJ", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "idea", "bin", "idea64.exe")); Utils.LogAndWriteLine(" FAIT 5N6 Flutter complet"); } private static async Task InstallFlutter() { Utils.LogAndWriteLine("Installation Flutter démarré"); + // ajouter flutter au path + Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "flutter", "bin")); // TODO remove this in favor of cache flutter await Utils.CopyFileFromNetworkShareAsync( Path.Combine(Config.localCache, "flutter.7z"), @@ -55,8 +58,6 @@ await Utils.CopyFileFromNetworkShareAsync( await Utils.Unzip7zFileAsync( Path.Combine(Config.localTemp, "flutter.7z"), Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); - // ajouter flutter au path - Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "flutter", "bin")); // execute "flutter doctor --android-licenses" Utils.RunCommand("flutter config --android-sdk "+Utils.GetSDKPath()); Utils.RunCommand("flutter config --android-studio-dir "+Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "android-studio")); @@ -78,7 +79,7 @@ await Utils.CopyFileFromNetworkShareAsync( await Task.WhenAll( Program.InstallAndroidSDK(), Utils.CopyFileFromNetworkShareAsync( - Path.Combine(Config.localCache, ".gradle.7z"), + Path.Combine(Config.localCache, ".gradle-Android-Flutter.7z"), Path.Combine(Config.localTemp, ".gradle.7z")), Program.InstallJava(), Utils.CopyFileFromNetworkShareAsync(