Skip to content

Commit

Permalink
Merge branch 'master' into fix-exec-st-exec
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Sep 15, 2021
2 parents a289108 + 82d4db2 commit 050e005
Show file tree
Hide file tree
Showing 438 changed files with 14,224 additions and 9,261 deletions.
923 changes: 894 additions & 29 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ android/ @ahumesky

# Apple

/src/objc_tools/ @allevato @davidgoldman @dmaclach @kelvinchan-google @reinhillman @thomasvl

/src/test/shell/bazel/apple/ @allevato @davidgoldman @dmaclach @kelvinchan-google @reinhillman @thomasvl

# Documentation
Expand Down
92 changes: 92 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when the Project
Steward has a reasonable belief that an individual's behavior may have a
negative impact on the project or its community.

## Conflict Resolution

We do not believe that all conflict is bad; healthy debate and disagreement
often yield positive results. However, it is never okay to be disrespectful or
to engage in behavior that violates the project’s code of conduct.

If you see someone violating the code of conduct, you are encouraged to address
the behavior directly with those involved. Many issues can be resolved quickly
and easily, and this gives people more control over the outcome of their
dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to code-of-conduct@bazel.build, the Project
Steward(s) for Bazel. It is the Project Steward’s duty to receive and address
reported violations of the code of conduct. They will then work with a committee
consisting of representatives from the Open Source Programs Office and the
Google Open Source Strategy team. If for any reason you are uncomfortable
reaching out to the Project Steward, please email opensource@google.com.

We will investigate every complaint, but you may not receive a direct response.
We will use our discretion in determining when and how to follow up on reported
incidents, which may range from not taking action to permanent expulsion from
the project and project-sponsored spaces. We will notify the accused of the
report and provide them an opportunity to discuss it before any action is taken.
The identity of the reporter will be omitted from the details of the report
supplied to the accused. In potentially harmful situations, such as ongoing
harassment or threats to anyone's safety, we may take action without notice.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
4 changes: 4 additions & 0 deletions scripts/docs/doc_versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"""This module contains the versions and hashes of Bazel's documentation tarballs."""

DOC_VERSIONS = [
{
"version": "4.2.1",
"sha256": "b767b7aa949f96b602257587add3be38acbead03bf919fe871397bc80d97f8b2",
},
{
"version": "4.2.0",
"sha256": "1188fc6c3354f85741bacbb2bc7dab6bbfd1d2f44475846293ff232fb01709b8",
Expand Down
3 changes: 2 additions & 1 deletion site/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ gems:
url: "https://docs.bazel.build" # used by jekyll-sitemap

# Update this to the newest release for the default docs.bazel.build version.
version: "4.2.0"
version: "4.2.1"

# This must be kept in sync with //scripts/docs:doc_versions.bzl
doc_versions:
- main
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
Expand Down
6 changes: 3 additions & 3 deletions site/docs/install-bazelisk.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ release.

You can install Bazelisk in multiple ways, including:

* `npm install -g @bazel/bazelisk`
* using [a binary release](https://github.com/bazelbuild/bazelisk/releases) for
Linux, macOS, or Windows
* using Homebrew on macOS
* by compiling from source using Go: `go get github.com/bazelbuild/bazelisk`
* using npm: `npm install -g @bazel/bazelisk`
* using Homebrew on macOS: `brew install bazelisk`
* by compiling from source using Go: `go install github.com/bazelbuild/bazelisk@latest` (needs Go 1.17 or later)

For more details, see
[the official README](https://github.com/bazelbuild/bazelisk/blob/master/README.md).
2 changes: 1 addition & 1 deletion site/docs/query-how-to.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h3 id="Aside_implicit_dependencies">Aside: implicit dependencies</h3>
protocol compiler. These dependencies are not mentioned in the build file,
but added in by the build tool. The full set of implicit dependencies is
currently undocumented. Using <code>--noimplicit_deps</code> allows you to filter out
these deps from your query results. For cquery, this will inlude resolved toolchains.
these deps from your query results. For cquery, this will include resolved toolchains.

<h2 id="Reverse_Dependencies">Reverse dependencies</h2>

Expand Down
12 changes: 9 additions & 3 deletions site/docs/user-manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ <h4 id='flag--strategy_regexp'><code class='flag'>--strategy_regexp=<var>&lt;fil
strategies and their effects.
</p>
<p>
The first <code>regex_filter</code> that matches the description is used. This option overrides
The last <code>regex_filter</code> that matches the description is used. This option overrides
other flags for specifying strategy.
</p>
<ul>
Expand All @@ -964,8 +964,14 @@ <h4 id='flag--strategy_regexp'><code class='flag'>--strategy_regexp=<var>&lt;fil
<li>
Example:
<code>--strategy_regexp='Compiling.*/bar=local' --strategy_regexp=Compiling=sandboxed</code>
will run 'Compiling //foo/bar/baz' with the <code>local</code> strategy, but reversing the order
would run it with <code>sandboxed</code>.
will run 'Compiling //foo/bar/baz' with the <code>sandboxed</code> strategy, but reversing
the order would run it with <code>local</code>.
</li>
<li>
Example:
<code>--strategy_regexp='Compiling.*/bar=local,sandboxed'</code>
will run 'Compiling //foo/bar/baz' with the <code>local</code> strategy and fall back to
<code>sandboxed</code> if fails.
</li>
</ul>

Expand Down
2 changes: 0 additions & 2 deletions src/create_embedded_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
('*def_parser.exe', lambda x: 'tools/def_parser/def_parser.exe'),
('*zipper.exe', lambda x: 'tools/zip/zipper/zipper.exe'),
('*zipper', lambda x: 'tools/zip/zipper/zipper'),
('*src/objc_tools/*',
lambda x: 'tools/objc/precomp_' + os.path.basename(x)),
('*xcode*make_hashed_objlist.py',
lambda x: 'tools/objc/make_hashed_objlist.py'),
('*xcode*xcode-locator', lambda x: 'tools/objc/xcode-locator'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private IOException analyzerError(final String location, final Exception cause)

// Generate the line to probeExp map so that we can evaluate the coverage.
private Map<Integer, BranchExp> mapProbes(final ClassReader reader) {
final ClassProbesMapper mapper = new ClassProbesMapper();
final ClassProbesMapper mapper = new ClassProbesMapper(reader.getClassName());
final ClassProbesAdapter adapter = new ClassProbesAdapter(mapper, false);
reader.accept(adapter, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.testing.coverage;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/** A branch coverage that must be evaluated as a combination of probes. */
Expand Down Expand Up @@ -57,9 +58,33 @@ public void update(int idx, CovExp exp) {
branches.set(idx, exp);
}

/** Make a union of the branches of two BranchExp. */
public void merge(BranchExp other) {
branches.addAll(other.branches);
/** Make a new BranchExp representing the concatenation of branches in inputs. */
public static BranchExp concatenate(BranchExp first, BranchExp second) {
List<CovExp> branches = new ArrayList<>(first.branches);
branches.addAll(second.branches);
return new BranchExp(branches);
}

/** Make a new BranchExp representing the pairwise union of branches in inputs */
public static BranchExp zip(BranchExp left, BranchExp right) {
List<CovExp> zippedBranches = new ArrayList<>();
int leftSize = left.branches.size();
int rightSize = right.branches.size();
int i;
for (i = 0; i < leftSize && i < rightSize; i++) {
List<CovExp> branches = Arrays.asList(left.branches.get(i), right.branches.get(i));
zippedBranches.add(new BranchExp(branches));
}
List<CovExp> remainder = leftSize < rightSize ? right.branches : left.branches;
for (; i < remainder.size(); i++) {
zippedBranches.add(new BranchExp(remainder.get(i)));
}
return new BranchExp(zippedBranches);
}

/** Wraps a CovExp in a BranchExp if it isn't one already. */
public static BranchExp ensureIsBranchExp(CovExp exp) {
return exp instanceof BranchExp ? (BranchExp) exp : new BranchExp(exp);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,81 @@

package com.google.testing.coverage;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.jacoco.core.internal.analysis.StringPool;
import org.jacoco.core.internal.analysis.filter.Filters;
import org.jacoco.core.internal.analysis.filter.IFilter;
import org.jacoco.core.internal.analysis.filter.IFilterContext;
import org.jacoco.core.internal.flow.ClassProbesVisitor;
import org.jacoco.core.internal.flow.MethodProbesVisitor;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.FieldVisitor;

/** A visitor that maps each source code line to the probes corresponding to the lines. */
public class ClassProbesMapper extends ClassProbesVisitor {
public class ClassProbesMapper extends ClassProbesVisitor implements IFilterContext {
private Map<Integer, BranchExp> classLineToBranchExp;

private IFilter allFilters = Filters.all();

private StringPool stringPool;

// IFilterContext state updating during visitations
private String className;
private String superClassName;
private Set<String> classAnnotations = new HashSet<>();
private Set<String> classAttributes = new HashSet<>();
private String sourceFileName;
private String sourceDebugExtension;

public Map<Integer, BranchExp> result() {
return classLineToBranchExp;
}

/** Create a new probe mapper object. */
public ClassProbesMapper() {
public ClassProbesMapper(String className) {
classLineToBranchExp = new TreeMap<Integer, BranchExp>();
stringPool = new StringPool();
className = stringPool.get(className);
}

@Override
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
classAnnotations.add(desc);
return super.visitAnnotation(desc, visible);
}

@Override
public void visitAttribute(final Attribute attribute) {
classAttributes.add(attribute.type);
}

@Override
public void visitSource(final String source, final String debug) {
sourceFileName = stringPool.get(source);
sourceDebugExtension = debug;
}

@Override
public void visit(
int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) {
superClassName = stringPool.get(name);
}

/** Returns a visitor for mapping method code. */
@Override
public MethodProbesVisitor visitMethod(
int access, String name, String desc, String signature, String[] exceptions) {
return new MethodProbesMapper() {
return new MethodProbesMapper(this, allFilters) {

@Override
public void visitEnd() {
super.visitEnd();
Expand All @@ -56,4 +107,34 @@ public FieldVisitor visitField(
public void visitTotalProbeCount(int count) {
// Nothing to do. Maybe perform some checks here.
}

@Override
public String getClassName() {
return className;
}

@Override
public String getSuperClassName() {
return superClassName;
}

@Override
public String getSourceDebugExtension() {
return sourceDebugExtension;
}

@Override
public String getSourceFileName() {
return sourceFileName;
}

@Override
public Set<String> getClassAnnotations() {
return classAnnotations;
}

@Override
public Set<String> getClassAttributes() {
return classAttributes;
}
}
Loading

0 comments on commit 050e005

Please sign in to comment.