(string ns,
VsVersions vsVersion, WinVersions winVersion, string winmd,
string npmPackageVersion, string npmScope, string outDir, bool noDefGen, bool noBuild, bool verbose)
| 160 | } |
| 161 | |
| 162 | static bool GenerateAndBuildNamespace(string ns, |
| 163 | VsVersions vsVersion, WinVersions winVersion, string winmd, |
| 164 | string npmPackageVersion, string npmScope, string outDir, bool noDefGen, bool noBuild, bool verbose) |
| 165 | { |
| 166 | string moduleOutDir = Path.Combine(outDir, ns.ToLower()); |
| 167 | |
| 168 | if (!Directory.Exists(moduleOutDir)) |
| 169 | { |
| 170 | Directory.CreateDirectory(moduleOutDir); |
| 171 | } |
| 172 | |
| 173 | var generator = new NodeRTProjectGenerator(winVersion, vsVersion, !noDefGen); |
| 174 | |
| 175 | Console.WriteLine("Generating code for: {0}...", ns); |
| 176 | |
| 177 | try |
| 178 | { |
| 179 | Reflector.GenerateProject(winmd, ns, moduleOutDir, generator, npmPackageVersion, npmScope, null); |
| 180 | } |
| 181 | catch (Exception e) |
| 182 | { |
| 183 | Console.WriteLine("Failed to generate code, error: {0}", e.Message); |
| 184 | return false; |
| 185 | } |
| 186 | |
| 187 | if (!noBuild) |
| 188 | { |
| 189 | Console.WriteLine("Building {0}...", ns); |
| 190 | |
| 191 | try |
| 192 | { |
| 193 | NodeRTProjectBuildUtils.BuildWithNodeGyp(moduleOutDir, vsVersion, verbose); |
| 194 | } |
| 195 | catch (IOException e) |
| 196 | { |
| 197 | Console.WriteLine("IO Error occured after building the project, error: {0}", e.Message); |
| 198 | Console.WriteLine("Generated project files are located at: {0}", moduleOutDir); |
| 199 | return false; |
| 200 | } |
| 201 | catch (Exception) |
| 202 | { |
| 203 | Console.WriteLine("Failed to build the generated project, please try to build the project manually"); |
| 204 | Console.WriteLine("Generated project files are located at: {0}", moduleOutDir); |
| 205 | return false; |
| 206 | } |
| 207 | Console.WriteLine("NodeRT module generated and built successfully at: {0}", moduleOutDir); |
| 208 | } |
| 209 | return true; |
| 210 | } |
| 211 | |
| 212 | static bool ValidateArguments(Dictionary<String, String> args) |
| 213 | { |
nothing calls this directly
no test coverage detected