srclib

package module
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2016 License: BSD-3-Clause, MIT Imports: 7 Imported by: 0

README

srclib Build Status

Note: srclib is alpha. Post an issue if you have any questions or difficulties running and hacking on it.

srclib is a source code analysis library. It provides standardized tools, interfaces and data formats for generating, representing and querying information about source code in software projects.

Why? Right now, most people write code in editors that don't give them as much programming assistance as is possible. That's because creating an editor plugin and language analyzer for your favorite language and editor combo is a lot of work. And when you're done, your plugin only supports a single language and editor, and maybe only half the features you wanted (such as doc lookups and "find usages"). Because there are no standard cross-language and cross-editor APIs and formats, it is difficult to reuse your plugin for other languages or editors.

We call this the M-by-N problem: given M editors and N languages, we need to write (on the order of) M×N plugins to get good tooling in every case. That number gets large quickly, and it's why we suffer from poor developer tools.

srclib solves this problem in 2 ways by:

  • Publishing standard formats and APIs for source analyzers and editor plugins to use. This means that improvements in a srclib language analyzer benefit users in any editor, and improvements in a srclib editor plugin benefit everyone who uses that editor on any language.

  • Providing high-quality language analyzers that implement this standard. These power Sourcegraph.com.

Step 1 is to build the language analyzers. Next up, we will build the editor plugins!

See srclib.org for more information.

Currently, srclib supports:

  • Languages: Go, JavaScript, and Ruby (coming very soon: Python and Java)

  • Features: jump-to-definition, find usages, type inference, documentation generation, and dependency resolution

Want to extend srclib to support more languages, features, or editors? We'll help! Post an issue to let us know what you're building to get started.

Usage

See Getting started for installation instructions.

Misc.

  • bash completion for srclib: run source contrib/completion/srclib-completion.bash or copy that file to /etc/bash_completion.d/srclib (path may be different on your system)

Development

srclib binary release process

Contributors with deploy privileges can update the official binaries via these instructions:

  1. go install github.com/laxer/goxc
  2. Ensure you have the AWS credentials set so that the AWS CLI (aws) can write to the srclib-release S3 bucket.
  3. Run make release V=1.2.3, where 1.2.3 is the version you want to release (which can be arbitrarily chosen but should be the next sequential git release tag for official releases).

License

srclib is licensed under the MIT License. More information in the LICENSE file.

Contributing

If you want to start hacking on srclib or write your own srclib toolchain, join the srclib Slack and then access it on srclib.slack.com. Don't forget to introduce yourself on the #General channel. We are more than happy to meet new contributors and to help people to get started.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Path is SRCLIBPATH, a colon-separated list of directories that lists
	// places to look for srclib toolchains and cache build data. It is
	// initialized from the SRCLIBPATH environment variable; if empty, it
	// defaults to $HOME/.srclib.
	Path = os.Getenv("SRCLIBPATH")

	// CacheDir stores cached build results. It is initialized from the
	// SRCLIBCACHE environment variable; if empty, it defaults to DIR/.cache,
	// where DIR is the first entry in Path (SRCLIBPATH).
	CacheDir = os.Getenv("SRCLIBCACHE")

	// CommandName holds the commands that will be used to call self when generating
	// Makefiles and updating toolchains.
	CommandName = "srclib"
)

Functions

This section is empty.

Types

type ToolRef added in v0.0.29

type ToolRef struct {
	// Toolchain is the toolchain path of the toolchain that contains this tool.
	Toolchain string

	// Subcmd is the name of the toolchain subcommand that runs this tool.
	Subcmd string
}

A ToolRef identifies a tool inside a specific toolchain. It can be used to look up the tool.

func (ToolRef) MarshalFlag added in v0.0.29

func (t ToolRef) MarshalFlag() (string, error)

func (ToolRef) String added in v0.0.29

func (t ToolRef) String() string

func (*ToolRef) UnmarshalFlag added in v0.0.29

func (t *ToolRef) UnmarshalFlag(value string) error

Directories

Path Synopsis
Package ann is a generated protocol buffer package.
Package ann is a generated protocol buffer package.
cmd
Package dep defines an interface for listing raw dependencies and resolving them, and registering handlers to perform these tasks.
Package dep defines an interface for listing raw dependencies and resolving them, and registering handlers to perform these tasks.
Package graph is a generated protocol buffer package.
Package graph is a generated protocol buffer package.
TODO(sqs): remove this file
TODO(sqs): remove this file
Package store handles srclib data access, importing, querying, and storage.
Package store handles srclib data access, importing, querying, and storage.
pb
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.
Package unit provides a source unit abstraction over distribution packages in various languages.
Package unit provides a source unit abstraction over distribution packages in various languages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL