|
18 | 18 |
|
19 | 19 | import com.facebook.buck.cxx.CxxPlatform;
|
20 | 20 | import com.facebook.buck.model.BuildTarget;
|
21 |
| -import com.facebook.buck.model.ImmutableFlavor; |
22 | 21 | import com.facebook.buck.rules.BuildRule;
|
23 | 22 | import com.facebook.buck.rules.BuildRuleParams;
|
24 | 23 | import com.facebook.buck.rules.BuildRuleResolver;
|
25 | 24 | import com.facebook.buck.rules.BuildRuleType;
|
26 | 25 | import com.facebook.buck.rules.Description;
|
27 | 26 | import com.facebook.buck.rules.SourcePath;
|
28 |
| -import com.facebook.buck.rules.SourcePathResolver; |
29 | 27 | import com.facebook.buck.rules.TargetGraph;
|
30 | 28 | import com.facebook.infer.annotation.SuppressFieldNotInitialized;
|
31 | 29 | import com.google.common.base.Optional;
|
32 |
| -import com.google.common.base.Suppliers; |
33 | 30 | import com.google.common.collect.ImmutableList;
|
34 | 31 | import com.google.common.collect.ImmutableSet;
|
35 | 32 | import com.google.common.collect.ImmutableSortedSet;
|
36 | 33 |
|
37 |
| -import java.nio.file.Paths; |
38 | 34 | import java.util.List;
|
39 | 35 |
|
40 | 36 | public class GoBinaryDescription implements Description<GoBinaryDescription.Arg> {
|
@@ -66,42 +62,14 @@ public <A extends Arg> BuildRule createBuildRule(
|
66 | 62 | BuildRuleParams params,
|
67 | 63 | BuildRuleResolver resolver,
|
68 | 64 | A args) {
|
69 |
| - BuildTarget libraryTarget = |
70 |
| - BuildTarget.builder(params.getBuildTarget()) |
71 |
| - .addFlavors(ImmutableFlavor.of("compile")) |
72 |
| - .build(); |
73 |
| - GoLibrary library = GoDescriptors.createGoLibraryRule( |
74 |
| - params.copyWithBuildTarget(libraryTarget), |
| 65 | + return GoDescriptors.createGoBinaryRule( |
| 66 | + params, |
75 | 67 | resolver,
|
76 | 68 | goBuckConfig,
|
77 |
| - Paths.get("main"), |
| 69 | + cxxPlatform, |
78 | 70 | args.srcs,
|
79 |
| - args.compilerFlags.or(ImmutableList.<String>of()) |
80 |
| - ); |
81 |
| - resolver.addToIndex(library); |
82 |
| - |
83 |
| - BuildRuleParams binaryParams = params.copyWithDeps( |
84 |
| - Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of(library)), |
85 |
| - Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of()) |
86 |
| - ); |
87 |
| - |
88 |
| - GoSymlinkTree symlinkTree = GoDescriptors.requireTransitiveSymlinkTreeRule( |
89 |
| - binaryParams, |
90 |
| - resolver); |
91 |
| - |
92 |
| - return new GoBinary( |
93 |
| - params.copyWithDeps( |
94 |
| - Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of(symlinkTree, library)), |
95 |
| - Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of())), |
96 |
| - new SourcePathResolver(resolver), |
97 |
| - cxxPlatform.getLd(), |
98 |
| - symlinkTree, |
99 |
| - library, |
100 |
| - goBuckConfig.getGoLinker().get(), |
101 |
| - ImmutableList.<String>builder() |
102 |
| - .addAll(goBuckConfig.getLinkerFlags()) |
103 |
| - .addAll(args.linkerFlags.or(ImmutableList.<String>of())) |
104 |
| - .build()); |
| 71 | + args.compilerFlags.or(ImmutableList.<String>of()), |
| 72 | + args.linkerFlags.or(ImmutableList.<String>of())); |
105 | 73 | }
|
106 | 74 |
|
107 | 75 | @SuppressFieldNotInitialized
|
|
0 commit comments