-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Typescript improvements Signed-off-by: Prabhu Subramanian <[email protected]> * Improvements based on chen tests Signed-off-by: Prabhu Subramanian <[email protected]> * Improvements based on chen tests Signed-off-by: Prabhu Subramanian <[email protected]> * Improvements based on chen tests Signed-off-by: Prabhu Subramanian <[email protected]> --------- Signed-off-by: Prabhu Subramanian <[email protected]>
- Loading branch information
Showing
10 changed files
with
164 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
name := "atom" | ||
ThisBuild / organization := "io.appthreat" | ||
ThisBuild / version := "2.0.18" | ||
ThisBuild / version := "2.0.19" | ||
ThisBuild / scalaVersion := "3.5.0" | ||
|
||
val chenVersion = "2.1.5" | ||
val chenVersion = "2.1.6" | ||
|
||
lazy val atom = Projects.atom | ||
|
||
val astGenVersion = "3.5.0" | ||
|
||
libraryDependencies ++= Seq( | ||
"com.github.pathikrit" %% "better-files" % "3.9.2", | ||
"com.github.scopt" %% "scopt" % "4.1.0", | ||
"org.slf4j" % "slf4j-nop" % "2.0.16" % Optional, | ||
"io.appthreat" %% "c2cpg" % Versions.chen excludeAll ( | ||
"com.github.pathikrit" %% "better-files" % "3.9.2", | ||
"com.github.scopt" %% "scopt" % "4.1.0", | ||
"org.slf4j" % "slf4j-nop" % "2.0.16" % Optional, | ||
("io.appthreat" %% "c2cpg" % Versions.chen).excludeAll( | ||
ExclusionRule(organization = "com.ibm.icu", name = "icu4j"), | ||
ExclusionRule(organization = "org.jline", name = "jline"), | ||
ExclusionRule(organization = "org.eclipse.platform", name = "org.eclipse.jface"), | ||
ExclusionRule(organization = "org.eclipse.platform", name = "org.eclipse.jface.text") | ||
), | ||
"io.appthreat" %% "dataflowengineoss" % Versions.chen, | ||
"io.appthreat" %% "pysrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "javasrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "jssrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "jimple2cpg" % Versions.chen, | ||
"io.appthreat" %% "php2atom" % Versions.chen, | ||
"io.appthreat" %% "semanticcpg" % Versions.chen % Test classifier "tests", | ||
"io.appthreat" %% "x2cpg" % Versions.chen % Test classifier "tests", | ||
"io.appthreat" %% "pysrc2cpg" % Versions.chen % Test classifier "tests", | ||
"org.scalatest" %% "scalatest" % "3.2.19" % Test | ||
"io.appthreat" %% "dataflowengineoss" % Versions.chen, | ||
"io.appthreat" %% "pysrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "javasrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "jssrc2cpg" % Versions.chen, | ||
"io.appthreat" %% "jimple2cpg" % Versions.chen, | ||
"io.appthreat" %% "php2atom" % Versions.chen, | ||
("io.appthreat" %% "semanticcpg" % Versions.chen % Test).classifier("tests"), | ||
("io.appthreat" %% "x2cpg" % Versions.chen % Test).classifier("tests"), | ||
("io.appthreat" %% "pysrc2cpg" % Versions.chen % Test).classifier("tests"), | ||
"org.scalatest" %% "scalatest" % "3.2.19" % Test | ||
) | ||
|
||
excludeDependencies ++= Seq( | ||
ExclusionRule("dev.scalapy", "scalapy-core"), | ||
ExclusionRule("org.gradle", "gradle-tooling-api"), | ||
ExclusionRule("org.scala-lang", "scala3-compiler") | ||
) | ||
|
||
Compile / doc / scalacOptions ++= Seq("-doc-title", "atom apidocs", "-doc-version", version.value) | ||
|
@@ -43,16 +49,22 @@ ThisBuild / compile / javacOptions ++= Seq( | |
"-Xlint", | ||
"--release=21" | ||
) ++ { | ||
// fail early if users with JDK11 try to run this | ||
val javaVersion = sys.props("java.specification.version").toFloat | ||
assert(javaVersion.toInt >= 21, s"this build requires JDK21+ - you're using $javaVersion") | ||
Nil | ||
// fail early if users with JDK11 try to run this | ||
val javaVersion = sys.props("java.specification.version").toFloat | ||
assert(javaVersion.toInt >= 21, s"this build requires JDK21+ - you're using $javaVersion") | ||
Nil | ||
} | ||
|
||
Universal / topLevelDirectory := None | ||
|
||
Universal / mappings := (Universal / mappings).value.filter { | ||
case (_, path) => !path.contains("org.scala-lang.scala3-compiler") && !path.contains("io.get-coursier") && !path.contains("com.michaelpollmeier.scala-repl-pp") | ||
case (_, path) => !path.contains("org.scala-lang.scala3-compiler") && !path.contains( | ||
"io.get-coursier" | ||
) && !path.contains("com.michaelpollmeier.scala-repl-pp") && !path.contains( | ||
"dev.scalapy.scalapy-core" | ||
) && !path.contains( | ||
"dev.scalapy.scalapy-macros" | ||
) | ||
} | ||
|
||
enablePlugins(JavaAppPackaging, ClasspathJarPlugin, GraalVMNativeImagePlugin) | ||
|
@@ -68,97 +80,99 @@ astGenDlUrl := s"https://github.com/joernio/astgen/releases/download/v${astGenVe | |
|
||
lazy val astGenBinaryNames = taskKey[Seq[String]]("astgen binary names") | ||
astGenBinaryNames := { | ||
if (sys.props.get("ALL_PLATFORMS").contains("TRUE")) { | ||
Seq(AstgenWin, AstgenLinux, AstgenMac, AstgenMacArm) | ||
} else { | ||
Environment.operatingSystem match { | ||
case Environment.OperatingSystemType.Windows => | ||
Seq(AstgenWin) | ||
case Environment.OperatingSystemType.Linux => | ||
Environment.architecture match { | ||
case Environment.ArchitectureType.X86 => Seq(AstgenLinux) | ||
case Environment.ArchitectureType.ARM => Seq(AstgenLinuxArm) | ||
} | ||
case Environment.OperatingSystemType.Mac => | ||
Environment.architecture match { | ||
case Environment.ArchitectureType.X86 => Seq(AstgenMac) | ||
case Environment.ArchitectureType.ARM => Seq(AstgenMacArm) | ||
} | ||
case Environment.OperatingSystemType.Unknown => | ||
if (sys.props.get("ALL_PLATFORMS").contains("TRUE")) { | ||
Seq(AstgenWin, AstgenLinux, AstgenMac, AstgenMacArm) | ||
} else { | ||
Environment.operatingSystem match { | ||
case Environment.OperatingSystemType.Windows => | ||
Seq(AstgenWin) | ||
case Environment.OperatingSystemType.Linux => | ||
Environment.architecture match { | ||
case Environment.ArchitectureType.X86 => Seq(AstgenLinux) | ||
case Environment.ArchitectureType.ARM => Seq(AstgenLinuxArm) | ||
} | ||
case Environment.OperatingSystemType.Mac => | ||
Environment.architecture match { | ||
case Environment.ArchitectureType.X86 => Seq(AstgenMac) | ||
case Environment.ArchitectureType.ARM => Seq(AstgenMacArm) | ||
} | ||
case Environment.OperatingSystemType.Unknown => | ||
Seq(AstgenWin, AstgenLinux, AstgenMac, AstgenMacArm) | ||
} | ||
} | ||
} | ||
} | ||
|
||
lazy val astGenDlTask = taskKey[Unit](s"Download astgen binaries") | ||
astGenDlTask := { | ||
val astGenDir = baseDirectory.value / "bin" / "astgen" | ||
astGenDir.mkdirs() | ||
|
||
astGenBinaryNames.value.foreach { fileName => | ||
val dest = astGenDir / fileName | ||
if (!dest.exists) { | ||
val url = s"${astGenDlUrl.value}$fileName" | ||
val downloadedFile = SimpleCache.downloadMaybe(url) | ||
IO.copyFile(downloadedFile, dest) | ||
val astGenDir = baseDirectory.value / "bin" / "astgen" | ||
astGenDir.mkdirs() | ||
|
||
astGenBinaryNames.value.foreach { fileName => | ||
val dest = astGenDir / fileName | ||
if (!dest.exists) { | ||
val url = s"${astGenDlUrl.value}$fileName" | ||
val downloadedFile = SimpleCache.downloadMaybe(url) | ||
IO.copyFile(downloadedFile, dest) | ||
} | ||
} | ||
} | ||
|
||
val distDir = (Universal / stagingDirectory).value / "bin" / "astgen" | ||
distDir.mkdirs() | ||
IO.copyDirectory(astGenDir, distDir) | ||
val distDir = (Universal / stagingDirectory).value / "bin" / "astgen" | ||
distDir.mkdirs() | ||
IO.copyDirectory(astGenDir, distDir) | ||
|
||
// permissions are lost during the download; need to set them manually | ||
astGenDir.listFiles().foreach(_.setExecutable(true, false)) | ||
distDir.listFiles().foreach(_.setExecutable(true, false)) | ||
// permissions are lost during the download; need to set them manually | ||
astGenDir.listFiles().foreach(_.setExecutable(true, false)) | ||
distDir.listFiles().foreach(_.setExecutable(true, false)) | ||
} | ||
|
||
lazy val astGenSetAllPlatforms = taskKey[Unit](s"Set ALL_PLATFORMS") | ||
astGenSetAllPlatforms := { System.setProperty("ALL_PLATFORMS", "TRUE") } | ||
|
||
stage := Def | ||
.sequential(astGenSetAllPlatforms, Universal / stage) | ||
.andFinally(System.setProperty("ALL_PLATFORMS", "FALSE")) | ||
.value | ||
.sequential(astGenSetAllPlatforms, Universal / stage) | ||
.andFinally(System.setProperty("ALL_PLATFORMS", "FALSE")) | ||
.value | ||
|
||
// Also remove astgen binaries with clean, e.g., to allow for updating them. | ||
// Sadly, we can't define the bin/ folders globally, | ||
// as .value can only be used within a task or setting macro | ||
cleanFiles ++= Seq( | ||
baseDirectory.value / "bin" / "astgen", | ||
(Universal / stagingDirectory).value / "bin" / "astgen" | ||
) ++ astGenBinaryNames.value.map(fileName => SimpleCache.encodeFile(s"${astGenDlUrl.value}$fileName")) | ||
) ++ astGenBinaryNames.value.map(fileName => | ||
SimpleCache.encodeFile(s"${astGenDlUrl.value}$fileName") | ||
) | ||
|
||
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) | ||
|
||
Global / onChangedBuildSource := ReloadOnSourceChanges | ||
|
||
maintainer := "Team AppThreat <[email protected]>" | ||
maintainer := "Team AppThreat <[email protected]>" | ||
packageSummary := "Create atom (⚛) representation" | ||
packageDescription := """Create atom (⚛) representation for your application, packages and libraries.""" | ||
debianPackageDependencies := Seq("java17-runtime-headless") | ||
rpmVendor := "AppThreat" | ||
rpmVendor := "AppThreat" | ||
|
||
lazy val createDistribution = taskKey[File]("Create a complete atom distribution") | ||
createDistribution := { | ||
val distributionFile = file("target/atom.zip") | ||
val zip = (atom / Universal / packageBin).value | ||
IO.copyFile(zip, distributionFile) | ||
println(s"created distribution - resulting files: $distributionFile") | ||
distributionFile | ||
val distributionFile = file("target/atom.zip") | ||
val zip = (atom / Universal / packageBin).value | ||
IO.copyFile(zip, distributionFile) | ||
println(s"created distribution - resulting files: $distributionFile") | ||
distributionFile | ||
} | ||
|
||
ThisBuild / resolvers ++= Seq( | ||
Resolver.mavenLocal, | ||
Resolver.githubPackages("appthreat/chen"), | ||
"Sonatype OSS" at "https://oss.sonatype.org/content/repositories/public", | ||
"Atlassian" at "https://packages.atlassian.com/mvn/maven-atlassian-external", | ||
"Gradle Releases" at "https://repo.gradle.org/gradle/libs-releases/" | ||
"Sonatype OSS".at("https://oss.sonatype.org/content/repositories/public"), | ||
"Atlassian".at("https://packages.atlassian.com/mvn/maven-atlassian-external"), | ||
"Gradle Releases".at("https://repo.gradle.org/gradle/libs-releases/") | ||
) | ||
|
||
ThisBuild / assemblyMergeStrategy := { | ||
case "application.conf" => MergeStrategy.concat | ||
case x => MergeStrategy.preferProject | ||
case "application.conf" => MergeStrategy.concat | ||
case x => MergeStrategy.preferProject | ||
} | ||
|
||
ThisBuild / versionScheme := Some("semver-spec") | ||
|
@@ -168,16 +182,24 @@ Global / onChangedBuildSource := ReloadOnSourceChanges | |
Compile / doc / sources := Seq.empty | ||
Compile / packageDoc / publishArtifact := false | ||
|
||
wartremoverWarnings ++= Seq(Wart.NoNeedImport, Wart.ArrayEquals, Wart.Any, Wart.FinalCaseClass, Wart.FinalVal, Wart.ToString, Wart.TryPartial) | ||
wartremoverWarnings ++= Seq( | ||
Wart.NoNeedImport, | ||
Wart.ArrayEquals, | ||
Wart.Any, | ||
Wart.FinalCaseClass, | ||
Wart.FinalVal, | ||
Wart.ToString, | ||
Wart.TryPartial | ||
) | ||
|
||
githubOwner := "appthreat" | ||
githubRepository := "atom" | ||
githubOwner := "appthreat" | ||
githubRepository := "atom" | ||
githubSuppressPublicationWarning := true | ||
credentials += | ||
Credentials( | ||
"GitHub Package Registry", | ||
"maven.pkg.github.com", | ||
"appthreat", | ||
sys.env.getOrElse("GITHUB_TOKEN", "N/A") | ||
) | ||
Credentials( | ||
"GitHub Package Registry", | ||
"maven.pkg.github.com", | ||
"appthreat", | ||
sys.env.getOrElse("GITHUB_TOKEN", "N/A") | ||
) | ||
graalVMNativeImageOptions := Seq("-H:+UnlockExperimentalVMOptions", "--no-fallback") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.10.1 | ||
sbt.version=1.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.