Skip to content

Commit

Permalink
Remove all traces of bintray
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg committed Mar 13, 2021
1 parent 77ccb14 commit dc80fd6
Show file tree
Hide file tree
Showing 261 changed files with 268 additions and 1,085 deletions.
14 changes: 2 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Global / bspEnabled := false
autoStartServer := false
Global / excludeLintKeys += autoStartServer


lazy val utils = project
.configure(baseSettings, publicationSettings)
.settings(libraryDependencies ++= Seq(Deps.ammoniteOps, Deps.osLib, Deps.sourcecode) ++ Deps.circe)
Expand Down Expand Up @@ -58,8 +57,6 @@ lazy val importer = project
.settings(
libraryDependencies ++= Seq(
Deps.bloop,
Deps.bintry,
Deps.asyncHttpClient,
Deps.scalatest % Test,
),
test in assembly := {},
Expand Down Expand Up @@ -165,16 +162,9 @@ lazy val publicationSettings: Project => Project = _.settings(
</developer>
</developers>
),
bintrayRepository := {
if (isSnapshot.value) "converter-snapshots" else "converter"
},
)

lazy val preventPublication: Project => Project =
_.settings(
publish := {},
publishTo := Some(Resolver.file("Unused transient repository", target.value / "fakepublish")),
publishArtifact := false,
publishLocal := {},
packagedArtifacts := Map.empty,
) // doesn't work - https://github.com/sbt/sbt-pgp/issues/42
skip in publish := true,
)
49 changes: 10 additions & 39 deletions cli/src/main/scala/org/scalablytyped/converter/cli/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import java.net.URI
import com.olvind.logging.{stdout, storing, LogLevel, Logger}
import fansi.{Attr, Color, Str}
import org.scalablytyped.converter.internal.importer._
import org.scalablytyped.converter.internal.importer.build.{
BinTrayPublisher,
BloopCompiler,
PublishedSbtProject,
SbtProject,
}
import org.scalablytyped.converter.internal.importer.build.{BloopCompiler, PublishedSbtProject, SbtProject}
import org.scalablytyped.converter.internal.importer.documentation.Npmjs
import org.scalablytyped.converter.internal.importer.jsonCodecs._
import org.scalablytyped.converter.internal.phases.PhaseListener.NoListener
Expand Down Expand Up @@ -54,26 +49,22 @@ object Main {
)

case class Config(
conversion: ConversionOptions,
wantedLibs: SortedSet[TsIdentLibrary],
publishBintrayRepo: Option[ProjectName],
publishGitUrl: Option[URI],
inDirectory: os.Path,
includeDev: Boolean,
includeProject: Boolean,
conversion: ConversionOptions,
wantedLibs: SortedSet[TsIdentLibrary],
inDirectory: os.Path,
includeDev: Boolean,
includeProject: Boolean,
) {
lazy val paths = new Paths(inDirectory)
def mapConversion(f: ConversionOptions => ConversionOptions) = copy(conversion = f(conversion))
}

val DefaultConfig = Config(
DefaultOptions,
wantedLibs = SortedSet(),
publishBintrayRepo = None,
publishGitUrl = None,
inDirectory = os.pwd,
includeDev = false,
includeProject = false,
wantedLibs = SortedSet(),
inDirectory = os.pwd,
includeDev = false,
includeProject = false,
)

val parseCachePath = Some(files.existing(constants.defaultCacheFolder / 'parse).toNIO)
Expand Down Expand Up @@ -174,14 +165,6 @@ object Main {
opt[Boolean]("enableLongApplyMethod")
.action((x, c) => c.mapConversion(_.copy(enableLongApplyMethod = x)))
.text(s"Enables long apply methods, instead of implicit ops builders"),
opt[ProjectName]("publish-to-bintray-repo")
.action((x, c) => c.copy(publishBintrayRepo = Some(x)))
.text(
s"Enable publishing to your bintray repo. You must also provide ${BinTrayPublisher.bintrayCredentialsFile} with user and password, and set publish-git-repo-link",
),
opt[URI]("publish-git-repo-link")
.action((x, c) => c.copy(publishGitUrl = Some(x)))
.text("Must set a public git repo uri since published artifacts must be open source"),
arg[Seq[TsIdentLibrary]]("libs")
.text("Libraries you want to convert from node_modules")
.unbounded()
Expand All @@ -204,8 +187,6 @@ object Main {
c @ Config(
conversion,
libsFromCmdLine,
publishBintrayRepoOpt,
publishGitUrlOpt,
inDir,
includeDev,
includeProject,
Expand All @@ -231,14 +212,6 @@ object Main {
case otherwise => otherwise
}

val publisherOpt: Option[Publisher] =
publishBintrayRepoOpt.map { repo =>
BinTrayPublisher(None, repo, publishGitUrlOpt, global) match {
case Left(err) => sys.error(s"Couldn't setup publishing: $err")
case Right(value) => value
}
}

val bootstrapped = Bootstrap.fromNodeModules(InFolder(nodeModulesPath), conversion, wantedLibs)

val sources: Vector[Source.TsLibSource] = {
Expand Down Expand Up @@ -303,7 +276,6 @@ object Main {
compiler = compiler,
targetFolder = c.paths.out,
organization = conversion.organization,
publisherOpt = None,
publishLocalFolder = constants.defaultLocalPublishFolder,
metadataFetcher = Npmjs.No,
softWrites = true,
Expand All @@ -313,7 +285,6 @@ object Main {
),
"build",
)
.nextOpt(publisherOpt.flatMap(_.enabled).map(Phase4Publish), "publish")

val results: Map[Source, PhaseRes[Source, PublishedSbtProject]] =
sources
Expand Down
24 changes: 3 additions & 21 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ and then start the conversion.
The output is a set of locally published jar files which you can paste into sbt
or your build tool of choice.

You can also use the tool to publish directly to a bintray repository if you
want to share the artifacts.

## Running
The easiest way to run is with coursier's excellent runner.

Expand Down Expand Up @@ -46,28 +43,13 @@ Usage: stc [options] [libs]
-s, --stdlib <value> Which parts of typescript stdlib you want to enable
--organization <value> Organization used (locally) publish artifacts
--ignoredLibs <value> Libraries you want to ignore
--publish-to-bintray-repo <value>
Enable publishing to your bintray repo. You must also provide ~/.bintray/.credentials with user and password, and set publish-git-repo-link
--publish-git-repo-link <value>
Must set a public git repo uri since published artifacts must be open source
libs Libraries you want to convert from node_modules
```

## Publishing

Only publishing to bintray is supported for now
1) register at bintray.com and create a maven repo
2) provide Bintray credentials (user name and API key) in `~/.bintray/.credentials`:
```
user = username
password = token
```
Create the file if missing

3) Run the cli tool with at least the following parameters:
`--publish-to-bintray-repo=mymavenreponame`
`--publish-git-repo-link=https://github.com/foo`
`--organization my.org`
The command line tool used to support publishing to bintray, but that service shut down.
As such, the flags `-publish-to-bintray-repo` and `--publish-git-repo-link` are now gone.
If you want this to return, make some noise (or a PR) at https://github.com/ScalablyTyped/Converter/issues/262

## Convert your Typescript project

Expand Down
1 change: 0 additions & 1 deletion docs/devel/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ For development you'll always use "debug mode".
| `-scalajs06` | Build libraries with Scala.js 0.6 instead of 1
| `-offline` | Skip pulling newest DefinitelyTyped and running `npm update`
| `-pedantic` | Make the converter more strict. Most things don't work yet in this mode
| `-publish` | Publish to bintray. You'll need credentials in `~/.bintray/.credentials`
| `-softWrites` | Will only write changed/deleted files. This is essential if you want to keep ScalablyTyped products open in an IDE to avoid reindexing the world.
| `-flavourNormal` | default
| `-flavourSlinky` | Use slinky flavour, integrate with scala-js-dom, and generate slinky components
Expand Down
12 changes: 0 additions & 12 deletions docs/library-developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,7 @@ So don't do that, it's a dead end anyway.
## Add to your `project/plugins.sbt`

```scala
resolvers += Resolver.bintrayRepo("oyvindberg", "converter")

// Current, for Scala.js 1.x.x
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "@VERSION@")

// The last version published for sbt 1.4.x and Scala.js 0.6.x was
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter06" % "1.0.0-beta28")

// the last version published for sbt 1.3.x and Scala.js 1.x was :
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta26")

// the last version published for sbt 1.3.x and Scala.js 0.6.x was :
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter06" % "1.0.0-beta26")
```

## Activate the plugin for a project in your `build.sbt`:
Expand Down
13 changes: 0 additions & 13 deletions docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,7 @@ Scala 2.12 / 2.13 and Scala.js 1.x.
## Add to your `project/plugins.sbt`

```scala
resolvers += Resolver.bintrayRepo("oyvindberg", "converter")

// Current, for Scala.js 1.x.x
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "@VERSION@")

// The last version published for sbt 1.4.x and Scala.js 0.6.x was
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter06" % "1.0.0-beta28")

// the last version published for sbt 1.3.x and Scala.js 1.x was :
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta26")

// the last version published for sbt 1.3.x and Scala.js 0.6.x was :
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter06" % "1.0.0-beta26")

```

## Activate the plugin for a project in your `build.sbt`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Phase3Compile(
compiler: Compiler,
targetFolder: os.Path,
organization: String,
publisherOpt: Option[Publisher],
publishLocalFolder: os.Path,
metadataFetcher: Npmjs,
softWrites: Boolean,
Expand Down Expand Up @@ -77,7 +76,6 @@ class Phase3Compile(
organization = organization,
name = lib.libName,
version = VersionHack.TemplateValue,
publisherOpt = publisherOpt,
localDeps = deps.toIArrayValues,
deps = flavour.dependencies,
scalaFiles = scalaFiles.map { case (relPath, content) => sourcesDir / relPath -> content },
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ object ContentSbtProject {
organization: String,
name: String,
version: String,
publisherOpt: Option[Publisher],
localDeps: IArray[PublishedSbtProject],
deps: Set[Dep],
scalaFiles: Map[os.RelPath, Array[Byte]],
Expand All @@ -28,11 +27,6 @@ object ContentSbtProject {
)
val depsString = allDeps.map(_.asSbt).distinct.sorted.mkString("Seq(\n ", ",\n ", ")")

val resolverInfo = publisherOpt match {
case Some(publisher) => s"${publisher.sbtPublishTo}\nresolvers += ${publisher.sbtResolver}\n"
case None => ""
}

s"""|organization := ${quote(organization)}
|name := ${quote(name)}
|version := ${quote(version)}
Expand All @@ -42,11 +36,10 @@ object ContentSbtProject {
|publishArtifact in packageDoc := false
|scalacOptions ++= ${versions.scalacOptions.map(quote).mkString("List(", ", ", ")")}
|licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
|""".stripMargin ++ resolverInfo
|""".stripMargin
}

val pluginsSbt = IArray
.fromOptions(Some(versions.scalaJs.sbtPlugin), publisherOpt.map(_.sbtPlugin))
val pluginsSbt = IArray(versions.scalaJs.sbtPlugin)
.map(dep => s"addSbtPlugin(${dep.asSbt})")
.mkString("", "\n", "\n")

Expand Down
51 changes: 22 additions & 29 deletions importer/src/main/scala/org/scalablytyped/converter/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import java.nio.file.Path
import java.util.concurrent.ForkJoinPool

import org.scalablytyped.converter.internal.constants.defaultCacheFolder
import org.scalablytyped.converter.internal.importer.build.BinTrayPublisher
import org.scalablytyped.converter.internal.importer.{withZipFs, Ci, Publisher}
import org.scalablytyped.converter.internal.importer.{withZipFs, Ci}
import org.scalablytyped.converter.internal.{constants, files}

import scala.concurrent.ExecutionContext
Expand All @@ -16,37 +15,31 @@ object Main {
/* I havent found a way to configure bloop to customize the global ExecutionContext, so this is it */
System.setProperty("scala.concurrent.context.numThreads", config.parallelScalas.toString)

val publishFolder = constants.defaultLocalPublishFolder

val pool = new ForkJoinPool(config.parallelLibraries)
val ec = ExecutionContext.fromExecutorService(pool)

withZipFs.maybe(files.existing(defaultCacheFolder) / "bintray.zip", config.enablePublish) { bintrayPathOpt =>
val publisher: Publisher =
if (config.enablePublish)
BinTrayPublisher(bintrayPathOpt, config.projectName, Some(config.repo), ec) match {
case Left(err) => sys.error(err)
case Right(value) => value
withZipFs(defaultCacheFolder / "npmjs.zip") { npmjsPath =>
withZipFs.maybe(defaultCacheFolder / "parseCache.zip", config.enableParseCache && config.conserveSpace) {
parseCachePathOpt =>
val parseCacheOpt: Option[Path] = parseCachePathOpt.orElse {
if (config.enableParseCache) Some((defaultCacheFolder / "parse").toNIO) else None
}
val paths =
Ci.Paths(
npmjs = npmjsPath,
parseCache = parseCacheOpt,
cacheFolder = defaultCacheFolder,
publishLocalFolder = constants.defaultLocalPublishFolder,
gitCache = defaultCacheFolder / "git",
)
val ci = new Ci(config, paths, pool, ec)
if (config.benchmark) {
println(ci.run())
println(ci.run())
println(ci.run())
} else {
ci.run()
}
else BinTrayPublisher.Dummy

withZipFs(defaultCacheFolder / "npmjs.zip") { npmjsPath =>
withZipFs.maybe(defaultCacheFolder / "parseCache.zip", config.enableParseCache && config.conserveSpace) {
parseCachePathOpt =>
val parseCacheOpt: Option[Path] = parseCachePathOpt.orElse {
if (config.enableParseCache) Some((defaultCacheFolder / "parse").toNIO) else None
}
val paths =
Ci.Paths(npmjsPath, parseCacheOpt, defaultCacheFolder, publishFolder, defaultCacheFolder / "git")
val ci = new Ci(config, paths, publisher, pool, ec)
if (config.benchmark) {
println(ci.run())
println(ci.run())
println(ci.run())
} else {
ci.run()
}
}
}
}

Expand Down
Loading

0 comments on commit dc80fd6

Please sign in to comment.