Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package rust |
| 16 | |
| 17 | import ( |
Ivan Lozano | ad8b18b | 2019-10-31 19:38:29 -0700 | [diff] [blame^] | 18 | "regexp" |
| 19 | "strings" |
| 20 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 21 | "android/soong/android" |
| 22 | ) |
| 23 | |
| 24 | func init() { |
| 25 | android.RegisterModuleType("rust_library", RustLibraryFactory) |
| 26 | android.RegisterModuleType("rust_library_dylib", RustLibraryDylibFactory) |
| 27 | android.RegisterModuleType("rust_library_rlib", RustLibraryRlibFactory) |
| 28 | android.RegisterModuleType("rust_library_host", RustLibraryHostFactory) |
| 29 | android.RegisterModuleType("rust_library_host_dylib", RustLibraryDylibHostFactory) |
| 30 | android.RegisterModuleType("rust_library_host_rlib", RustLibraryRlibHostFactory) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 31 | android.RegisterModuleType("rust_library_shared", RustLibrarySharedFactory) |
| 32 | android.RegisterModuleType("rust_library_static", RustLibraryStaticFactory) |
| 33 | android.RegisterModuleType("rust_library_host_shared", RustLibrarySharedHostFactory) |
| 34 | android.RegisterModuleType("rust_library_host_static", RustLibraryStaticHostFactory) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | type VariantLibraryProperties struct { |
| 38 | Enabled *bool `android:"arch_variant"` |
| 39 | } |
| 40 | |
| 41 | type LibraryCompilerProperties struct { |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 42 | Rlib VariantLibraryProperties `android:"arch_variant"` |
| 43 | Dylib VariantLibraryProperties `android:"arch_variant"` |
| 44 | Shared VariantLibraryProperties `android:"arch_variant"` |
| 45 | Static VariantLibraryProperties `android:"arch_variant"` |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 46 | |
| 47 | // path to the source file that is the main entry point of the program (e.g. src/lib.rs) |
| 48 | Srcs []string `android:"path,arch_variant"` |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 49 | |
| 50 | // path to include directories to pass to cc_* modules, only relevant for static/shared variants. |
| 51 | Include_dirs []string `android:"path,arch_variant"` |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | type LibraryMutatedProperties struct { |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 55 | // Build a dylib variant |
| 56 | BuildDylib bool `blueprint:"mutated"` |
| 57 | // Build an rlib variant |
| 58 | BuildRlib bool `blueprint:"mutated"` |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 59 | // Build a shared library variant |
| 60 | BuildShared bool `blueprint:"mutated"` |
| 61 | // Build a static library variant |
| 62 | BuildStatic bool `blueprint:"mutated"` |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 63 | |
| 64 | // This variant is a dylib |
| 65 | VariantIsDylib bool `blueprint:"mutated"` |
| 66 | // This variant is an rlib |
| 67 | VariantIsRlib bool `blueprint:"mutated"` |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 68 | // This variant is a shared library |
| 69 | VariantIsShared bool `blueprint:"mutated"` |
| 70 | // This variant is a static library |
| 71 | VariantIsStatic bool `blueprint:"mutated"` |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | type libraryDecorator struct { |
| 75 | *baseCompiler |
| 76 | |
| 77 | Properties LibraryCompilerProperties |
| 78 | MutatedProperties LibraryMutatedProperties |
| 79 | distFile android.OptionalPath |
| 80 | unstrippedOutputFile android.Path |
| 81 | } |
| 82 | |
| 83 | type libraryInterface interface { |
| 84 | rlib() bool |
| 85 | dylib() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 86 | static() bool |
| 87 | shared() bool |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 88 | |
| 89 | // Returns true if the build options for the module have selected a particular build type |
| 90 | buildRlib() bool |
| 91 | buildDylib() bool |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 92 | buildShared() bool |
| 93 | buildStatic() bool |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 94 | |
| 95 | // Sets a particular variant type |
| 96 | setRlib() |
| 97 | setDylib() |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 98 | setShared() |
| 99 | setStatic() |
| 100 | |
| 101 | // Build a specific library variant |
| 102 | BuildOnlyRlib() |
| 103 | BuildOnlyDylib() |
| 104 | BuildOnlyStatic() |
| 105 | BuildOnlyShared() |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | func (library *libraryDecorator) exportedDirs() []string { |
| 109 | return library.linkDirs |
| 110 | } |
| 111 | |
| 112 | func (library *libraryDecorator) exportedDepFlags() []string { |
| 113 | return library.depFlags |
| 114 | } |
| 115 | |
| 116 | func (library *libraryDecorator) reexportDirs(dirs ...string) { |
| 117 | library.linkDirs = android.FirstUniqueStrings(append(library.linkDirs, dirs...)) |
| 118 | } |
| 119 | |
| 120 | func (library *libraryDecorator) reexportDepFlags(flags ...string) { |
| 121 | library.depFlags = android.FirstUniqueStrings(append(library.depFlags, flags...)) |
| 122 | } |
| 123 | |
| 124 | func (library *libraryDecorator) rlib() bool { |
| 125 | return library.MutatedProperties.VariantIsRlib |
| 126 | } |
| 127 | |
| 128 | func (library *libraryDecorator) dylib() bool { |
| 129 | return library.MutatedProperties.VariantIsDylib |
| 130 | } |
| 131 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 132 | func (library *libraryDecorator) shared() bool { |
| 133 | return library.MutatedProperties.VariantIsShared |
| 134 | } |
| 135 | |
| 136 | func (library *libraryDecorator) static() bool { |
| 137 | return library.MutatedProperties.VariantIsStatic |
| 138 | } |
| 139 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 140 | func (library *libraryDecorator) buildRlib() bool { |
| 141 | return library.MutatedProperties.BuildRlib && BoolDefault(library.Properties.Rlib.Enabled, true) |
| 142 | } |
| 143 | |
| 144 | func (library *libraryDecorator) buildDylib() bool { |
| 145 | return library.MutatedProperties.BuildDylib && BoolDefault(library.Properties.Dylib.Enabled, true) |
| 146 | } |
| 147 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 148 | func (library *libraryDecorator) buildShared() bool { |
| 149 | return library.MutatedProperties.BuildShared && BoolDefault(library.Properties.Shared.Enabled, true) |
| 150 | } |
| 151 | |
| 152 | func (library *libraryDecorator) buildStatic() bool { |
| 153 | return library.MutatedProperties.BuildStatic && BoolDefault(library.Properties.Static.Enabled, true) |
| 154 | } |
| 155 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 156 | func (library *libraryDecorator) setRlib() { |
| 157 | library.MutatedProperties.VariantIsRlib = true |
| 158 | library.MutatedProperties.VariantIsDylib = false |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 159 | library.MutatedProperties.VariantIsStatic = false |
| 160 | library.MutatedProperties.VariantIsShared = false |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | func (library *libraryDecorator) setDylib() { |
| 164 | library.MutatedProperties.VariantIsRlib = false |
| 165 | library.MutatedProperties.VariantIsDylib = true |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 166 | library.MutatedProperties.VariantIsStatic = false |
| 167 | library.MutatedProperties.VariantIsShared = false |
| 168 | } |
| 169 | |
| 170 | func (library *libraryDecorator) setShared() { |
| 171 | library.MutatedProperties.VariantIsStatic = false |
| 172 | library.MutatedProperties.VariantIsShared = true |
| 173 | library.MutatedProperties.VariantIsRlib = false |
| 174 | library.MutatedProperties.VariantIsDylib = false |
| 175 | } |
| 176 | |
| 177 | func (library *libraryDecorator) setStatic() { |
| 178 | library.MutatedProperties.VariantIsStatic = true |
| 179 | library.MutatedProperties.VariantIsShared = false |
| 180 | library.MutatedProperties.VariantIsRlib = false |
| 181 | library.MutatedProperties.VariantIsDylib = false |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | var _ compiler = (*libraryDecorator)(nil) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 185 | var _ libraryInterface = (*libraryDecorator)(nil) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 186 | |
| 187 | // rust_library produces all variants. |
| 188 | func RustLibraryFactory() android.Module { |
| 189 | module, _ := NewRustLibrary(android.HostAndDeviceSupported) |
| 190 | return module.Init() |
| 191 | } |
| 192 | |
| 193 | // rust_library_dylib produces a dylib. |
| 194 | func RustLibraryDylibFactory() android.Module { |
| 195 | module, library := NewRustLibrary(android.HostAndDeviceSupported) |
| 196 | library.BuildOnlyDylib() |
| 197 | return module.Init() |
| 198 | } |
| 199 | |
| 200 | // rust_library_rlib produces an rlib. |
| 201 | func RustLibraryRlibFactory() android.Module { |
| 202 | module, library := NewRustLibrary(android.HostAndDeviceSupported) |
| 203 | library.BuildOnlyRlib() |
| 204 | return module.Init() |
| 205 | } |
| 206 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 207 | // rust_library_shared produces a shared library. |
| 208 | func RustLibrarySharedFactory() android.Module { |
| 209 | module, library := NewRustLibrary(android.HostAndDeviceSupported) |
| 210 | library.BuildOnlyShared() |
| 211 | return module.Init() |
| 212 | } |
| 213 | |
| 214 | // rust_library_static produces a static library. |
| 215 | func RustLibraryStaticFactory() android.Module { |
| 216 | module, library := NewRustLibrary(android.HostAndDeviceSupported) |
| 217 | library.BuildOnlyStatic() |
| 218 | return module.Init() |
| 219 | } |
| 220 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 221 | // rust_library_host produces all variants. |
| 222 | func RustLibraryHostFactory() android.Module { |
| 223 | module, _ := NewRustLibrary(android.HostSupported) |
| 224 | return module.Init() |
| 225 | } |
| 226 | |
| 227 | // rust_library_dylib_host produces a dylib. |
| 228 | func RustLibraryDylibHostFactory() android.Module { |
| 229 | module, library := NewRustLibrary(android.HostSupported) |
| 230 | library.BuildOnlyDylib() |
| 231 | return module.Init() |
| 232 | } |
| 233 | |
| 234 | // rust_library_rlib_host produces an rlib. |
| 235 | func RustLibraryRlibHostFactory() android.Module { |
| 236 | module, library := NewRustLibrary(android.HostSupported) |
| 237 | library.BuildOnlyRlib() |
| 238 | return module.Init() |
| 239 | } |
| 240 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 241 | // rust_library_static_host produces a static library. |
| 242 | func RustLibraryStaticHostFactory() android.Module { |
| 243 | module, library := NewRustLibrary(android.HostSupported) |
| 244 | library.BuildOnlyStatic() |
| 245 | return module.Init() |
| 246 | } |
| 247 | |
| 248 | // rust_library_shared_host produces an shared library. |
| 249 | func RustLibrarySharedHostFactory() android.Module { |
| 250 | module, library := NewRustLibrary(android.HostSupported) |
| 251 | library.BuildOnlyShared() |
| 252 | return module.Init() |
| 253 | } |
| 254 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 255 | func (library *libraryDecorator) BuildOnlyDylib() { |
| 256 | library.MutatedProperties.BuildRlib = false |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 257 | library.MutatedProperties.BuildShared = false |
| 258 | library.MutatedProperties.BuildStatic = false |
| 259 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | func (library *libraryDecorator) BuildOnlyRlib() { |
| 263 | library.MutatedProperties.BuildDylib = false |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 264 | library.MutatedProperties.BuildShared = false |
| 265 | library.MutatedProperties.BuildStatic = false |
| 266 | } |
| 267 | |
| 268 | func (library *libraryDecorator) BuildOnlyStatic() { |
| 269 | library.MutatedProperties.BuildShared = false |
| 270 | library.MutatedProperties.BuildRlib = false |
| 271 | library.MutatedProperties.BuildDylib = false |
| 272 | |
| 273 | } |
| 274 | |
| 275 | func (library *libraryDecorator) BuildOnlyShared() { |
| 276 | library.MutatedProperties.BuildStatic = false |
| 277 | library.MutatedProperties.BuildRlib = false |
| 278 | library.MutatedProperties.BuildDylib = false |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | func NewRustLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) { |
| 282 | module := newModule(hod, android.MultilibFirst) |
| 283 | |
| 284 | library := &libraryDecorator{ |
| 285 | MutatedProperties: LibraryMutatedProperties{ |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 286 | BuildDylib: true, |
| 287 | BuildRlib: true, |
| 288 | BuildShared: true, |
| 289 | BuildStatic: true, |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 290 | }, |
| 291 | baseCompiler: NewBaseCompiler("lib", "lib64"), |
| 292 | } |
| 293 | |
| 294 | module.compiler = library |
| 295 | |
| 296 | return module, library |
| 297 | } |
| 298 | |
| 299 | func (library *libraryDecorator) compilerProps() []interface{} { |
| 300 | return append(library.baseCompiler.compilerProps(), |
| 301 | &library.Properties, |
| 302 | &library.MutatedProperties) |
| 303 | } |
| 304 | |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 305 | func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { |
| 306 | deps = library.baseCompiler.compilerDeps(ctx, deps) |
| 307 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 308 | if ctx.toolchain().Bionic() && (library.dylib() || library.shared()) { |
Ivan Lozano | f1c8433 | 2019-09-20 11:00:37 -0700 | [diff] [blame] | 309 | deps = library.baseCompiler.bionicDeps(ctx, deps) |
| 310 | } |
| 311 | |
| 312 | return deps |
| 313 | } |
| 314 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 315 | func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path { |
| 316 | var outputFile android.WritablePath |
| 317 | |
| 318 | srcPath := srcPathFromModuleSrcs(ctx, library.Properties.Srcs) |
| 319 | |
| 320 | flags.RustFlags = append(flags.RustFlags, deps.depFlags...) |
| 321 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 322 | if library.dylib() || library.shared() { |
| 323 | // We need prefer-dynamic for now to avoid linking in the static stdlib. See: |
| 324 | // https://github.com/rust-lang/rust/issues/19680 |
| 325 | // https://github.com/rust-lang/rust/issues/34909 |
| 326 | flags.RustFlags = append(flags.RustFlags, "-C prefer-dynamic") |
| 327 | } |
| 328 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 329 | if library.rlib() { |
| 330 | fileName := library.getStem(ctx) + ctx.toolchain().RlibSuffix() |
| 331 | outputFile = android.PathForModuleOut(ctx, fileName) |
| 332 | |
| 333 | TransformSrctoRlib(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) |
| 334 | } else if library.dylib() { |
| 335 | fileName := library.getStem(ctx) + ctx.toolchain().DylibSuffix() |
| 336 | outputFile = android.PathForModuleOut(ctx, fileName) |
| 337 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 338 | TransformSrctoDylib(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 339 | } else if library.static() { |
| 340 | fileName := library.getStem(ctx) + ctx.toolchain().StaticLibSuffix() |
| 341 | outputFile = android.PathForModuleOut(ctx, fileName) |
| 342 | |
| 343 | TransformSrctoStatic(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) |
| 344 | } else if library.shared() { |
| 345 | fileName := library.getStem(ctx) + ctx.toolchain().SharedLibSuffix() |
| 346 | outputFile = android.PathForModuleOut(ctx, fileName) |
| 347 | |
| 348 | TransformSrctoShared(ctx, srcPath, deps, flags, outputFile, deps.linkDirs) |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 349 | } |
| 350 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 351 | if library.rlib() || library.dylib() { |
| 352 | library.reexportDirs(deps.linkDirs...) |
| 353 | library.reexportDepFlags(deps.depFlags...) |
| 354 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 355 | library.unstrippedOutputFile = outputFile |
| 356 | |
| 357 | return outputFile |
| 358 | } |
| 359 | |
Ivan Lozano | ad8b18b | 2019-10-31 19:38:29 -0700 | [diff] [blame^] | 360 | func (library *libraryDecorator) getStem(ctx ModuleContext) string { |
| 361 | stem := library.baseCompiler.getStemWithoutSuffix(ctx) |
| 362 | validateLibraryStem(ctx, stem, library.crateName()) |
| 363 | |
| 364 | return stem + String(library.baseCompiler.Properties.Suffix) |
| 365 | } |
| 366 | |
| 367 | var validCrateName = regexp.MustCompile("[^a-zA-Z0-9_]+") |
| 368 | |
| 369 | func validateLibraryStem(ctx BaseModuleContext, filename string, crate_name string) { |
| 370 | if crate_name == "" { |
| 371 | ctx.PropertyErrorf("crate_name", "crate_name must be defined.") |
| 372 | } |
| 373 | |
| 374 | // crate_names are used for the library output file, and rustc expects these |
| 375 | // to be alphanumeric with underscores allowed. |
| 376 | if validCrateName.MatchString(crate_name) { |
| 377 | ctx.PropertyErrorf("crate_name", |
| 378 | "library crate_names must be alphanumeric with underscores allowed") |
| 379 | } |
| 380 | |
| 381 | // Libraries are expected to begin with "lib" followed by the crate_name |
| 382 | if !strings.HasPrefix(filename, "lib"+crate_name) { |
| 383 | ctx.ModuleErrorf("Invalid name or stem property; library filenames must start with lib<crate_name>") |
| 384 | } |
| 385 | } |
| 386 | |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 387 | func LibraryMutator(mctx android.BottomUpMutatorContext) { |
| 388 | if m, ok := mctx.Module().(*Module); ok && m.compiler != nil { |
| 389 | switch library := m.compiler.(type) { |
| 390 | case libraryInterface: |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 391 | |
Ivan Lozano | 52767be | 2019-10-18 14:49:46 -0700 | [diff] [blame] | 392 | // We only build the rust library variants here. This assumes that |
| 393 | // LinkageMutator runs first and there's an empty variant |
| 394 | // if rust variants are required. |
| 395 | if !library.static() && !library.shared() { |
| 396 | if library.buildRlib() && library.buildDylib() { |
| 397 | modules := mctx.CreateLocalVariations("rlib", "dylib") |
| 398 | rlib := modules[0].(*Module) |
| 399 | dylib := modules[1].(*Module) |
| 400 | |
| 401 | rlib.compiler.(libraryInterface).setRlib() |
| 402 | dylib.compiler.(libraryInterface).setDylib() |
| 403 | } else if library.buildRlib() { |
| 404 | modules := mctx.CreateLocalVariations("rlib") |
| 405 | modules[0].(*Module).compiler.(libraryInterface).setRlib() |
| 406 | } else if library.buildDylib() { |
| 407 | modules := mctx.CreateLocalVariations("dylib") |
| 408 | modules[0].(*Module).compiler.(libraryInterface).setDylib() |
| 409 | } |
Ivan Lozano | ffee334 | 2019-08-27 12:03:00 -0700 | [diff] [blame] | 410 | } |
| 411 | } |
| 412 | } |
| 413 | } |