Issue #1837 - Remove unused build back-ends from the tree.
This leaves just use of recursive make to build applications.
This commit is contained in:
34 files changed
+29
-2771
No files matched your search
+2
-38
@@ -137,16 +137,10 @@ default:: $(BUILD_BACKEND_FILES)
|
||||
endif
|
||||
|
||||
install_manifests := \
|
||||
$(addprefix dist/,branding idl include public private sdk xpi-stage) \
|
||||
$(addprefix dist/,branding bin idl include public private sdk xpi-stage) \
|
||||
_tests \
|
||||
$(NULL)
|
||||
# Skip the dist/bin install manifest when using the hybrid
|
||||
# FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
|
||||
# xpidl handling to FasterMake in that case, mechanically making the dist/bin
|
||||
# install manifest non-existent (non-existent manifests being skipped)
|
||||
ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
||||
install_manifests += dist/bin
|
||||
endif
|
||||
|
||||
install_manifest_depends = \
|
||||
CLOBBER \
|
||||
$(configure_dir)/configure \
|
||||
@@ -166,27 +160,6 @@ endif
|
||||
.PHONY: install-manifests
|
||||
install-manifests: $(addprefix install-,$(install_manifests))
|
||||
|
||||
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
|
||||
# to recurse in the faster/ directory in parallel of install manifests.
|
||||
# But dist/idl needs to happen before (cf. dependencies in
|
||||
# config/faster/rules.mk)
|
||||
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
||||
install-manifests: faster
|
||||
.PHONY: faster
|
||||
faster: install-dist/idl
|
||||
$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
|
||||
endif
|
||||
|
||||
.PHONY: tup
|
||||
tup:
|
||||
$(call BUILDSTATUS,TIERS make tup)
|
||||
$(call BUILDSTATUS,TIER_START make)
|
||||
$(MAKE) install-manifests buildid.h source-repo.h
|
||||
$(call BUILDSTATUS,TIER_FINISH make)
|
||||
$(call BUILDSTATUS,TIER_START tup)
|
||||
@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
|
||||
$(call BUILDSTATUS,TIER_FINISH tup)
|
||||
|
||||
# process_install_manifest needs to be invoked with --no-remove when building
|
||||
# js as standalone because automated builds are building nspr separately and
|
||||
# that would remove the resulting files.
|
||||
@@ -198,17 +171,8 @@ endif
|
||||
|
||||
.PHONY: $(addprefix install-,$(subst /,_,$(install_manifests)))
|
||||
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
|
||||
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
||||
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want
|
||||
@# to ensure the FasterMake end doesn't have install manifests for the
|
||||
@# same directory, because that would blow up
|
||||
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
|
||||
endif
|
||||
$(addprefix $(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
|
||||
|
||||
# Dummy wrapper rule to allow the faster backend to piggy back
|
||||
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
|
||||
|
||||
.PHONY: install-tests
|
||||
install-tests: install-test-files
|
||||
|
||||
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
import java.util.regex.Pattern
|
||||
|
||||
allprojects {
|
||||
// Expose the per-object-directory configuration to all projects.
|
||||
ext {
|
||||
mozconfig = gradle.mozconfig
|
||||
topsrcdir = gradle.mozconfig.topsrcdir
|
||||
topobjdir = gradle.mozconfig.topobjdir
|
||||
}
|
||||
|
||||
repositories {
|
||||
if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildDir "${topobjdir}/gradle/build"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
|
||||
maven {
|
||||
url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
|
||||
}
|
||||
}
|
||||
// For android-sdk-manager SNAPSHOT releases.
|
||||
maven {
|
||||
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
||||
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
|
||||
// Without these, we get errors linting.
|
||||
exclude module: 'guava'
|
||||
}
|
||||
// Provided in tree.
|
||||
classpath 'com.jakewharton.sdkmanager:gradle-plugin:1.5.0-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
task generateCodeAndResources(type:Exec) {
|
||||
workingDir "${topobjdir}"
|
||||
|
||||
commandLine mozconfig.substs.GMAKE
|
||||
args '-C'
|
||||
args "${topobjdir}/mobile/android/base"
|
||||
args 'gradle-targets'
|
||||
|
||||
// Only show the output if something went wrong.
|
||||
ignoreExitValue = true
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
errorOutput = standardOutput
|
||||
doLast {
|
||||
if (execResult.exitValue != 0) {
|
||||
throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Skip unit test for all build variants, unless if it was specifically requested by user.
|
||||
// The enabled property for the unit test tasks is reset based on the command line task names just before the task execution.
|
||||
// I bet there is a easier/cleaner way to do this, but this gets the job done for now.
|
||||
Pattern pattern = Pattern.compile('.*test(.+UnitTest)?.*')
|
||||
boolean startTasksIncludeTest = gradle.startParameter.taskNames.any {
|
||||
taskName ->
|
||||
taskName.matches(pattern)
|
||||
}
|
||||
gradle.taskGraph.beforeTask {
|
||||
Task task ->
|
||||
if (task.name.matches(pattern)) {
|
||||
task.enabled = startTasksIncludeTest
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
subprojects {
|
||||
if (!hasProperty('android')) {
|
||||
return
|
||||
}
|
||||
android.applicationVariants.all {
|
||||
preBuild.dependsOn rootProject.generateCodeAndResources
|
||||
}
|
||||
android.libraryVariants.all {
|
||||
preBuild.dependsOn rootProject.generateCodeAndResources
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'idea'
|
||||
|
||||
idea {
|
||||
project {
|
||||
languageLevel = '1.7'
|
||||
}
|
||||
|
||||
module {
|
||||
// Object directories take a huge amount of time for IntelliJ to index.
|
||||
// Exclude them. Convention is that object directories start with obj.
|
||||
// IntelliJ is clever and will not exclude the parts of the object
|
||||
// directory that are referenced, if there are any. In practice,
|
||||
// indexing the entirety of the tree is taking too long, so exclude all
|
||||
// but mobile/.
|
||||
def topsrcdirURI = file(topsrcdir).toURI()
|
||||
excludeDirs += files(file(topsrcdir)
|
||||
.listFiles({it.isDirectory()} as FileFilter)
|
||||
.collect({topsrcdirURI.relativize(it.toURI()).toString()}) // Relative paths.
|
||||
.findAll({!it.equals('mobile/')}))
|
||||
|
||||
// If topobjdir is below topsrcdir, hide only some portions of that tree.
|
||||
def topobjdirURI = file(topobjdir).toURI()
|
||||
if (!topsrcdirURI.relativize(topobjdirURI).isAbsolute()) {
|
||||
excludeDirs -= file(topobjdir)
|
||||
excludeDirs += files(file(topobjdir).listFiles())
|
||||
excludeDirs -= file("${topobjdir}/gradle")
|
||||
}
|
||||
|
||||
if (!mozconfig.substs.MOZ_INSTALL_TRACKING) {
|
||||
excludeDirs += file("${topsrcdir}/mobile/android/thirdparty/com/adjust")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
.. _build_cppeclipse:
|
||||
|
||||
=====================
|
||||
Cpp Eclipse Projects
|
||||
=====================
|
||||
|
||||
For additional information on using Eclipse CDT see
|
||||
`the MDN page
|
||||
<https://developer.mozilla.org/en-US/docs/Eclipse_CDT>`_.
|
||||
|
||||
The build system contains alpha support for generating C++ Eclipse
|
||||
project files to aid with development.
|
||||
|
||||
Please report bugs to bugzilla and make them depend on bug 973770.
|
||||
|
||||
To generate a C++ Eclipse project files, you'll need to have a fully
|
||||
built tree::
|
||||
|
||||
mach build
|
||||
|
||||
Then, simply generate the Eclipse build backend::
|
||||
|
||||
mach build-backend -b CppEclipse
|
||||
|
||||
If all goes well, the path to the generated workspace should be
|
||||
printed.
|
||||
|
||||
To use the generated Eclipse project files, you'll need to
|
||||
have a Eclipse CDT 8.3 (We plan to follow the latest Eclipse release)
|
||||
`Eclipse CDT plugin
|
||||
<https://www.eclipse.org/cdt/>`_
|
||||
installed. You can then import all the projects into Eclipse using
|
||||
*File > Import ... > General > Existing Projects into Workspace*
|
||||
-only- if you have not ran the background indexer.
|
||||
|
||||
Updating Project Files
|
||||
======================
|
||||
|
||||
As you pull and update the source tree, your C++ Eclipse files may
|
||||
fall out of sync with the build configuration. The tree should still
|
||||
build fine from within Eclipse, but source files may be missing and in
|
||||
rare circumstances Eclipse's index may not have the proper build
|
||||
configuration.
|
||||
|
||||
To account for this, you'll want to periodically regenerate the
|
||||
Eclipse project files. You can do this by running ``mach build
|
||||
&& mach build-backend -b CppEclipse`` from the
|
||||
command line.
|
||||
|
||||
Currently, regeneration rewrites the original project files. **If
|
||||
you've made any customizations to the projects, they will likely get
|
||||
overwritten.** We would like to improve this user experience in the
|
||||
future.
|
||||
|
||||
@@ -28,14 +28,6 @@ Important Concepts
|
||||
locales
|
||||
rust
|
||||
|
||||
integrated development environment (IDE)
|
||||
========================================
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
cppeclipse
|
||||
visualstudio
|
||||
|
||||
mozbuild
|
||||
========
|
||||
|
||||
|
||||
@@ -5,41 +5,44 @@ Supported Configurations
|
||||
========================
|
||||
|
||||
This page attempts to document supported build configurations.
|
||||
For more up-to-date information please go to http://developer.palemoon.org/
|
||||
|
||||
Windows
|
||||
=======
|
||||
|
||||
We support building on Windows XP and newer operating systems using
|
||||
Visual Studio 2010 and newer.
|
||||
We support building on Windows 7 and newer operating systems using
|
||||
Visual Studio 2015 U3.
|
||||
|
||||
The following are not fully supported by Mozilla (but may work):
|
||||
The following are not fully supported (but may work):
|
||||
|
||||
* Building without the latest *MozillaBuild* Windows development
|
||||
environment
|
||||
* Building with a *MozillaBuild* Windows development
|
||||
environment not mentioned on the developer documentation site.
|
||||
* Building with Mingw or any other non-Visual Studio toolchain.
|
||||
|
||||
OS X
|
||||
====
|
||||
|
||||
We support building on OS X 10.6 and newer with the OS X 10.6 SDK.
|
||||
(This section needs updating)
|
||||
We support building on OS X 10.8 and newer with the OS X 10.8 SDK.
|
||||
|
||||
The tree should build with the following OS X releases and SDK versions:
|
||||
|
||||
* 10.6 Snow Leopard
|
||||
* 10.7 Lion
|
||||
* 10.8 Mountain Lion
|
||||
* 10.9 Mavericks
|
||||
* 10.10 Yosemite
|
||||
* 10.11 El Capitan
|
||||
* 10.12 Sierra
|
||||
* 10.13 High Sierra
|
||||
* 10.14 Mojave
|
||||
* 10.15 Catalina
|
||||
* 11 Big Sur (Including Apple ARM SoC)
|
||||
|
||||
The tree requires building with Clang 3.3 and newer. This corresponds to
|
||||
version of 4.2 of Apple's Clang that ships with Xcode. This corresponds
|
||||
to Xcode 4.6 and newer. Xcode 4.6 only runs on OS X 10.7.4 and newer.
|
||||
So, OS X 10.6 users will need to install a non-Apple toolchain. Running
|
||||
``mach bootstrap`` should install an appropriate toolchain from Homebrew
|
||||
or MacPorts automatically.
|
||||
The tree requires building with Apple's Clang 4.2 that ships with Xcode.
|
||||
This corresponds to Xcode 4.6 and newer. Xcode 4.6 only runs on OS X 10.7.4
|
||||
and newer.
|
||||
|
||||
The tree should build with GCC 4.4 and newer on OS X. However, this
|
||||
The tree should build with GCC 7.1 and newer on OS X. However, this
|
||||
build configuration isn't as widely used (and differs from what Mozilla
|
||||
uses to produce OS X builds), so it's recommended to stick with Clang.
|
||||
uses to produce OS X builds).
|
||||
|
||||
Linux
|
||||
=====
|
||||
@@ -47,9 +50,6 @@ Linux
|
||||
Linux 2.6 and later kernels are supported.
|
||||
|
||||
Most distributions are supported as long as the proper package
|
||||
dependencies are in place. Running ``mach bootstrap`` should install
|
||||
packages for popular Linux distributions. ``configure`` will typically
|
||||
dependencies are in place. ``configure`` will typically
|
||||
detect missing dependencies and inform you how to disable features to
|
||||
work around unsatisfied dependencies.
|
||||
|
||||
Clang 3.3 or GCC 4.4 is required to build the tree.
|
||||
@@ -1,100 +0,0 @@
|
||||
.. _build_visualstudio:
|
||||
|
||||
======================
|
||||
Visual Studio Projects
|
||||
======================
|
||||
|
||||
The build system contains alpha support for generating Visual Studio
|
||||
project files to aid with development.
|
||||
|
||||
To generate Visual Studio project files, you'll need to have a configured tree::
|
||||
|
||||
mach configure
|
||||
|
||||
(If you have built recently, your tree is already configured.)
|
||||
|
||||
Then, simply generate the Visual Studio build backend::
|
||||
|
||||
mach build-backend -b VisualStudio
|
||||
|
||||
If all goes well, the path to the generated Solution (``.sln``) file should be
|
||||
printed. You should be able to open that solution with Visual Studio 2010 or
|
||||
newer.
|
||||
|
||||
Currently, output is hard-coded to the Visual Studio 2010 format. If you open
|
||||
the solution in a newer Visual Studio release, you will be prompted to upgrade
|
||||
projects. Simply click through the wizard to do that.
|
||||
|
||||
Structure of Solution
|
||||
=====================
|
||||
|
||||
The Visual Studio solution consists of hundreds of projects spanning thousands
|
||||
of files. To help with organization, the solution is divided into the following
|
||||
trees/folders:
|
||||
|
||||
Build Targets
|
||||
This folder contains common build targets. The *full* project is used to
|
||||
perform a full build. The *binaries* project is used to build just binaries.
|
||||
The *visual-studio* project can be built to regenerate the Visual Studio
|
||||
project files.
|
||||
|
||||
Performing the *clean* action on any of these targets will clean the
|
||||
*entire* build output.
|
||||
|
||||
Binaries
|
||||
This folder contains common binaries that can be executed from within
|
||||
Visual Studio. If you are building the Firefox desktop application,
|
||||
the *firefox* project will launch firefox.exe. You probably want one of
|
||||
these set to your startup project.
|
||||
|
||||
Libraries
|
||||
This folder contains entries for each static library that is produced as
|
||||
part of the build. These roughly correspond to each directory in the tree
|
||||
containing C/C++. e.g. code from ``dom/base`` will be contained in the
|
||||
``dom_base`` project.
|
||||
|
||||
These projects don't do anything when built. If you build a project here,
|
||||
the *binaries* build target project is built.
|
||||
|
||||
Updating Project Files
|
||||
======================
|
||||
|
||||
As you pull and update the source tree, your Visual Studio files may fall out
|
||||
of sync with the build configuration. The tree should still build fine from
|
||||
within Visual Studio. But source files may be missing and IntelliSense may not
|
||||
have the proper build configuration.
|
||||
|
||||
To account for this, you'll want to periodically regenerate the Visual Studio
|
||||
project files. You can do this within Visual Studio by building the
|
||||
``Build Targets :: visual-studio`` project or by running
|
||||
``mach build-backend -b VisualStudio`` from the command line.
|
||||
|
||||
Currently, regeneration rewrites the original project files. **If you've made
|
||||
any customizations to the solution or projects, they will likely get
|
||||
overwritten.** We would like to improve this user experience in the
|
||||
future.
|
||||
|
||||
Moving Project Files Around
|
||||
===========================
|
||||
|
||||
The produced Visual Studio solution and project files should be portable.
|
||||
If you want to move them to a non-default directory, they should continue
|
||||
to work from wherever they are. If they don't, please file a bug.
|
||||
|
||||
Invoking mach through Visual Studio
|
||||
===================================
|
||||
|
||||
It's possible to build the tree via Visual Studio. There is some light magic
|
||||
involved here.
|
||||
|
||||
Alongside the Visual Studio project files is a batch script named ``mach.bat``.
|
||||
This batch script sets the environment variables present in your *MozillaBuild*
|
||||
development environment at the time of Visual Studio project generation
|
||||
and invokes *mach* inside an msys shell with the arguments specified to the
|
||||
batch script. This script essentially allows you to invoke mach commands
|
||||
inside the MozillaBuild environment without having to load MozillaBuild.
|
||||
|
||||
While projects currently only utilize the ``mach build`` command, the batch
|
||||
script does not limit it's use: any mach command can be invoked. Developers
|
||||
may abuse this fact to add custom projects and commands that invoke other
|
||||
mach commands.
|
||||
@@ -100,7 +100,6 @@ MACH_MODULES = [
|
||||
'python/mach/mach/commands/settings.py',
|
||||
'python/compare-locales/mach_commands.py',
|
||||
'python/mozbuild/mozbuild/mach_commands.py',
|
||||
'python/mozbuild/mozbuild/backend/mach_commands.py',
|
||||
'python/mozbuild/mozbuild/compilation/codecomplete.py',
|
||||
'python/mozbuild/mozbuild/frontend/mach_commands.py',
|
||||
'services/common/tests/mach_commands.py',
|
||||
|
||||
@@ -97,10 +97,3 @@ if CONFIG['MOZ_VALGRIND']:
|
||||
'valgrind/i386-redhat-linux-gnu.sup',
|
||||
'valgrind/x86_64-redhat-linux-gnu.sup',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ARTIFACT_BUILDS']:
|
||||
# Ensure a pre-built interfaces.xpt installed to the objdir by the artifact
|
||||
# code is included by the top-level chrome.manifest.
|
||||
EXTRA_COMPONENTS += [
|
||||
'prebuilt-interfaces.manifest',
|
||||
]
|
||||
@@ -45,7 +45,7 @@ endif # WINNT
|
||||
ifndef INCLUDED_AUTOCONF_MK
|
||||
default::
|
||||
else
|
||||
TIERS := $(if $(MOZ_ARTIFACT_BUILDS),artifact )pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
|
||||
TIERS := pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
|
||||
endif
|
||||
|
||||
# These defines are used to support the twin-topsrcdir model for comm-central.
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# /!\ Please make sure to update the following comment when you touch this
|
||||
# file. Thank you /!\
|
||||
|
||||
# The traditional Mozilla build system relied on going through the entire
|
||||
# build tree a number of times with different targets, and many of the
|
||||
# things happening at each step required other things happening in previous
|
||||
# steps without any documentation of those dependencies.
|
||||
#
|
||||
# This new build system tries to start afresh by establishing what files or
|
||||
# operations are needed for the build, and applying the necessary rules to
|
||||
# have those in place, relying on make dependencies to get them going.
|
||||
#
|
||||
# As of writing, only building non-compiled parts of Firefox is supported
|
||||
# here (a few other things are also left out). This is a starting point, with
|
||||
# the intent to grow this build system to make it more complete.
|
||||
#
|
||||
# This file contains rules and dependencies to get things working. The intent
|
||||
# is for a Makefile to define some dependencies and variables, and include
|
||||
# this file. What needs to be defined there, and ends up being generated by
|
||||
# python/mozbuild/mozbuild/backend/fastermake.py is the following:
|
||||
# - TOPSRCDIR/TOPOBJDIR, respectively the top source directory and the top
|
||||
# object directory
|
||||
# - PYTHON, the path to the python executable
|
||||
# - ACDEFINES, which contains a set of -Dvar=name to be used during
|
||||
# preprocessing
|
||||
# - INSTALL_MANIFESTS, which defines the list of base directories handled
|
||||
# by install manifests, see further below
|
||||
#
|
||||
# A convention used between this file and the Makefile including it is that
|
||||
# global Make variables names are uppercase, while "local" Make variables
|
||||
# applied to specific targets are lowercase.
|
||||
|
||||
# Targets to be triggered for a default build
|
||||
default: $(addprefix install-,$(INSTALL_MANIFESTS))
|
||||
|
||||
ifndef NO_XPIDL
|
||||
# Targets from the recursive make backend to be built for a default build
|
||||
default: $(TOPOBJDIR)/config/makefiles/xpidl/xpidl
|
||||
endif
|
||||
|
||||
# Mac builds require to copy things in dist/bin/*.app
|
||||
# TODO: remove the MOZ_WIDGET_TOOLKIT and MOZ_BUILD_APP variables from
|
||||
# faster/Makefile and python/mozbuild/mozbuild/test/backend/test_build.py
|
||||
# when this is not required anymore.
|
||||
# We however don't need to do this when using the hybrid
|
||||
# FasterMake/RecursiveMake backend (FASTER_RECURSIVE_MAKE is set when
|
||||
# recursing from the RecursiveMake backend)
|
||||
ifndef FASTER_RECURSIVE_MAKE
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
default:
|
||||
$(MAKE) -C $(TOPOBJDIR)/$(MOZ_BUILD_APP)/app repackage
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: FORCE
|
||||
|
||||
# Extra define to trigger some workarounds. We should strive to limit the
|
||||
# use of those. As of writing the only ones are in
|
||||
# toolkit/content/buildconfig.html and browser/locales/jar.mn.
|
||||
ACDEFINES += -DBUILD_FASTER
|
||||
|
||||
# Files under the faster/ sub-directory, however, are not meant to use the
|
||||
# fallback
|
||||
$(TOPOBJDIR)/faster/%: ;
|
||||
|
||||
# Generic rule to fall back to the recursive make backend.
|
||||
# This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make
|
||||
# <3.82 apply pattern rules in definition order, not stem length like
|
||||
# modern GNU Make.
|
||||
$(TOPOBJDIR)/%: FORCE
|
||||
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||
|
||||
# Install files using install manifests
|
||||
#
|
||||
# The list of base directories is given in INSTALL_MANIFESTS. The
|
||||
# corresponding install manifests are named correspondingly, with forward
|
||||
# slashes replaced with underscores, and prefixed with `install_`. That is,
|
||||
# the install manifest for `dist/bin` would be `install_dist_bin`.
|
||||
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(addprefix $(TOPOBJDIR)/,buildid.h source-repo.h)
|
||||
@# For now, force preprocessed files to be reprocessed every time.
|
||||
@# The overhead is not that big, and this avoids waiting for proper
|
||||
@# support for defines tracking in process_install_manifest.
|
||||
@touch install_$(subst /,_,$*)
|
||||
@# BOOKMARKS_INCLUDE_DIR is for bookmarks.html only.
|
||||
$(PYTHON) -m mozbuild.action.process_install_manifest \
|
||||
--track install_$(subst /,_,$*).track \
|
||||
$(TOPOBJDIR)/$* \
|
||||
-DAB_CD=en-US \
|
||||
-DBOOKMARKS_INCLUDE_DIR=$(TOPSRCDIR)/browser/locales/en-US/profile \
|
||||
$(ACDEFINES) \
|
||||
install_$(subst /,_,$*)
|
||||
|
||||
# ============================================================================
|
||||
# Below is a set of additional dependencies and variables used to build things
|
||||
# that are not supported by data in moz.build.
|
||||
|
||||
# The xpidl target in config/makefiles/xpidl requires the install manifest for
|
||||
# dist/idl to have been processed. When using the hybrid
|
||||
# FasterMake/RecursiveMake backend, this dependency is handled in the top-level
|
||||
# Makefile.
|
||||
ifndef FASTER_RECURSIVE_MAKE
|
||||
$(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(TOPOBJDIR)/install-dist_idl
|
||||
endif
|
||||
# It also requires all the install manifests for dist/bin to have been processed
|
||||
# because it adds interfaces.manifest references with buildlist.py.
|
||||
$(TOPOBJDIR)/config/makefiles/xpidl/xpidl: $(addprefix install-,$(filter dist/bin%,$(INSTALL_MANIFESTS)))
|
||||
@@ -1,2 +0,0 @@
|
||||
org.gradle.parallel=true
|
||||
org.gradle.daemon=true
|
||||
Vendored
BIN
Binary file not shown.
-7
@@ -1,7 +0,0 @@
|
||||
#Fri Sep 16 15:41:50 PDT 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionSha256Sum=88a910cdf2e03ebbb5fe90f7ecf534fc9ac22e12112dc9a2fee810c598a76091
|
||||
@@ -1,160 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
+2
-75
@@ -11,33 +11,6 @@ include('build/moz.configure/init.configure')
|
||||
# - Spidermonkey-specific options and rules should go in js/moz.configure.
|
||||
# - etc.
|
||||
|
||||
option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
|
||||
help='Download and use prebuilt binary artifacts.')
|
||||
|
||||
@depends('--enable-artifact-builds')
|
||||
def artifact_builds(value):
|
||||
if value:
|
||||
return True
|
||||
|
||||
set_config('MOZ_ARTIFACT_BUILDS', artifact_builds)
|
||||
|
||||
imply_option('--enable-artifact-build-symbols',
|
||||
depends(artifact_builds)(lambda v: False if v is None else None),
|
||||
reason='--disable-artifact-builds')
|
||||
|
||||
option('--enable-artifact-build-symbols',
|
||||
help='Download symbols when artifact builds are enabled.')
|
||||
|
||||
set_config('MOZ_ARTIFACT_BUILD_SYMBOLS',
|
||||
depends_if('--enable-artifact-build-symbols')(lambda _: True))
|
||||
|
||||
@depends('--enable-artifact-builds')
|
||||
def imply_disable_compile_environment(value):
|
||||
if value:
|
||||
return False
|
||||
|
||||
imply_option('--enable-compile-environment', imply_disable_compile_environment)
|
||||
|
||||
option('--disable-compile-environment',
|
||||
help='Disable compiler/library checks')
|
||||
|
||||
@@ -73,43 +46,8 @@ include('build/moz.configure/warnings.configure',
|
||||
|
||||
include(include_project_configure)
|
||||
|
||||
@depends('--help')
|
||||
@imports(_from='mozbuild.backend', _import='backends')
|
||||
def build_backends_choices(_):
|
||||
return tuple(backends)
|
||||
|
||||
|
||||
@deprecated_option('--enable-build-backend', nargs='+',
|
||||
choices=build_backends_choices)
|
||||
def build_backend(backends):
|
||||
if backends:
|
||||
return tuple('+%s' % b for b in backends)
|
||||
|
||||
imply_option('--build-backends', build_backend)
|
||||
|
||||
|
||||
@depends('--enable-artifact-builds', '--disable-compile-environment', '--help')
|
||||
@imports('sys')
|
||||
def build_backend_defaults(artifact_builds, compile_environment, _):
|
||||
if artifact_builds:
|
||||
all_backends = ['FasterMake+RecursiveMake']
|
||||
else:
|
||||
all_backends = ['RecursiveMake', 'FasterMake']
|
||||
# Normally, we'd use target.os == 'WINNT', but a dependency on target
|
||||
# would require target to depend on --help, as well as host and shell,
|
||||
# and this is not a can of worms we can open at the moment.
|
||||
if sys.platform == 'win32' and compile_environment:
|
||||
all_backends.append('VisualStudio')
|
||||
return tuple(all_backends)
|
||||
|
||||
option('--build-backends', nargs='+', default=build_backend_defaults,
|
||||
choices=build_backends_choices, help='Build backends to generate')
|
||||
|
||||
@depends('--build-backends')
|
||||
def build_backends(backends):
|
||||
return backends
|
||||
|
||||
set_config('BUILD_BACKENDS', build_backends)
|
||||
# We only support one build-backend, namely RecursiveMake.
|
||||
set_config('BUILD_BACKENDS', tuple(['RecursiveMake']))
|
||||
|
||||
|
||||
# Awk detection
|
||||
@@ -186,17 +124,6 @@ def possible_makes(make, host):
|
||||
|
||||
check_prog('GMAKE', possible_makes)
|
||||
|
||||
# tup detection
|
||||
# ==============================================================
|
||||
@depends(build_backends)
|
||||
def tup_progs(build_backends):
|
||||
for backend in build_backends:
|
||||
if 'Tup' in backend:
|
||||
return ['tup']
|
||||
return None
|
||||
|
||||
tup = check_prog('TUP', tup_progs)
|
||||
|
||||
# Miscellaneous programs
|
||||
# ==============================================================
|
||||
check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
|
||||
|
||||
@@ -4961,7 +4961,6 @@ AC_SUBST_LIST(VPX_ASFLAGS)
|
||||
AC_SUBST(VPX_AS_CONVERSION)
|
||||
AC_SUBST(VPX_X86_ASM)
|
||||
AC_SUBST(VPX_ARM_ASM)
|
||||
AC_SUBST(MOZ_CODE_COVERAGE)
|
||||
AC_SUBST(LIBJPEG_TURBO_USE_YASM)
|
||||
AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
|
||||
AC_SUBST(MOZ_LIBAV_FFT)
|
||||
|
||||
@@ -27,7 +27,6 @@ PYTHON_UNIT_TESTS += [
|
||||
'mozbuild/mozbuild/test/backend/test_build.py',
|
||||
'mozbuild/mozbuild/test/backend/test_configenvironment.py',
|
||||
'mozbuild/mozbuild/test/backend/test_recursivemake.py',
|
||||
'mozbuild/mozbuild/test/backend/test_visualstudio.py',
|
||||
'mozbuild/mozbuild/test/compilation/test_warnings.py',
|
||||
'mozbuild/mozbuild/test/configure/lint.py',
|
||||
'mozbuild/mozbuild/test/configure/test_checks_configure.py',
|
||||
|
||||
@@ -3,23 +3,12 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
backends = {
|
||||
'ChromeMap': 'mozbuild.codecoverage.chrome_map',
|
||||
'CompileDB': 'mozbuild.compilation.database',
|
||||
'CppEclipse': 'mozbuild.backend.cpp_eclipse',
|
||||
'FasterMake': 'mozbuild.backend.fastermake',
|
||||
'FasterMake+RecursiveMake': None,
|
||||
'RecursiveMake': 'mozbuild.backend.recursivemake',
|
||||
'Tup': 'mozbuild.backend.tup',
|
||||
'VisualStudio': 'mozbuild.backend.visualstudio',
|
||||
}
|
||||
|
||||
|
||||
def get_backend_class(name):
|
||||
if '+' in name:
|
||||
from mozbuild.backend.base import HybridBackend
|
||||
return HybridBackend(*(get_backend_class(name)
|
||||
for name in name.split('+')))
|
||||
|
||||
class_name = '%sBackend' % name
|
||||
module = __import__(backends[name], globals(), locals(), [class_name])
|
||||
return getattr(module, class_name)
|
||||
@@ -125,13 +125,11 @@ class BuildBackend(LoggingMixin):
|
||||
|
||||
for obj in objs:
|
||||
obj_start = time.time()
|
||||
if (not self.consume_object(obj) and
|
||||
not isinstance(self, PartialBackend)):
|
||||
if (not self.consume_object(obj)):
|
||||
raise Exception('Unhandled object of type %s' % type(obj))
|
||||
self._execution_time += time.time() - obj_start
|
||||
|
||||
if (isinstance(obj, ContextDerived) and
|
||||
not isinstance(self, PartialBackend)):
|
||||
if (isinstance(obj, ContextDerived)):
|
||||
self.backend_input_files |= obj.context_all_paths
|
||||
|
||||
# Pull in all loaded Python as dependencies so any Python changes that
|
||||
@@ -266,52 +264,3 @@ class BuildBackend(LoggingMixin):
|
||||
with self._write_file(obj.output_path) as fh:
|
||||
pp.out = fh
|
||||
yield pp
|
||||
|
||||
|
||||
class PartialBackend(BuildBackend):
|
||||
"""A PartialBackend is a BuildBackend declaring that its consume_object
|
||||
method may not handle all build configuration objects it's passed, and
|
||||
that it's fine."""
|
||||
|
||||
|
||||
def HybridBackend(*backends):
|
||||
"""A HybridBackend is the combination of one or more PartialBackends
|
||||
with a non-partial BuildBackend.
|
||||
|
||||
Build configuration objects are passed to each backend, stopping at the
|
||||
first of them that declares having handled them.
|
||||
"""
|
||||
assert len(backends) >= 2
|
||||
assert all(issubclass(b, PartialBackend) for b in backends[:-1])
|
||||
assert not(issubclass(backends[-1], PartialBackend))
|
||||
assert all(issubclass(b, BuildBackend) for b in backends)
|
||||
|
||||
class TheHybridBackend(BuildBackend):
|
||||
def __init__(self, environment):
|
||||
self._backends = [b(environment) for b in backends]
|
||||
super(TheHybridBackend, self).__init__(environment)
|
||||
|
||||
def consume_object(self, obj):
|
||||
return any(b.consume_object(obj) for b in self._backends)
|
||||
|
||||
def consume_finished(self):
|
||||
for backend in self._backends:
|
||||
backend.consume_finished()
|
||||
|
||||
for attr in ('_execution_time', '_created_count', '_updated_count',
|
||||
'_unchanged_count', '_deleted_count'):
|
||||
setattr(self, attr,
|
||||
sum(getattr(b, attr) for b in self._backends))
|
||||
|
||||
for b in self._backends:
|
||||
self.file_diffs.update(b.file_diffs)
|
||||
for attr in ('backend_input_files', '_backend_output_files'):
|
||||
files = getattr(self, attr)
|
||||
files |= getattr(b, attr)
|
||||
|
||||
name = '+'.join(itertools.chain(
|
||||
(b.__name__.replace('Backend', '') for b in backends[:1]),
|
||||
(b.__name__ for b in backends[-1:])
|
||||
))
|
||||
|
||||
return type(str(name), (TheHybridBackend,), {})
|
||||
@@ -252,71 +252,35 @@ class CommonBackend(BuildBackend):
|
||||
|
||||
# We should consider aggregating WebIDL types in emitter.py.
|
||||
elif isinstance(obj, WebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.sources.add(mozpath.join(obj.srcdir, obj.basename))
|
||||
|
||||
elif isinstance(obj, GeneratedEventWebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.generated_events_sources.add(mozpath.join(
|
||||
obj.srcdir, obj.basename))
|
||||
|
||||
elif isinstance(obj, TestWebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.test_sources.add(mozpath.join(obj.srcdir,
|
||||
obj.basename))
|
||||
|
||||
elif isinstance(obj, PreprocessedTestWebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.preprocessed_test_sources.add(mozpath.join(
|
||||
obj.srcdir, obj.basename))
|
||||
|
||||
elif isinstance(obj, GeneratedWebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.generated_sources.add(mozpath.join(obj.srcdir,
|
||||
obj.basename))
|
||||
|
||||
elif isinstance(obj, PreprocessedWebIDLFile):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.preprocessed_sources.add(mozpath.join(
|
||||
obj.srcdir, obj.basename))
|
||||
|
||||
elif isinstance(obj, ExampleWebIDLInterface):
|
||||
# WebIDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._webidls.example_interfaces.add(obj.name)
|
||||
|
||||
elif isinstance(obj, IPDLFile):
|
||||
# IPDL isn't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
self._ipdl_sources.add(mozpath.join(obj.srcdir, obj.basename))
|
||||
|
||||
elif isinstance(obj, UnifiedSources):
|
||||
# Unified sources aren't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
return True
|
||||
|
||||
if obj.have_unified_mapping:
|
||||
self._write_unified_files(obj.unified_source_mapping, obj.objdir)
|
||||
if hasattr(self, '_process_unified_sources'):
|
||||
|
||||
@@ -187,10 +187,6 @@ class ConfigEnvironment(object):
|
||||
|
||||
self.substs_unicode = ReadOnlyDict(self.substs_unicode)
|
||||
|
||||
@property
|
||||
def is_artifact_build(self):
|
||||
return self.substs.get('MOZ_ARTIFACT_BUILDS', False)
|
||||
|
||||
@staticmethod
|
||||
def from_config_status(path):
|
||||
config = BuildConfig.from_config_status(path)
|
||||
|
||||
@@ -1,685 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import errno
|
||||
import random
|
||||
import os
|
||||
import subprocess
|
||||
import types
|
||||
import xml.etree.ElementTree as ET
|
||||
from .common import CommonBackend
|
||||
|
||||
from ..frontend.data import (
|
||||
Defines,
|
||||
)
|
||||
from mozbuild.base import ExecutionSummary
|
||||
|
||||
# TODO Have ./mach eclipse generate the workspace and index it:
|
||||
# /Users/bgirard/mozilla/eclipse/eclipse/eclipse/eclipse -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data $PWD/workspace -importAll $PWD/eclipse
|
||||
# Open eclipse:
|
||||
# /Users/bgirard/mozilla/eclipse/eclipse/eclipse/eclipse -data $PWD/workspace
|
||||
|
||||
class CppEclipseBackend(CommonBackend):
|
||||
"""Backend that generates Cpp Eclipse project files.
|
||||
"""
|
||||
|
||||
def __init__(self, environment):
|
||||
if os.name == 'nt':
|
||||
raise Exception('Eclipse is not supported on Windows. '
|
||||
'Consider using Visual Studio instead.')
|
||||
super(CppEclipseBackend, self).__init__(environment)
|
||||
|
||||
def _init(self):
|
||||
CommonBackend._init(self)
|
||||
|
||||
self._paths_to_defines = {}
|
||||
self._project_name = 'Gecko'
|
||||
self._workspace_dir = self._get_workspace_path()
|
||||
self._project_dir = os.path.join(self._workspace_dir, self._project_name)
|
||||
self._overwriting_workspace = os.path.isdir(self._workspace_dir)
|
||||
|
||||
self._macbundle = self.environment.substs['MOZ_MACBUNDLE_NAME']
|
||||
self._appname = self.environment.substs['MOZ_APP_NAME']
|
||||
self._bin_suffix = self.environment.substs['BIN_SUFFIX']
|
||||
self._cxx = self.environment.substs['CXX']
|
||||
# Note: We need the C Pre Processor (CPP) flags, not the CXX flags
|
||||
self._cppflags = self.environment.substs.get('CPPFLAGS', '')
|
||||
|
||||
def summary(self):
|
||||
return ExecutionSummary(
|
||||
'CppEclipse backend executed in {execution_time:.2f}s\n'
|
||||
'Generated Cpp Eclipse workspace in "{workspace:s}".\n'
|
||||
'If missing, import the project using File > Import > General > Existing Project into workspace\n'
|
||||
'\n'
|
||||
'Run with: eclipse -data {workspace:s}\n',
|
||||
execution_time=self._execution_time,
|
||||
workspace=self._workspace_dir)
|
||||
|
||||
def _get_workspace_path(self):
|
||||
return CppEclipseBackend.get_workspace_path(self.environment.topsrcdir, self.environment.topobjdir)
|
||||
|
||||
@staticmethod
|
||||
def get_workspace_path(topsrcdir, topobjdir):
|
||||
# Eclipse doesn't support having the workspace inside the srcdir.
|
||||
# Since most people have their objdir inside their srcdir it's easier
|
||||
# and more consistent to just put the workspace along side the srcdir
|
||||
srcdir_parent = os.path.dirname(topsrcdir)
|
||||
workspace_dirname = "eclipse_" + os.path.basename(topobjdir)
|
||||
return os.path.join(srcdir_parent, workspace_dirname)
|
||||
|
||||
def consume_object(self, obj):
|
||||
reldir = getattr(obj, 'relativedir', None)
|
||||
|
||||
# Note that unlike VS, Eclipse' indexer seem to crawl the headers and
|
||||
# isn't picky about the local includes.
|
||||
if isinstance(obj, Defines):
|
||||
self._paths_to_defines.setdefault(reldir, {}).update(obj.defines)
|
||||
|
||||
return True
|
||||
|
||||
def consume_finished(self):
|
||||
settings_dir = os.path.join(self._project_dir, '.settings')
|
||||
launch_dir = os.path.join(self._project_dir, 'RunConfigurations')
|
||||
workspace_settings_dir = os.path.join(self._workspace_dir, '.metadata/.plugins/org.eclipse.core.runtime/.settings')
|
||||
workspace_language_dir = os.path.join(self._workspace_dir, '.metadata/.plugins/org.eclipse.cdt.core')
|
||||
|
||||
for dir_name in [self._project_dir, settings_dir, launch_dir, workspace_settings_dir, workspace_language_dir]:
|
||||
try:
|
||||
os.makedirs(dir_name)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
project_path = os.path.join(self._project_dir, '.project')
|
||||
with open(project_path, 'wb') as fh:
|
||||
self._write_project(fh)
|
||||
|
||||
cproject_path = os.path.join(self._project_dir, '.cproject')
|
||||
with open(cproject_path, 'wb') as fh:
|
||||
self._write_cproject(fh)
|
||||
|
||||
language_path = os.path.join(settings_dir, 'language.settings.xml')
|
||||
with open(language_path, 'wb') as fh:
|
||||
self._write_language_settings(fh)
|
||||
|
||||
workspace_language_path = os.path.join(workspace_language_dir, 'language.settings.xml')
|
||||
with open(workspace_language_path, 'wb') as fh:
|
||||
workspace_lang_settings = WORKSPACE_LANGUAGE_SETTINGS_TEMPLATE
|
||||
workspace_lang_settings = workspace_lang_settings.replace("@COMPILER_FLAGS@", self._cxx + " " + self._cppflags);
|
||||
fh.write(workspace_lang_settings)
|
||||
|
||||
self._write_launch_files(launch_dir)
|
||||
|
||||
# This will show up as an 'unmanged' formatter. This can be named by generating
|
||||
# another file.
|
||||
formatter_prefs_path = os.path.join(settings_dir, 'org.eclipse.cdt.core.prefs')
|
||||
with open(formatter_prefs_path, 'wb') as fh:
|
||||
fh.write(FORMATTER_SETTINGS);
|
||||
|
||||
editor_prefs_path = os.path.join(workspace_settings_dir, "org.eclipse.ui.editors.prefs");
|
||||
with open(editor_prefs_path, 'wb') as fh:
|
||||
fh.write(EDITOR_SETTINGS);
|
||||
|
||||
# Now import the project into the workspace
|
||||
self._import_project()
|
||||
|
||||
def _import_project(self):
|
||||
# If the workspace already exists then don't import the project again because
|
||||
# eclipse doesn't handle this properly
|
||||
if self._overwriting_workspace:
|
||||
return
|
||||
|
||||
# We disable the indexer otherwise we're forced to index
|
||||
# the whole codebase when importing the project. Indexing the project can take 20 minutes.
|
||||
self._write_noindex()
|
||||
|
||||
try:
|
||||
process = subprocess.check_call(
|
||||
["eclipse", "-application", "-nosplash",
|
||||
"org.eclipse.cdt.managedbuilder.core.headlessbuild",
|
||||
"-data", self._workspace_dir, "-importAll", self._project_dir])
|
||||
finally:
|
||||
self._remove_noindex()
|
||||
|
||||
def _write_noindex(self):
|
||||
noindex_path = os.path.join(self._project_dir, '.settings/org.eclipse.cdt.core.prefs')
|
||||
with open(noindex_path, 'wb') as fh:
|
||||
fh.write(NOINDEX_TEMPLATE);
|
||||
|
||||
def _remove_noindex(self):
|
||||
noindex_path = os.path.join(self._project_dir, '.settings/org.eclipse.cdt.core.prefs')
|
||||
os.remove(noindex_path)
|
||||
|
||||
def _define_entry(self, name, value):
|
||||
define = ET.Element('entry')
|
||||
define.set('kind', 'macro')
|
||||
define.set('name', name)
|
||||
define.set('value', value)
|
||||
return ET.tostring(define)
|
||||
|
||||
def _write_language_settings(self, fh):
|
||||
settings = LANGUAGE_SETTINGS_TEMPLATE
|
||||
|
||||
settings = settings.replace('@GLOBAL_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include'))
|
||||
settings = settings.replace('@NSPR_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include/nspr'))
|
||||
settings = settings.replace('@IPDL_INCLUDE_PATH@', os.path.join(self.environment.topobjdir, 'ipc/ipdl/_ipdlheaders'))
|
||||
settings = settings.replace('@PREINCLUDE_FILE_PATH@', os.path.join(self.environment.topobjdir, 'dist/include/mozilla-config.h'))
|
||||
settings = settings.replace('@DEFINE_MOZILLA_INTERNAL_API@', self._define_entry('MOZILLA_INTERNAL_API', '1'))
|
||||
settings = settings.replace("@COMPILER_FLAGS@", self._cxx + " " + self._cppflags);
|
||||
|
||||
fh.write(settings)
|
||||
|
||||
def _write_launch_files(self, launch_dir):
|
||||
bin_dir = os.path.join(self.environment.topobjdir, 'dist')
|
||||
|
||||
# TODO Improve binary detection
|
||||
if self._macbundle:
|
||||
exe_path = os.path.join(bin_dir, self._macbundle, 'Contents/MacOS')
|
||||
else:
|
||||
exe_path = os.path.join(bin_dir, 'bin')
|
||||
|
||||
exe_path = os.path.join(exe_path, self._appname + self._bin_suffix)
|
||||
|
||||
main_gecko_launch = os.path.join(launch_dir, 'gecko.launch')
|
||||
with open(main_gecko_launch, 'wb') as fh:
|
||||
launch = GECKO_LAUNCH_CONFIG_TEMPLATE
|
||||
launch = launch.replace('@LAUNCH_PROGRAM@', exe_path)
|
||||
launch = launch.replace('@LAUNCH_ARGS@', '-P -no-remote')
|
||||
fh.write(launch)
|
||||
|
||||
#TODO Add more launch configs (and delegate calls to mach)
|
||||
|
||||
def _write_project(self, fh):
|
||||
project = PROJECT_TEMPLATE;
|
||||
|
||||
project = project.replace('@PROJECT_NAME@', self._project_name)
|
||||
project = project.replace('@PROJECT_TOPSRCDIR@', self.environment.topsrcdir)
|
||||
fh.write(project)
|
||||
|
||||
def _write_cproject(self, fh):
|
||||
cproject_header = CPROJECT_TEMPLATE_HEADER
|
||||
cproject_header = cproject_header.replace('@PROJECT_TOPSRCDIR@', self.environment.topobjdir)
|
||||
cproject_header = cproject_header.replace('@MACH_COMMAND@', os.path.join(self.environment.topsrcdir, 'mach'))
|
||||
fh.write(cproject_header)
|
||||
|
||||
for path, defines in self._paths_to_defines.items():
|
||||
folderinfo = CPROJECT_TEMPLATE_FOLDER_INFO_HEADER
|
||||
folderinfo = folderinfo.replace('@FOLDER_ID@', str(random.randint(1000000, 99999999999)))
|
||||
folderinfo = folderinfo.replace('@FOLDER_NAME@', 'tree/' + path)
|
||||
fh.write(folderinfo)
|
||||
for k, v in defines.items():
|
||||
define = ET.Element('listOptionValue')
|
||||
define.set('builtIn', 'false')
|
||||
define.set('value', str(k) + "=" + str(v))
|
||||
fh.write(ET.tostring(define))
|
||||
fh.write(CPROJECT_TEMPLATE_FOLDER_INFO_FOOTER)
|
||||
|
||||
|
||||
fh.write(CPROJECT_TEMPLATE_FOOTER)
|
||||
|
||||
|
||||
PROJECT_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>@PROJECT_NAME@</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers></triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>tree</name>
|
||||
<type>2</type>
|
||||
<location>@PROJECT_TOPSRCDIR@</location>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>17111971</id>
|
||||
<name>tree</name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-obj-*</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>14081994</id>
|
||||
<name>tree</name>
|
||||
<type>22</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.rej</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>25121970</id>
|
||||
<name>tree</name>
|
||||
<type>22</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.orig</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>10102004</id>
|
||||
<name>tree</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-.hg</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>23122002</id>
|
||||
<name>tree</name>
|
||||
<type>22</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.pyc</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
"""
|
||||
|
||||
CPROJECT_TEMPLATE_HEADER = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="0.1674256904">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1674256904" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1674256904" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="0.1674256904." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.1276586933" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.710759961" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder arguments="--log-no-times build" buildPath="@PROJECT_TOPSRCDIR@" command="@MACH_COMMAND@" enableCleanBuild="false" incrementalBuildTarget="binaries" id="org.eclipse.cdt.build.core.settings.default.builder.1437267827" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
"""
|
||||
CPROJECT_TEMPLATE_FOLDER_INFO_HEADER = """
|
||||
<folderInfo id="0.1674256904.@FOLDER_ID@" name="/" resourcePath="@FOLDER_NAME@">
|
||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1022318069" name="No ToolChain" superClass="org.eclipse.cdt.build.core.prefbase.toolchain" unusedChildren="">
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1259030812" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs.1800697532"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.1407291069" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder.582514939">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1907658087" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
||||
"""
|
||||
CPROJECT_TEMPLATE_FOLDER_INFO_DEFINE = """
|
||||
<listOptionValue builtIn="false" value="@FOLDER_DEFINE@"/>
|
||||
"""
|
||||
CPROJECT_TEMPLATE_FOLDER_INFO_FOOTER = """
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.440601711" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
"""
|
||||
CPROJECT_TEMPLATE_FILEINFO = """ <fileInfo id="0.1674256904.474736658" name="Layers.cpp" rcbsApplicability="disable" resourcePath="tree/gfx/layers/Layers.cpp" toolsToInvoke="org.eclipse.cdt.build.core.settings.holder.582514939.463639939">
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.582514939.463639939" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder.582514939">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.symbols.232300236" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="BENWA=BENWAVAL"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1942876228" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</fileInfo>
|
||||
"""
|
||||
CPROJECT_TEMPLATE_FOOTER = """ </configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Empty.null.1281234804" name="Empty"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="0.1674256904">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Default"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
</cproject>
|
||||
"""
|
||||
|
||||
WORKSPACE_LANGUAGE_SETTINGS_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<plugin>
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="true" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="@COMPILER_FLAGS@ -E -P -v -dD "${INPUTS}"">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</plugin>
|
||||
"""
|
||||
|
||||
LANGUAGE_SETTINGS_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="0.1674256904" name="Default">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true" store-entries-with-project="true">
|
||||
<language id="org.eclipse.cdt.core.g++">
|
||||
<resource project-relative-path="">
|
||||
<entry kind="includePath" name="@GLOBAL_INCLUDE_PATH@">
|
||||
<flag value="LOCAL"/>
|
||||
</entry>
|
||||
<entry kind="includePath" name="@NSPR_INCLUDE_PATH@">
|
||||
<flag value="LOCAL"/>
|
||||
</entry>
|
||||
<entry kind="includePath" name="@IPDL_INCLUDE_PATH@">
|
||||
<flag value="LOCAL"/>
|
||||
</entry>
|
||||
<entry kind="includeFile" name="@PREINCLUDE_FILE_PATH@">
|
||||
<flag value="LOCAL"/>
|
||||
</entry>
|
||||
<!--
|
||||
Because of https://developer.mozilla.org/en-US/docs/Eclipse_CDT#Headers_are_only_parsed_once
|
||||
we need to make sure headers are parsed with MOZILLA_INTERNAL_API to make sure
|
||||
the indexer gets the version that is used in most of the true. This means that
|
||||
MOZILLA_EXTERNAL_API code will suffer.
|
||||
-->
|
||||
@DEFINE_MOZILLA_INTERNAL_API@
|
||||
</resource>
|
||||
</language>
|
||||
</provider>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-859273372804152468" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="@COMPILER_FLAGS@ -E -P -v -dD "${INPUTS}" -std=c++11" prefer-non-shared="true" store-entries-with-project="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
"""
|
||||
|
||||
GECKO_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="lldb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="@LAUNCH_ARGS@"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="@LAUNCH_PROGRAM@"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Gecko"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/gecko"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
"""
|
||||
|
||||
B2GFLASH_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="lldb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="@LAUNCH_PROGRAM@"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Gecko"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="@OBJDIR@"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/gecko"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
"""
|
||||
|
||||
|
||||
EDITOR_SETTINGS = """eclipse.preferences.version=1
|
||||
lineNumberRuler=true
|
||||
overviewRuler_migration=migrated_3.1
|
||||
printMargin=true
|
||||
printMarginColumn=80
|
||||
showCarriageReturn=false
|
||||
showEnclosedSpaces=false
|
||||
showLeadingSpaces=false
|
||||
showLineFeed=false
|
||||
showWhitespaceCharacters=true
|
||||
spacesForTabs=true
|
||||
tabWidth=2
|
||||
undoHistorySize=200
|
||||
"""
|
||||
|
||||
FORMATTER_SETTINGS = """eclipse.preferences.version=1
|
||||
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_assignment=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
|
||||
org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34
|
||||
org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18
|
||||
org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=48
|
||||
org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expression_list=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_member_access=0
|
||||
org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line_shifted
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_switch=end_of_line
|
||||
org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line
|
||||
org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1
|
||||
org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true
|
||||
org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
|
||||
org.eclipse.cdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true
|
||||
org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false
|
||||
org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=true
|
||||
org.eclipse.cdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.cdt.core.formatter.indentation.size=2
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.cdt.core.formatter.join_wrapped_lines=false
|
||||
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.cdt.core.formatter.lineSplit=80
|
||||
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.cdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.cdt.core.formatter.tabulation.size=2
|
||||
org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
"""
|
||||
|
||||
NOINDEX_TEMPLATE = """eclipse.preferences.version=1
|
||||
indexer/indexerId=org.eclipse.cdt.core.nullIndexer
|
||||
"""
|
||||
@@ -1,165 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
|
||||
from mozbuild.backend.base import PartialBackend
|
||||
from mozbuild.backend.common import CommonBackend
|
||||
from mozbuild.frontend.context import (
|
||||
ObjDirPath,
|
||||
)
|
||||
from mozbuild.frontend.data import (
|
||||
ChromeManifestEntry,
|
||||
FinalTargetPreprocessedFiles,
|
||||
FinalTargetFiles,
|
||||
JARManifest,
|
||||
XPIDLFile,
|
||||
)
|
||||
from mozbuild.makeutil import Makefile
|
||||
from mozbuild.util import OrderedDefaultDict
|
||||
from mozpack.manifests import InstallManifest
|
||||
import mozpack.path as mozpath
|
||||
|
||||
|
||||
class FasterMakeBackend(CommonBackend, PartialBackend):
|
||||
def _init(self):
|
||||
super(FasterMakeBackend, self)._init()
|
||||
|
||||
self._manifest_entries = OrderedDefaultDict(set)
|
||||
|
||||
self._install_manifests = OrderedDefaultDict(InstallManifest)
|
||||
|
||||
self._dependencies = OrderedDefaultDict(list)
|
||||
|
||||
self._has_xpidl = False
|
||||
|
||||
def _add_preprocess(self, obj, path, dest, target=None, **kwargs):
|
||||
if target is None:
|
||||
target = mozpath.basename(path)
|
||||
# This matches what PP_TARGETS do in config/rules.
|
||||
if target.endswith('.in'):
|
||||
target = target[:-3]
|
||||
if target.endswith('.css'):
|
||||
kwargs['marker'] = '%'
|
||||
depfile = mozpath.join(
|
||||
self.environment.topobjdir, 'faster', '.deps',
|
||||
mozpath.join(obj.install_target, dest, target).replace('/', '_'))
|
||||
self._install_manifests[obj.install_target].add_preprocess(
|
||||
mozpath.join(obj.srcdir, path),
|
||||
mozpath.join(dest, target),
|
||||
depfile,
|
||||
**kwargs)
|
||||
|
||||
def consume_object(self, obj):
|
||||
if isinstance(obj, JARManifest) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
self._consume_jar_manifest(obj)
|
||||
|
||||
elif isinstance(obj, (FinalTargetFiles,
|
||||
FinalTargetPreprocessedFiles)) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
defines = obj.defines or {}
|
||||
if defines:
|
||||
defines = defines.defines
|
||||
for path, files in obj.files.walk():
|
||||
for f in files:
|
||||
if isinstance(obj, FinalTargetPreprocessedFiles):
|
||||
self._add_preprocess(obj, f.full_path, path,
|
||||
target=f.target_basename,
|
||||
defines=defines)
|
||||
elif '*' in f:
|
||||
def _prefix(s):
|
||||
for p in mozpath.split(s):
|
||||
if '*' not in p:
|
||||
yield p + '/'
|
||||
prefix = ''.join(_prefix(f.full_path))
|
||||
|
||||
self._install_manifests[obj.install_target] \
|
||||
.add_pattern_symlink(
|
||||
prefix,
|
||||
f.full_path[len(prefix):],
|
||||
mozpath.join(path, f.target_basename))
|
||||
else:
|
||||
self._install_manifests[obj.install_target].add_symlink(
|
||||
f.full_path,
|
||||
mozpath.join(path, f.target_basename)
|
||||
)
|
||||
if isinstance(f, ObjDirPath):
|
||||
dep_target = 'install-%s' % obj.install_target
|
||||
self._dependencies[dep_target].append(
|
||||
mozpath.relpath(f.full_path,
|
||||
self.environment.topobjdir))
|
||||
|
||||
elif isinstance(obj, ChromeManifestEntry) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
top_level = mozpath.join(obj.install_target, 'chrome.manifest')
|
||||
if obj.path != top_level:
|
||||
entry = 'manifest %s' % mozpath.relpath(obj.path,
|
||||
obj.install_target)
|
||||
self._manifest_entries[top_level].add(entry)
|
||||
self._manifest_entries[obj.path].add(str(obj.entry))
|
||||
|
||||
elif isinstance(obj, XPIDLFile):
|
||||
self._has_xpidl = True
|
||||
# We're not actually handling XPIDL files.
|
||||
return False
|
||||
|
||||
else:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def consume_finished(self):
|
||||
mk = Makefile()
|
||||
# Add the default rule at the very beginning.
|
||||
mk.create_rule(['default'])
|
||||
mk.add_statement('TOPSRCDIR = %s' % self.environment.topsrcdir)
|
||||
mk.add_statement('TOPOBJDIR = %s' % self.environment.topobjdir)
|
||||
if not self._has_xpidl:
|
||||
mk.add_statement('NO_XPIDL = 1')
|
||||
|
||||
# Add a few necessary variables inherited from configure
|
||||
for var in (
|
||||
'PYTHON',
|
||||
'ACDEFINES',
|
||||
'MOZ_BUILD_APP',
|
||||
'MOZ_WIDGET_TOOLKIT',
|
||||
):
|
||||
value = self.environment.substs.get(var)
|
||||
if value is not None:
|
||||
mk.add_statement('%s = %s' % (var, value))
|
||||
|
||||
install_manifests_bases = self._install_manifests.keys()
|
||||
|
||||
# Add information for chrome manifest generation
|
||||
manifest_targets = []
|
||||
|
||||
for target, entries in self._manifest_entries.iteritems():
|
||||
manifest_targets.append(target)
|
||||
install_target = mozpath.basedir(target, install_manifests_bases)
|
||||
self._install_manifests[install_target].add_content(
|
||||
''.join('%s\n' % e for e in sorted(entries)),
|
||||
mozpath.relpath(target, install_target))
|
||||
|
||||
# Add information for install manifests.
|
||||
mk.add_statement('INSTALL_MANIFESTS = %s'
|
||||
% ' '.join(self._install_manifests.keys()))
|
||||
|
||||
# Add dependencies we infered:
|
||||
for target, deps in self._dependencies.iteritems():
|
||||
mk.create_rule([target]).add_dependencies(
|
||||
'$(TOPOBJDIR)/%s' % d for d in deps)
|
||||
|
||||
mk.add_statement('include $(TOPSRCDIR)/config/faster/rules.mk')
|
||||
|
||||
for base, install_manifest in self._install_manifests.iteritems():
|
||||
with self._write_file(
|
||||
mozpath.join(self.environment.topobjdir, 'faster',
|
||||
'install_%s' % base.replace('/', '_'))) as fh:
|
||||
install_manifest.write(fileobj=fh)
|
||||
|
||||
with self._write_file(
|
||||
mozpath.join(self.environment.topobjdir, 'faster',
|
||||
'Makefile')) as fh:
|
||||
mk.dump(fh, removal_guard=False)
|
||||
@@ -1,123 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import which
|
||||
|
||||
from mozbuild.base import (
|
||||
MachCommandBase,
|
||||
)
|
||||
|
||||
from mach.decorators import (
|
||||
CommandArgument,
|
||||
CommandProvider,
|
||||
Command,
|
||||
)
|
||||
|
||||
@CommandProvider
|
||||
class MachCommands(MachCommandBase):
|
||||
@Command('ide', category='devenv',
|
||||
description='Generate a project and launch an IDE.')
|
||||
@CommandArgument('ide', choices=['eclipse', 'visualstudio', 'intellij'])
|
||||
@CommandArgument('args', nargs=argparse.REMAINDER)
|
||||
def eclipse(self, ide, args):
|
||||
if ide == 'eclipse':
|
||||
backend = 'CppEclipse'
|
||||
elif ide == 'visualstudio':
|
||||
backend = 'VisualStudio'
|
||||
|
||||
if ide == 'eclipse':
|
||||
try:
|
||||
which.which('eclipse')
|
||||
except which.WhichError:
|
||||
print('Eclipse CDT 8.4 or later must be installed in your PATH.')
|
||||
print('Download: http://www.eclipse.org/cdt/downloads.php')
|
||||
return 1
|
||||
elif ide =='intellij':
|
||||
studio = ['idea']
|
||||
if sys.platform != 'darwin':
|
||||
try:
|
||||
which.which(studio[0])
|
||||
except:
|
||||
self.print_ide_error(ide)
|
||||
return 1
|
||||
else:
|
||||
# In order of preference!
|
||||
for d in self.get_mac_ide_preferences(ide):
|
||||
if os.path.isdir(d):
|
||||
studio = ['open', '-a', d]
|
||||
break
|
||||
else:
|
||||
print('IntelliJ IDEA 14 is not installed in /Applications.')
|
||||
return 1
|
||||
|
||||
# Here we refresh the whole build. 'build export' is sufficient here and is probably more
|
||||
# correct but it's also nice having a single target to get a fully built and indexed
|
||||
# project (gives a easy target to use before go out to lunch).
|
||||
res = self._mach_context.commands.dispatch('build', self._mach_context)
|
||||
if res != 0:
|
||||
return 1
|
||||
|
||||
if ide in ('intellij'):
|
||||
res = self._mach_context.commands.dispatch('package', self._mach_context)
|
||||
if res != 0:
|
||||
return 1
|
||||
else:
|
||||
# Generate or refresh the IDE backend.
|
||||
python = self.virtualenv_manager.python_path
|
||||
config_status = os.path.join(self.topobjdir, 'config.status')
|
||||
args = [python, config_status, '--backend=%s' % backend]
|
||||
res = self._run_command_in_objdir(args=args, pass_thru=True, ensure_exit_code=False)
|
||||
if res != 0:
|
||||
return 1
|
||||
|
||||
|
||||
if ide == 'eclipse':
|
||||
eclipse_workspace_dir = self.get_eclipse_workspace_path()
|
||||
process = subprocess.check_call(['eclipse', '-data', eclipse_workspace_dir])
|
||||
elif ide == 'visualstudio':
|
||||
visual_studio_workspace_dir = self.get_visualstudio_workspace_path()
|
||||
process = subprocess.check_call(['explorer.exe', visual_studio_workspace_dir])
|
||||
elif ide == 'intellij':
|
||||
gradle_dir = None
|
||||
if self.is_gradle_project_already_imported():
|
||||
gradle_dir = self.get_gradle_project_path()
|
||||
else:
|
||||
gradle_dir = self.get_gradle_import_path()
|
||||
process = subprocess.check_call(studio + [gradle_dir])
|
||||
|
||||
def get_eclipse_workspace_path(self):
|
||||
from mozbuild.backend.cpp_eclipse import CppEclipseBackend
|
||||
return CppEclipseBackend.get_workspace_path(self.topsrcdir, self.topobjdir)
|
||||
|
||||
def get_visualstudio_workspace_path(self):
|
||||
return os.path.join(self.topobjdir, 'msvc', 'mozilla.sln')
|
||||
|
||||
def get_gradle_project_path(self):
|
||||
return os.path.join(self.topobjdir, 'mobile', 'gradle')
|
||||
|
||||
def get_gradle_import_path(self):
|
||||
return os.path.join(self.get_gradle_project_path(), 'build.gradle')
|
||||
|
||||
def is_gradle_project_already_imported(self):
|
||||
gradle_project_path = os.path.join(self.get_gradle_project_path(), '.idea')
|
||||
return os.path.exists(gradle_project_path)
|
||||
|
||||
def get_mac_ide_preferences(self, ide):
|
||||
if sys.platform == 'darwin':
|
||||
return [
|
||||
'/Applications/IntelliJ IDEA 14 EAP.app',
|
||||
'/Applications/IntelliJ IDEA 14.app',
|
||||
'/Applications/IntelliJ IDEA 14 CE EAP.app',
|
||||
'/Applications/IntelliJ IDEA 14 CE.app']
|
||||
|
||||
def print_ide_error(self, ide):
|
||||
if ide == 'intellij':
|
||||
print('IntelliJ is not installed in your PATH.')
|
||||
print('You can generate a command-line launcher from IntelliJ IDEA->Tools->Create Command-line launcher with script name \'idea\'')
|
||||
@@ -1,582 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# This file contains a build backend for generating Visual Studio project
|
||||
# files.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import types
|
||||
import uuid
|
||||
|
||||
from xml.dom import getDOMImplementation
|
||||
|
||||
from mozpack.files import FileFinder
|
||||
|
||||
from .common import CommonBackend
|
||||
from ..frontend.data import (
|
||||
Defines,
|
||||
GeneratedSources,
|
||||
HostProgram,
|
||||
HostSources,
|
||||
Library,
|
||||
LocalInclude,
|
||||
Program,
|
||||
Sources,
|
||||
UnifiedSources,
|
||||
)
|
||||
from mozbuild.base import ExecutionSummary
|
||||
|
||||
|
||||
MSBUILD_NAMESPACE = 'http://schemas.microsoft.com/developer/msbuild/2003'
|
||||
|
||||
def get_id(name):
|
||||
return str(uuid.uuid5(uuid.NAMESPACE_URL, name)).upper()
|
||||
|
||||
def visual_studio_product_to_solution_version(version):
|
||||
if version == '2015':
|
||||
return '12.00', '14'
|
||||
else:
|
||||
raise Exception('Unknown version seen: %s' % version)
|
||||
|
||||
def visual_studio_product_to_platform_toolset_version(version):
|
||||
if version == '2015':
|
||||
return 'v140'
|
||||
else:
|
||||
raise Exception('Unknown version seen: %s' % version)
|
||||
|
||||
class VisualStudioBackend(CommonBackend):
|
||||
"""Generate Visual Studio project files.
|
||||
|
||||
This backend is used to produce Visual Studio projects and a solution
|
||||
to foster developing Firefox with Visual Studio.
|
||||
|
||||
This backend is currently considered experimental. There are many things
|
||||
not optimal about how it works.
|
||||
"""
|
||||
|
||||
def _init(self):
|
||||
CommonBackend._init(self)
|
||||
|
||||
# These should eventually evolve into parameters.
|
||||
self._out_dir = os.path.join(self.environment.topobjdir, 'msvc')
|
||||
self._projsubdir = 'projects'
|
||||
|
||||
self._version = self.environment.substs.get('MSVS_VERSION', '2015')
|
||||
|
||||
self._paths_to_sources = {}
|
||||
self._paths_to_includes = {}
|
||||
self._paths_to_defines = {}
|
||||
self._paths_to_configs = {}
|
||||
self._libs_to_paths = {}
|
||||
self._progs_to_paths = {}
|
||||
|
||||
def summary(self):
|
||||
return ExecutionSummary(
|
||||
'VisualStudio backend executed in {execution_time:.2f}s\n'
|
||||
'Generated Visual Studio solution at {path:s}',
|
||||
execution_time=self._execution_time,
|
||||
path=os.path.join(self._out_dir, 'mozilla.sln'))
|
||||
|
||||
def consume_object(self, obj):
|
||||
reldir = getattr(obj, 'relativedir', None)
|
||||
|
||||
if hasattr(obj, 'config') and reldir not in self._paths_to_configs:
|
||||
self._paths_to_configs[reldir] = obj.config
|
||||
|
||||
if isinstance(obj, Sources):
|
||||
self._add_sources(reldir, obj)
|
||||
|
||||
elif isinstance(obj, HostSources):
|
||||
self._add_sources(reldir, obj)
|
||||
|
||||
elif isinstance(obj, GeneratedSources):
|
||||
self._add_sources(reldir, obj)
|
||||
|
||||
elif isinstance(obj, UnifiedSources):
|
||||
# XXX we should be letting CommonBackend.consume_object call this
|
||||
# for us instead.
|
||||
self._process_unified_sources(obj);
|
||||
|
||||
elif isinstance(obj, Library):
|
||||
self._libs_to_paths[obj.basename] = reldir
|
||||
|
||||
elif isinstance(obj, Program) or isinstance(obj, HostProgram):
|
||||
self._progs_to_paths[obj.program] = reldir
|
||||
|
||||
elif isinstance(obj, Defines):
|
||||
self._paths_to_defines.setdefault(reldir, {}).update(obj.defines)
|
||||
|
||||
elif isinstance(obj, LocalInclude):
|
||||
includes = self._paths_to_includes.setdefault(reldir, [])
|
||||
includes.append(obj.path.full_path)
|
||||
|
||||
# Just acknowledge everything.
|
||||
return True
|
||||
|
||||
def _add_sources(self, reldir, obj):
|
||||
s = self._paths_to_sources.setdefault(reldir, set())
|
||||
s.update(obj.files)
|
||||
|
||||
def _process_unified_sources(self, obj):
|
||||
reldir = getattr(obj, 'relativedir', None)
|
||||
|
||||
s = self._paths_to_sources.setdefault(reldir, set())
|
||||
s.update(obj.files)
|
||||
|
||||
def consume_finished(self):
|
||||
out_dir = self._out_dir
|
||||
out_proj_dir = os.path.join(self._out_dir, self._projsubdir)
|
||||
|
||||
projects = self._write_projects_for_sources(self._libs_to_paths,
|
||||
"library", out_proj_dir)
|
||||
projects.update(self._write_projects_for_sources(self._progs_to_paths,
|
||||
"binary", out_proj_dir))
|
||||
|
||||
# Generate projects that can be used to build common targets.
|
||||
for target in ('export', 'binaries', 'tools', 'full'):
|
||||
basename = 'target_%s' % target
|
||||
command = '$(SolutionDir)\\mach.bat build'
|
||||
if target != 'full':
|
||||
command += ' %s' % target
|
||||
|
||||
project_id = self._write_vs_project(out_proj_dir, basename, target,
|
||||
build_command=command,
|
||||
clean_command='$(SolutionDir)\\mach.bat build clean')
|
||||
|
||||
projects[basename] = (project_id, basename, target)
|
||||
|
||||
# A project that can be used to regenerate the visual studio projects.
|
||||
basename = 'target_vs'
|
||||
project_id = self._write_vs_project(out_proj_dir, basename, 'visual-studio',
|
||||
build_command='$(SolutionDir)\\mach.bat build-backend -b VisualStudio')
|
||||
projects[basename] = (project_id, basename, 'visual-studio')
|
||||
|
||||
# Write out a shared property file with common variables.
|
||||
props_path = os.path.join(out_proj_dir, 'mozilla.props')
|
||||
with self._write_file(props_path, mode='rb') as fh:
|
||||
self._write_props(fh)
|
||||
|
||||
# Generate some wrapper scripts that allow us to invoke mach inside
|
||||
# a MozillaBuild-like environment. We currently only use the batch
|
||||
# script. We'd like to use the PowerShell script. However, it seems
|
||||
# to buffer output from within Visual Studio (surely this is
|
||||
# configurable) and the default execution policy of PowerShell doesn't
|
||||
# allow custom scripts to be executed.
|
||||
with self._write_file(os.path.join(out_dir, 'mach.bat'), mode='rb') as fh:
|
||||
self._write_mach_batch(fh)
|
||||
|
||||
with self._write_file(os.path.join(out_dir, 'mach.ps1'), mode='rb') as fh:
|
||||
self._write_mach_powershell(fh)
|
||||
|
||||
# Write out a solution file to tie it all together.
|
||||
solution_path = os.path.join(out_dir, 'mozilla.sln')
|
||||
with self._write_file(solution_path, mode='rb') as fh:
|
||||
self._write_solution(fh, projects)
|
||||
|
||||
def _write_projects_for_sources(self, sources, prefix, out_dir):
|
||||
projects = {}
|
||||
for item, path in sorted(sources.items()):
|
||||
config = self._paths_to_configs.get(path, None)
|
||||
sources = self._paths_to_sources.get(path, set())
|
||||
sources = set(os.path.join('$(TopSrcDir)', path, s) for s in sources)
|
||||
sources = set(os.path.normpath(s) for s in sources)
|
||||
|
||||
finder = FileFinder(os.path.join(self.environment.topsrcdir, path),
|
||||
find_executables=False)
|
||||
|
||||
headers = [t[0] for t in finder.find('*.h')]
|
||||
headers = [os.path.normpath(os.path.join('$(TopSrcDir)',
|
||||
path, f)) for f in headers]
|
||||
|
||||
includes = [
|
||||
os.path.join('$(TopSrcDir)', path),
|
||||
os.path.join('$(TopObjDir)', path),
|
||||
]
|
||||
includes.extend(self._paths_to_includes.get(path, []))
|
||||
includes.append('$(TopObjDir)\\dist\\include\\nss')
|
||||
includes.append('$(TopObjDir)\\dist\\include')
|
||||
|
||||
for v in ('NSPR_CFLAGS', 'NSS_CFLAGS', 'MOZ_JPEG_CFLAGS',
|
||||
'MOZ_PNG_CFLAGS', 'MOZ_ZLIB_CFLAGS', 'MOZ_PIXMAN_CFLAGS'):
|
||||
if not config:
|
||||
break
|
||||
|
||||
args = config.substs.get(v, [])
|
||||
|
||||
for i, arg in enumerate(args):
|
||||
if arg.startswith('-I'):
|
||||
includes.append(os.path.normpath(arg[2:]))
|
||||
|
||||
# Pull in system defaults.
|
||||
includes.append('$(DefaultIncludes)')
|
||||
|
||||
includes = [os.path.normpath(i) for i in includes]
|
||||
|
||||
defines = []
|
||||
for k, v in self._paths_to_defines.get(path, {}).items():
|
||||
if v is True:
|
||||
defines.append(k)
|
||||
else:
|
||||
defines.append('%s=%s' % (k, v))
|
||||
|
||||
debugger=None
|
||||
if prefix == 'binary':
|
||||
if item.startswith(self.environment.substs['MOZ_APP_NAME']):
|
||||
debugger = ('$(TopObjDir)\\dist\\bin\\%s' % item, '-no-remote')
|
||||
else:
|
||||
debugger = ('$(TopObjDir)\\dist\\bin\\%s' % item, '')
|
||||
|
||||
basename = '%s_%s' % (prefix, item)
|
||||
|
||||
project_id = self._write_vs_project(out_dir, basename, item,
|
||||
includes=includes,
|
||||
forced_includes=['$(TopObjDir)\\dist\\include\\mozilla-config.h'],
|
||||
defines=defines,
|
||||
headers=headers,
|
||||
sources=sources,
|
||||
debugger=debugger)
|
||||
|
||||
projects[basename] = (project_id, basename, item)
|
||||
|
||||
return projects
|
||||
|
||||
def _write_solution(self, fh, projects):
|
||||
# Visual Studio appears to write out its current version in the
|
||||
# solution file. Instead of trying to figure out what version it will
|
||||
# write, try to parse the version out of the existing file and use it
|
||||
# verbatim.
|
||||
vs_version = None
|
||||
try:
|
||||
with open(fh.name, 'rb') as sfh:
|
||||
for line in sfh:
|
||||
if line.startswith(b'VisualStudioVersion = '):
|
||||
vs_version = line.split(b' = ', 1)[1].strip()
|
||||
except IOError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
format_version, comment_version = visual_studio_product_to_solution_version(self._version)
|
||||
# This is a Visual C++ Project type.
|
||||
project_type = '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
|
||||
|
||||
# Visual Studio seems to require this header.
|
||||
fh.write('Microsoft Visual Studio Solution File, Format Version %s\r\n' %
|
||||
format_version)
|
||||
fh.write('# Visual Studio %s\r\n' % comment_version)
|
||||
|
||||
if vs_version:
|
||||
fh.write('VisualStudioVersion = %s\r\n' % vs_version)
|
||||
|
||||
# Corresponds to VS2013.
|
||||
fh.write('MinimumVisualStudioVersion = 12.0.31101.0\r\n')
|
||||
|
||||
binaries_id = projects['target_binaries'][0]
|
||||
|
||||
# Write out entries for each project.
|
||||
for key in sorted(projects):
|
||||
project_id, basename, name = projects[key]
|
||||
path = os.path.join(self._projsubdir, '%s.vcxproj' % basename)
|
||||
|
||||
fh.write('Project("{%s}") = "%s", "%s", "{%s}"\r\n' % (
|
||||
project_type, name, path, project_id))
|
||||
|
||||
# Make all libraries depend on the binaries target.
|
||||
if key.startswith('library_'):
|
||||
fh.write('\tProjectSection(ProjectDependencies) = postProject\r\n')
|
||||
fh.write('\t\t{%s} = {%s}\r\n' % (binaries_id, binaries_id))
|
||||
fh.write('\tEndProjectSection\r\n')
|
||||
|
||||
fh.write('EndProject\r\n')
|
||||
|
||||
# Write out solution folders for organizing things.
|
||||
|
||||
# This is the UUID you use for solution folders.
|
||||
container_id = '2150E333-8FDC-42A3-9474-1A3956D46DE8'
|
||||
|
||||
def write_container(desc):
|
||||
cid = get_id(desc.encode('utf-8'))
|
||||
fh.write('Project("{%s}") = "%s", "%s", "{%s}"\r\n' % (
|
||||
container_id, desc, desc, cid))
|
||||
fh.write('EndProject\r\n')
|
||||
|
||||
return cid
|
||||
|
||||
library_id = write_container('Libraries')
|
||||
target_id = write_container('Build Targets')
|
||||
binary_id = write_container('Binaries')
|
||||
|
||||
fh.write('Global\r\n')
|
||||
|
||||
# Make every project a member of our one configuration.
|
||||
fh.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n')
|
||||
fh.write('\t\tBuild|Win32 = Build|Win32\r\n')
|
||||
fh.write('\tEndGlobalSection\r\n')
|
||||
|
||||
# Set every project's active configuration to the one configuration and
|
||||
# set up the default build project.
|
||||
fh.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n')
|
||||
for name, project in sorted(projects.items()):
|
||||
fh.write('\t\t{%s}.Build|Win32.ActiveCfg = Build|Win32\r\n' % project[0])
|
||||
|
||||
# Only build the full build target by default.
|
||||
# It's important we don't write multiple entries here because they
|
||||
# conflict!
|
||||
if name == 'target_full':
|
||||
fh.write('\t\t{%s}.Build|Win32.Build.0 = Build|Win32\r\n' % project[0])
|
||||
|
||||
fh.write('\tEndGlobalSection\r\n')
|
||||
|
||||
fh.write('\tGlobalSection(SolutionProperties) = preSolution\r\n')
|
||||
fh.write('\t\tHideSolutionNode = FALSE\r\n')
|
||||
fh.write('\tEndGlobalSection\r\n')
|
||||
|
||||
# Associate projects with containers.
|
||||
fh.write('\tGlobalSection(NestedProjects) = preSolution\r\n')
|
||||
for key in sorted(projects):
|
||||
project_id = projects[key][0]
|
||||
|
||||
if key.startswith('library_'):
|
||||
container_id = library_id
|
||||
elif key.startswith('target_'):
|
||||
container_id = target_id
|
||||
elif key.startswith('binary_'):
|
||||
container_id = binary_id
|
||||
else:
|
||||
raise Exception('Unknown project type: %s' % key)
|
||||
|
||||
fh.write('\t\t{%s} = {%s}\r\n' % (project_id, container_id))
|
||||
fh.write('\tEndGlobalSection\r\n')
|
||||
|
||||
fh.write('EndGlobal\r\n')
|
||||
|
||||
def _write_props(self, fh):
|
||||
impl = getDOMImplementation()
|
||||
doc = impl.createDocument(MSBUILD_NAMESPACE, 'Project', None)
|
||||
|
||||
project = doc.documentElement
|
||||
project.setAttribute('xmlns', MSBUILD_NAMESPACE)
|
||||
project.setAttribute('ToolsVersion', '4.0')
|
||||
|
||||
ig = project.appendChild(doc.createElement('ImportGroup'))
|
||||
ig.setAttribute('Label', 'PropertySheets')
|
||||
|
||||
pg = project.appendChild(doc.createElement('PropertyGroup'))
|
||||
pg.setAttribute('Label', 'UserMacros')
|
||||
|
||||
ig = project.appendChild(doc.createElement('ItemGroup'))
|
||||
|
||||
def add_var(k, v):
|
||||
e = pg.appendChild(doc.createElement(k))
|
||||
e.appendChild(doc.createTextNode(v))
|
||||
|
||||
e = ig.appendChild(doc.createElement('BuildMacro'))
|
||||
e.setAttribute('Include', k)
|
||||
|
||||
e = e.appendChild(doc.createElement('Value'))
|
||||
e.appendChild(doc.createTextNode('$(%s)' % k))
|
||||
|
||||
add_var('TopObjDir', os.path.normpath(self.environment.topobjdir))
|
||||
add_var('TopSrcDir', os.path.normpath(self.environment.topsrcdir))
|
||||
add_var('PYTHON', '$(TopObjDir)\\_virtualenv\\Scripts\\python.exe')
|
||||
add_var('MACH', '$(TopSrcDir)\\mach')
|
||||
|
||||
# From MozillaBuild.
|
||||
add_var('DefaultIncludes', os.environ.get('INCLUDE', ''))
|
||||
|
||||
fh.write(b'\xef\xbb\xbf')
|
||||
doc.writexml(fh, addindent=' ', newl='\r\n')
|
||||
|
||||
def _relevant_environment_variables(self):
|
||||
# Write out the environment variables, presumably coming from
|
||||
# MozillaBuild.
|
||||
for k, v in sorted(os.environ.items()):
|
||||
if not re.match('^[a-zA-Z0-9_]+$', k):
|
||||
continue
|
||||
|
||||
if k in ('OLDPWD', 'PS1'):
|
||||
continue
|
||||
|
||||
if k.startswith('_'):
|
||||
continue
|
||||
|
||||
yield k, v
|
||||
|
||||
yield 'TOPSRCDIR', self.environment.topsrcdir
|
||||
yield 'TOPOBJDIR', self.environment.topobjdir
|
||||
|
||||
def _write_mach_powershell(self, fh):
|
||||
for k, v in self._relevant_environment_variables():
|
||||
fh.write(b'$env:%s = "%s"\r\n' % (k, v))
|
||||
|
||||
relpath = os.path.relpath(self.environment.topsrcdir,
|
||||
self.environment.topobjdir).replace('\\', '/')
|
||||
|
||||
fh.write(b'$bashargs = "%s/mach", "--log-no-times"\r\n' % relpath)
|
||||
fh.write(b'$bashargs = $bashargs + $args\r\n')
|
||||
|
||||
fh.write(b"$expanded = $bashargs -join ' '\r\n")
|
||||
fh.write(b'$procargs = "-c", $expanded\r\n')
|
||||
|
||||
fh.write(b'Start-Process -WorkingDirectory $env:TOPOBJDIR '
|
||||
b'-FilePath $env:MOZILLABUILD\\msys\\bin\\bash '
|
||||
b'-ArgumentList $procargs '
|
||||
b'-Wait -NoNewWindow\r\n')
|
||||
|
||||
def _write_mach_batch(self, fh):
|
||||
"""Write out a batch script that builds the tree.
|
||||
|
||||
The script "bootstraps" into the MozillaBuild environment by setting
|
||||
the environment variables that are active in the current MozillaBuild
|
||||
environment. Then, it builds the tree.
|
||||
"""
|
||||
for k, v in self._relevant_environment_variables():
|
||||
fh.write(b'SET "%s=%s"\r\n' % (k, v))
|
||||
|
||||
fh.write(b'cd %TOPOBJDIR%\r\n')
|
||||
|
||||
# We need to convert Windows-native paths to msys paths. Easiest way is
|
||||
# relative paths, since munging c:\ to /c/ is slightly more
|
||||
# complicated.
|
||||
relpath = os.path.relpath(self.environment.topsrcdir,
|
||||
self.environment.topobjdir).replace('\\', '/')
|
||||
|
||||
# We go through mach because it has the logic for choosing the most
|
||||
# appropriate build tool.
|
||||
fh.write(b'"%%MOZILLABUILD%%\\msys\\bin\\bash" '
|
||||
b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"' % relpath)
|
||||
|
||||
def _write_vs_project(self, out_dir, basename, name, **kwargs):
|
||||
root = '%s.vcxproj' % basename
|
||||
project_id = get_id(basename.encode('utf-8'))
|
||||
|
||||
with self._write_file(os.path.join(out_dir, root), mode='rb') as fh:
|
||||
project_id, name = VisualStudioBackend.write_vs_project(fh,
|
||||
self._version, project_id, name, **kwargs)
|
||||
|
||||
with self._write_file(os.path.join(out_dir, '%s.user' % root), mode='rb') as fh:
|
||||
fh.write('<?xml version="1.0" encoding="utf-8"?>\r\n')
|
||||
fh.write('<Project ToolsVersion="4.0" xmlns="%s">\r\n' %
|
||||
MSBUILD_NAMESPACE)
|
||||
fh.write('</Project>\r\n')
|
||||
|
||||
return project_id
|
||||
|
||||
@staticmethod
|
||||
def write_vs_project(fh, version, project_id, name, includes=[],
|
||||
forced_includes=[], defines=[],
|
||||
build_command=None, clean_command=None,
|
||||
debugger=None, headers=[], sources=[]):
|
||||
|
||||
impl = getDOMImplementation()
|
||||
doc = impl.createDocument(MSBUILD_NAMESPACE, 'Project', None)
|
||||
|
||||
project = doc.documentElement
|
||||
project.setAttribute('DefaultTargets', 'Build')
|
||||
project.setAttribute('ToolsVersion', '4.0')
|
||||
project.setAttribute('xmlns', MSBUILD_NAMESPACE)
|
||||
|
||||
ig = project.appendChild(doc.createElement('ItemGroup'))
|
||||
ig.setAttribute('Label', 'ProjectConfigurations')
|
||||
|
||||
pc = ig.appendChild(doc.createElement('ProjectConfiguration'))
|
||||
pc.setAttribute('Include', 'Build|Win32')
|
||||
|
||||
c = pc.appendChild(doc.createElement('Configuration'))
|
||||
c.appendChild(doc.createTextNode('Build'))
|
||||
|
||||
p = pc.appendChild(doc.createElement('Platform'))
|
||||
p.appendChild(doc.createTextNode('Win32'))
|
||||
|
||||
pg = project.appendChild(doc.createElement('PropertyGroup'))
|
||||
pg.setAttribute('Label', 'Globals')
|
||||
|
||||
n = pg.appendChild(doc.createElement('ProjectName'))
|
||||
n.appendChild(doc.createTextNode(name))
|
||||
|
||||
k = pg.appendChild(doc.createElement('Keyword'))
|
||||
k.appendChild(doc.createTextNode('MakeFileProj'))
|
||||
|
||||
g = pg.appendChild(doc.createElement('ProjectGuid'))
|
||||
g.appendChild(doc.createTextNode('{%s}' % project_id))
|
||||
|
||||
rn = pg.appendChild(doc.createElement('RootNamespace'))
|
||||
rn.appendChild(doc.createTextNode('mozilla'))
|
||||
|
||||
pts = pg.appendChild(doc.createElement('PlatformToolset'))
|
||||
pts.appendChild(doc.createTextNode(visual_studio_product_to_platform_toolset_version(version)))
|
||||
|
||||
i = project.appendChild(doc.createElement('Import'))
|
||||
i.setAttribute('Project', '$(VCTargetsPath)\\Microsoft.Cpp.Default.props')
|
||||
|
||||
ig = project.appendChild(doc.createElement('ImportGroup'))
|
||||
ig.setAttribute('Label', 'ExtensionTargets')
|
||||
|
||||
ig = project.appendChild(doc.createElement('ImportGroup'))
|
||||
ig.setAttribute('Label', 'ExtensionSettings')
|
||||
|
||||
ig = project.appendChild(doc.createElement('ImportGroup'))
|
||||
ig.setAttribute('Label', 'PropertySheets')
|
||||
i = ig.appendChild(doc.createElement('Import'))
|
||||
i.setAttribute('Project', 'mozilla.props')
|
||||
|
||||
pg = project.appendChild(doc.createElement('PropertyGroup'))
|
||||
pg.setAttribute('Label', 'Configuration')
|
||||
ct = pg.appendChild(doc.createElement('ConfigurationType'))
|
||||
ct.appendChild(doc.createTextNode('Makefile'))
|
||||
|
||||
pg = project.appendChild(doc.createElement('PropertyGroup'))
|
||||
pg.setAttribute('Condition', "'$(Configuration)|$(Platform)'=='Build|Win32'")
|
||||
|
||||
if build_command:
|
||||
n = pg.appendChild(doc.createElement('NMakeBuildCommandLine'))
|
||||
n.appendChild(doc.createTextNode(build_command))
|
||||
|
||||
if clean_command:
|
||||
n = pg.appendChild(doc.createElement('NMakeCleanCommandLine'))
|
||||
n.appendChild(doc.createTextNode(clean_command))
|
||||
|
||||
if includes:
|
||||
n = pg.appendChild(doc.createElement('NMakeIncludeSearchPath'))
|
||||
n.appendChild(doc.createTextNode(';'.join(includes)))
|
||||
|
||||
if forced_includes:
|
||||
n = pg.appendChild(doc.createElement('NMakeForcedIncludes'))
|
||||
n.appendChild(doc.createTextNode(';'.join(forced_includes)))
|
||||
|
||||
if defines:
|
||||
n = pg.appendChild(doc.createElement('NMakePreprocessorDefinitions'))
|
||||
n.appendChild(doc.createTextNode(';'.join(defines)))
|
||||
|
||||
if debugger:
|
||||
n = pg.appendChild(doc.createElement('LocalDebuggerCommand'))
|
||||
n.appendChild(doc.createTextNode(debugger[0]))
|
||||
|
||||
n = pg.appendChild(doc.createElement('LocalDebuggerCommandArguments'))
|
||||
n.appendChild(doc.createTextNode(debugger[1]))
|
||||
|
||||
i = project.appendChild(doc.createElement('Import'))
|
||||
i.setAttribute('Project', '$(VCTargetsPath)\\Microsoft.Cpp.props')
|
||||
|
||||
i = project.appendChild(doc.createElement('Import'))
|
||||
i.setAttribute('Project', '$(VCTargetsPath)\\Microsoft.Cpp.targets')
|
||||
|
||||
# Now add files to the project.
|
||||
ig = project.appendChild(doc.createElement('ItemGroup'))
|
||||
for header in sorted(headers or []):
|
||||
n = ig.appendChild(doc.createElement('ClInclude'))
|
||||
n.setAttribute('Include', header)
|
||||
|
||||
ig = project.appendChild(doc.createElement('ItemGroup'))
|
||||
for source in sorted(sources or []):
|
||||
n = ig.appendChild(doc.createElement('ClCompile'))
|
||||
n.setAttribute('Include', source)
|
||||
|
||||
fh.write(b'\xef\xbb\xbf')
|
||||
doc.writexml(fh, addindent=' ', newl='\r\n')
|
||||
|
||||
return project_id, name
|
||||
Whitespace-only changes.
@@ -1,105 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from collections import defaultdict
|
||||
import json
|
||||
import os
|
||||
import urlparse
|
||||
|
||||
from mach.config import ConfigSettings
|
||||
from mach.logging import LoggingManager
|
||||
from mozbuild.backend.common import CommonBackend
|
||||
from mozbuild.base import MozbuildObject
|
||||
from mozbuild.frontend.data import (
|
||||
FinalTargetFiles,
|
||||
FinalTargetPreprocessedFiles,
|
||||
)
|
||||
from mozbuild.frontend.data import JARManifest, ChromeManifestEntry
|
||||
from mozpack.chrome.manifest import (
|
||||
Manifest,
|
||||
ManifestChrome,
|
||||
ManifestOverride,
|
||||
ManifestResource,
|
||||
parse_manifest,
|
||||
)
|
||||
import mozpack.path as mozpath
|
||||
|
||||
|
||||
class ChromeManifestHandler(object):
|
||||
def __init__(self):
|
||||
self.overrides = {}
|
||||
self.chrome_mapping = defaultdict(set)
|
||||
|
||||
def handle_manifest_entry(self, entry):
|
||||
format_strings = {
|
||||
"content": "chrome://%s/content/",
|
||||
"resource": "resource://%s/",
|
||||
"locale": "chrome://%s/locale/",
|
||||
"skin": "chrome://%s/skin/",
|
||||
}
|
||||
|
||||
if isinstance(entry, (ManifestChrome, ManifestResource)):
|
||||
if isinstance(entry, ManifestResource):
|
||||
dest = entry.target
|
||||
url = urlparse.urlparse(dest)
|
||||
if not url.scheme:
|
||||
dest = mozpath.normpath(mozpath.join(entry.base, dest))
|
||||
if url.scheme == 'file':
|
||||
dest = mozpath.normpath(url.path)
|
||||
else:
|
||||
dest = mozpath.normpath(entry.path)
|
||||
|
||||
base_uri = format_strings[entry.type] % entry.name
|
||||
self.chrome_mapping[base_uri].add(dest)
|
||||
if isinstance(entry, ManifestOverride):
|
||||
self.overrides[entry.overloaded] = entry.overload
|
||||
if isinstance(entry, Manifest):
|
||||
for e in parse_manifest(None, entry.path):
|
||||
self.handle_manifest_entry(e)
|
||||
|
||||
class ChromeMapBackend(CommonBackend):
|
||||
def _init(self):
|
||||
CommonBackend._init(self)
|
||||
|
||||
log_manager = LoggingManager()
|
||||
self._cmd = MozbuildObject(self.environment.topsrcdir, ConfigSettings(),
|
||||
log_manager, self.environment.topobjdir)
|
||||
self._install_mapping = {}
|
||||
self.manifest_handler = ChromeManifestHandler()
|
||||
|
||||
def consume_object(self, obj):
|
||||
if isinstance(obj, JARManifest):
|
||||
self._consume_jar_manifest(obj)
|
||||
if isinstance(obj, ChromeManifestEntry):
|
||||
self.manifest_handler.handle_manifest_entry(obj.entry)
|
||||
if isinstance(obj, (FinalTargetFiles,
|
||||
FinalTargetPreprocessedFiles)):
|
||||
self._handle_final_target_files(obj)
|
||||
return True
|
||||
|
||||
def _handle_final_target_files(self, obj):
|
||||
for path, files in obj.files.walk():
|
||||
for f in files:
|
||||
dest = mozpath.join(obj.install_target, path, f.target_basename)
|
||||
is_pp = isinstance(obj,
|
||||
FinalTargetPreprocessedFiles)
|
||||
self._install_mapping[dest] = f.full_path, is_pp
|
||||
|
||||
def consume_finished(self):
|
||||
# Our result has three parts:
|
||||
# A map from url prefixes to objdir directories:
|
||||
# { "chrome://mozapps/content/": [ "dist/bin/chrome/toolkit/content/mozapps" ], ... }
|
||||
# A map of overrides.
|
||||
# A map from objdir paths to sourcedir paths, and a flag for whether the source was preprocessed:
|
||||
# { "dist/bin/browser/chrome/browser/content/browser/aboutSessionRestore.js":
|
||||
# [ "$topsrcdir/browser/components/sessionstore/content/aboutSessionRestore.js", false ], ... }
|
||||
outputfile = os.path.join(self.environment.topobjdir, 'chrome-map.json')
|
||||
with self._write_file(outputfile) as fh:
|
||||
chrome_mapping = self.manifest_handler.chrome_mapping
|
||||
overrides = self.manifest_handler.overrides
|
||||
json.dump([
|
||||
{k: list(v) for k, v in chrome_mapping.iteritems()},
|
||||
overrides,
|
||||
self._install_mapping,
|
||||
], fh, sort_keys=True, indent=2)
|
||||
@@ -1,43 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from mozpack.files import FileFinder
|
||||
from mozpack.copier import Jarrer
|
||||
|
||||
def package_gcno_tree(root, output_file):
|
||||
# XXX JarWriter doesn't support unicode strings, see bug 1056859
|
||||
if isinstance(root, unicode):
|
||||
root = root.encode('utf-8')
|
||||
|
||||
finder = FileFinder(root)
|
||||
jarrer = Jarrer(optimize=False)
|
||||
for p, f in finder.find("**/*.gcno"):
|
||||
jarrer.add(p, f)
|
||||
jarrer.copy(output_file)
|
||||
|
||||
|
||||
def cli(args=sys.argv[1:]):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-o', '--output-file',
|
||||
dest='output_file',
|
||||
help='Path to save packaged data to.')
|
||||
parser.add_argument('--root',
|
||||
dest='root',
|
||||
default=None,
|
||||
help='Root directory to search from.')
|
||||
args = parser.parse_args(args)
|
||||
|
||||
if not args.root:
|
||||
from buildconfig import topobjdir
|
||||
args.root = topobjdir
|
||||
|
||||
return package_gcno_tree(args.root, args.output_file)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(cli())
|
||||
@@ -32,19 +32,6 @@ from mozbuild.backend import (
|
||||
|
||||
log_manager = LoggingManager()
|
||||
|
||||
VISUAL_STUDIO_ADVERTISEMENT = '''
|
||||
===============================
|
||||
Visual Studio Support Available
|
||||
|
||||
You are building Firefox on Windows. You can generate Visual Studio
|
||||
files by running:
|
||||
|
||||
mach build-backend --backend=VisualStudio
|
||||
|
||||
===============================
|
||||
'''.strip()
|
||||
|
||||
|
||||
def config_status(topobjdir='.', topsrcdir='.', defines=None,
|
||||
non_global_defines=None, substs=None, source=None,
|
||||
mozconfig=None, args=sys.argv[1:]):
|
||||
@@ -173,7 +160,3 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None,
|
||||
for path, diff in sorted(the_backend.file_diffs.items()):
|
||||
print('\n'.join(diff))
|
||||
|
||||
# Advertise Visual Studio if appropriate.
|
||||
if os.name == 'nt' and 'VisualStudio' not in options.backend:
|
||||
print(VISUAL_STUDIO_ADVERTISEMENT)
|
||||
|
||||
@@ -509,7 +509,7 @@ class Build(MachCommandBase):
|
||||
# to avoid accidentally disclosing PII.
|
||||
telemetry_data['substs'] = {}
|
||||
try:
|
||||
for key in ['MOZ_ARTIFACT_BUILDS', 'MOZ_USING_CCACHE']:
|
||||
for key in ['MOZ_USING_CCACHE']:
|
||||
value = self.substs.get(key, False)
|
||||
telemetry_data['substs'][key] = value
|
||||
except BuildEnvironmentNotFoundException:
|
||||
@@ -1493,154 +1493,6 @@ class MachDebug(MachCommandBase):
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
json.dump(self, cls=EnvironmentEncoder, sort_keys=True, fp=out)
|
||||
|
||||
class ArtifactSubCommand(SubCommand):
|
||||
def __call__(self, func):
|
||||
after = SubCommand.__call__(self, func)
|
||||
jobchoices = {
|
||||
'linux',
|
||||
'linux64',
|
||||
'macosx64',
|
||||
'win32',
|
||||
'win64'
|
||||
}
|
||||
args = [
|
||||
CommandArgument('--tree', metavar='TREE', type=str,
|
||||
help='Firefox tree.'),
|
||||
CommandArgument('--job', metavar='JOB', choices=jobchoices,
|
||||
help='Build job.'),
|
||||
CommandArgument('--verbose', '-v', action='store_true',
|
||||
help='Print verbose output.'),
|
||||
]
|
||||
for arg in args:
|
||||
after = arg(after)
|
||||
return after
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class PackageFrontend(MachCommandBase):
|
||||
"""Fetch and install binary artifacts from Mozilla automation."""
|
||||
|
||||
@Command('artifact', category='post-build',
|
||||
description='Use pre-built artifacts to build Firefox.')
|
||||
def artifact(self):
|
||||
'''Download, cache, and install pre-built binary artifacts to build Firefox.
|
||||
|
||||
Use |mach build| as normal to freshen your installed binary libraries:
|
||||
artifact builds automatically download, cache, and install binary
|
||||
artifacts from Mozilla automation, replacing whatever may be in your
|
||||
object directory. Use |mach artifact last| to see what binary artifacts
|
||||
were last used.
|
||||
|
||||
Never build libxul again!
|
||||
|
||||
'''
|
||||
pass
|
||||
|
||||
def _set_log_level(self, verbose):
|
||||
self.log_manager.terminal_handler.setLevel(logging.INFO if not verbose else logging.DEBUG)
|
||||
|
||||
def _install_pip_package(self, package):
|
||||
if os.environ.get('MOZ_AUTOMATION'):
|
||||
self.virtualenv_manager._run_pip([
|
||||
'install',
|
||||
package,
|
||||
'--no-index',
|
||||
'--find-links',
|
||||
'http://pypi.pub.build.mozilla.org/pub',
|
||||
'--trusted-host',
|
||||
'pypi.pub.build.mozilla.org',
|
||||
])
|
||||
return
|
||||
self.virtualenv_manager.install_pip_package(package)
|
||||
|
||||
def _make_artifacts(self, tree=None, job=None, skip_cache=False):
|
||||
# Undo PATH munging that will be done by activating the virtualenv,
|
||||
# so that invoked subprocesses expecting to find system python
|
||||
# (git cinnabar, in particular), will not find virtualenv python.
|
||||
original_path = os.environ.get('PATH', '')
|
||||
self._activate_virtualenv()
|
||||
os.environ['PATH'] = original_path
|
||||
|
||||
for package in ('taskcluster==0.0.32',
|
||||
'mozregression==1.0.2'):
|
||||
self._install_pip_package(package)
|
||||
|
||||
state_dir = self._mach_context.state_dir
|
||||
cache_dir = os.path.join(state_dir, 'package-frontend')
|
||||
|
||||
try:
|
||||
os.makedirs(cache_dir)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
import which
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
build_obj = MozbuildObject.from_environment(cwd=here)
|
||||
|
||||
hg = None
|
||||
if conditions.is_hg(build_obj):
|
||||
if self._is_windows():
|
||||
hg = which.which('hg.exe')
|
||||
else:
|
||||
hg = which.which('hg')
|
||||
|
||||
git = None
|
||||
if conditions.is_git(build_obj):
|
||||
if self._is_windows():
|
||||
git = which.which('git.exe')
|
||||
else:
|
||||
git = which.which('git')
|
||||
|
||||
# Absolutely must come after the virtualenv is populated!
|
||||
from mozbuild.artifacts import Artifacts
|
||||
artifacts = Artifacts(tree, self.substs, self.defines, job,
|
||||
log=self.log, cache_dir=cache_dir,
|
||||
skip_cache=skip_cache, hg=hg, git=git,
|
||||
topsrcdir=self.topsrcdir)
|
||||
return artifacts
|
||||
|
||||
@ArtifactSubCommand('artifact', 'install',
|
||||
'Install a good pre-built artifact.')
|
||||
@CommandArgument('source', metavar='SRC', nargs='?', type=str,
|
||||
help='Where to fetch and install artifacts from. Can be omitted, in '
|
||||
'which case the current hg repository is inspected; an hg revision; '
|
||||
'a remote URL; or a local file.',
|
||||
default=None)
|
||||
@CommandArgument('--skip-cache', action='store_true',
|
||||
help='Skip all local caches to force re-fetching remote artifacts.',
|
||||
default=False)
|
||||
def artifact_install(self, source=None, skip_cache=False, tree=None, job=None, verbose=False):
|
||||
self._set_log_level(verbose)
|
||||
artifacts = self._make_artifacts(tree=tree, job=job, skip_cache=skip_cache)
|
||||
|
||||
return artifacts.install_from(source, self.distdir)
|
||||
|
||||
@ArtifactSubCommand('artifact', 'last',
|
||||
'Print the last pre-built artifact installed.')
|
||||
def artifact_print_last(self, tree=None, job=None, verbose=False):
|
||||
self._set_log_level(verbose)
|
||||
artifacts = self._make_artifacts(tree=tree, job=job)
|
||||
artifacts.print_last()
|
||||
return 0
|
||||
|
||||
@ArtifactSubCommand('artifact', 'print-cache',
|
||||
'Print local artifact cache for debugging.')
|
||||
def artifact_print_cache(self, tree=None, job=None, verbose=False):
|
||||
self._set_log_level(verbose)
|
||||
artifacts = self._make_artifacts(tree=tree, job=job)
|
||||
artifacts.print_cache()
|
||||
return 0
|
||||
|
||||
@ArtifactSubCommand('artifact', 'clear-cache',
|
||||
'Delete local artifacts and reset local artifact cache.')
|
||||
def artifact_clear_cache(self, tree=None, job=None, verbose=False):
|
||||
self._set_log_level(verbose)
|
||||
artifacts = self._make_artifacts(tree=tree, job=job)
|
||||
artifacts.clear_cache()
|
||||
return 0
|
||||
|
||||
@CommandProvider
|
||||
class Vendor(MachCommandBase):
|
||||
"""Vendor third-party dependencies into the source repository."""
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from xml.dom.minidom import parse
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from mozbuild.backend.visualstudio import VisualStudioBackend
|
||||
from mozbuild.test.backend.common import BackendTester
|
||||
|
||||
from mozunit import main
|
||||
|
||||
|
||||
class TestVisualStudioBackend(BackendTester):
|
||||
@unittest.skip('Failing inconsistently in automation.')
|
||||
def test_basic(self):
|
||||
"""Ensure we can consume our stub project."""
|
||||
|
||||
env = self._consume('visual-studio', VisualStudioBackend)
|
||||
|
||||
msvc = os.path.join(env.topobjdir, 'msvc')
|
||||
self.assertTrue(os.path.isdir(msvc))
|
||||
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'mozilla.sln')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'mozilla.props')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'mach.bat')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'binary_my_app.vcxproj')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'target_full.vcxproj')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'library_dir1.vcxproj')))
|
||||
self.assertTrue(os.path.isfile(os.path.join(msvc, 'library_dir1.vcxproj.user')))
|
||||
|
||||
d = parse(os.path.join(msvc, 'library_dir1.vcxproj'))
|
||||
self.assertEqual(d.documentElement.tagName, 'Project')
|
||||
els = d.getElementsByTagName('ClCompile')
|
||||
self.assertEqual(len(els), 2)
|
||||
|
||||
# mozilla-config.h should be explicitly listed as an include.
|
||||
els = d.getElementsByTagName('NMakeForcedIncludes')
|
||||
self.assertEqual(len(els), 1)
|
||||
self.assertEqual(els[0].firstChild.nodeValue,
|
||||
'$(TopObjDir)\\dist\\include\\mozilla-config.h')
|
||||
|
||||
# LOCAL_INCLUDES get added to the include search path.
|
||||
els = d.getElementsByTagName('NMakeIncludeSearchPath')
|
||||
self.assertEqual(len(els), 1)
|
||||
includes = els[0].firstChild.nodeValue.split(';')
|
||||
self.assertIn(os.path.normpath('$(TopSrcDir)/includeA/foo'), includes)
|
||||
self.assertIn(os.path.normpath('$(TopSrcDir)/dir1'), includes)
|
||||
self.assertIn(os.path.normpath('$(TopObjDir)/dir1'), includes)
|
||||
self.assertIn(os.path.normpath('$(TopObjDir)\\dist\\include'), includes)
|
||||
|
||||
# DEFINES get added to the project.
|
||||
els = d.getElementsByTagName('NMakePreprocessorDefinitions')
|
||||
self.assertEqual(len(els), 1)
|
||||
defines = els[0].firstChild.nodeValue.split(';')
|
||||
self.assertIn('DEFINEFOO', defines)
|
||||
self.assertIn('DEFINEBAR=bar', defines)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1 +0,0 @@
|
||||
throw new GradleException("Building with Gradle is not supported.")
|
||||
@@ -62,19 +62,6 @@ ifdef MOZ_PACKAGE_JSSHELL
|
||||
$(RM) $(PKG_JSSHELL)
|
||||
$(MAKE_JSSHELL)
|
||||
endif # MOZ_PACKAGE_JSSHELL
|
||||
ifdef MOZ_ARTIFACT_BUILD_SYMBOLS
|
||||
@echo 'Packaging existing crashreporter symbols from artifact build...'
|
||||
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
|
||||
cd $(DIST)/crashreporter-symbols && \
|
||||
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
|
||||
endif # MOZ_ARTIFACT_BUILD_SYMBOLS
|
||||
ifdef MOZ_CODE_COVERAGE
|
||||
# Package code coverage gcno tree
|
||||
@echo 'Packaging code coverage data...'
|
||||
$(RM) $(CODE_COVERAGE_ARCHIVE_BASENAME).zip
|
||||
$(PYTHON) -mmozbuild.codecoverage.packager \
|
||||
--output-file='$(DIST)/$(PKG_PATH)$(CODE_COVERAGE_ARCHIVE_BASENAME).zip'
|
||||
endif
|
||||
ifeq (Darwin, $(OS_ARCH))
|
||||
ifdef MOZ_ASAN
|
||||
@echo "Rewriting ASan runtime dylib paths for all binaries in $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) ..."
|
||||
|
||||
@@ -446,11 +446,6 @@ UPLOAD_FILES= \
|
||||
$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip) \
|
||||
$(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
|
||||
|
||||
ifdef MOZ_CODE_COVERAGE
|
||||
UPLOAD_FILES += \
|
||||
$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(CODE_COVERAGE_ARCHIVE_BASENAME).zip)
|
||||
endif
|
||||
|
||||
ifdef UNIFY_DIST
|
||||
UNIFY_ARCH := $(notdir $(patsubst %/,%,$(dir $(UNIFY_DIST))))
|
||||
UPLOAD_FILES += \
|
||||
|
||||
Reference in new issue
Block a user