Skip to content

Commit

Permalink
Add HTTPS using OpenSSL (#32)
Browse files Browse the repository at this point in the history
* Switch over to toml11

* Remove cpptoml

* Switch over to using a separate internal representation for the recipe to maintain order and allow for comments

* Round trip comments

* Fix value bug

* Switch to iniailize command

* Match new update/create package api

* Add basic auth api

* Fix breaking issues in latest msvc

* Fix some stuff

* Add (disabled) botan client

* Add missing exports

* Add missing exports

* Enable HTTPS requests

* Add console manager to read password

* Better status results for api

* Cleanup messages

Co-authored-by: Matthew Asplund <[email protected]>
  • Loading branch information
mwasplund and Matthew Asplund authored Apr 19, 2020
1 parent 6ca4ecb commit 6b9b88c
Show file tree
Hide file tree
Showing 79 changed files with 2,347 additions and 363 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@

# Build
out/
bin/
obj/
11 changes: 7 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
url = https://github.com/mwasplund/Json11.git
[submodule "Dependencies/toml11"]
path = Dependencies/toml11
url = https://github.com/mwasplund/toml11.git
[submodule "Dependencies/cpptoml"]
path = Dependencies/cpptoml
url = https://github.com/mwasplund/cpptoml.git
url = https://github.com/mwasplund/toml11.gits
[submodule "Dependencies/cpp-httplib"]
path = Dependencies/cpp-httplib
url = https://github.com/mwasplund/cpp-httplib.git
[submodule "Dependencies/LzmaSdk"]
path = Dependencies/LzmaSdk
url = https://github.com/mwasplund/LzmaSdk.git
[submodule "Dependencies/botan"]
path = Dependencies/botan
url = https://github.com/mwasplund/botan.git
[submodule "Dependencies/openssl"]
path = Dependencies/openssl
url = https://github.com/openssl/openssl.git
2 changes: 1 addition & 1 deletion Dependencies/LzmaSdk
2 changes: 1 addition & 1 deletion Dependencies/SoupTest
2 changes: 1 addition & 1 deletion Dependencies/cpp-httplib
Submodule cpp-httplib updated 2 files
+24 −0 Recipe.toml
+31 −6 httplib.h
1 change: 0 additions & 1 deletion Dependencies/cpptoml
Submodule cpptoml deleted from 56c804
1 change: 1 addition & 0 deletions Dependencies/openssl
Submodule openssl added at 6f8922
2 changes: 1 addition & 1 deletion Dependencies/toml11
17 changes: 16 additions & 1 deletion Docs/DeveloperSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,30 @@
* [Build Tools For Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with "c++ build tools" workload.
* [Latest Release](https://github.com/mwasplund/Soup/releases)

### OpenSSL Requirements
* Perl. We recommend ActiveState Perl, available from https://www.activestate.com/ActivePerl
* Netwide Assembler, a.k.a. NASM, available from https://www.nasm.us

## Setup
Clone the repository and all submodules recursively.

```
git clone --recursive https://github.com/mwasplund/Soup.git
```

## Build the client
## Build

### Build openssl
using x64 Native Tools Command Prompt for VS 2019
```
cd Dependencies/openssl
PATH=%PATH%;"C:\Program Files\NASM"
perl Configure VC-WIN64A
nmake
nmake test
```

### Build the Client
```
cd Source/Client
soup build
Expand Down
2 changes: 2 additions & 0 deletions Source/Client/Commands/BuildCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ namespace Soup::Client
// arguments.PlatformLibraries.push_back(Path("odbc32.lib"));
// arguments.PlatformLibraries.push_back(Path("odbccp32.lib"));

arguments.PlatformLibraries.push_back("crypt32.lib");

std::string runtimeCompiler = config.GetRuntimeCompiler();
std::string systemCompiler = runtimeCompiler;

Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Commands/InitializeCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main()
private:
void UpdateDefaultValues(Recipe& recipe)
{
Log::HighPriority("Name: (" + std::string(recipe.GetName()) + ")");
Log::HighPriority("Name: (" + recipe.GetName() + ")");
auto newName = std::string();
std::getline(std::cin, newName);
if (!newName.empty())
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Commands/RunCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace Soup::Client
auto configuration = "release";
auto compilerName = config.GetRuntimeCompiler();
auto binaryDirectory = RecipeExtensions::GetBinaryDirectory(compilerName, configuration);
auto executablePath = workingDirectory + binaryDirectory + Path(std::string(recipe.GetName()) + ".exe");
auto executablePath = workingDirectory + binaryDirectory + Path(recipe.GetName() + ".exe");
Log::Info(executablePath.ToString());
if (!System::IFileSystem::Current().Exists(executablePath))
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Commands/VersionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Soup::Client

// TODO var version = Assembly.GetExecutingAssembly().GetName().Version;
// Log::Message($"{version.Major}.{version.Minor}.{version.Build}");
Log::HighPriority("0.5.7");
Log::HighPriority("0.6.0");
}

private:
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Options/ArgumentsParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Soup::Client

result = std::move(options);
}
else if (commandType == "init")
else if (commandType == "initialize")
{
Log::Diag("Parse initialize");

Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Options/InitializeOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Soup::Client
/// <summary>
/// Initialize Command Options
/// </summary>
// TODO: [Verb("init")]
// TODO: [Verb("initialize")]
class InitializeOptions : public SharedOptions
{
};
Expand Down
5 changes: 3 additions & 2 deletions Source/Client/Program.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace Soup::Client
Network::INetworkManager::Register(std::make_shared<Network::HttpLibNetworkManager>());
System::IFileSystem::Register(std::make_shared<System::STLFileSystem>());
System::IProcessManager::Register(std::make_shared<System::PlatformProcessManager>());
IO::IConsoleManager::Register(std::make_shared<IO::SystemConsoleManager>());

// Attempt to parse the provided arguments
Log::Diag("ProgramStart");
Expand Down Expand Up @@ -91,7 +92,7 @@ namespace Soup::Client
else if (arguments.IsA<ViewOptions>())
command = Setup(arguments.ExtractResult<ViewOptions>());
else
throw std::runtime_error("Unknown arguments.");
throw std::runtime_error("Unknown arguments");

// Run the requested command
Log::Diag("Run Command");
Expand All @@ -101,7 +102,7 @@ namespace Soup::Client
}
catch (const std::exception& ex)
{
Log::Error("Exception Handled: Exiting.");
Log::Error("Exception Handled: Exiting");
Log::Error(ex.what());
return -2;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name = "Soup"
Version = "0.5.6"
Version = "0.6.0"
Type = "Executable"

# Ensure the core build extensions are runtime dependencies
Expand Down
13 changes: 12 additions & 1 deletion Source/Compiler/MSVC.UnitTests/CompilerArgumentBuilderTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++11",
"/Od",
"/X",
Expand Down Expand Up @@ -107,6 +108,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/showIncludes",
"/std:c++11",
"/Od",
Expand Down Expand Up @@ -153,6 +155,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
expectedFlag,
"/Od",
"/X",
Expand Down Expand Up @@ -195,6 +198,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++latest",
"/experimental:module",
"/Od",
Expand Down Expand Up @@ -239,6 +243,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++17",
"/Od",
"/X",
Expand Down Expand Up @@ -284,6 +289,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++17",
expectedFlag,
"/X",
Expand Down Expand Up @@ -328,6 +334,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/Z7",
"/std:c++17",
"/Od",
Expand Down Expand Up @@ -374,6 +381,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++11",
"/Od",
"/I\"C:/Files/SDK/\"",
Expand Down Expand Up @@ -421,6 +429,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++11",
"/Od",
"/DDEBUG",
Expand Down Expand Up @@ -468,6 +477,7 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++11",
"/Od",
"/X",
Expand Down Expand Up @@ -516,13 +526,14 @@ namespace Soup::Compiler::MSVC::UnitTests

auto expectedArguments = std::vector<std::string>({
"/nologo",
"/Zc:__cplusplus",
"/std:c++11",
"/Od",
"/X",
"/RTC1",
"/EHsc",
"/MT",
"/module:export",
"/module:interface",
"/module:output",
"\"module.ifc\"",
"/bigobj",
Expand Down
4 changes: 2 additions & 2 deletions Source/Compiler/MSVC.UnitTests/CompilerTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Soup::Compiler::MSVC::UnitTests
new Build::BuildGraphNode(
"File.cpp",
"bin/mock.cl.exe",
"/nologo /std:c++11 /Od /X /RTC1 /EHsc /MT /bigobj /c File.cpp /Fo\"obj/File.obj\"",
"/nologo /Zc:__cplusplus /std:c++11 /Od /X /RTC1 /EHsc /MT /bigobj /c File.cpp /Fo\"obj/File.obj\"",
"Source",
std::vector<std::string>({
"File.cpp",
Expand Down Expand Up @@ -90,7 +90,7 @@ namespace Soup::Compiler::MSVC::UnitTests
new Build::BuildGraphNode(
"File.cpp",
"bin/mock.cl.exe",
"/nologo /std:c++11 /Od /I\"Includes\" /DDEBUG /X /RTC1 /EHsc /MT /module:reference \"Module.pcm\" /module:export /module:output \"obj/File.ifc\" /bigobj /c File.cpp /Fo\"obj/File.obj\"",
"/nologo /Zc:__cplusplus /std:c++11 /Od /I\"Includes\" /DDEBUG /X /RTC1 /EHsc /MT /module:reference \"Module.pcm\" /module:interface /module:output \"obj/File.ifc\" /bigobj /c File.cpp /Fo\"obj/File.obj\"",
"Source",
std::vector<std::string>({
"Module.pcm",
Expand Down
5 changes: 4 additions & 1 deletion Source/Compiler/MSVC/ArgumentBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace Soup::Compiler::MSVC
// Disable the logo
AddFlag(commandArgs, ArgumentFlag_NoLogo);

// Get better support for _cplusplus macro version
AddParameter(commandArgs, "Zc", "__cplusplus");

// Enable Header includes if needed
if (args.GenerateIncludeTree)
{
Expand Down Expand Up @@ -153,7 +156,7 @@ namespace Soup::Compiler::MSVC

if (args.ExportModule)
{
AddParameter(commandArgs, Compiler_ArgumentParameter_Module, "export");
AddParameter(commandArgs, Compiler_ArgumentParameter_Module, "interface");

// Place the ifc in the output directory
//var outputFile = "{Path.GetFileNameWithoutExtension(sourceFile)}.{ModuleFileExtension}";
Expand Down
Loading

0 comments on commit 6b9b88c

Please sign in to comment.