Flutter Engine
 
Loading...
Searching...
No Matches
license_file_compare.cc File Reference
#include <iostream>
#include "flutter/third_party/re2/re2/re2.h"
#include "flutter/tools/licenses_cpp/src/mmap_file.h"
#include "third_party/abseil-cpp/absl/container/flat_hash_set.h"
#include "third_party/abseil-cpp/absl/log/check.h"
#include "third_party/abseil-cpp/absl/log/globals.h"
#include "third_party/abseil-cpp/absl/log/initialize.h"
#include "third_party/abseil-cpp/absl/log/log.h"

Go to the source code of this file.

Functions

int main (int argc, const char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

Definition at line 32 of file license_file_compare.cc.

32 {
33 if (argc != 3) {
34 std::cerr << "usage: " << argv[0] << " <path> <path>" << std::endl;
35 return 1;
36 }
37
38 absl::InitializeLog();
39 absl::SetStderrThreshold(absl::LogSeverity::kInfo);
40
41 absl::StatusOr<MMapFile> first = MMapFile::Make(argv[1]);
42 CHECK(first.ok());
43 absl::StatusOr<MMapFile> second = MMapFile::Make(argv[2]);
44 CHECK(second.ok());
45
46 absl::flat_hash_set<std::string_view> first_copyrights =
47 GetCopyrights(*first);
48 absl::flat_hash_set<std::string_view> second_copyrights =
49 GetCopyrights(*second);
50
51 LOG(INFO) << "first size: " << first_copyrights.size();
52 LOG(INFO) << "second size: " << second_copyrights.size();
53
54 for (std::string_view entry : first_copyrights) {
55 if (second_copyrights.find(entry) == second_copyrights.end()) {
56 LOG(INFO) << "second missing: " << entry;
57 }
58 }
59 for (std::string_view entry : second_copyrights) {
60 if (first_copyrights.find(entry) == first_copyrights.end()) {
61 LOG(INFO) << "first missing: " << entry;
62 }
63 }
64
65 return 0;
66}
static absl::StatusOr< MMapFile > Make(std::string_view path)
Definition mmap_file.cc:13
char ** argv
Definition library.h:9

References argv, and MMapFile::Make().