Skip to content

Commit

Permalink
[GN] migrate third_party/zlib:zip_unittests to GN
Browse files Browse the repository at this point in the history
b/211924019

Change-Id: I13e4941c19d425c2d8d57603ad1f43200f9a56d3
  • Loading branch information
Cobalt Team committed Dec 31, 2021
1 parent 016fcfd commit d4ab936
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
57 changes: 56 additions & 1 deletion third_party/zlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,13 @@ static_library("minizip") {
":zlib",
]

if (!is_starboard) {
if (is_starboard) {
sources += [
"contrib/minizip/iostarboard.c",
"contrib/minizip/iostarboard.h",
]
deps += [ "//starboard:starboard_headers_only" ]
} else {
configs -= [ "//build/config/compiler:chromium_code" ]
}
configs += [
Expand Down Expand Up @@ -448,3 +454,52 @@ if (!is_starboard) {
]
}
}

static_library("zip") {
sources = [
"google/zip.cc",
"google/zip.h",
"google/zip_internal.cc",
"google/zip_internal.h",
"google/zip_reader.cc",
"google/zip_reader.h",
"google/zip_writer.cc",
"google/zip_writer.h",
]

deps = [
":minizip",
"//base",
]
}

target(gtest_target_type, "zip_unittests") {
testonly = true

sources = [
"google/compression_utils_unittest.cc",
"google/zip_reader_unittest.cc",
"google/zip_unittest.cc",
"google/compression_utils.cc",
"google/compression_utils.h",
"google/compression_utils_portable.cc",
"google/compression_utils_portable.h",
]

deps = [
":minizip",
":zip",
":zlib",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//starboard/common",
"//testing/gmock",
"//testing/gtest",
"//third_party/zlib/google/test:zip_unittest_files",
]

if (is_starboard) {
configs -= [ "//starboard/build/config:size" ]
configs += [ "//starboard/build/config:speed" ]
}
}
33 changes: 33 additions & 0 deletions third_party/zlib/google/test/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

copy("zip_unittest_files") {
sources = [
"data/create_test_zip.sh",
"data/evil.zip",
"data/evil_via_absolute_file_name.zip",
"data/evil_via_invalid_utf8.zip",
"data/test.zip",
"data/test_encrypted.zip",
"data/test_mismatch_size.zip",
"data/test_nocompress.zip",
"data/test/foo.txt",
"data/test/foo/bar.txt",
"data/test/foo/bar/baz.txt",
"data/test/foo/bar/quux.txt",
"data/test/foo/bar/.hidden",
]

outputs = [ "$root_build_dir/content/test/zlib/{{source_target_relative}}" ]
}

0 comments on commit d4ab936

Please sign in to comment.