Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rust tool similar to go's go tool #5014

Merged
merged 2 commits into from
Feb 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ CFG_LIBFUZZER :=$(call CFG_LIB_NAME,fuzzer)
CFG_LIBRUSTPKG :=$(call CFG_LIB_NAME,rustpkg)
CFG_LIBRUSTDOC :=$(call CFG_LIB_NAME,rustdoc)
CFG_LIBRUSTI :=$(call CFG_LIB_NAME,rusti)
CFG_LIBRUST :=$(call CFG_LIB_NAME,rust)

STDLIB_GLOB :=$(call CFG_LIB_GLOB,std)
CORELIB_GLOB :=$(call CFG_LIB_GLOB,core)
Expand All @@ -143,6 +144,7 @@ LIBFUZZER_GLOB :=$(call CFG_LIB_GLOB,fuzzer)
LIBRUSTPKG_GLOB :=$(call CFG_LIB_GLOB,rustpkg)
LIBRUSTDOC_GLOB :=$(call CFG_LIB_GLOB,rustdoc)
LIBRUSTI_GLOB :=$(call CFG_LIB_GLOB,rusti)
LIBRUST_GLOB :=$(call CFG_LIB_GLOB,rust)
STDLIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,std)
CORELIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,core)
LIBRUSTC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustc)
Expand All @@ -151,6 +153,7 @@ LIBFUZZER_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,fuzzer)
LIBRUSTPKG_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustpkg)
LIBRUSTDOC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustdoc)
LIBRUSTI_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rusti)
LIBRUST_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rust)

# version-string calculation
CFG_GIT_DIR := $(CFG_SRC_DIR).git
Expand Down Expand Up @@ -374,18 +377,21 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/rustpkg$$(X) \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X) \
$$(HBIN$(1)_H_$(3))/rusti$$(X) \
$$(HBIN$(1)_H_$(3))/rust$$(X) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBFUZZER) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTPKG) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTDOC) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTI) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUST) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBFUZZER) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTPKG) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTDOC) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTI)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTI) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUST)

ifeq ($(1),0)
# Don't run the the stage0 compiler under valgrind - that ship has sailed
Expand Down
3 changes: 3 additions & 0 deletions mk/clean.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ clean$(1)_H_$(2):
$(Q)rm -f $$(HBIN$(1)_H_$(2))/serializer$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rusti$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rust$(X)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBFUZZER)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTPKG)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTDOC)
Expand All @@ -77,6 +78,7 @@ clean$(1)_H_$(2):
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBSYNTAX)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTI)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUST)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CORELIB_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(STDLIB_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB)
Expand All @@ -85,6 +87,7 @@ clean$(1)_H_$(2):
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTPKG_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTDOC_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTI_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUST_GLOB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib

Expand Down
1 change: 1 addition & 0 deletions mk/dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ PKG_FILES := \
driver \
librustpkg \
librusti \
librust \
librustc \
compiletest \
etc \
Expand Down
8 changes: 8 additions & 0 deletions mk/install.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTDOC_GLOB))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTI_GLOB))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUST_GLOB))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)

endef
Expand Down Expand Up @@ -90,15 +92,18 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTC))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTPKG))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTDOC))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTI))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUST))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBSYNTAX_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTI_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUST_GLOB))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM))
$(Q)$(call INSTALL,$(S)/man, \
Expand All @@ -114,12 +119,14 @@ uninstall:
$(Q)rm -f $(PHB)/rustc$(X)
$(Q)rm -f $(PHB)/rustpkg$(X)
$(Q)rm -f $(PHB)/rusti$(X)
$(Q)rm -f $(PHB)/rust$(X)
$(Q)rm -f $(PHB)/rustdoc$(X)
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTPKG)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTC)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTDOC)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTI)
$(Q)rm -f $(PHL)/$(CFG_LIBRUST)
$(Q)rm -f $(PHL)/$(CFG_RUNTIME)
$(Q)for i in \
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB)) \
Expand All @@ -129,6 +136,7 @@ uninstall:
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTI_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUST_GLOB)) \
; \
do rm -f $$i ; \
done
Expand Down
3 changes: 2 additions & 1 deletion mk/pp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ else
$(S)src/test/*/*/*.rs) \
$(wildcard $(S)src/fuzzer/*.rs) \
$(wildcard $(S)src/rustpkg/*.rs) \
$(wildcard $(S)src/rusti/*.rs)
$(wildcard $(S)src/rusti/*.rs) \
$(wildcard $(S)src/rust/*.rs)

PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
"no-reformat\|xfail-pretty\|xfail-test")
Expand Down
16 changes: 11 additions & 5 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
######################################################################

# The names of crates that must be tested
TEST_CRATES = core std syntax rustc rustdoc rusti rustpkg
TEST_CRATES = core std syntax rustc rustdoc rusti rust rustpkg

# Markdown files under doc/ that should have their code extracted and run
DOC_TEST_NAMES = tutorial tutorial-ffi tutorial-macros tutorial-borrowed-ptr tutorial-tasks rust
Expand Down Expand Up @@ -241,6 +241,12 @@ $(3)/test/rustitest.stage$(1)-$(2)$$(X): \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

$(3)/test/rusttest.stage$(1)-$(2)$$(X): \
$$(RUST_LIB) $$(RUST_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

$(3)/test/rustdoctest.stage$(1)-$(2)$$(X): \
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
Expand Down Expand Up @@ -464,20 +470,20 @@ $(foreach host,$(CFG_TARGET_TRIPLES), \

define DEF_RUN_DOC_TEST

DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4) := \
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
--src-base $(3)/test/doc-$(4)/ \
--build-base $(3)/test/doc-$(4)/ \
--mode run-pass

check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))

$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
doc-$(4)-extract$(3)
@$$(call E, run doc-$(4): $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
&& touch $$@

Expand Down
36 changes: 36 additions & 0 deletions mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ RUSTDOC_INPUTS := $(wildcard $(S)src/librustdoc/*.rs)
RUSTI_LIB := $(S)src/librusti/rusti.rc
RUSTI_INPUTS := $(wildcard $(S)src/librusti/*.rs)

# Rust, the convenience tool
RUST_LIB := $(S)src/librust/rust.rc
RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)

# FIXME: These are only built for the host arch. Eventually we'll
# have tools that need to built for other targets.
define TOOLS_STAGE_N_TARGET
Expand Down Expand Up @@ -102,6 +106,21 @@ $$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X): \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rusti -o $$@ $$<

$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUST): \
$$(RUST_LIB) $$(RUST_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@

$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUST)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rust -o $$@ $$<

endef

define TOOLS_STAGE_N_HOST
Expand Down Expand Up @@ -185,6 +204,23 @@ $$(HBIN$(2)_H_$(4))/rusti$$(X): \
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@

$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUST): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUST) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC) \
$$(HSREQ$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUST_GLOB) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUST_DSYM_GLOB)) \
$$(HLIB$(2)_H_$(4))

$$(HBIN$(2)_H_$(4))/rust$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUST) \
$$(HSREQ$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@

endef

$(foreach host,$(CFG_TARGET_TRIPLES), \
Expand Down
3 changes: 3 additions & 0 deletions src/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ extern mod this(name = "rustdoc", vers = "0.6");
#[cfg(rusti)]
extern mod this(name = "rusti", vers = "0.6");

#[cfg(rust)]
extern mod this(name = "rust", vers = "0.6");

#[cfg(rustc)]
extern mod this(name = "rustc", vers = "0.6");

Expand Down
Loading