Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include license and warranty statement with solc. #2353

Merged
merged 2 commits into from
Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ include(EthExecutableHelper)
# Include utils
include(EthUtils)

# Create license.h from LICENSE.txt and template
file(READ ${CMAKE_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT)
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/license.h.in" "license.h")

include(EthOptions)
configure_project(TESTS)

Expand Down
3 changes: 3 additions & 0 deletions cmake/templates/license.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

static char const* licenseText = R"(@LICENSE_TEXT@)";
28 changes: 25 additions & 3 deletions solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "CommandLineInterface.h"

#include "solidity/BuildInfo.h"
#include "license.h"

#include <libsolidity/interface/Version.h>
#include <libsolidity/parsing/Scanner.h>
Expand Down Expand Up @@ -94,6 +95,7 @@ static string const g_strHelp = "help";
static string const g_strInputFile = "input-file";
static string const g_strInterface = "interface";
static string const g_strJulia = "julia";
static string const g_strLicense = "license";
static string const g_strLibraries = "libraries";
static string const g_strLink = "link";
static string const g_strMetadata = "metadata";
Expand Down Expand Up @@ -186,6 +188,13 @@ static void version()
exit(0);
}

static void license()
{
// This is a static variable generated by cmake from LICENSE.txt
cout << licenseText << endl;
exit(0);
}

static bool needsHumanTargetedStdout(po::variables_map const& _args)
{
if (_args.count(g_argGas))
Expand Down Expand Up @@ -510,8 +519,13 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da
bool CommandLineInterface::parseArguments(int _argc, char** _argv)
{
// Declare the supported options.
po::options_description desc(
R"(solc, the Solidity commandline compiler.
po::options_description desc(R"(solc, the Solidity commandline compiler.

Solidity Copyright (C) 2014-2017 Solidity contributors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the copyright statement here? It is not even in the headers yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can do without, but the GPL "how to apply the license" suggests this. The thing is that the copyright is just shared by the authors which I think is the default, so perhaps we can just remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should sort this in a separate PR which also adds it to the files. Gives us more time to find the proper wording :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess "Copyright (C) 2014-2017 the Solidity authors and contributors." should be more clear. There seem to be a distinction between the two words, whereas author means the "initial creator", while contributor is anyone else.

This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See 'solc --license'
for details.

Usage: solc [options] [input_file...]
Compiles the given Solidity input files (or the standard input if none given or
"-" is used as a file name) and outputs the components specified in the options
Expand All @@ -523,10 +537,12 @@ remap paths using the context:prefix=path syntax.

Allowed options)",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length - 23);
po::options_description::m_default_line_length - 23
);
desc.add_options()
(g_argHelp.c_str(), "Show help message and exit.")
(g_argVersion.c_str(), "Show version and exit.")
(g_strLicense.c_str(), "Show licensing information and exit.")
(g_argOptimize.c_str(), "Enable bytecode optimizer.")
(
g_argOptimizeRuns.c_str(),
Expand Down Expand Up @@ -633,6 +649,12 @@ Allowed options)",
return false;
}

if (m_args.count(g_strLicense))
{
license();
return false;
}

if (m_args.count(g_argCombinedJson))
{
vector<string> requests;
Expand Down