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

Commit dd23d04

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 1d73a4a commit dd23d04

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

+1-1

cmd/dep/init.go

+1-2
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

+5-1
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() {

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

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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
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+
}

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

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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
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+
}

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

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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
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+
}

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

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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
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+
}

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

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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
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+
}

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

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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
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)