Commit 07ec0acf authored by binji@chromium.org's avatar binji@chromium.org

[NaCl SDK] Create a resources/ directory and move files to it.

* Move files out of the roout of examples/ to resources/
* Move files from examples/resources to resources/
* Move Makefile templates to resources/ and rename them.

BUG=none
R=sbc@chromium.org

Review URL: https://codereview.chromium.org/23919004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221741 0039d316-1c4b-4281-b951-d872f2087c98
parent ae3b19fc
...@@ -19,7 +19,7 @@ import build_version ...@@ -19,7 +19,7 @@ import build_version
import easy_template import easy_template
import parse_dsc import parse_dsc
from build_paths import SDK_SRC_DIR, OUT_DIR, SDK_EXAMPLE_DIR from build_paths import SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR
sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) sys.path.append(os.path.join(SDK_SRC_DIR, 'tools'))
import getos import getos
...@@ -81,7 +81,7 @@ def main(args): ...@@ -81,7 +81,7 @@ def main(args):
pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver)
app_dir = os.path.join(OUT_DIR, 'naclsdk_app') app_dir = os.path.join(OUT_DIR, 'naclsdk_app')
app_examples_dir = os.path.join(app_dir, 'examples') app_examples_dir = os.path.join(app_dir, 'examples')
sdk_resources_dir = os.path.join(SDK_EXAMPLE_DIR, 'resources') sdk_resources_dir = SDK_RESOURCE_DIR
platform = getos.GetPlatform() platform = getos.GetPlatform()
buildbot_common.RemoveDir(app_dir) buildbot_common.RemoveDir(app_dir)
...@@ -138,7 +138,7 @@ def main(args): ...@@ -138,7 +138,7 @@ def main(args):
os.environ['NACL_SDK_ROOT'] = pepperdir os.environ['NACL_SDK_ROOT'] = pepperdir
build_projects.BuildProjects(app_dir, tree, deps=True, clean=False, build_projects.BuildProjects(app_dir, tree, deps=False, clean=False,
config=config) config=config)
RemoveBuildCruft(app_dir) RemoveBuildCruft(app_dir)
......
...@@ -9,6 +9,7 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) ...@@ -9,6 +9,7 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
SDK_EXAMPLE_DIR = os.path.join(SDK_SRC_DIR, 'examples') SDK_EXAMPLE_DIR = os.path.join(SDK_SRC_DIR, 'examples')
SDK_LIBRARY_DIR = os.path.join(SDK_SRC_DIR, 'libraries') SDK_LIBRARY_DIR = os.path.join(SDK_SRC_DIR, 'libraries')
SDK_RESOURCE_DIR = os.path.join(SDK_SRC_DIR, 'resources')
SDK_DIR = os.path.dirname(SDK_SRC_DIR) SDK_DIR = os.path.dirname(SDK_SRC_DIR)
SRC_DIR = os.path.dirname(SDK_DIR) SRC_DIR = os.path.dirname(SDK_DIR)
NACL_DIR = os.path.join(SRC_DIR, 'native_client') NACL_DIR = os.path.join(SRC_DIR, 'native_client')
......
...@@ -13,7 +13,7 @@ import build_version ...@@ -13,7 +13,7 @@ import build_version
import generate_make import generate_make
import parse_dsc import parse_dsc
from build_paths import NACL_DIR, SDK_SRC_DIR, OUT_DIR, SDK_EXAMPLE_DIR from build_paths import NACL_DIR, SDK_SRC_DIR, OUT_DIR, SDK_RESOURCE_DIR
from build_paths import GSTORE from build_paths import GSTORE
from generate_index import LandingPage from generate_index import LandingPage
...@@ -54,14 +54,10 @@ def UpdateHelpers(pepperdir, clobber=False): ...@@ -54,14 +54,10 @@ def UpdateHelpers(pepperdir, clobber=False):
buildbot_common.RemoveDir(exampledir) buildbot_common.RemoveDir(exampledir)
buildbot_common.MakeDir(exampledir) buildbot_common.MakeDir(exampledir)
# Copy files for individual bild and landing page # Copy files for individual build and landing page
files = ['favicon.ico', 'httpd.cmd'] files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js',
CopyFilesFromTo(files, SDK_EXAMPLE_DIR, exampledir) 'button_close.png', 'button_close_hover.png']
CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir)
resourcesdir = os.path.join(SDK_EXAMPLE_DIR, 'resources')
files = ['index.css', 'index.js', 'button_close.png',
'button_close_hover.png']
CopyFilesFromTo(files, resourcesdir, exampledir)
# Copy tools scripts and make includes # Copy tools scripts and make includes
buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'),
...@@ -133,9 +129,7 @@ def UpdateProjects(pepperdir, project_tree, toolchains, ...@@ -133,9 +129,7 @@ def UpdateProjects(pepperdir, project_tree, toolchains,
if landing_page: if landing_page:
# Generate the landing page text file. # Generate the landing page text file.
index_html = os.path.join(pepperdir, 'examples', 'index.html') index_html = os.path.join(pepperdir, 'examples', 'index.html')
example_resources_dir = os.path.join(SDK_EXAMPLE_DIR, 'resources') index_template = os.path.join(SDK_RESOURCE_DIR, 'index.html.template')
index_template = os.path.join(example_resources_dir,
'index.html.template')
with open(index_html, 'w') as fh: with open(index_html, 'w') as fh:
out = landing_page.GeneratePage(index_template) out = landing_page.GeneratePage(index_template)
fh.write(out) fh.write(out)
......
...@@ -11,7 +11,7 @@ import build_version ...@@ -11,7 +11,7 @@ import build_version
import getos import getos
from buildbot_common import ErrorExit from buildbot_common import ErrorExit
from easy_template import RunTemplateFileIfChanged from easy_template import RunTemplateFileIfChanged
from build_paths import SCRIPT_DIR, SDK_EXAMPLE_DIR from build_paths import SDK_RESOURCE_DIR
def Trace(msg): def Trace(msg):
if Trace.verbose: if Trace.verbose:
...@@ -137,7 +137,7 @@ def ProcessHTML(srcroot, dstroot, desc, toolchains, configs, first_toolchain): ...@@ -137,7 +137,7 @@ def ProcessHTML(srcroot, dstroot, desc, toolchains, configs, first_toolchain):
def GenerateManifest(srcroot, dstroot, desc): def GenerateManifest(srcroot, dstroot, desc):
outdir = os.path.join(dstroot, desc['DEST'], desc['NAME']) outdir = os.path.join(dstroot, desc['DEST'], desc['NAME'])
srcpath = os.path.join(SDK_EXAMPLE_DIR, 'resources', 'manifest.json.template') srcpath = os.path.join(SDK_RESOURCE_DIR, 'manifest.json.template')
dstpath = os.path.join(outdir, 'manifest.json') dstpath = os.path.join(outdir, 'manifest.json')
permissions = desc.get('PERMISSIONS', []) permissions = desc.get('PERMISSIONS', [])
socket_permissions = desc.get('SOCKET_PERMISSIONS', []) socket_permissions = desc.get('SOCKET_PERMISSIONS', [])
...@@ -182,8 +182,7 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, ...@@ -182,8 +182,7 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None,
name = desc['NAME'] name = desc['NAME']
out_dir = os.path.join(dstroot, desc['DEST'], name) out_dir = os.path.join(dstroot, desc['DEST'], name)
buildbot_common.MakeDir(out_dir) buildbot_common.MakeDir(out_dir)
srcdirs = desc.get('SEARCH', ['.', '..', '../..']) srcdirs = desc.get('SEARCH', ['.', SDK_RESOURCE_DIR])
srcdirs.append(os.path.join(SDK_EXAMPLE_DIR, 'resources'))
# Copy sources to example directory # Copy sources to example directory
sources = GenerateSourceCopyList(desc) sources = GenerateSourceCopyList(desc)
...@@ -198,9 +197,9 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, ...@@ -198,9 +197,9 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None,
make_path = os.path.join(out_dir, 'Makefile') make_path = os.path.join(out_dir, 'Makefile')
if IsNexe(desc): if IsNexe(desc):
template = os.path.join(SCRIPT_DIR, 'template.mk') template = os.path.join(SDK_RESOURCE_DIR, 'Makefile.example.template')
else: else:
template = os.path.join(SCRIPT_DIR, 'library.mk') template = os.path.join(SDK_RESOURCE_DIR, 'Makefile.library.template')
# Ensure the order of |tools| is the same as toolchains; that way if # Ensure the order of |tools| is the same as toolchains; that way if
# first_toolchain is set, it will choose based on the order of |toolchains|. # first_toolchain is set, it will choose based on the order of |toolchains|.
...@@ -240,7 +239,7 @@ def GenerateMasterMakefile(pepperdir, out_path, targets): ...@@ -240,7 +239,7 @@ def GenerateMasterMakefile(pepperdir, out_path, targets):
out_path: Root for output such that out_path+NAME = full path out_path: Root for output such that out_path+NAME = full path
targets: List of targets names targets: List of targets names
""" """
in_path = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') in_path = os.path.join(SDK_RESOURCE_DIR, 'Makefile.index.template')
out_path = os.path.join(out_path, 'Makefile') out_path = os.path.join(out_path, 'Makefile')
rel_path = os.path.relpath(pepperdir, os.path.dirname(out_path)) rel_path = os.path.relpath(pepperdir, os.path.dirname(out_path))
template_dict = { template_dict = {
......
{ {
'DISABLE_PACKAGE': True, # Doesn't work in packaged apps yet. 'DISABLE_PACKAGE': True, # Doesn't work in packaged apps yet.
'TOOLS': ['newlib'], 'TOOLS': ['newlib'],
'SEARCH': [
'.',
'../..',
],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'debugging', 'NAME' : 'debugging',
......
{ {
'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'win'], 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'win'],
'SEARCH': [ 'SEARCH': [
'.',
'../../../../testing/gmock/include/gmock', '../../../../testing/gmock/include/gmock',
'../../../../testing/gmock/include/gmock/internal', '../../../../testing/gmock/include/gmock/internal',
'../../../../testing/gmock/src', '../../../../testing/gmock/src',
......
{ {
'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'], 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'],
'SEARCH': [ 'SEARCH': [
'.',
'../../../../ppapi/cpp', '../../../../ppapi/cpp',
'../../../../ppapi/cpp/dev', '../../../../ppapi/cpp/dev',
'../../../../ppapi/cpp/extensions', '../../../../ppapi/cpp/extensions',
......
{ {
'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'], 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'],
'SEARCH': [
'.'
],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'sdk_util', 'NAME' : 'sdk_util',
......
{ {
'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TOOLS': ['newlib', 'glibc', 'pnacl'],
'SEARCH': [
'.'
],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'xray', 'NAME' : 'xray',
......
{ {
'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TOOLS': ['newlib', 'glibc', 'pnacl'],
# Need to add ../../examples for common.js
'SEARCH': ['.', '../../examples'],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'nacl_io_socket_test', 'NAME' : 'nacl_io_socket_test',
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TOOLS': ['newlib', 'glibc', 'pnacl'],
'SEL_LDR': True, 'SEL_LDR': True,
# Need to add ../../examples for common.js
'SEARCH': ['.', '../../examples'],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'nacl_io_test', 'NAME' : 'nacl_io_test',
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TOOLS': ['newlib', 'glibc', 'pnacl'],
'SEL_LDR': True, 'SEL_LDR': True,
# Need to add ../../examples for common.js
'SEARCH': ['.', '../../examples'],
'TARGETS': [ 'TARGETS': [
{ {
'NAME' : 'sdk_util_test', 'NAME' : 'sdk_util_test',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment