Skip to content

Commit

Permalink
Release commit created with Cranko.
Browse files Browse the repository at this point in the history
+++ cranko-release-info-v1
[[projects]]
qnames = ["tectonic_xdv", "cargo"]
version = "0.1.10"
age = 2

[[projects]]
qnames = ["tectonic_cfg_support", "cargo"]
version = "0.1.1"
age = 2

[[projects]]
qnames = ["tectonic", "cargo"]
version = "0.3.1"
age = 0

+++
  • Loading branch information
cranko committed Nov 2, 2020
2 parents 180a4fd + 118de70 commit fbd1fff
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# tectonic 0.3.1 (2020-11-02)

- Fix compilation on Windows/MSVC (`sys/time.h` is not available)
- Don't print an empty `error:` line in the CLI (#665, #670)


# tectonic 0.3.0 (2020-11-01)

The 0.3 series updates the core Tectonic engines to align with the code in
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[package]
name = "tectonic"
version = "0.3.0"
version = "0.3.1"
authors = ["Peter Williams <[email protected]>"]
build = "build.rs"
description = """
Expand Down Expand Up @@ -88,7 +88,7 @@ tokio = "0.1.22"

[package.metadata.vcpkg]
git = "https://github.com/microsoft/vcpkg"
rev = "527c0e04332db88a7906e469dca1d9f0a35726fc"
rev = "b7056e9f1f34f18b6648b1f1d9c4e9d31f04e91c"

[package.metadata.vcpkg.target]
x86_64-apple-darwin = { install = ["freetype","harfbuzz[icu,graphite2]"] }
Expand Down
15 changes: 6 additions & 9 deletions dist/azure-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,12 @@ parameters:
TARGET: x86_64-apple-darwin
TOOLCHAIN: stable

# Temporarily disabled due to vcpkg brokenness that looks like it
# will take a little while to resolve. Tracking issue:
# https://github.com/tectonic-typesetting/tectonic/issues/668
# - name: windows
# vmImage: windows-2019
# params: {}
# vars:
# TARGET: x86_64-pc-windows-msvc
# TOOLCHAIN: stable-x86_64-pc-windows-msvc
- name: windows
vmImage: windows-2019
params: {}
vars:
TARGET: x86_64-pc-windows-msvc
TOOLCHAIN: stable-x86_64-pc-windows-msvc

- name: crossBuilds
type: object
Expand Down
8 changes: 4 additions & 4 deletions src/bin/tectonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ fn main() {
"this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/"
);

// Now that we've got colorized output, we're to pass off to the inner
// function ... all so that we can print out the word "error:" in red.
// This code parallels various bits of the `error_chain` crate.
// Now that we've got colorized output, pass off to the inner function ...
// all so that we can print out the word "error:" in red. This code
// parallels various bits of the `error_chain` crate.

if let Err(ref e) = inner(args, config, &mut *status) {
tt_error!(status, ""; e);
status.report_error(e);
process::exit(1)
}
}
17 changes: 17 additions & 0 deletions src/status/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,25 @@ pub enum MessageKind {

pub trait StatusBackend {
/// Report a message to the status backend.
///
/// If `err` is not None, it represents an error that somehow caused the
/// current message to be reported. It should be displayed in some
/// appropriate fashion.
fn report(&mut self, kind: MessageKind, args: Arguments, err: Option<&Error>);

/// Report an error to the status backend.
///
/// Unlike the basic `report` function, in this case there is no additional
/// contextual information provided. The default implementation delegates to
/// `report()` with a generic lead-in message of "an error occurred".
fn report_error(&mut self, err: &Error) {
self.report(
MessageKind::Error,
format_args!("an error occurred"),
Some(err),
)
}

/// Issue a note-level status, idealy highlighting a particular phrase.
///
/// This is a bit of a hack. For [`driver::ProcessingSession::run`], I
Expand Down
14 changes: 14 additions & 0 deletions src/status/plain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ impl StatusBackend for PlainStatusBackend {
}
}

fn report_error(&mut self, err: &Error) {
let mut prefix = "error";

for item in err.iter() {
eprintln!("{}: {}", prefix, item);
prefix = "caused by";
}

if let Some(backtrace) = err.backtrace() {
eprintln!("debugging: backtrace follows:");
eprintln!("{:?}", backtrace);
}
}

fn note_highlighted(&mut self, before: &str, highlighted: &str, after: &str) {
if self.chatter > ChatterLevel::Minimal {
self.report(
Expand Down
21 changes: 21 additions & 0 deletions src/status/termcolor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@ impl StatusBackend for TermcolorStatusBackend {
}
}

fn report_error(&mut self, err: &Error) {
let mut first = true;
let kind = MessageKind::Error;

for item in err.iter() {
if first {
self.generic_message(kind, None, format_args!("{}", item));
first = false;
} else {
self.generic_message(kind, Some("caused by:"), format_args!("{}", item));
}
}

if let Some(backtrace) = err.backtrace() {
self.generic_message(kind, Some("debugging:"), format_args!("backtrace follows:"));
self.with_stream(kind, |s| {
writeln!(s, "{:?}", backtrace).expect("backtrace dump failed");
});
}
}

fn note_highlighted(&mut self, before: &str, highlighted: &str, after: &str) {
if self.chatter > ChatterLevel::Minimal {
write!(self.stdout, "{}", before).expect("write to stdout failed");
Expand Down
11 changes: 11 additions & 0 deletions tectonic/xetex-texmfmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
#include "xetex-ext.h"

#include <time.h> /* For `struct tm'. Moved here for Visual Studio 2005. */
#ifndef _MSC_VER
#include <sys/time.h>
#define HAVE_GETTIMEOFDAY
#endif

static char *last_source_name = NULL;
static int last_lineno;
Expand Down Expand Up @@ -124,10 +127,18 @@ get_date_and_time (time_t source_date_epoch,
void
get_seconds_and_micros (int32_t *seconds, int32_t *micros)
{
#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
gettimeofday(&tv, NULL);
*seconds = tv.tv_sec;
*micros = tv.tv_usec;
#else
/* This is what we use on Windows/MSVC. Less than ideal.
* We should replace this with a Rust-backed cross-platform API. */
time_t myclock = time((time_t *) NULL);
*seconds = myclock;
*micros = 0;
#endif
}


Expand Down

0 comments on commit fbd1fff

Please sign in to comment.