Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
dep: Enable importing other tools and add integration tests
Browse files Browse the repository at this point in the history
- Turned off skip tools flag by default
- Added glide integration tests for the init case
- Move removing transitive dependencies from the imported manifest to
finalize manifest stage to avoid ignoring some constraints when
importing metadata from other tools
  • Loading branch information
ChinmayR committed Oct 17, 2017
1 parent 1d73a4a commit dd23d04
Show file tree
Hide file tree
Showing 56 changed files with 469 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ WIP:

* gps: Process canonical import paths. (#1017)
* gps: Persistent cache. (#1127, #1215)

* dep: Enable importing other tools and add integration tests

# v0.3.1

Expand Down
3 changes: 1 addition & 2 deletions cmd/dep/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
}
}

rootAnalyzer.skipTools = true // Don't import external config during solve for now
copyLock := *p.Lock // Copy lock before solving. Use this to separate new lock projects from solved lock
copyLock := *p.Lock // Copy lock before solving. Use this to separate new lock projects from solved lock

params := gps.SolveParameters{
RootDir: root,
Expand Down
6 changes: 5 additions & 1 deletion cmd/dep/root_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (a *rootAnalyzer) importManifestAndLock(dir string, pr gps.ProjectRoot, sup
if err != nil {
return nil, nil, err
}
a.removeTransitiveDependencies(m)
return m, l, err
}
}
Expand Down Expand Up @@ -112,6 +111,11 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
}

func (a *rootAnalyzer) FinalizeRootManifestAndLock(m *dep.Manifest, l *dep.Lock, ol dep.Lock) {
// Transitive dependencies could sneak into the manifest when other importers are used
if !a.skipTools {
a.removeTransitiveDependencies(m)
}

// Iterate through the new projects in solved lock and add them to manifest
// if they are direct deps and log feedback for all the new projects.
for _, y := range l.Projects() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dep/testdata/harness_tests/init/glide/case3/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Import glide config in dependencies.
Import glide config in direct dependencies.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Import deptestglideA tag v0.3.0 which has a corrupt glide manifest.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideA
version: v0.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideA"
)

type PointToDepTestGlideAv010 deptestglideA.Bversion2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commands": [
["init", "-no-examples", "-v"]
],
"error-expected": "v0.3.0: unable to parse"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take a direct dependency where the version is defined by glide.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[[constraint]]
name = "github.com/ChinmayR/deptestglideB"
version = "0.1.0"

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideB
version: v0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideB"
)

type FooVersion1 deptestglideB.FooVersion1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"commands": [
["init", "-no-examples", "-v"]
],
"vendor-final": [
"github.com/ChinmayR/deptestglideB"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take a direct dependency on a transient dependency where the versions are conflicted. Resolving should fail.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideA
version: v0.1.0
- package: github.com/ChinmayR/deptestglideB
version: v0.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideA"
"github.com/ChinmayR/deptestglideB"
)

type PointToDepTestGlideAv010 deptestglideA.Bversion1
type FooVersion2 deptestglideB.FooVersion2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commands": [
["init", "-no-examples", "-v"]
],
"error-expected": "master: Could not introduce github.com/ChinmayR/deptestglideA@master, as it is not allowed by constraint ^0.1.0 from project github.com/golang/notexist."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take a direct dependency on a transient dependency where the versions are not conflicted. Resolving should pass.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

[[constraint]]
name = "github.com/ChinmayR/deptestglideA"
version = "0.2.0"

[[constraint]]
name = "github.com/ChinmayR/deptestglideB"

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideA
version: v0.2.0
- package: github.com/ChinmayR/deptestglideB
version: ~0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideA"
"github.com/ChinmayR/deptestglideB"
)

type PointToDepTestGlideAv010 deptestglideA.Bversion2
type FooVersion2 deptestglideB.FooVersion2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"commands": [
["init", "-no-examples", "-v"]
],
"vendor-final": [
"github.com/ChinmayR/deptestglideA",
"github.com/ChinmayR/deptestglideB"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Have two transient dependencies have different versions of the same repo. Resolving should fail.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideA
version: v0.4.0
- package: github.com/ChinmayR/deptestglideB
version: v0.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideA"
"github.com/ChinmayR/deptestglideB"
)

type PointToDepTestGlideCv010 deptestglideA.Cversion1
type PointToDepTestGlideCv020 deptestglideB.Cversion2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commands": [
["init", "-no-examples", "-v"]
],
"error-expected": "No versions of github.com/ChinmayR/deptestglideB met constraints"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test if a transitive glide manifest is read.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[[constraint]]
name = "github.com/ChinmayR/deptestglideA"
version = "0.6.0"

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package: github.com/golang/notexist
homepage: http://example.com
license: MIT
owners:
- name: Sam Boyer
email: [email protected]
homepage: http://sdboyer.io
import:
- package: github.com/ChinmayR/deptestglideA
version: v0.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"github.com/ChinmayR/deptestglideA"
)

type PointToDepTestGlideAv010 deptestglideA.PointToDepTestGlideBv050
Loading

0 comments on commit dd23d04

Please sign in to comment.