Skip to content

Commit

Permalink
Merge pull request #719 from /issues/1808
Browse files Browse the repository at this point in the history
fix resource organization and dependencies
  • Loading branch information
bridiver authored Oct 24, 2018
2 parents 782487d + c995282 commit e300d5a
Show file tree
Hide file tree
Showing 154 changed files with 548 additions and 450 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/.idea/
/browser/resources/brave_extension/
/components/brave_webtorrent/extension/out/
/components/brave_rewards/extension/brave_rewards/out/
/components/brave_rewards/resources/extension/brave_rewards/out/
/dist/
/out/
/vendor
Expand Down
12 changes: 11 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ group("brave") {
]
}

group("resources") {
public_deps = [
# TODO(bridiver)
# "//brave/browser:resources",
# "//brave/common:resources",
# "//brave/renderer:resources",
"//brave/components/resources",
]
}

if (is_mac) {
group("framework_bundle_data") {
deps = [
"vendor/brave-extension:brave_extension_framework_bundle_data",
"components/brave_rewards/extension:framework_bundle_data",
"components/brave_rewards/resources/extension:framework_bundle_data",
]
}
}
Expand Down
10 changes: 7 additions & 3 deletions brave_paks.gni
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,21 @@ template("brave_extra_paks") {
"$root_gen_dir/brave/brave_unscaled_resources.pak",
"$root_gen_dir/brave/browser/resources/brave_settings_resources.pak",
"$root_gen_dir/components/brave_components_resources.pak",
"$root_gen_dir/brave/components/brave_rewards/extension/brave_rewards_resources.pak",
"$root_gen_dir/components/brave_components_strings.pak",
"$root_gen_dir/brave/components/brave_rewards/resources/brave_rewards_resources.pak",
"$root_gen_dir/brave/components/brave_rewards/resources/extension/brave_rewards_extension_resources.pak",
"$target_gen_dir/browser/resources/brave_extension.pak",
"$target_gen_dir/components/brave_webtorrent/brave_webtorrent_resources.pak",
]

deps = [
"//brave/app:brave_generated_resources_grit",
"//brave/app/theme:brave_unscaled_resources",
"//brave/components/brave_rewards/extension:resources",
"//brave/components/brave_rewards/resources",
"//brave/components/brave_rewards/resources/extension:resources",
"//brave/components/brave_webtorrent:resources",
"//brave/components/resources:brave_components_resources_grit",
"//brave/components/resources",
"//brave/components/resources:strings",
"//brave/browser/resources:brave_extension_grit",
"//brave/browser/resources:brave_settings_resources",
"//brave/common/extensions/api"
Expand Down
2 changes: 1 addition & 1 deletion browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ source_set("browser") {
"autoplay",
"//base",
"//brave/components/brave_shields/browser:brave_shields",
"//brave/components/resources:brave_components_resources_grit",
"//brave/components/resources",
"//brave/browser/resources:brave_extension_grit",
"//chrome/browser",
"download",
Expand Down
2 changes: 1 addition & 1 deletion browser/extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ source_set("extensions") {
deps = [
"//brave/browser/resources:brave_extension_grit",
"//brave/common/extensions/api",
"//brave/components/brave_rewards/extension:resources",
"//brave/components/brave_rewards/resources/extension:resources",
"//brave/components/brave_webtorrent:resources",
"//chrome/browser",
"//content/public/browser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "brave/browser/extensions/brave_component_extension_resource_manager.h"

#include "brave/browser/resources/grit/brave_extension_resources_map.h"
#include "brave/components/brave_rewards/extension/grit/brave_rewards_resources_map.h"
#include "brave/components/brave_rewards/resources/extension/grit/brave_rewards_extension_resources_map.h"
#include "brave/components/brave_webtorrent/grit/brave_webtorrent_resources_map.h"

namespace extensions {
Expand All @@ -17,8 +17,8 @@ BraveComponentExtensionResourceManager() {
kBraveExtensionSize);

AddComponentResourceEntries(
kBraveRewardsResources,
kBraveRewardsResourcesSize);
kBraveRewardsExtensionResources,
kBraveRewardsExtensionResourcesSize);

AddComponentResourceEntries(
kBraveWebtorrentResources,
Expand Down
2 changes: 1 addition & 1 deletion browser/extensions/brave_component_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "brave/common/brave_switches.h"
#include "brave/common/extensions/extension_constants.h"
#include "brave/components/brave_rewards/browser/buildflags/buildflags.h"
#include "brave/components/brave_rewards/extension/grit/brave_rewards_resources.h"
#include "brave/components/brave_rewards/resources/extension/grit/brave_rewards_extension_resources.h"
#include "brave/components/brave_webtorrent/grit/brave_webtorrent_resources.h"
#include "components/grit/brave_components_resources.h"
#include "extensions/browser/extension_prefs.h"
Expand Down
11 changes: 9 additions & 2 deletions browser/resources/resource_ids
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
},
"brave/components/resources/brave_components_resources.grd": {
"includes": [33000],
"messages": [33500],
},
"brave/browser/resources/brave_extension.grd": {
"includes": [34000],
Expand All @@ -26,5 +25,13 @@
"includes": [36500],
},
# brave webtorrent 37500
# brave rewards 38000
"brave/components/brave_rewards/resources/extension/extension_resources.grd": {
"includes": [38000]
},
"brave/components/brave_rewards/resources/brave_rewards_resources.grd": {
"includes": [38500]
},
"brave/components/resources/brave_components_strings.grd": {
"messages": [39000]
},
}
2 changes: 1 addition & 1 deletion browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ source_set("ui") {
"//brave/components/brave_rewards/browser",
"//brave/browser/tor",
"//brave/browser/resources:brave_settings_resources",
"//brave/components/resources:brave_components_resources_grit",
"//brave/components/resources",
"//chrome/app:command_ids",
"//chrome/common",
"//content/public/browser",
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/webui/brave_donate_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#include "brave/browser/ui/webui/basic_ui.h"
#include "brave/common/pref_names.h"
#include "brave/common/webui_url_constants.h"
#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "components/grit/brave_components_resources.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui_data_source.h"
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/webui/brave_rewards_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include "brave/components/brave_rewards/browser/rewards_notifications_service_observer.h"
#include "brave/components/brave_rewards/browser/rewards_service_factory.h"
#include "brave/components/brave_rewards/browser/rewards_service_observer.h"
#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "brave/common/webui_url_constants.h"
#include "chrome/browser/profiles/profile.h"
#include "components/grit/brave_components_resources.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
Expand Down
2 changes: 2 additions & 0 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#include <map>

#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "components/grit/brave_components_resources.h"
#include "components/grit/brave_components_strings.h"
#include "content/public/browser/web_ui_data_source.h"

namespace {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "brave/common/extensions/extension_constants.h"
#include "components/grit/brave_components_resources.h"
#include "brave/components/brave_rewards/extension/grit/brave_rewards_resources.h"
#include "brave/components/brave_rewards/resources/extension/grit/brave_rewards_extension_resources.h"
#include "brave/components/brave_webtorrent/grit/brave_webtorrent_resources.h"

namespace extensions {
Expand Down
8 changes: 4 additions & 4 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/components/brave_rewards/browser/rewards_service_impl.h"
#include "brave/components/brave_rewards/browser/wallet_properties.h"
#include "brave/components/brave_rewards/browser/balance_report.h"

#include <functional>
#include <limits.h>
Expand All @@ -28,18 +26,20 @@
#include "bat/ledger/wallet_info.h"
#include "brave/common/brave_switches.h"
#include "brave/common/extensions/api/brave_rewards.h"
#include "brave/components/brave_rewards/browser/balance_report.h"
#include "brave/components/brave_rewards/browser/publisher_info_database.h"
#include "brave/components/brave_rewards/browser/rewards_fetcher_service_observer.h"
#include "brave/components/brave_rewards/browser/rewards_notifications_service.h"
#include "brave/components/brave_rewards/browser/rewards_notifications_service_factory.h"
#include "brave/components/brave_rewards/browser/rewards_service_observer.h"
#include "brave/components/brave_rewards/browser/wallet_properties.h"
#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/favicon_types.h"
#include "components/grit/brave_components_resources.h"
#include "content_site.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_api_frame_id_map.h"
Expand Down Expand Up @@ -664,7 +664,7 @@ void RewardsServiceImpl::OnPublisherStateSaved(
void RewardsServiceImpl::LoadNicewareList(
ledger::GetNicewareListCallback callback) {
std::string data = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_BRAVE_REWARDS_NICEWARE_LIST).as_string();
IDR_BRAVE_REWARDS_NICEWARE_LIST).as_string();

if (data.empty()) {
LOG(ERROR) << "Failed to read in niceware list";
Expand Down
28 changes: 28 additions & 0 deletions components/brave_rewards/resources/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import("//brave/components/brave_rewards/browser/buildflags/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")


grit("resources") {
source = "brave_rewards_resources.grd"

outputs = [
"grit/brave_rewards_resources.h",
"brave_rewards_resources.pak",
]

deps = [
"ui",
"donate",
]

grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]

resource_ids = "//brave/browser/resources/resource_ids"

output_dir = "$root_gen_dir/brave/components/brave_rewards/resources"
}
34 changes: 34 additions & 0 deletions components/brave_rewards/resources/brave_rewards_resources.grd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/brave_rewards_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="brave_rewards_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<!-- WebUI Brave Rewards resources -->
<include name="IDR_BRAVE_REWARDS_HTML" file="ui/brave_rewards.html" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_JS" file="${root_gen_dir}/brave/brave_rewards.bundle.js" type="BINDATA" use_base_dir="false" />
<include name="IDR_BRAVE_REWARDS_IMG_ADS_DISABLED" file="img/ads_disabled.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_CONTRIBUTE_DISABLED" file="img/contribute_disabled.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_DONATE_DISABLED" file="img/donate_disabled.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_WALLET_BG" file="img/wallet_bg.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_CAPTCHA_BAT" file="img/captcha_bat.png" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_WELCOME_BG" file="img/welcome_bg.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_BART_TEMP" file="img/temp/bartBaker.jpeg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_BAT" file="img/BAT.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_BTC" file="img/BTC.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_ETH" file="img/ETH.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_IMG_LTC" file="img/LTC.svg" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_NICEWARE_LIST" file="../../../vendor/bat-native-ledger/niceware/wordlist" type="BINDATA" />

<!-- WebUI donate resources -->
<include name="IDR_BRAVE_DONATE_BG_1" file="img/donate_bg_1.svg" type="BINDATA" />
<include name="IDR_BRAVE_DONATE_BG_2" file="img/donate_bg_2.svg" type="BINDATA" />
<include name="IDR_BRAVE_DONATE_HTML" file="donate/brave_donate.html" type="BINDATA" />
<include name="IDR_BRAVE_DONATE_JS" file="${root_gen_dir}/brave/brave_donate.bundle.js" type="BINDATA" use_base_dir="false" />
</includes>
</release>
</grit>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require('emptykit.css')

// Components
import App from './components/app'
require('../../fonts/muli.css')
require('../../fonts/poppins.css')
require('../../../fonts/muli.css')
require('../../../fonts/poppins.css')

// Utils
import store from './store'
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import("//extensions/buildflags/buildflags.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")

assert(enable_extensions)

grit("resources") {
source = "resources.grd"
source = "extension_resources.grd"
outputs = [
"grit/brave_rewards_resources_map.cc",
"grit/brave_rewards_resources_map.h",
"grit/brave_rewards_resources.h",
"brave_rewards_resources.pak",
"grit/brave_rewards_extension_resources_map.cc",
"grit/brave_rewards_extension_resources_map.h",
"grit/brave_rewards_extension_resources.h",
"brave_rewards_extension_resources.pak",
]

deps = [
"//brave/components/brave_rewards/extension/brave_rewards"
"//brave/components/brave_rewards/resources/extension/brave_rewards"
]

resource_ids = ""
resource_ids = "//brave/browser/resources/resource_ids"

output_dir = "$root_gen_dir/brave/components/brave_rewards/extension"
output_dir = "$root_gen_dir/brave/components/brave_rewards/resources/extension"
}

if (is_mac) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ transpile_web_ui("brave_rewards_panel") {
]

output_dir =
"$root_gen_dir/../../../brave/components/brave_rewards/extension/brave_rewards/out"
"$root_gen_dir/../../../brave/components/brave_rewards/resources/extension/brave_rewards/out"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

// Utils
import { debounce } from '../../../../common/debounce'
import { debounce } from '../../../../../common/debounce'

const keyName = 'rewards-panel-data'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import Theme from 'brave-ui/theme/brave-default'
import { ThemeProvider } from 'brave-ui/theme'
import { initLocale } from 'brave-ui/helpers'
require('emptykit.css')
require('../../../fonts/muli.css')
require('../../../fonts/poppins.css')
require('../../../../fonts/muli.css')
require('../../../../fonts/poppins.css')

// Components
import App from './components/app'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="true">
<outputs>
<output filename="grit/brave_rewards_resources.h" type="rc_header">
<output filename="grit/brave_rewards_extension_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="brave_rewards_resources.pak" type="data_package" />
<output filename="grit/brave_rewards_resources_map.cc" type="resource_file_map_source" />
<output filename="grit/brave_rewards_resources_map.h" type="resource_map_header" />
<output filename="brave_rewards_extension_resources.pak" type="data_package" />
<output filename="grit/brave_rewards_extension_resources_map.cc" type="resource_file_map_source" />
<output filename="grit/brave_rewards_extension_resources_map.h" type="resource_map_header" />
</outputs>
<release seq="1">
<includes first_id="38000">
<includes>
<include name="IDR_BRAVE_REWARDS" file="brave_rewards/manifest.json" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_LOCALES_EN" file="brave_rewards/_locales/en/messages.json" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_PANEL_HTML" file="brave_rewards/brave_rewards_panel.html" type="BINDATA" />
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require('emptykit.css')

// Components
import App from './components/app'
require('../../fonts/muli.css')
require('../../fonts/poppins.css')
require('../../../fonts/muli.css')
require('../../../fonts/poppins.css')

// Utils
import store from './store'
Expand Down
Loading

0 comments on commit e300d5a

Please sign in to comment.