Skip to content

Commit faf1e73

Browse files
simonmarfacebook-github-bot
authored andcommitted
Fix CI (#564)
Summary: NOTE: this includes #559, because some of the compile errors were in that code and it wasn't worth fixing them twice. Pull Request resolved: #564 Test Plan: Imported from GitHub, without a `Test Plan:` line. Rollback Plan: Reviewed By: rubmary Differential Revision: D78016736 Pulled By: jjuliamolin fbshipit-source-id: d5234476ba3ebfaa2dbd5399b7a685ef2893103a
1 parent 84f43b6 commit faf1e73

7 files changed

Lines changed: 136 additions & 186 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,19 @@ jobs:
146146
- name: Populate hackage index
147147
run: cabal update
148148

149+
# This tells the folly-clib package to look for folly using pkg-config
150+
# instead of building its own copy of the sources. Later we can switch
151+
# to using bundled-folly, or have CI test both variants.
152+
- name: Disable bundled-folly
153+
run: echo CABAL_CONFIG_FLAGS="$CABAL_CONFIG_FLAGS -f-bundled-folly" >> "$GITHUB_ENV"
154+
155+
- name: Grab folly sources
156+
run: |
157+
apt-get install -y wget
158+
cd hsthrift
159+
make setup-folly
160+
make setup-folly-version
161+
149162
- name: Disable some tests
150163
run: echo CABAL_CONFIG_FLAGS="$CABAL_CONFIG_FLAGS -f-hack-tests -f-rust-tests -f-python-tests" >> "$GITHUB_ENV"
151164

glean.cabal.in

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ common fb-haskell
2525
default-extensions:
2626
BangPatterns
2727
BinaryLiterals
28-
CPP
2928
DataKinds
3029
DeriveDataTypeable
3130
DeriveGeneric
@@ -134,10 +133,6 @@ common folly
134133
build-depends: fb-util < 0.2
135134
pkgconfig-depends: libfolly
136135

137-
-- Facebook-specific features
138-
flag facebook
139-
default: False
140-
141136
common deps
142137
build-depends:
143138
fb-util,
@@ -1129,10 +1124,7 @@ executable glean
11291124
GleanCLI.Restore
11301125
GleanCLI.Write
11311126
ghc-options: -main-is GleanCLI -with-rtsopts=-I0
1132-
default-extensions: CPP
11331127
extra-libraries: stdc++
1134-
if flag(facebook)
1135-
ghc-options: -DGLEAN_FACEBOOK
11361128
build-depends:
11371129
glean:cli-types,
11381130
glean:client-hs,

glean/db/Glean/Database/Config.hs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,41 @@
88

99
{-# LANGUAGE ApplicativeDo, CPP #-}
1010
module Glean.Database.Config (
11+
-- * DataStore
1112
DataStore(..),
1213
fileDataStore,
1314
tmpDataStore,
1415
memoryDataStore,
16+
17+
-- * Config, and options parser
18+
options,
1519
Config(..),
20+
DebugFlags(..),
21+
22+
-- * Finding and parsing the schema
1623
ServerConfig.SchemaLocation(..),
1724
showSchemaLocation,
1825
schemaLocation,
1926
schemaLocationOption,
20-
DebugFlags(..),
21-
options,
2227
processSchema,
2328
processSchemaCached,
2429
processOneSchema,
2530
SchemaIndex(..),
2631
schemaForSchemaId,
2732
ProcessedSchema(..),
28-
schemaSourceIndexConfig,
2933
catSchemaFiles,
3034
schemaLocationToSource,
31-
schemaLocationFiles,
32-
schemaSourceFilesFromDir,
33-
schemaSourceDir,
34-
schemaSourceFile,
35-
schemaSourceIndexFile,
3635
parseSchemaDir,
3736
parseSchemaIndex,
38-
-- testing
37+
loadSchemaIndex,
38+
39+
-- * Testing only
40+
41+
-- if you're using these somewhere other than a test,
42+
-- you should probably be using something from the API above instead.
3943
processSchemaForTesting,
44+
schemaLocationFiles,
45+
schemaSourceDir,
4046
) where
4147

4248
import Control.Exception
@@ -426,6 +432,16 @@ schemaLocation cfg server_cfg = do
426432
other ->
427433
return other
428434

435+
-- | Find and load the SchemaIndex, taking into account command line
436+
-- flags, the ServerConfig, and the cfgSchemaHook. This is a
437+
-- convenience function used by the CLI.
438+
loadSchemaIndex :: ConfigProvider c => Config -> c -> IO SchemaIndex
439+
loadSchemaIndex cfg cfgAPI = do
440+
serverConfig <- ThriftSource.load cfgAPI (cfgServerConfig cfg)
441+
loc <- schemaLocation cfg serverConfig
442+
let (schemaSource, _) = cfgSchemaHook cfg loc
443+
ThriftSource.load cfgAPI schemaSource
444+
429445
showSchemaLocation :: ServerConfig.SchemaLocation -> String
430446
showSchemaLocation = \case
431447
ServerConfig.SchemaLocation_dir d -> "dir:" <> Text.unpack d

glean/db/Glean/Database/Schema.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ module Glean.Database.Schema
1616
, newDbSchema
1717
, newMergedDbSchema
1818
, mkDbSchemaFromSource
19-
, mkDbSchema
20-
, findSchemaInIndex
2119
, lookupPid
2220
, compareSchemaPredicates
2321
, validateNewSchema

glean/db/Glean/Database/Util.hs

Lines changed: 0 additions & 48 deletions
This file was deleted.

glean/tools/gleancli/GleanCLI.hs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import qualified Glean.Types as Thrift
5050
import Glean.Impl.ConfigProvider
5151
import Glean.Util.ConfigProvider
5252
import Glean.Util.ShellPrint
53-
import qualified Glean.Util.ThriftSource as ThriftSource
5453
import Glean.Shell
5554

5655
import GleanCLI.Backup
@@ -661,11 +660,9 @@ instance Plugin WriteSerializedInventoryCommand where
661660
let cfg = case svc of
662661
Glean.Local cfg _ -> cfg
663662
Glean.Remote{} -> def
664-
serverConfig <- ThriftSource.load cfgAPI (cfgServerConfig cfg)
665-
loc <- GleanDB.schemaLocation cfg serverConfig
666-
let (schemaSource, _) = GleanDB.cfgSchemaHook cfg loc
667-
index <- ThriftSource.load cfgAPI schemaSource
668-
dbSchema <- newDbSchema Nothing index selector readWriteContent def
663+
index <- GleanDB.loadSchemaIndex cfg cfgAPI
664+
dbSchema <- newDbSchema Nothing index selector
665+
readWriteContent def
669666
return $ Inventory.serialize $ schemaInventory dbSchema
670667

671668
inventory <- case writeSerializedInventoryFrom of

0 commit comments

Comments
 (0)