Commit graph

25 commits

Author SHA1 Message Date
Colin Cross
a2bc585afe Fix compiling binaries with go 1.13
The go compile command in go 1.13 needs -p main instead of
-p $pkgPath when compiling binaries.  This also works for older
go releases.

Also turn on travis for go 1.13.

Change-Id: I45ce185aa44cfa01a7933cc6e52290a85c851641
2019-09-06 14:25:28 -07:00
Colin Cross
4f6631f74f Remove go 1.9 testing
strings.Builder is not in go 1.9.

Change-Id: If605026850af2819d2a31bb920837150e5031a71
2019-06-20 11:05:58 -07:00
Colin Cross
16b01609ce Run go 1.11 and go 1.12 in travis
Change-Id: If8d53ca83fb97cc6b68e3e5f4025119bb3ea2502
2019-02-28 14:42:04 -08:00
Dan Willemsen
e6d45fe39f Support go1.10
Add stubs for the new testDeps interface functions. Also removes testing
for 1.8.

Change-Id: Ice58cca20658d905df9fb87e822d7861abf60976
2018-02-27 01:49:49 -08:00
colincross
b67c1d433c Merge pull request #166 from colincross/create
Add TopDownMutatorContext.CreateModule
2017-09-20 14:09:15 -07:00
Dan Willemsen
b8534bf280 Use go1.9 instead of go1.9rc1
Change-Id: Id698eff8efeb723f8665c0358cdb0cfca4d5f776
2017-09-13 16:50:27 -07:00
Colin Cross
d40859438e travis: run short tests with race detector enabled
Change-Id: I333d01547c4b8061fcc45b5079e97fa617cf0878
2017-08-01 15:12:12 -07:00
Dan Willemsen
a4363454c8 Workaround gimme not setting GOROOT
This appears to be fixed in gimme 1.2.0, but that's not available in
Travis yet (even in the latest trusty images). This is the gimme change
to always set GOROOT:

913dd17ff3

Change-Id: Ic9024b4bbbf5c75ed162a03fe119e4db9a1cdbba
2017-07-25 16:11:14 -07:00
Dan Willemsen
53d563facb Fix build on Go 1.9
Change-Id: Ie471f396b22cd88104b4f05dbcf3677c7ffd5f08
2017-07-25 10:45:51 -07:00
Dan Willemsen
91e2483024 Fix and test rebuilds of bootstrap ninja when using tests
Add testing of bootstrap.bash -t to travis, and fix spacing issues
causing rebuilds.

Change-Id: Ia30367e40f5cf32de9749b2742d68b57e9201278
2017-07-24 14:02:51 -07:00
Dan Willemsen
1e72321e58 Use microfactory to build the bootstrap minibp
This duplicates building common blueprint go packages between minibp and
the primary builder, but drastically simplifies the first stage,
removing the need to check in a generated build.ninja.in.

Change-Id: I639a9637f1ed36d4210823ef276c0f7a064a83bd
2017-07-24 14:02:51 -07:00
Dan Willemsen
7dafbbcf6a Add microfactory directly from Soong
From commit 38cef8ac3979da8e13037540981fe7aecc1e1fbe

Removes Go 1.7 from travis, since this depends on os.Executable

Change-Id: I58e2ae542621ffad66e9e145031091cb93ebb497
2017-07-24 14:02:15 -07:00
Colin Cross
d317b06164 Test against go 1.7.6 and 1.8.3
Go 1.5.1 is obsolete, test against the two currently supported versions
of go (1.7.6 and 1.8.3).

Change-Id: Ie463dd4d57e3d5c7795e780aedd8056072695342
2017-07-13 11:10:39 -07:00
Colin Cross
127d2eae8b Import globbing from Soong
Add globbing with dependency checking to blueprint.  Calling
ModuleContext.GlobWithDeps or SingletonContext.GlobWithDeps will return
a list of files that match the globs, while also adding efficient
dependencies to rerun the primary builder if a file that matches the
glob is added or removed.

Also use the globbing support for optional_subdirs=, subdirs= and build=
lines in blueprints files.  The globbing slightly changes the behavior
of subname= lines, it no longer falls back to looking for a file called
"Blueprints".  Blueprint files that need to include a subdirectory with
a different name can use build= instead of subdir= to directly include
them.  The Blueprints file is updated to reset subname="Blueprints" in
case we want to include subdirectories inside blueprint and the primary
builder has changed the subname.

Also adds a new test directory that contains a simple primary builder
tree to test regeneration for globbing, and runs the tests in travis.

Change-Id: I83ce525fd11e11579cc58ba5308d01ca8eea7bc6
2016-11-03 13:54:03 -07:00
Dan Willemsen
7d0dddd84d Simplify bootstrap
tl;dr: Read if you don't use the wrapper or use SKIP_NINJA

Previously, we were relying on the ninja behavior of restarting the
build when the build.ninja file was updated to switch between different
bootstrap stages. But that means that every step that could produce a
build.ninja must pass in order to switch to a different stage. That
wasn't a big problem when we had a two stage build -- there was very
little that could fail in the second stage before we chose to go back to
the first stage. But when we had a three stage build, it was possible to
get into a state (usually during development) where you were in the
second stage, but the build was failing because the first stage needed
to be run. This was fixed in d79f1af742
by adding a wrapper that always started building at the first stage.

But this kept all of the complexity of using ninja restarts without any
of the benefits, so this change removes that complexity and just runs
each stage sequentially in the wrapper. So the wrapper is now required.

Since we're no longer going through choosestage, we can also skip the
template parsing for the later stages that don't need to be templated --
this can save a couple of seconds for large files.

In addition to all of the above, this also lets Soong reduce the number
of times the main ninja file is loaded. We had been running the wrapper
once (3 stages), then running ninja again after combining the
Soong-generated build.ninja with the Kati-generated build.ninja. This
change lets us removing the intermediate parsing of Soong's build.ninja,
so that we only execute ninja 3 times per build. It also lets us have
dependencies on pools or rules from Kati in the primary builder, since
we're never executing the main build.ninja without the Kati build.ninja.

The wrapper has a new option, NINJA to provide the path to ninja. This
used to be hardcoded to `ninja`, and will still default to that. But
we'll be running the first two bootstrap stages with $NINJA even if
SKIP_NINJA is set.

The wrapper passes "-w dupbuild=err" to ninja now -- this really should
always be turned on if you care about reliable builds.

Change-Id: I6f656b74eb3d064b8b9e69d1d6dac1129d72b747
2016-08-30 17:26:56 -07:00
Colin Cross
5b0231b027 Enforce gofmt in travis
Run gofmt -l . during travis to catch pull requests that have not had
gofmt run on them.

Change-Id: Ibfdf988a535d82721f3c4bc328b189f606f12778
2016-08-11 10:21:37 -07:00
Dan Willemsen
d79f1af742 Add build wrapper to do stage selection before ninja
This wrapper script can be used instead of ninja to ensure the build
won't get stuck building the primary builder.

An example of when this would happen:

1. Do a successful build
2. Sync/make a change in the primary builder (soong, etc) that depends
   on a blueprint change.
3. The next build would notice that change, and rewind to the primary
   stage to rebuild the builder. That build would fail.
4. Sync/fix the blueprint code.
5. The next build would still fail. The bootstrap stage would need to
   be run in order to fix the primary stage, but we're still stuck in the
   primary stage. The only way to switch stages is to successfully
   complete everything required to choose the next stage.

This generally isn't a problem in the main stage, since there is no code
being built in the dependency chain leading up to stage selection.

Any existing wrappers (like soong) can execute this wrapper (optionally
skipping ninja execution) if they're worried about the above situation.
This isn't strictly required -- running ninja directly will still work
in most cases, you'll just need to re-run bootstrap.bash if you get into
a bad state.

Change-Id: I5901d7240a1daa388a786ceb1c8259502fc14058
2015-12-10 16:18:15 -08:00
Colin Cross
a2cd69899f Update travis to use go 1.5
Update .travis.yml to specify go 1.5.1, and update build.ninja.in to
include the new in line function names used by go 1.5.
2015-11-09 12:56:38 -08:00
Dan Willemsen
d2e70839f2 Merge branch 'master' into danw/multistagebootstrap
Pull in the latest travis config

Change-Id: I71b5900237378877520a68d639260819d28d1b25
2015-07-30 16:55:34 -07:00
Dan Willemsen
91a657e219 Enhance bootstrap stage selection
This simplifies the bootstrap process while making it more flexible by
moving the stage selection into a go binary(choosestage). It will now be
possible to have more than two build stages.

Now each stage has a ninja template(main.ninja.in) and a timestamp
file(main.ninja.in.timestamp). The timestamp file may be updated by any
build stage that wishes to regenerate the ninja template. If the
choosestage binaries sees that the timestamp is newer than the template,
it will choose the prior stage.

The main stage no longer writes to the source tree to update the
build.ninja.in file. This was a problem for read-only source trees.
Instead, the choosestage binary first checks to see if that file is
newer than the last bootstrap.ninja.in, copies it in place, and starts
the boostrap stage.

The bootstrap stage regenerates it's own ninja template, but that
required a loop through the main stage to actually run it. The
choosestage binary now detects if the template has changed for the
current stage, and will restart the stage.

One change is that if dependencies do get messed up, instead of silently
failing, there's a higher chance that the bootstrap step will just
continue looping, doing nothing. This can happen if the main stage
has a dependency that triggers the bootstrap stage, but the bootstrap
stage doesn't see anything required to rebuild the main ninja file. A
side effect of this requirement is that changes to test code will now
rebuild the main ninja file.

Change-Id: I9965cfba79dc0dbbd3af05f5944f7653054455a2
2015-07-23 22:06:02 -07:00
Dan Willemsen
f04c55172f Add test suite for bootstrapping
This only checks to make sure that for a given updated file, the
bootstrap stage is properly run. It doesn't actually check to make sure
that anything was rebuilt.

Change-Id: I9cb6ff1d483264da30e43d5580361d93b148f42c
2015-07-23 22:04:42 -07:00
Dan Willemsen
8cc6d75034 Switch to custom-built ninja v1.6.0 2015-07-23 21:07:32 -07:00
Dan Willemsen
4ba7307e91 Migrate to container-based travis infrastructure
http://docs.travis-ci.com/user/migrating-from-legacy/
2015-07-23 21:07:32 -07:00
Dan Willemsen
187a9bf7d5 Fix running travis on forked repos
If we're not on the official repo, link the directory structure around
so that go can still find the code.
2015-07-23 21:07:32 -07:00
Jamie Gennis
aefb6570ee Add .travis.yml to configure CI 2015-03-21 03:12:46 -04:00