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

Commit b35247a

Browse files
committed
dep: Enable importing other tools and add integration tests
- 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
1 parent efd428f commit b35247a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+469
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion

cmd/dep/init.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ func (cmd *initCommand) Run(ctx *dep.Ctx, args []string) error {
159159
}
160160
}
161161

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

165164
params := gps.SolveParameters{
166165
RootDir: root,

cmd/dep/root_analyzer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func (a *rootAnalyzer) importManifestAndLock(dir string, pr gps.ProjectRoot, sup
6666
if err != nil {
6767
return nil, nil, err
6868
}
69-
a.removeTransitiveDependencies(m)
7069
return m, l, err
7170
}
7271
}
@@ -112,6 +111,11 @@ func (a *rootAnalyzer) DeriveManifestAndLock(dir string, pr gps.ProjectRoot) (gp
112111
}
113112

114113
func (a *rootAnalyzer) FinalizeRootManifestAndLock(m *dep.Manifest, l *dep.Lock, ol dep.Lock) {
114+
// Transitive dependencies could sneak into the manifest when other importers are used
115+
if !a.skipTools {
116+
a.removeTransitiveDependencies(m)
117+
}
118+
115119
// Iterate through the new projects in solved lock and add them to manifest
116120
// if they are direct deps and log feedback for all the new projects.
117121
for _, y := range l.Projects() {
Lines changed: 1 addition & 1 deletion

cmd/dep/testdata/harness_tests/init/glide/case3/final/Gopkg.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/corrupt-glide/initial/glide.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideA
10+
version: v0.3.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideA"
9+
)
10+
11+
type PointToDepTestGlideAv010 deptestglideA.Bversion2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-v"]
4+
],
5+
"error-expected": "v0.3.0: unable to parse"
6+
}
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/direct-dep/final/Gopkg.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
[[constraint]]
3+
name = "github.com/ChinmayR/deptestglideB"
4+
version = "0.1.0"

cmd/dep/testdata/harness_tests/init/glide/direct-dep/initial/glide.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideB
10+
version: v0.1.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideB"
9+
)
10+
11+
type FooVersion1 deptestglideB.FooVersion1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-v"]
4+
],
5+
"vendor-final": [
6+
"github.com/ChinmayR/deptestglideB"
7+
]
8+
}
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/direct-trans-conflict/initial/glide.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideA
10+
version: v0.1.0
11+
- package: github.com/ChinmayR/deptestglideB
12+
version: v0.2.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideA"
9+
"github.com/ChinmayR/deptestglideB"
10+
)
11+
12+
type PointToDepTestGlideAv010 deptestglideA.Bversion1
13+
type FooVersion2 deptestglideB.FooVersion2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-v"]
4+
],
5+
"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."
6+
}
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/direct-trans-no-conflict/final/Gopkg.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
[[constraint]]
3+
name = "github.com/ChinmayR/deptestglideA"
4+
version = "0.2.0"
5+
6+
[[constraint]]
7+
name = "github.com/ChinmayR/deptestglideB"

cmd/dep/testdata/harness_tests/init/glide/direct-trans-no-conflict/initial/glide.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideA
10+
version: v0.2.0
11+
- package: github.com/ChinmayR/deptestglideB
12+
version: ~0.1.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideA"
9+
"github.com/ChinmayR/deptestglideB"
10+
)
11+
12+
type PointToDepTestGlideAv010 deptestglideA.Bversion2
13+
type FooVersion2 deptestglideB.FooVersion2
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-v"]
4+
],
5+
"vendor-final": [
6+
"github.com/ChinmayR/deptestglideA",
7+
"github.com/ChinmayR/deptestglideB"
8+
]
9+
}
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/trans-trans-conflict/initial/glide.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideA
10+
version: v0.4.0
11+
- package: github.com/ChinmayR/deptestglideB
12+
version: v0.3.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideA"
9+
"github.com/ChinmayR/deptestglideB"
10+
)
11+
12+
type PointToDepTestGlideCv010 deptestglideA.Cversion1
13+
type PointToDepTestGlideCv020 deptestglideB.Cversion2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commands": [
3+
["init", "-no-examples", "-v"]
4+
],
5+
"error-expected": "No versions of github.com/ChinmayR/deptestglideB met constraints"
6+
}
Lines changed: 1 addition & 0 deletions

cmd/dep/testdata/harness_tests/init/glide/trans-trans-trans/final/Gopkg.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
[[constraint]]
3+
name = "github.com/ChinmayR/deptestglideA"
4+
version = "0.6.0"

cmd/dep/testdata/harness_tests/init/glide/trans-trans-trans/initial/glide.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package: github.com/golang/notexist
2+
homepage: http://example.com
3+
license: MIT
4+
owners:
5+
- name: Sam Boyer
6+
7+
homepage: http://sdboyer.io
8+
import:
9+
- package: github.com/ChinmayR/deptestglideA
10+
version: v0.6.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/ChinmayR/deptestglideA"
9+
)
10+
11+
type PointToDepTestGlideAv010 deptestglideA.PointToDepTestGlideBv050

0 commit comments

Comments
 (0)