From cd1b3cb14e4a6e6e2faf7db31ff49cd2a69386fb Mon Sep 17 00:00:00 2001 From: Miguel Branco Date: Wed, 11 Sep 2024 13:58:42 +0200 Subject: [PATCH] Removing protocol compiler (#508) --- build.sbt | 24 +-- project/Dependencies.scala | 2 + .../protocol/compiler/Placeholder.java | 17 -- .../src/main/java/module-info.java | 18 -- .../protocol/compiler/completions.proto | 73 -------- .../com/rawlabs/protocol/compiler/docs.proto | 62 ------- .../protocol/compiler/location_config.proto | 165 ------------------ .../rawlabs/protocol/compiler/messages.proto | 43 ----- .../compiler/program_description.proto | 49 ------ .../compiler/program_environment.proto | 41 ----- 10 files changed, 3 insertions(+), 491 deletions(-) delete mode 100644 protocol-compiler/src/main/java/com/rawlabs/protocol/compiler/Placeholder.java delete mode 100644 protocol-compiler/src/main/java/module-info.java delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/completions.proto delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/docs.proto delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/location_config.proto delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/messages.proto delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_description.proto delete mode 100644 protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_environment.proto diff --git a/build.sbt b/build.sbt index 766f2b279..09d68b09b 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,6 @@ writeVersionToFile := { lazy val root = (project in file(".")) .doPatchDependencies() .aggregate( - protocolCompiler, compiler, snapiParser, snapiFrontend, @@ -56,30 +55,8 @@ lazy val root = (project in file(".")) publishLocal / skip := true ) -lazy val protocolCompiler = (project in file("protocol-compiler")) - .doPatchDependencies() - .enablePlugins(ProtobufPlugin) - .settings( - commonSettings, - commonCompileSettings, - testSettings, - libraryDependencies ++= Seq( - protocolRaw % "compile->compile;test->test;protobuf->protobuf" - ), - // Set fixed versions - ProtobufConfig / version := "3.25.4", - ProtobufConfig / protobufGrpcVersion := "1.62.2", - // Forcing the dependency so that 'requires' annotation in module-info.java works properly. - libraryDependencies += "com.google.protobuf" % "protobuf-java" % ((ProtobufConfig / version).value), - // Include the protobuf files in the JAR - Compile / unmanagedResourceDirectories += (ProtobufConfig / sourceDirectory).value - ) - lazy val compiler = (project in file("compiler")) .doPatchDependencies() - .dependsOn( - protocolCompiler % "compile->compile;test->test" - ) .settings( commonSettings, // Ignore deprecation warnings in the compiler. Needed for a Jackson feature we require. @@ -88,6 +65,7 @@ lazy val compiler = (project in file("compiler")) testSettings, libraryDependencies ++= Seq( utilsCore % "compile->compile;test->test", + protocolCompiler % "compile->compile;test->test", trufflePolyglot ) ++ jacksonDeps ) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 997a6a449..2c0bf83a1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -20,6 +20,8 @@ object Dependencies { val protocolRaw = "com.raw-labs" %% "protocol-raw" % "0.50.0" + val protocolCompiler = "com.raw-labs" %% "protocol-compiler" % "0.50.0" + val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5" val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.4.12" diff --git a/protocol-compiler/src/main/java/com/rawlabs/protocol/compiler/Placeholder.java b/protocol-compiler/src/main/java/com/rawlabs/protocol/compiler/Placeholder.java deleted file mode 100644 index 364059ad1..000000000 --- a/protocol-compiler/src/main/java/com/rawlabs/protocol/compiler/Placeholder.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -package com.rawlabs.protocol.compiler; - -class Placeholder { - // Placeholder class to allow the module-info.java file to be compiled -} diff --git a/protocol-compiler/src/main/java/module-info.java b/protocol-compiler/src/main/java/module-info.java deleted file mode 100644 index 641f399aa..000000000 --- a/protocol-compiler/src/main/java/module-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -module raw.protocol.compiler { - requires com.google.protobuf; - requires raw.protocol.raw; - - exports com.rawlabs.protocol.compiler; -} diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/completions.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/completions.proto deleted file mode 100644 index 467ff42c6..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/completions.proto +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -import "com/rawlabs/protocol/compiler/docs.proto"; - -package com.rawlabs.protocol.compiler; - -message Completion { - oneof completion { - TypeCompletion type = 1; - FieldCompletion field = 2; - LetBindCompletion letBind = 3; - LetFunCompletion letFun = 4; - LetFunRecCompletion letFunRec = 5; - FunParamCompletion funParam = 6; - PackageCompletion package = 7; - EntryCompletion entry = 8; - } -} - -message TypeCompletion { - string name = 1; - string type = 2; -} - -message FieldCompletion { - string name = 1; - string type = 2; -} - -message LetBindCompletion { - string name = 1; - string type = 2; -} - -message LetFunCompletion { - string name = 1; - string type = 2; -} - -message LetFunRecCompletion { - string name = 1; - string type = 2; -} - -message FunParamCompletion { - string name = 1; - string type = 2; -} - -message PackageCompletion { - string name = 1; - PackageDoc doc = 2; -} - -message EntryCompletion { - string name = 1; - EntryDoc doc = 2; -} \ No newline at end of file diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/docs.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/docs.proto deleted file mode 100644 index 4b64d019b..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/docs.proto +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -package com.rawlabs.protocol.compiler; - -message PackageDoc { - string description = 1; - optional string info = 2; - optional string warning = 3; - optional string danger = 4; -} - -message EntryDoc { - string summary = 1; - optional string description = 2; - repeated ExampleDoc examples = 3; - repeated ParamDoc params = 4; - optional ReturnDoc ret = 5; - optional string info = 6; - optional string warning = 7; - optional string danger = 8; -} - -message ExampleDoc { - string example = 1; - optional string result = 2; -} - -message ParamDoc { - string name = 1; - TypeDoc typeDoc = 2; - string description = 3; - bool isOptional = 4; - bool isVarArg = 5; - optional string info = 6; - optional string warning = 7; - optional string danger = 8; - optional string customSyntax = 9; -} - -message ReturnDoc { - string description = 1; - optional TypeDoc retType = 2; -} - -message TypeDoc { - repeated string possibleTypes = 1; -} \ No newline at end of file diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/location_config.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/location_config.proto deleted file mode 100644 index 621696d70..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/location_config.proto +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -package com.rawlabs.protocol.compiler; - -message LocationConfig { - oneof config { - S3Config s3 = 1; - MySqlConfig mysql = 2; - OracleConfig oracle = 3; - PostgreSQLConfig postgresql = 4; - SQLServerConfig sqlserver = 5; - SnowflakeConfig snowflake = 6; - SqliteConfig sqlite = 7; - TeradataConfig teradata = 8; - GitHubConfig github = 9; - JiraConfig jira = 10; - ConfluenceConfig confluence = 11; - SalesforceConfig salesforce = 12; - DropboxAccessTokenConfig dropboxAccessToken = 13; - DropboxUsernamePasswordConfig dropboxUsernamePassword = 14; - HttpHeadersConfig httpHeaders = 15; - SecretConfig secret = 99; - ErrorConfig error = 9999; - } -} - -message S3Config { - optional S3AccessSecretKey accessSecretKey = 1; - optional string region = 2; -} - -message S3AccessSecretKey { - string accessKey = 1; - string secretKey = 2; -} - -message MySqlConfig { - string host = 1; - int32 port = 2; - string database = 3; - string user = 4; - string password = 5; -} - -message OracleConfig { - string host = 1; - int32 port = 2; - string database = 3; - string user = 4; - string password = 5; - optional string schema = 6; -} - -message PostgreSQLConfig { - string host = 1; - int32 port = 2; - string database = 3; - string user = 4; - string password = 5; - optional string schema = 6; -} - -message SQLServerConfig { - string host = 1; - int32 port = 2; - string database = 3; - string user = 4; - string password = 5; - optional string schema = 6; -} - -message SnowflakeConfig { - string database = 1; - string user = 2; - string password = 3; - string accountIdentifier = 4; - map parameters = 5; - optional string schema = 6; -} - -message SqliteConfig { - string path = 1; - optional string schema = 2; -} - -message TeradataConfig { - string host = 1; - int32 port = 2; - string database = 3; - string user = 4; - string password = 5; - map parameters = 6; - optional string schema = 7; -} - -message GitHubConfig { - string token = 1; - optional string baseUrl = 2; -} - -message JiraConfig { - string baseUrl = 1; - string username = 2; - string token = 3; - JiraTokenType tokenType = 4; - - enum JiraTokenType { - STANDARD_ACCESS_TOKEN = 0; - PERSONAL_ACCESS_TOKEN = 1; - } -} - -message ConfluenceConfig { - string baseUrl = 1; - string username = 2; - string token = 3; -} - -message SalesforceConfig { - string url = 1; - string username = 2; - string password = 3; - string securityToken = 4; - string clientId = 5; - string apiVersion = 6; - repeated string customObjects = 7; -} - -message DropboxAccessTokenConfig { - string accessToken = 1; -} - -message DropboxUsernamePasswordConfig { - string username = 1; - string password = 2; -} - -message HttpHeadersConfig { - map headers = 1; -} - -// This is not used in practice but is kept for compatibility with FDW interface. -message SecretConfig { - string name = 1; - string value = 2; -} - -message ErrorConfig { - string message = 1; -} \ No newline at end of file diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/messages.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/messages.proto deleted file mode 100644 index cd4effd2a..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/messages.proto +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -package com.rawlabs.protocol.compiler; - -message Message { - string message = 1; - repeated Range positions = 2; - string code = 3; - repeated int32 tags = 4; - Severity severity = 5; - - enum Severity { - HINT = 0; - INFO = 10; - WARNING = 20; - ERROR = 99; - } -} - -message Range { - Position begin = 1; - Position end = 2; -} - -message Position { - uint32 line = 1; - uint32 column = 2; -} diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_description.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_description.proto deleted file mode 100644 index f0f85b68d..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_description.proto +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -package com.rawlabs.protocol.compiler; - -import "com/rawlabs/protocol/raw/types.proto"; -import "com/rawlabs/protocol/raw/values.proto"; - -message ProgramDescription { - map decls = 1; - optional Decl body = 2; - optional string comment = 3; -} - -message Decls { - repeated Decl decls = 1; -} - -message Decl { - optional Params params = 1; - optional com.rawlabs.protocol.raw.Type outType = 2; - optional string comment = 3; -} - -message Params { - repeated Param params = 1; -} - -message Param { - string name = 1; - com.rawlabs.protocol.raw.Type tipe = 2; - optional com.rawlabs.protocol.raw.Value defaultValue = 3; - optional string comment = 4; - bool required = 5; -} diff --git a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_environment.proto b/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_environment.proto deleted file mode 100644 index 412353f4b..000000000 --- a/protocol-compiler/src/main/protobuf/com/rawlabs/protocol/compiler/program_environment.proto +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2024 RAW Labs S.A. - * - * Use of this software is governed by the Business Source License - * included in the file licenses/BSL.txt. - * - * As of the Change Date specified in that file, in accordance with - * the Business Source License, use of this software will be governed - * by the Apache License, Version 2.0, included in the file - * licenses/APL.txt. - */ - -syntax = "proto3"; - -option java_package = "com.rawlabs.protocol.compiler"; -option java_multiple_files = true; - -package com.rawlabs.protocol.compiler; - -import "com/rawlabs/protocol/raw/values.proto"; -import "com/rawlabs/protocol/compiler/location_config.proto"; - -message ProgramEnvironment { - string uid = 1; - optional Arguments arguments = 2; - repeated string scopes = 3; - map secrets = 4; - map locationConfigs = 5; - map options = 6; - optional string jdbcUrl = 7; - optional string traceId = 8; -} - -message Arguments { - repeated Argument arguments = 1; -} - -message Argument { - string name = 1; - com.rawlabs.protocol.raw.Value value = 2; -} \ No newline at end of file